summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/gis
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 /pkgs/applications/gis
parentcbaf6673d6d73f3e3b627b9e4a25236c08624b69 (diff)
parent1c9af2d89cdeb62eef0c9d3798fdd2203f21f221 (diff)
Merge pull request #39125 from mpickering/darwin-saga
SAGA, SAGA LTS release, dependencies and QGIS SAGA plugin
Diffstat (limited to 'pkgs/applications/gis')
-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
6 files changed, 144 insertions, 8 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;
+ };
+}