Merge pull request #39125 from mpickering/darwin-saga
SAGA, SAGA LTS release, dependencies and QGIS SAGA plugin
This commit is contained in:
commit
878c6c090d
@ -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" \
|
||||
|
19
pkgs/applications/gis/saga/clang_patch.patch
Normal file
19
pkgs/applications/gis/saga/clang_patch.patch
Normal file
@ -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();
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
55
pkgs/applications/gis/saga/finite-6.3.0.patch
Normal file
55
pkgs/applications/gis/saga/finite-6.3.0.patch
Normal file
@ -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]);
|
13
pkgs/applications/gis/saga/finite.patch
Normal file
13
pkgs/applications/gis/saga/finite.patch
Normal file
@ -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
|
36
pkgs/applications/gis/saga/lts.nix
Normal file
36
pkgs/applications/gis/saga/lts.nix
Normal file
@ -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;
|
||||
};
|
||||
}
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
@ -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 { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user