about summary refs log tree commit diff
path: root/pkgs/applications/gis
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/gis')
-rw-r--r--pkgs/applications/gis/grass/default.nix4
-rw-r--r--pkgs/applications/gis/grass/no_symbolic_links.patch37
-rw-r--r--pkgs/applications/gis/qgis/default.nix55
3 files changed, 85 insertions, 11 deletions
diff --git a/pkgs/applications/gis/grass/default.nix b/pkgs/applications/gis/grass/default.nix
index 987b544c5565..8353bce1b847 100644
--- a/pkgs/applications/gis/grass/default.nix
+++ b/pkgs/applications/gis/grass/default.nix
@@ -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 = [ ./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 000000000000..ef09b97b7037
--- /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 "<tr><td valign=\"top\"><a href=\"$HTMLDIRG/$i\">$BASENAME</a></td> <td>$SHORTDESC</td></tr>" >> $FULLINDEX
+       # make them local to user to simplify page links
+       echo "<tr><td valign=\"top\"><a href=\"global_$i\">$BASENAME</a></td> <td>$SHORTDESC</td></tr>" >> $FULLINDEX
+-      ln -sf "$HTMLDIRG/$i" global_$i
+     done
+   done
+ fi
+@@ -183,8 +182,3 @@ echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
+ </html>" > $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
diff --git a/pkgs/applications/gis/qgis/default.nix b/pkgs/applications/gis/qgis/default.nix
index 21ee4297599a..75f980c6781b 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.17";
 
   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 = "1nxwl5lwibbiz9v3qaw3px7iyxg113zr4j8d99yj07mhk2ap082y";
   };
 
-  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];
   };
 }