From 49182bcd34a73d33fccb9a0e709bd9cc45bfa26f Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 13 Mar 2018 09:04:18 +0000 Subject: Fix grass build on darwin --- pkgs/applications/gis/grass/default.nix | 6 +++- .../applications/gis/grass/no_symbolic_links.patch | 37 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 pkgs/applications/gis/grass/no_symbolic_links.patch (limited to 'pkgs') diff --git a/pkgs/applications/gis/grass/default.nix b/pkgs/applications/gis/grass/default.nix index 987b544c556..5b36c24ab10 100644 --- a/pkgs/applications/gis/grass/default.nix +++ b/pkgs/applications/gis/grass/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, flex, bison, pkgconfig, zlib, libtiff, libpng, fftw , cairo, readline, ffmpeg, makeWrapper, wxGTK30, netcdf, blas -, proj, gdal, geos, sqlite, postgresql, mysql, python2Packages +, proj, gdal, geos, sqlite, postgresql, mysql, python2Packages, lib }: stdenv.mkDerivation { @@ -15,6 +15,10 @@ stdenv.mkDerivation { readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql mysql.connector-c blas ] ++ (with python2Packages; [ python dateutil wxPython30 numpy ]); + # On Darwin the installer tries to symlink the help files into a system + # directory + patches = [] ++ lib.optional stdenv.isDarwin [ ./no_symbolic_links.patch ]; + configureFlags = [ "--with-proj-share=${proj}/share/proj" "--without-opengl" diff --git a/pkgs/applications/gis/grass/no_symbolic_links.patch b/pkgs/applications/gis/grass/no_symbolic_links.patch new file mode 100644 index 00000000000..ef09b97b703 --- /dev/null +++ b/pkgs/applications/gis/grass/no_symbolic_links.patch @@ -0,0 +1,37 @@ +diff --git a/include/Make/Install.make b/include/Make/Install.make +index 0aba138..8ba74bc 100644 +--- a/include/Make/Install.make ++++ b/include/Make/Install.make +@@ -116,11 +116,6 @@ real-install: | $(INST_DIR) $(UNIX_BIN) + -$(INSTALL) config.status $(INST_DIR)/config.status + -$(CHMOD) -R a+rX $(INST_DIR) 2>/dev/null + +-ifneq ($(findstring darwin,$(ARCH)),) +- @# enable OSX Help Viewer +- @/bin/ln -sfh "$(INST_DIR)/docs/html" /Library/Documentation/Help/GRASS-$(GRASS_VERSION_MAJOR).$(GRASS_VERSION_MINOR) +-endif +- + $(INST_DIR) $(UNIX_BIN): + $(MAKE_DIR_CMD) $@ + +diff --git a/macosx/app/build_html_user_index.sh b/macosx/app/build_html_user_index.sh +index 04e63eb..c9d9c2c 100755 +--- a/macosx/app/build_html_user_index.sh ++++ b/macosx/app/build_html_user_index.sh +@@ -140,7 +140,6 @@ else + # echo "$BASENAME $SHORTDESC" >> $FULLINDEX + # make them local to user to simplify page links + echo "$BASENAME $SHORTDESC" >> $FULLINDEX +- ln -sf "$HTMLDIRG/$i" global_$i + done + done + fi +@@ -183,8 +182,3 @@ echo " + " > $i.html + done + +-# add Help Viewer links in user docs folder +- +-mkdir -p $HOME/Library/Documentation/Help/ +-ln -sfh ../../GRASS/$GRASS_MMVER/Modules/docs/html $HOME/Library/Documentation/Help/GRASS-$GRASS_MMVER-addon +-ln -sfh $GISBASE/docs/html $HOME/Library/Documentation/Help/GRASS-$GRASS_MMVER -- cgit 1.4.1 From f0a8f1f313c2197d5c441191752e2e79c8638e94 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 13 Mar 2018 09:43:47 +0000 Subject: Refine libspatialindex platforms attribute --- pkgs/development/libraries/libspatialindex/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/libspatialindex/default.nix b/pkgs/development/libraries/libspatialindex/default.nix index fe0acbfc538..aa3aaa1c59b 100644 --- a/pkgs/development/libraries/libspatialindex/default.nix +++ b/pkgs/development/libraries/libspatialindex/default.nix @@ -16,6 +16,6 @@ stdenv.mkDerivation rec { description = "Extensible spatial index library in C++"; homepage = http://libspatialindex.github.io/; license = stdenv.lib.licenses.mit; - platforms = stdenv.lib.platforms.linux; + platforms = stdenv.lib.platforms.unix; }; } -- cgit 1.4.1 From de6360b63e322ad5b301f732f225626bc5807e5c Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 13 Mar 2018 09:44:31 +0000 Subject: Build qca2 on darwin --- pkgs/development/libraries/qca2/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/qca2/default.nix b/pkgs/development/libraries/qca2/default.nix index 4976399a66a..dd2e772450a 100644 --- a/pkgs/development/libraries/qca2/default.nix +++ b/pkgs/development/libraries/qca2/default.nix @@ -25,6 +25,6 @@ stdenv.mkDerivation rec { license = "LGPL"; homepage = http://delta.affinix.com/qca; maintainers = [ maintainers.sander ]; - platforms = platforms.linux; + platforms = platforms.unix; }; } -- cgit 1.4.1 From 3391006fd584fadb89fac191407c08a87d307f11 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 13 Mar 2018 09:47:08 +0000 Subject: Fix qscintilla qt5 darwin build --- pkgs/development/libraries/qscintilla/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pkgs') diff --git a/pkgs/development/libraries/qscintilla/default.nix b/pkgs/development/libraries/qscintilla/default.nix index d6bd90fa47d..f442e1bf908 100644 --- a/pkgs/development/libraries/qscintilla/default.nix +++ b/pkgs/development/libraries/qscintilla/default.nix @@ -3,6 +3,11 @@ , withQt5 ? false, qtbase ? null, qtmacextras ? null, qmake ? null }: +# Fix Xcode 8 compilation problem +let xcodePatch = + fetchurl { url = "https://raw.githubusercontent.com/Homebrew/formula-patches/a651d71/qscintilla2/xcode-8.patch"; + sha256 = "1a88309fdfd421f4458550b710a562c622d72d6e6fdd697107e4a43161d69bc9"; }; +in stdenv.mkDerivation rec { pname = "qscintilla"; version = "2.9.4"; @@ -19,6 +24,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ unzip ] ++ (if withQt5 then [ qmake ] else [ qmake4Hook ]); + + patches = [] ++ lib.optional withQt5 [ xcodePatch ]; + enableParallelBuilding = true; preConfigure = '' -- cgit 1.4.1 From ef4bce8bf11d2f7e7ec53c48d90cc38800161252 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 13 Mar 2018 09:48:17 +0000 Subject: Build qwt6 on darwin --- pkgs/development/libraries/qwt/6.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/qwt/6.nix b/pkgs/development/libraries/qwt/6.nix index 314ab0f9e61..6e0fa53aa82 100644 --- a/pkgs/development/libraries/qwt/6.nix +++ b/pkgs/development/libraries/qwt/6.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation rec { homepage = http://qwt.sourceforge.net/; # LGPL 2.1 plus a few exceptions (more liberal) license = stdenv.lib.licenses.qwt; - platforms = platforms.linux; + platforms = platforms.unix; maintainers = [ maintainers.bjornfor ]; branch = "6"; }; -- cgit 1.4.1 From 2c6cd5b69cb4ed8d8da790ca1cad1fe11a98a4ed Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 20 Mar 2018 18:41:37 +0000 Subject: Build qscintilla on darwin --- pkgs/top-level/python-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5c49b6bc0c8..64c92056c5f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -14189,7 +14189,7 @@ in { description = "A Python binding to QScintilla, Qt based text editing control"; license = licenses.lgpl21Plus; maintainers = with maintainers; [ danbst ]; - platforms = platforms.linux; + platforms = platforms.unix; }; }); -- cgit 1.4.1 From 4a4478bbc097269f30566cb52b5cde6fde3b8032 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 13 Mar 2018 09:58:29 +0000 Subject: Add additional darwin dependency for qca2 --- pkgs/development/libraries/qca2/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/qca2/default.nix b/pkgs/development/libraries/qca2/default.nix index dd2e772450a..568e7ce07b3 100644 --- a/pkgs/development/libraries/qca2/default.nix +++ b/pkgs/development/libraries/qca2/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, cmake, pkgconfig, qt }: +{ stdenv, fetchurl, cmake, pkgconfig, qt, darwin }: stdenv.mkDerivation rec { name = "qca-${version}"; @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ cmake pkgconfig ]; - buildInputs = [ qt ]; + buildInputs = [ (stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security) qt ]; enableParallelBuilding = true; -- cgit 1.4.1 From 92f76df8254c633b78f744df155efa52599eb130 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 13 Mar 2018 09:59:02 +0000 Subject: Add darwin to qwt platforms attribute --- pkgs/development/libraries/qwt/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/qwt/default.nix b/pkgs/development/libraries/qwt/default.nix index da5769e92cd..f900de5e578 100644 --- a/pkgs/development/libraries/qwt/default.nix +++ b/pkgs/development/libraries/qwt/default.nix @@ -25,7 +25,7 @@ stdenv.mkDerivation rec { homepage = http://qwt.sourceforge.net/; # LGPL 2.1 plus a few exceptions (more liberal) license = stdenv.lib.licenses.qwt; - platforms = platforms.linux; + platforms = platforms.unix; maintainers = [ maintainers.bjornfor ]; }; } -- cgit 1.4.1 From 7842e5dda5986d1f1da33e75bdc5c8135925174d Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 13 Mar 2018 09:57:12 +0000 Subject: Package QGIS 2.18 for darwin There are still some problems with the withGrass option but the package is mostly functional. --- pkgs/applications/gis/qgis/default.nix | 55 +++++++++++++++++++++++++++------- pkgs/top-level/all-packages.nix | 4 ++- 2 files changed, 47 insertions(+), 12 deletions(-) (limited to 'pkgs') diff --git a/pkgs/applications/gis/qgis/default.nix b/pkgs/applications/gis/qgis/default.nix index c2a09a507cc..043da8c8031 100644 --- a/pkgs/applications/gis/qgis/default.nix +++ b/pkgs/applications/gis/qgis/default.nix @@ -1,23 +1,31 @@ { stdenv, fetchurl, fetchpatch, gdal, cmake, qt4, flex, bison, proj, geos, xlibsWrapper, sqlite, gsl , qwt, fcgi, python2Packages, libspatialindex, libspatialite, qscintilla, postgresql, makeWrapper -, qjson, qca2, txt2tags, openssl -, withGrass ? false, grass +, qjson, qca2, txt2tags, openssl, darwin, pkgconfig +, withGrass ? false, grass, IOKit, ApplicationServices }: stdenv.mkDerivation rec { name = "qgis-2.18.16"; buildInputs = [ gdal qt4 flex openssl bison proj geos xlibsWrapper sqlite gsl qwt qscintilla - fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags ] ++ + fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags pkgconfig ] + ++ + (stdenv.lib.optionals stdenv.isDarwin [IOKit ApplicationServices]) + ++ (stdenv.lib.optional withGrass grass) ++ + (stdenv.lib.optional (stdenv.isDarwin && withGrass) darwin.apple_sdk.libs.utmp) ++ (with python2Packages; [ jinja2 numpy psycopg2 pygments requests python2Packages.qscintilla sip ]); - nativeBuildInputs = [ cmake makeWrapper ]; + nativeBuildInputs = [ cmake makeWrapper pkgconfig ]; # `make -f src/providers/wms/CMakeFiles/wmsprovider_a.dir/build.make src/providers/wms/CMakeFiles/wmsprovider_a.dir/qgswmssourceselect.cpp.o`: # fatal error: ui_qgsdelimitedtextsourceselectbase.h: No such file or directory enableParallelBuilding = false; + preConfigure = '' + NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags libspatialindex)" + ''; + # To handle the lack of 'local' RPATH; required, as they call one of # their built binaries requiring their libs, in the build process. preBuild = '' @@ -29,19 +37,44 @@ stdenv.mkDerivation rec { sha256 = "0d880m013kzi4qiyr27yjx6hzpb652slp66gyqgw9ziw03wy12c9"; }; - cmakeFlags = stdenv.lib.optional withGrass "-DGRASS_PREFIX7=${grass}/${grass.name}"; + # 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"]; - postInstall = '' - wrapProgram $out/bin/qgis \ - --prefix PYTHONPATH : $PYTHONPATH \ - --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ openssl ]} - ''; + + + 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 + ${stdenv.lib.optionalString withGrass "ln -sf ${grass} $out/QGIS.app/Contents/MacOS/grass"} + for file in $(find $out -type f -name "QGIS"); do + wrapProgram "$file" \ + --prefix DYLD_LIBRARY_PATH : "${qwt}/lib" \ + --prefix DYLD_LIBRARY_PATH : "${qscintilla}/lib" \ + ${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 + ''); meta = { description = "User friendly Open Source Geographic Information System"; homepage = http://www.qgis.org; license = stdenv.lib.licenses.gpl2Plus; - platforms = with stdenv.lib.platforms; linux; + platforms = with stdenv.lib.platforms; unix; maintainers = with stdenv.lib.maintainers; [viric]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 71a86853651..63a74435a77 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17225,7 +17225,9 @@ with pkgs; qemu-riscv = callPackage ../applications/virtualization/qemu/riscv.nix {}; - qgis = callPackage ../applications/gis/qgis {}; + qgis = callPackage ../applications/gis/qgis { + inherit (darwin.apple_sdk.frameworks) IOKit ApplicationServices; + }; qgroundcontrol = libsForQt5.callPackage ../applications/science/robotics/qgroundcontrol { }; -- cgit 1.4.1 From 9031300f5e05520f4eb0cabdab457427e32a854d Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 20 Mar 2018 22:34:17 +0000 Subject: Remove darwin specific patch --- pkgs/applications/gis/grass/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs') diff --git a/pkgs/applications/gis/grass/default.nix b/pkgs/applications/gis/grass/default.nix index 5b36c24ab10..8353bce1b84 100644 --- a/pkgs/applications/gis/grass/default.nix +++ b/pkgs/applications/gis/grass/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, flex, bison, pkgconfig, zlib, libtiff, libpng, fftw , cairo, readline, ffmpeg, makeWrapper, wxGTK30, netcdf, blas -, proj, gdal, geos, sqlite, postgresql, mysql, python2Packages, lib +, proj, gdal, geos, sqlite, postgresql, mysql, python2Packages }: stdenv.mkDerivation { @@ -17,7 +17,7 @@ stdenv.mkDerivation { # On Darwin the installer tries to symlink the help files into a system # directory - patches = [] ++ lib.optional stdenv.isDarwin [ ./no_symbolic_links.patch ]; + patches = [ ./no_symbolic_links.patch ]; configureFlags = [ "--with-proj-share=${proj}/share/proj" -- cgit 1.4.1