summary refs log tree commit diff
path: root/pkgs/applications/gis/saga
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/gis/saga')
-rw-r--r--pkgs/applications/gis/saga/default.nix91
-rw-r--r--pkgs/applications/gis/saga/opencv4.patch14
2 files changed, 91 insertions, 14 deletions
diff --git a/pkgs/applications/gis/saga/default.nix b/pkgs/applications/gis/saga/default.nix
index 388ac1ee7a7..716972342ed 100644
--- a/pkgs/applications/gis/saga/default.nix
+++ b/pkgs/applications/gis/saga/default.nix
@@ -1,27 +1,90 @@
-{ stdenv, fetchurl, gdal, wxGTK30, proj, libiodbc, lzma,
-  libharu, opencv2, vigra, postgresql, Cocoa,
-  unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }:
+{ stdenv
+, fetchurl
+# native
+, autoreconfHook
+, pkg-config
+# not native
+, gdal
+, wxGTK31-gtk3
+, proj_5
+, dxflib
+, curl
+, libiodbc
+, lzma
+, libharu
+, opencv
+, vigra
+, postgresql
+, Cocoa
+, unixODBC
+, poppler
+, hdf4
+, hdf5
+, netcdf
+, sqlite
+, qhull
+, giflib
+, libsvm
+, fftw
+}:
 
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   pname = "saga";
-  version = "7.6.2";
+  version = "7.7.0";
 
+  src = fetchurl {
+    url = "https://sourceforge.net/projects/saga-gis/files/SAGA%20-%20${stdenv.lib.versions.major version}/SAGA%20-%20${version}/saga-${version}.tar.gz";
+    sha256 = "1nmvrlcpcm2pas9pnav13iydnym9d8yqqnwq47lm0j6b0a2wy9zk";
+  };
+
+  nativeBuildInputs = [
+    # Upstream's gnerated ./configure is not reliable
+    autoreconfHook
+    pkg-config
+  ];
+  configureFlags = [
+    "--with-system-svm"
+    # hdf is no detected otherwise
+    "HDF5_LIBS=-l${hdf5}/lib"
+    "HDF5_CFLAGS=-I${hdf5.dev}/include"
+  ];
+  buildInputs = [
+    curl
+    dxflib
+    fftw
+    libsvm
+    hdf5
+    gdal
+    wxGTK31-gtk3
+    proj_5
+    libharu
+    opencv
+    vigra
+    postgresql
+    libiodbc
+    lzma
+    qhull
+    giflib
+  ]
   # See https://groups.google.com/forum/#!topic/nix-devel/h_vSzEJAPXs
   # for why the have additional buildInputs on darwin
-  buildInputs = [ gdal wxGTK30 proj libharu opencv2 vigra postgresql libiodbc lzma
-                  qhull giflib ]
-                ++ stdenv.lib.optionals stdenv.isDarwin
-                  [ Cocoa unixODBC poppler hdf4.out hdf5 netcdf sqlite ];
+  ++ stdenv.lib.optionals stdenv.isDarwin [
+    Cocoa
+    unixODBC
+    poppler
+    netcdf
+    sqlite
+  ];
+
+  patches = [
+    # See https://sourceforge.net/p/saga-gis/bugs/280/
+    ./opencv4.patch
+  ];
 
   enableParallelBuilding = true;
 
   CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11 -Wno-narrowing";
 
-  src = fetchurl {
-    url = "https://sourceforge.net/projects/saga-gis/files/SAGA%20-%207/SAGA%20-%207.6.2/saga-7.6.2.tar.gz";
-    sha256 = "09j5magmayq2y620kqa490mfd1kpdp3lng2ifcgbrmssc079ybm0";
-  };
-
   meta = with stdenv.lib; {
     description = "System for Automated Geoscientific Analyses";
     homepage = "http://www.saga-gis.org";
diff --git a/pkgs/applications/gis/saga/opencv4.patch b/pkgs/applications/gis/saga/opencv4.patch
new file mode 100644
index 00000000000..0b26192bf09
--- /dev/null
+++ b/pkgs/applications/gis/saga/opencv4.patch
@@ -0,0 +1,14 @@
+--- a/src/tools/imagery/imagery_opencv/Makefile.am
++++ b/src/tools/imagery/imagery_opencv/Makefile.am
+@@ -7,9 +7,9 @@
+ 
+ if HAVE_CV
+ DEF_SAGA           = -D_SAGA_LINUX -D_TYPEDEF_BYTE -D_TYPEDEF_WORD
+-CXX_INCS           = -I$(top_srcdir)/src/saga_core -I/usr/include/opencv
++CXX_INCS           = -I$(top_srcdir)/src/saga_core `pkg-config opencv4 --cflags`
+ AM_CXXFLAGS        = -fPIC $(CXX_INCS) $(DEF_SAGA) $(DBGFLAGS) $(GOMPFLAGS)
+-AM_LDFLAGS         = -fPIC -shared -avoid-version `pkg-config opencv --libs`
++AM_LDFLAGS         = -fPIC -shared -avoid-version `pkg-config opencv4 --libs`
+ pkglib_LTLIBRARIES = libimagery_opencv.la
+ libimagery_opencv_la_SOURCES =\
+ MLB_Interface.cpp\