about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2018-10-14 19:14:48 +0000
committerGitHub <noreply@github.com>2018-10-14 19:14:48 +0000
commit878c6c090dfd0acc077d4edfc1cca702d3a7fcd8 (patch)
treeb228a204e5171117e697349162f8674747e6cd9f
parentcbaf6673d6d73f3e3b627b9e4a25236c08624b69 (diff)
parent1c9af2d89cdeb62eef0c9d3798fdd2203f21f221 (diff)
downloadnixlib-878c6c090dfd0acc077d4edfc1cca702d3a7fcd8.tar
nixlib-878c6c090dfd0acc077d4edfc1cca702d3a7fcd8.tar.gz
nixlib-878c6c090dfd0acc077d4edfc1cca702d3a7fcd8.tar.bz2
nixlib-878c6c090dfd0acc077d4edfc1cca702d3a7fcd8.tar.lz
nixlib-878c6c090dfd0acc077d4edfc1cca702d3a7fcd8.tar.xz
nixlib-878c6c090dfd0acc077d4edfc1cca702d3a7fcd8.tar.zst
nixlib-878c6c090dfd0acc077d4edfc1cca702d3a7fcd8.zip
Merge pull request #39125 from mpickering/darwin-saga
SAGA, SAGA LTS release, dependencies and QGIS SAGA plugin
-rw-r--r--pkgs/applications/gis/qgis/default.nix7
-rw-r--r--pkgs/applications/gis/saga/clang_patch.patch19
-rw-r--r--pkgs/applications/gis/saga/default.nix22
-rw-r--r--pkgs/applications/gis/saga/finite-6.3.0.patch55
-rw-r--r--pkgs/applications/gis/saga/finite.patch13
-rw-r--r--pkgs/applications/gis/saga/lts.nix36
-rw-r--r--pkgs/desktops/gnome-2/platform/GConf/default.nix2
-rw-r--r--pkgs/development/libraries/libharu/default.nix2
-rw-r--r--pkgs/development/libraries/libiodbc/default.nix7
-rw-r--r--pkgs/development/libraries/vigra/default.nix8
-rw-r--r--pkgs/top-level/all-packages.nix10
11 files changed, 166 insertions, 15 deletions
diff --git a/pkgs/applications/gis/qgis/default.nix b/pkgs/applications/gis/qgis/default.nix
index 744aef20fda6..b98d048d0343 100644
--- a/pkgs/applications/gis/qgis/default.nix
+++ b/pkgs/applications/gis/qgis/default.nix
@@ -1,14 +1,15 @@
 { 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, darwin, pkgconfig
-, withGrass ? true, grass, IOKit, ApplicationServices
+, withGrass ? true, grass, saga, IOKit, ApplicationServices
 }:
 
 stdenv.mkDerivation rec {
   name = "qgis-2.18.22";
 
   buildInputs = [ gdal qt4 flex openssl bison proj geos xlibsWrapper sqlite gsl qwt qscintilla
-    fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags pkgconfig ]
+    fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags pkgconfig
+    saga ]
   ++
     (stdenv.lib.optionals stdenv.isDarwin [IOKit ApplicationServices])
   ++
@@ -68,6 +69,8 @@ stdenv.mkDerivation rec {
       # Necessary for QGIS to find the correct default GRASS path
       # Plugins look for gdal tools like deminfo on the PATH
       ${stdenv.lib.optionalString withGrass "ln -sf ${grass} $out/QGIS.app/Contents/MacOS/grass"}
+      # Necessary for QGIS to find the right SAGA installation
+      ln -sf ${saga}/bin/saga_cmd $out/QGIS.app/Contents/MacOS/bin/saga_cmd
       for file in $(find $out -type f -name "QGIS"); do
         wrapProgram "$file" \
           --prefix DYLD_LIBRARY_PATH : "${qwt}/lib" \
diff --git a/pkgs/applications/gis/saga/clang_patch.patch b/pkgs/applications/gis/saga/clang_patch.patch
new file mode 100644
index 000000000000..e6af8d130514
--- /dev/null
+++ b/pkgs/applications/gis/saga/clang_patch.patch
@@ -0,0 +1,19 @@
+commit e92b250968e9656084ab5984689747ca615ff6e7
+Author: Volker Wichmann <wichmann@laserdata.at>
+Date:   Sun Mar 5 13:49:53 2017 +0100
+
+    saga_api, CSG_Table::Del_Records(): bug fix, check record count correctly
+
+diff --git a/src/saga_core/saga_api/table.cpp b/src/saga_core/saga_api/table.cpp
+index 76a1d8d..fa1a66f 100644
+--- a/src/saga_core/saga_api/table.cpp
++++ b/src/saga_core/saga_api/table.cpp
+@@ -901,7 +901,7 @@ bool CSG_Table::Del_Record(int iRecord)
+ //---------------------------------------------------------
+ bool CSG_Table::Del_Records(void)
+ {
+-	if( m_Records > 0 )
++	if( m_nRecords > 0 )
+ 	{
+ 		_Index_Destroy();
+
diff --git a/pkgs/applications/gis/saga/default.nix b/pkgs/applications/gis/saga/default.nix
index a0f2e007555e..10cec193cc0d 100644
--- a/pkgs/applications/gis/saga/default.nix
+++ b/pkgs/applications/gis/saga/default.nix
@@ -1,23 +1,33 @@
 { stdenv, fetchurl, gdal, wxGTK30, proj, libiodbc, lzma, jasper,
-  libharu, opencv, vigra, postgresql }:
+  libharu, opencv, vigra, postgresql, Cocoa,
+  unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }:
 
 stdenv.mkDerivation rec {
   name = "saga-6.3.0";
 
-  buildInputs = [ gdal wxGTK30 proj libharu opencv vigra postgresql libiodbc lzma jasper ];
+  # See https://groups.google.com/forum/#!topic/nix-devel/h_vSzEJAPXs
+  # for why the have additional buildInputs on darwin
+  buildInputs = [ gdal wxGTK30 proj libharu opencv vigra postgresql libiodbc lzma
+                  jasper qhull giflib ]
+                ++ stdenv.lib.optionals stdenv.isDarwin
+                  [ Cocoa unixODBC poppler hdf4.out hdf5 netcdf sqlite ];
 
   enableParallelBuilding = true;
 
+  patches = [ ./finite-6.3.0.patch];
+
+  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11 -Wno-narrowing";
+
   src = fetchurl {
     url = "mirror://sourceforge/project/saga-gis/SAGA%20-%206/SAGA%20-%206.3.0/saga-6.3.0.tar.gz";
     sha256 = "0hyjim8fcp3mna1hig22nnn4ki3j6b7096am2amcs99sdr09jjxv";
   };
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "System for Automated Geoscientific Analyses";
     homepage = http://www.saga-gis.org;
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = [ stdenv.lib.maintainers.michelk ];
-    platforms = ["x86_64-linux" ];
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.michelk ];
+    platforms = with platforms; unix;
   };
 }
diff --git a/pkgs/applications/gis/saga/finite-6.3.0.patch b/pkgs/applications/gis/saga/finite-6.3.0.patch
new file mode 100644
index 000000000000..91c9543edfda
--- /dev/null
+++ b/pkgs/applications/gis/saga/finite-6.3.0.patch
@@ -0,0 +1,55 @@
+diff --git a/src/tools/imagery/imagery_maxent/me.cpp b/src/tools/imagery/imagery_maxent/me.cpp
+index c5da854..d3e9cff 100755
+--- a/src/tools/imagery/imagery_maxent/me.cpp
++++ b/src/tools/imagery/imagery_maxent/me.cpp
+@@ -21,7 +21,7 @@
+ #ifdef _SAGA_MSW
+ #define isinf(x) (!_finite(x))
+ #else
+-#define isinf(x) (!finite(x))
++#define isinf(x) (!isfinite(x))
+ #endif
+ 
+ /** The input array contains a set of log probabilities lp1, lp2, lp3
+@@ -47,7 +47,7 @@ double sumLogProb(vector<double>& logprobs)
+ /** returns log (e^logprob1 + e^logprob2). */
+ double sumLogProb(double logprob1, double logprob2)
+ {
+-  if (isinf(logprob1) && isinf(logprob2)) 
++  if (isinf(logprob1) && isinf(logprob2))
+     return logprob1; // both prob1 and prob2 are 0, return log 0.
+   if (logprob1>logprob2)
+     return logprob1+log(1+exp(logprob2-logprob1));
+@@ -70,8 +70,8 @@ void MaxEntModel::print(ostream& ostrm, MaxEntTrainer& trainer)
+   for (FtMap::iterator it = _index.begin(); it!=_index.end(); it++) {
+     unsigned long i = it->second;
+     for (unsigned long c = 0; c<_classes; c++) {
+-      ostrm << "lambda(" << trainer.className(c) << ", " 
+-	    << trainer.getStr(it->first) << ")=" 
++      ostrm << "lambda(" << trainer.className(c) << ", "
++	    << trainer.getStr(it->first) << ")="
+ 	    << _lambda[i+c] << endl;
+     }
+   }
+@@ -86,7 +86,7 @@ int MaxEntModel::getProbs(MaxEntEvent& event, vector<double>& probs)
+     double s = 0;
+     for (unsigned int f = 0; f<event.size(); f++) {
+       FtMap::iterator it = _index.find(event[f]);
+-      if (it!=_index.end()) 
++      if (it!=_index.end())
+ 	s += _lambda[it->second+c];
+     }
+     probs[c] = s;
+@@ -142,10 +142,10 @@ double MaxEntModel::getObsCounts(EventSet& events, vector<double>& obsCounts)
+     double ftSum = 0;
+     for (unsigned long j=0; j<e.size(); j++) {
+       FtMap::iterator it = _index.find(e[j]);
+-      if (it!=_index.end()) 
++      if (it!=_index.end())
+ 	obsCounts[it->second+c] += count;
+       else { // new feature, need to expand obsCounts and _lambda
+-	for (unsigned int k = 0; k<_classes; k++) 
++	for (unsigned int k = 0; k<_classes; k++)
+ 	  obsCounts.push_back(0);
+ 	obsCounts[_lambda.size()+c] += count;
+ 	addFeature(e[j]);
diff --git a/pkgs/applications/gis/saga/finite.patch b/pkgs/applications/gis/saga/finite.patch
new file mode 100644
index 000000000000..7f60743534bd
--- /dev/null
+++ b/pkgs/applications/gis/saga/finite.patch
@@ -0,0 +1,13 @@
+diff --git a/saga-gis/src/modules/imagery/imagery_maxent/me.cpp b/saga-gis/src/modules/imagery/imagery_maxent/me.cpp
+index c5da854..d3e9cff 100755
+--- a/src/modules/imagery/imagery_maxent/me.cpp
++++ b/src/modules/imagery/imagery_maxent/me.cpp
+@@ -21,7 +21,7 @@
+ #ifdef _SAGA_MSW
+ #define isinf(x) (!_finite(x))
+ #else
+-#define isinf(x) (!finite(x))
++#define isinf(x) (!isfinite(x))
+ #endif
+
+ /** The input array contains a set of log probabilities lp1, lp2, lp3
diff --git a/pkgs/applications/gis/saga/lts.nix b/pkgs/applications/gis/saga/lts.nix
new file mode 100644
index 000000000000..ca0034aa9708
--- /dev/null
+++ b/pkgs/applications/gis/saga/lts.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchgit, gdal, wxGTK30, proj, libiodbc, lzma, jasper,
+  libharu, opencv, vigra, postgresql, autoreconfHook, Cocoa
+  , unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }:
+
+stdenv.mkDerivation rec {
+  name = "saga-2.3.2";
+
+  # See https://groups.google.com/forum/#!topic/nix-devel/h_vSzEJAPXs
+  # for why the have additional buildInputs on darwin
+  buildInputs = [ autoreconfHook gdal wxGTK30 proj libharu opencv vigra
+                  postgresql libiodbc lzma jasper
+                  unixODBC poppler hdf4.out hdf5 netcdf sqlite qhull giflib ]
+                ++ stdenv.lib.optional stdenv.isDarwin Cocoa ;
+
+  enableParallelBuilding = true;
+
+  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11 -Wno-narrowing";
+
+  sourceRoot = "code-b6f474f/saga-gis";
+
+  patches = [ ./clang_patch.patch ./finite.patch];
+
+  src = fetchgit {
+    url = "https://git.code.sf.net/p/saga-gis/code.git";
+    rev = "b6f474f8af4af7f0ff82548cc6f88c53547d91f5";
+    sha256 = "0iakynai8mhcwj6wxvafkqhd7b417ss7hyhbcp9wf6092l6vc2zd";
+  };
+
+  meta = with stdenv.lib; {
+    description = "System for Automated Geoscientific Analyses";
+    homepage = http://www.saga-gis.org;
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.mpickering ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/pkgs/desktops/gnome-2/platform/GConf/default.nix b/pkgs/desktops/gnome-2/platform/GConf/default.nix
index dd9264514d4a..df3de11e738d 100644
--- a/pkgs/desktops/gnome-2/platform/GConf/default.nix
+++ b/pkgs/desktops/gnome-2/platform/GConf/default.nix
@@ -27,6 +27,6 @@ stdenv.mkDerivation rec {
   meta = with stdenv.lib; {
     homepage = https://projects.gnome.org/gconf/;
     description = "Deprecated system for storing application preferences";
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libharu/default.nix b/pkgs/development/libraries/libharu/default.nix
index 5d120f61e086..0830b45b308b 100644
--- a/pkgs/development/libraries/libharu/default.nix
+++ b/pkgs/development/libraries/libharu/default.nix
@@ -15,6 +15,6 @@ stdenv.mkDerivation {
     homepage = http://libharu.org/;
     license = stdenv.lib.licenses.zlib;
     maintainers = [ stdenv.lib.maintainers.marcweber ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libiodbc/default.nix b/pkgs/development/libraries/libiodbc/default.nix
index 738c11161955..45649f944f51 100644
--- a/pkgs/development/libraries/libiodbc/default.nix
+++ b/pkgs/development/libraries/libiodbc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, gtk2, useGTK ? false }:
+{ stdenv, fetchurl, pkgconfig, gtk2, Carbon, useGTK ? false }:
 
 stdenv.mkDerivation rec {
   name = "libiodbc-3.52.12";
@@ -9,7 +9,8 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = stdenv.lib.optionals useGTK [ gtk2 ];
+  buildInputs = stdenv.lib.optionals useGTK [ gtk2 ]
+                ++ stdenv.lib.optional stdenv.isDarwin Carbon;
 
   preBuild =
     ''
@@ -19,6 +20,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "iODBC driver manager";
     homepage = http://www.iodbc.org;
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/vigra/default.nix b/pkgs/development/libraries/vigra/default.nix
index 12c166beacbd..fb69d4bf63e7 100644
--- a/pkgs/development/libraries/vigra/default.nix
+++ b/pkgs/development/libraries/vigra/default.nix
@@ -15,6 +15,12 @@ in stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = "-I${ilmbase.dev}/include/OpenEXR";
 
+  # Fixes compilation with clang (on darwin) see https://github.com/ukoethe/vigra/issues/414
+  patches =
+    let clangPatch = fetchurl { url = "https://github.com/ukoethe/vigra/commit/81958d302494e137f98a8b1d7869841532f90388.patch";
+                                sha256 = "1i1w6smijgb5z8bg9jaq84ccy00k2sxm87s37lgjpyix901gjlgi"; };
+    in [ clangPatch ];
+
   buildInputs = [ boost cmake fftw fftwSinglePrec hdf5 ilmbase libjpeg libpng
                   libtiff numpy openexr python ];
 
@@ -34,6 +40,6 @@ in stdenv.mkDerivation rec {
     homepage = https://hci.iwr.uni-heidelberg.de/vigra;
     license = licenses.mit;
     maintainers = [ maintainers.viric ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 8daf69f64f65..1e8995d7124b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -10649,6 +10649,7 @@ with pkgs;
 
   libiodbc = callPackage ../development/libraries/libiodbc {
     useGTK = config.libiodbc.gtk or false;
+    inherit (darwin.apple_sdk.frameworks) Carbon;
   };
 
   libivykis = callPackage ../development/libraries/libivykis { };
@@ -18410,6 +18411,7 @@ with pkgs;
 
   qgis = callPackage ../applications/gis/qgis {
     inherit (darwin.apple_sdk.frameworks) IOKit ApplicationServices;
+    saga = saga_2_3_2;
   };
 
   qgroundcontrol = libsForQt5.callPackage ../applications/science/robotics/qgroundcontrol { };
@@ -20377,7 +20379,13 @@ with pkgs;
 
   rrootage = callPackage ../games/rrootage { };
 
-  saga = callPackage ../applications/gis/saga { };
+  saga = callPackage ../applications/gis/saga {
+    inherit (darwin.apple_sdk.frameworks) Cocoa;
+  };
+
+  saga_2_3_2 = callPackage ../applications/gis/saga/lts.nix {
+    inherit (darwin.apple_sdk.frameworks) Cocoa;
+  };
 
   samplv1 = callPackage ../applications/audio/samplv1 { };