2018-09-01 09:52:33 +01:00
|
|
|
{ stdenv, fetchurl, fetchpatch, gdal, cmake, qt4, flex, bison, proj, geos, xlibsWrapper, sqlite, gsl
|
2016-11-08 14:17:06 +00:00
|
|
|
, qwt, fcgi, python2Packages, libspatialindex, libspatialite, qscintilla, postgresql, makeWrapper
|
2018-03-13 09:57:12 +00:00
|
|
|
, qjson, qca2, txt2tags, openssl, darwin, pkgconfig
|
2018-04-18 21:23:13 +01:00
|
|
|
, withGrass ? true, grass, saga, IOKit, ApplicationServices
|
2015-10-27 07:26:07 +00:00
|
|
|
}:
|
2008-12-20 01:20:35 +00:00
|
|
|
|
2011-08-11 10:35:17 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2018-08-03 19:34:47 +01:00
|
|
|
name = "qgis-2.18.22";
|
2009-03-06 23:21:28 +00:00
|
|
|
|
2016-09-11 20:19:53 +01:00
|
|
|
buildInputs = [ gdal qt4 flex openssl bison proj geos xlibsWrapper sqlite gsl qwt qscintilla
|
2018-04-18 21:23:13 +01:00
|
|
|
fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags pkgconfig
|
|
|
|
saga ]
|
2018-03-13 09:57:12 +00:00
|
|
|
++
|
|
|
|
(stdenv.lib.optionals stdenv.isDarwin [IOKit ApplicationServices])
|
|
|
|
++
|
2015-10-27 07:26:07 +00:00
|
|
|
(stdenv.lib.optional withGrass grass) ++
|
2018-03-13 09:57:12 +00:00
|
|
|
(stdenv.lib.optional (stdenv.isDarwin && withGrass) darwin.apple_sdk.libs.utmp) ++
|
2017-07-15 18:32:38 +01:00
|
|
|
(with python2Packages; [ jinja2 numpy psycopg2 pygments requests python2Packages.qscintilla sip ]);
|
2011-08-11 10:35:17 +01:00
|
|
|
|
2018-03-13 09:57:12 +00:00
|
|
|
nativeBuildInputs = [ cmake makeWrapper pkgconfig ];
|
2011-08-11 10:35:17 +01:00
|
|
|
|
2017-12-05 11:26:04 +00:00
|
|
|
# `make -f src/providers/wms/CMakeFiles/wmsprovider_a.dir/build.make src/providers/wms/CMakeFiles/wmsprovider_a.dir/qgswmssourceselect.cpp.o`:
|
2017-01-29 14:19:43 +00:00
|
|
|
# fatal error: ui_qgsdelimitedtextsourceselectbase.h: No such file or directory
|
2017-12-05 11:26:04 +00:00
|
|
|
enableParallelBuilding = false;
|
2013-07-18 10:40:23 +01:00
|
|
|
|
2018-03-13 09:57:12 +00:00
|
|
|
preConfigure = ''
|
|
|
|
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags libspatialindex)"
|
|
|
|
'';
|
|
|
|
|
2013-07-18 10:40:23 +01:00
|
|
|
# To handle the lack of 'local' RPATH; required, as they call one of
|
|
|
|
# their built binaries requiring their libs, in the build process.
|
|
|
|
preBuild = ''
|
2016-09-11 20:19:53 +01:00
|
|
|
export LD_LIBRARY_PATH=`pwd`/output/lib:${stdenv.lib.makeLibraryPath [ openssl ]}:$LD_LIBRARY_PATH
|
2013-07-18 10:40:23 +01:00
|
|
|
'';
|
2009-03-06 23:21:28 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 19:43:35 +01:00
|
|
|
url = "https://qgis.org/downloads/${name}.tar.bz2";
|
2018-08-03 19:34:47 +01:00
|
|
|
sha256 = "00b3a2hfn3i7bdx7x96vz2nj0976vpkhid4ss7n8c33fdvw3k82a";
|
2009-03-06 23:21:28 +00:00
|
|
|
};
|
|
|
|
|
2018-09-01 09:52:33 +01:00
|
|
|
patches = [
|
|
|
|
# https://github.com/qgis/QGIS/pull/7765
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/qgis/QGIS/commit/6b61ef361a77f057dc29eb07463007bd9012b253.patch";
|
|
|
|
sha256 = "1xibcahm18n7nxff1xvwwzjf505hvhiw5dk12is7aclv49h0rdf7";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-03-13 09:57:12 +00:00
|
|
|
# CMAKE_FIND_FRAMEWORK=never stops the installer choosing system
|
|
|
|
# installed frameworks
|
|
|
|
# QGIS_MACAPP_BUNDLE=0 stops the installer copying the Qt binaries into the
|
|
|
|
# installation which causes havoc
|
|
|
|
# Building RelWithDebInfo allows QGIS_DEBUG to print debugging information
|
|
|
|
cmakeFlags = stdenv.lib.optional withGrass "-DGRASS_PREFIX7=${grass}/${grass.name}"
|
|
|
|
++ stdenv.lib.optional stdenv.isDarwin
|
|
|
|
(["-DCMAKE_FIND_FRAMEWORK=never"]
|
|
|
|
++ ["-DQGIS_MACAPP_BUNDLE=0"]);
|
|
|
|
# ++ ["-DCMAKE_BUILD_TYPE=RelWithDebInfo"];
|
2015-10-27 07:26:07 +00:00
|
|
|
|
2018-03-13 09:57:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
postInstall =
|
|
|
|
(stdenv.lib.optionalString stdenv.isLinux ''
|
|
|
|
wrapProgram $out/bin/qgis \
|
|
|
|
--set PYTHONPATH $PYTHONPATH \
|
|
|
|
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ openssl ]}
|
|
|
|
'') +
|
|
|
|
(stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Necessary for QGIS to find the correct default GRASS path
|
2018-04-13 00:09:32 +01:00
|
|
|
# Plugins look for gdal tools like deminfo on the PATH
|
2018-03-13 09:57:12 +00:00
|
|
|
${stdenv.lib.optionalString withGrass "ln -sf ${grass} $out/QGIS.app/Contents/MacOS/grass"}
|
2018-04-18 21:23:13 +01:00
|
|
|
# Necessary for QGIS to find the right SAGA installation
|
|
|
|
ln -sf ${saga}/bin/saga_cmd $out/QGIS.app/Contents/MacOS/bin/saga_cmd
|
2018-03-13 09:57:12 +00:00
|
|
|
for file in $(find $out -type f -name "QGIS"); do
|
|
|
|
wrapProgram "$file" \
|
|
|
|
--prefix DYLD_LIBRARY_PATH : "${qwt}/lib" \
|
|
|
|
--prefix DYLD_LIBRARY_PATH : "${qscintilla}/lib" \
|
2018-04-13 00:09:32 +01:00
|
|
|
--prefix PATH : "${gdal}/bin" \
|
2018-03-13 09:57:12 +00:00
|
|
|
${stdenv.lib.optionalString withGrass "--prefix PATH : ${grass}/bin"} \
|
|
|
|
--set PYTHONPATH $PYTHONPATH
|
|
|
|
done
|
|
|
|
mkdir -p $out/bin
|
|
|
|
ln -s $out/QGIS.app/Contents/MacOS/QGIS $out/bin/qgis
|
|
|
|
'');
|
2014-12-20 16:32:59 +00:00
|
|
|
|
2009-03-06 23:21:28 +00:00
|
|
|
meta = {
|
2013-07-18 10:40:23 +01:00
|
|
|
description = "User friendly Open Source Geographic Information System";
|
|
|
|
homepage = http://www.qgis.org;
|
2014-06-19 05:19:00 +01:00
|
|
|
license = stdenv.lib.licenses.gpl2Plus;
|
2018-03-13 09:57:12 +00:00
|
|
|
platforms = with stdenv.lib.platforms; unix;
|
2018-07-22 20:50:19 +01:00
|
|
|
maintainers = with stdenv.lib.maintainers; [mpickering];
|
2008-12-20 01:20:35 +00:00
|
|
|
};
|
|
|
|
}
|