Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Merge pull request #39125 from mpickering/darwin-saga

SAGA, SAGA LTS release, dependencies and QGIS SAGA plugin

authored by

Michael Raskin and committed by
GitHub
878c6c09 cbaf6673

+166 -15
+5 -2
pkgs/applications/gis/qgis/default.nix
··· 1 1 { stdenv, fetchurl, fetchpatch, gdal, cmake, qt4, flex, bison, proj, geos, xlibsWrapper, sqlite, gsl 2 2 , qwt, fcgi, python2Packages, libspatialindex, libspatialite, qscintilla, postgresql, makeWrapper 3 3 , qjson, qca2, txt2tags, openssl, darwin, pkgconfig 4 - , withGrass ? true, grass, IOKit, ApplicationServices 4 + , withGrass ? true, grass, saga, IOKit, ApplicationServices 5 5 }: 6 6 7 7 stdenv.mkDerivation rec { 8 8 name = "qgis-2.18.22"; 9 9 10 10 buildInputs = [ gdal qt4 flex openssl bison proj geos xlibsWrapper sqlite gsl qwt qscintilla 11 - fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags pkgconfig ] 11 + fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags pkgconfig 12 + saga ] 12 13 ++ 13 14 (stdenv.lib.optionals stdenv.isDarwin [IOKit ApplicationServices]) 14 15 ++ ··· 68 69 # Necessary for QGIS to find the correct default GRASS path 69 70 # Plugins look for gdal tools like deminfo on the PATH 70 71 ${stdenv.lib.optionalString withGrass "ln -sf ${grass} $out/QGIS.app/Contents/MacOS/grass"} 72 + # Necessary for QGIS to find the right SAGA installation 73 + ln -sf ${saga}/bin/saga_cmd $out/QGIS.app/Contents/MacOS/bin/saga_cmd 71 74 for file in $(find $out -type f -name "QGIS"); do 72 75 wrapProgram "$file" \ 73 76 --prefix DYLD_LIBRARY_PATH : "${qwt}/lib" \
+19
pkgs/applications/gis/saga/clang_patch.patch
··· 1 + commit e92b250968e9656084ab5984689747ca615ff6e7 2 + Author: Volker Wichmann <wichmann@laserdata.at> 3 + Date: Sun Mar 5 13:49:53 2017 +0100 4 + 5 + saga_api, CSG_Table::Del_Records(): bug fix, check record count correctly 6 + 7 + diff --git a/src/saga_core/saga_api/table.cpp b/src/saga_core/saga_api/table.cpp 8 + index 76a1d8d..fa1a66f 100644 9 + --- a/src/saga_core/saga_api/table.cpp 10 + +++ b/src/saga_core/saga_api/table.cpp 11 + @@ -901,7 +901,7 @@ bool CSG_Table::Del_Record(int iRecord) 12 + //--------------------------------------------------------- 13 + bool CSG_Table::Del_Records(void) 14 + { 15 + - if( m_Records > 0 ) 16 + + if( m_nRecords > 0 ) 17 + { 18 + _Index_Destroy(); 19 +
+16 -6
pkgs/applications/gis/saga/default.nix
··· 1 1 { stdenv, fetchurl, gdal, wxGTK30, proj, libiodbc, lzma, jasper, 2 - libharu, opencv, vigra, postgresql }: 2 + libharu, opencv, vigra, postgresql, Cocoa, 3 + unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }: 3 4 4 5 stdenv.mkDerivation rec { 5 6 name = "saga-6.3.0"; 6 7 7 - buildInputs = [ gdal wxGTK30 proj libharu opencv vigra postgresql libiodbc lzma jasper ]; 8 + # See https://groups.google.com/forum/#!topic/nix-devel/h_vSzEJAPXs 9 + # for why the have additional buildInputs on darwin 10 + buildInputs = [ gdal wxGTK30 proj libharu opencv vigra postgresql libiodbc lzma 11 + jasper qhull giflib ] 12 + ++ stdenv.lib.optionals stdenv.isDarwin 13 + [ Cocoa unixODBC poppler hdf4.out hdf5 netcdf sqlite ]; 8 14 9 15 enableParallelBuilding = true; 10 16 17 + patches = [ ./finite-6.3.0.patch]; 18 + 19 + CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11 -Wno-narrowing"; 20 + 11 21 src = fetchurl { 12 22 url = "mirror://sourceforge/project/saga-gis/SAGA%20-%206/SAGA%20-%206.3.0/saga-6.3.0.tar.gz"; 13 23 sha256 = "0hyjim8fcp3mna1hig22nnn4ki3j6b7096am2amcs99sdr09jjxv"; 14 24 }; 15 25 16 - meta = { 26 + meta = with stdenv.lib; { 17 27 description = "System for Automated Geoscientific Analyses"; 18 28 homepage = http://www.saga-gis.org; 19 - license = stdenv.lib.licenses.gpl2Plus; 20 - maintainers = [ stdenv.lib.maintainers.michelk ]; 21 - platforms = ["x86_64-linux" ]; 29 + license = licenses.gpl2Plus; 30 + maintainers = [ maintainers.michelk ]; 31 + platforms = with platforms; unix; 22 32 }; 23 33 }
+55
pkgs/applications/gis/saga/finite-6.3.0.patch
··· 1 + diff --git a/src/tools/imagery/imagery_maxent/me.cpp b/src/tools/imagery/imagery_maxent/me.cpp 2 + index c5da854..d3e9cff 100755 3 + --- a/src/tools/imagery/imagery_maxent/me.cpp 4 + +++ b/src/tools/imagery/imagery_maxent/me.cpp 5 + @@ -21,7 +21,7 @@ 6 + #ifdef _SAGA_MSW 7 + #define isinf(x) (!_finite(x)) 8 + #else 9 + -#define isinf(x) (!finite(x)) 10 + +#define isinf(x) (!isfinite(x)) 11 + #endif 12 + 13 + /** The input array contains a set of log probabilities lp1, lp2, lp3 14 + @@ -47,7 +47,7 @@ double sumLogProb(vector<double>& logprobs) 15 + /** returns log (e^logprob1 + e^logprob2). */ 16 + double sumLogProb(double logprob1, double logprob2) 17 + { 18 + - if (isinf(logprob1) && isinf(logprob2)) 19 + + if (isinf(logprob1) && isinf(logprob2)) 20 + return logprob1; // both prob1 and prob2 are 0, return log 0. 21 + if (logprob1>logprob2) 22 + return logprob1+log(1+exp(logprob2-logprob1)); 23 + @@ -70,8 +70,8 @@ void MaxEntModel::print(ostream& ostrm, MaxEntTrainer& trainer) 24 + for (FtMap::iterator it = _index.begin(); it!=_index.end(); it++) { 25 + unsigned long i = it->second; 26 + for (unsigned long c = 0; c<_classes; c++) { 27 + - ostrm << "lambda(" << trainer.className(c) << ", " 28 + - << trainer.getStr(it->first) << ")=" 29 + + ostrm << "lambda(" << trainer.className(c) << ", " 30 + + << trainer.getStr(it->first) << ")=" 31 + << _lambda[i+c] << endl; 32 + } 33 + } 34 + @@ -86,7 +86,7 @@ int MaxEntModel::getProbs(MaxEntEvent& event, vector<double>& probs) 35 + double s = 0; 36 + for (unsigned int f = 0; f<event.size(); f++) { 37 + FtMap::iterator it = _index.find(event[f]); 38 + - if (it!=_index.end()) 39 + + if (it!=_index.end()) 40 + s += _lambda[it->second+c]; 41 + } 42 + probs[c] = s; 43 + @@ -142,10 +142,10 @@ double MaxEntModel::getObsCounts(EventSet& events, vector<double>& obsCounts) 44 + double ftSum = 0; 45 + for (unsigned long j=0; j<e.size(); j++) { 46 + FtMap::iterator it = _index.find(e[j]); 47 + - if (it!=_index.end()) 48 + + if (it!=_index.end()) 49 + obsCounts[it->second+c] += count; 50 + else { // new feature, need to expand obsCounts and _lambda 51 + - for (unsigned int k = 0; k<_classes; k++) 52 + + for (unsigned int k = 0; k<_classes; k++) 53 + obsCounts.push_back(0); 54 + obsCounts[_lambda.size()+c] += count; 55 + addFeature(e[j]);
+13
pkgs/applications/gis/saga/finite.patch
··· 1 + diff --git a/saga-gis/src/modules/imagery/imagery_maxent/me.cpp b/saga-gis/src/modules/imagery/imagery_maxent/me.cpp 2 + index c5da854..d3e9cff 100755 3 + --- a/src/modules/imagery/imagery_maxent/me.cpp 4 + +++ b/src/modules/imagery/imagery_maxent/me.cpp 5 + @@ -21,7 +21,7 @@ 6 + #ifdef _SAGA_MSW 7 + #define isinf(x) (!_finite(x)) 8 + #else 9 + -#define isinf(x) (!finite(x)) 10 + +#define isinf(x) (!isfinite(x)) 11 + #endif 12 + 13 + /** The input array contains a set of log probabilities lp1, lp2, lp3
+36
pkgs/applications/gis/saga/lts.nix
··· 1 + { stdenv, fetchgit, gdal, wxGTK30, proj, libiodbc, lzma, jasper, 2 + libharu, opencv, vigra, postgresql, autoreconfHook, Cocoa 3 + , unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }: 4 + 5 + stdenv.mkDerivation rec { 6 + name = "saga-2.3.2"; 7 + 8 + # See https://groups.google.com/forum/#!topic/nix-devel/h_vSzEJAPXs 9 + # for why the have additional buildInputs on darwin 10 + buildInputs = [ autoreconfHook gdal wxGTK30 proj libharu opencv vigra 11 + postgresql libiodbc lzma jasper 12 + unixODBC poppler hdf4.out hdf5 netcdf sqlite qhull giflib ] 13 + ++ stdenv.lib.optional stdenv.isDarwin Cocoa ; 14 + 15 + enableParallelBuilding = true; 16 + 17 + CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11 -Wno-narrowing"; 18 + 19 + sourceRoot = "code-b6f474f/saga-gis"; 20 + 21 + patches = [ ./clang_patch.patch ./finite.patch]; 22 + 23 + src = fetchgit { 24 + url = "https://git.code.sf.net/p/saga-gis/code.git"; 25 + rev = "b6f474f8af4af7f0ff82548cc6f88c53547d91f5"; 26 + sha256 = "0iakynai8mhcwj6wxvafkqhd7b417ss7hyhbcp9wf6092l6vc2zd"; 27 + }; 28 + 29 + meta = with stdenv.lib; { 30 + description = "System for Automated Geoscientific Analyses"; 31 + homepage = http://www.saga-gis.org; 32 + license = licenses.gpl2Plus; 33 + maintainers = [ maintainers.mpickering ]; 34 + platforms = with platforms; unix; 35 + }; 36 + }
+1 -1
pkgs/desktops/gnome-2/platform/GConf/default.nix
··· 27 27 meta = with stdenv.lib; { 28 28 homepage = https://projects.gnome.org/gconf/; 29 29 description = "Deprecated system for storing application preferences"; 30 - platforms = platforms.linux; 30 + platforms = platforms.unix; 31 31 }; 32 32 }
+1 -1
pkgs/development/libraries/libharu/default.nix
··· 15 15 homepage = http://libharu.org/; 16 16 license = stdenv.lib.licenses.zlib; 17 17 maintainers = [ stdenv.lib.maintainers.marcweber ]; 18 - platforms = stdenv.lib.platforms.linux; 18 + platforms = stdenv.lib.platforms.unix; 19 19 }; 20 20 }
+4 -3
pkgs/development/libraries/libiodbc/default.nix
··· 1 - { stdenv, fetchurl, pkgconfig, gtk2, useGTK ? false }: 1 + { stdenv, fetchurl, pkgconfig, gtk2, Carbon, useGTK ? false }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 name = "libiodbc-3.52.12"; ··· 9 9 }; 10 10 11 11 nativeBuildInputs = [ pkgconfig ]; 12 - buildInputs = stdenv.lib.optionals useGTK [ gtk2 ]; 12 + buildInputs = stdenv.lib.optionals useGTK [ gtk2 ] 13 + ++ stdenv.lib.optional stdenv.isDarwin Carbon; 13 14 14 15 preBuild = 15 16 '' ··· 19 20 meta = { 20 21 description = "iODBC driver manager"; 21 22 homepage = http://www.iodbc.org; 22 - platforms = stdenv.lib.platforms.linux; 23 + platforms = stdenv.lib.platforms.unix; 23 24 }; 24 25 }
+7 -1
pkgs/development/libraries/vigra/default.nix
··· 15 15 16 16 NIX_CFLAGS_COMPILE = "-I${ilmbase.dev}/include/OpenEXR"; 17 17 18 + # Fixes compilation with clang (on darwin) see https://github.com/ukoethe/vigra/issues/414 19 + patches = 20 + let clangPatch = fetchurl { url = "https://github.com/ukoethe/vigra/commit/81958d302494e137f98a8b1d7869841532f90388.patch"; 21 + sha256 = "1i1w6smijgb5z8bg9jaq84ccy00k2sxm87s37lgjpyix901gjlgi"; }; 22 + in [ clangPatch ]; 23 + 18 24 buildInputs = [ boost cmake fftw fftwSinglePrec hdf5 ilmbase libjpeg libpng 19 25 libtiff numpy openexr python ]; 20 26 ··· 34 40 homepage = https://hci.iwr.uni-heidelberg.de/vigra; 35 41 license = licenses.mit; 36 42 maintainers = [ maintainers.viric ]; 37 - platforms = platforms.linux; 43 + platforms = platforms.unix; 38 44 }; 39 45 }
+9 -1
pkgs/top-level/all-packages.nix
··· 10649 10649 10650 10650 libiodbc = callPackage ../development/libraries/libiodbc { 10651 10651 useGTK = config.libiodbc.gtk or false; 10652 + inherit (darwin.apple_sdk.frameworks) Carbon; 10652 10653 }; 10653 10654 10654 10655 libivykis = callPackage ../development/libraries/libivykis { }; ··· 18410 18411 18411 18412 qgis = callPackage ../applications/gis/qgis { 18412 18413 inherit (darwin.apple_sdk.frameworks) IOKit ApplicationServices; 18414 + saga = saga_2_3_2; 18413 18415 }; 18414 18416 18415 18417 qgroundcontrol = libsForQt5.callPackage ../applications/science/robotics/qgroundcontrol { }; ··· 20377 20379 20378 20380 rrootage = callPackage ../games/rrootage { }; 20379 20381 20380 - saga = callPackage ../applications/gis/saga { }; 20382 + saga = callPackage ../applications/gis/saga { 20383 + inherit (darwin.apple_sdk.frameworks) Cocoa; 20384 + }; 20385 + 20386 + saga_2_3_2 = callPackage ../applications/gis/saga/lts.nix { 20387 + inherit (darwin.apple_sdk.frameworks) Cocoa; 20388 + }; 20381 20389 20382 20390 samplv1 = callPackage ../applications/audio/samplv1 { }; 20383 20391