From c79d054a4c579555a3c70b523c4efa02b6137c71 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 17 Apr 2018 20:37:01 +0100 Subject: [PATCH 01/12] libharu: Build on darwin --- pkgs/development/libraries/libharu/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libharu/default.nix b/pkgs/development/libraries/libharu/default.nix index 5d120f61e08..0830b45b308 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; }; } From 9c34d1069f4c6664a259a66c1815d473c1b8d4de Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 17 Apr 2018 20:37:29 +0100 Subject: [PATCH 02/12] libiodbc: Build on darwin --- pkgs/development/libraries/libiodbc/default.nix | 7 ++++--- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/libiodbc/default.nix b/pkgs/development/libraries/libiodbc/default.nix index 738c1116195..45649f944f5 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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 26fef8cb1d7..bcb3acac0ac 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10373,6 +10373,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 { }; From 2891beb31c5d3c8d055804ae4f41b07fbb366244 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 17 Apr 2018 20:39:10 +0100 Subject: [PATCH 03/12] vigra: Build on darwin --- pkgs/development/libraries/vigra/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/vigra/default.nix b/pkgs/development/libraries/vigra/default.nix index 14211ea65e9..27f66ff6881 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 ]; @@ -31,6 +37,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; }; } From cce0fc8fe5c5991b2fc36455b4b0353fff6cc2cf Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 17 Apr 2018 20:36:47 +0100 Subject: [PATCH 04/12] saga: Build on darwin There are some unresolved dependency issues which means a lot of additional dependencies have to be added explicitly on darwin but not on linux. Maybe something to do with libtool. See https://groups.google.com/forum/#!topic/nix-devel/h_vSzEJAPXs --- pkgs/applications/gis/saga/default.nix | 17 +++++++++++------ pkgs/top-level/all-packages.nix | 4 ++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/gis/saga/default.nix b/pkgs/applications/gis/saga/default.nix index a0f2e007555..02f2de64811 100644 --- a/pkgs/applications/gis/saga/default.nix +++ b/pkgs/applications/gis/saga/default.nix @@ -1,10 +1,15 @@ { stdenv, fetchurl, gdal, wxGTK30, proj, libiodbc, lzma, jasper, - libharu, opencv, vigra, postgresql }: + libharu, opencv, vigra, postgresql, Cocoa, + unixODBC , poppler, hdf4, hdf5, netcdf, sqlite }: 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 ] + ++ stdenv.lib.optionals stdenv.isDarwin + [ Cocoa unixODBC poppler hdf4.out hdf5 netcdf sqlite ]; enableParallelBuilding = true; @@ -13,11 +18,11 @@ stdenv.mkDerivation rec { 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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bcb3acac0ac..7e124de83a4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19878,6 +19878,10 @@ with pkgs; saga = callPackage ../applications/gis/saga { }; + saga = callPackage ../applications/gis/saga { + inherit (darwin.apple_sdk.frameworks) Cocoa; + }; + samplv1 = callPackage ../applications/audio/samplv1 { }; sauerbraten = callPackage ../games/sauerbraten {}; From 7262b88b0a9033e3b000ac6b80582551245a6fa7 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 17 Apr 2018 20:39:50 +0100 Subject: [PATCH 05/12] saga_2_3_2: Init at 2.3.2 This is the lts branch of SAGA which is currently used by QGIS 2.18.x series. --- pkgs/applications/gis/saga/clang_patch.patch | 19 +++++++++++ pkgs/applications/gis/saga/lts.nix | 33 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +++ 3 files changed, 56 insertions(+) create mode 100644 pkgs/applications/gis/saga/clang_patch.patch create mode 100644 pkgs/applications/gis/saga/lts.nix diff --git a/pkgs/applications/gis/saga/clang_patch.patch b/pkgs/applications/gis/saga/clang_patch.patch new file mode 100644 index 00000000000..e6af8d13051 --- /dev/null +++ b/pkgs/applications/gis/saga/clang_patch.patch @@ -0,0 +1,19 @@ +commit e92b250968e9656084ab5984689747ca615ff6e7 +Author: Volker Wichmann +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/lts.nix b/pkgs/applications/gis/saga/lts.nix new file mode 100644 index 00000000000..a0e9d64ac8e --- /dev/null +++ b/pkgs/applications/gis/saga/lts.nix @@ -0,0 +1,33 @@ +{ stdenv, fetchgit, gdal, wxGTK30, proj, libiodbc, lzma, jasper, + libharu, opencv, vigra, postgresql, autoreconfHook, Cocoa + , unixODBC , poppler, hdf4, hdf5, netcdf, sqlite }: + +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 + Cocoa unixODBC poppler hdf4.out hdf5 netcdf sqlite ]; + + enableParallelBuilding = true; + + sourceRoot = "code-b6f474f/saga-gis"; + + patches = [ ./clang_patch.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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7e124de83a4..56088c77e84 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19882,6 +19882,10 @@ with pkgs; 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 { }; sauerbraten = callPackage ../games/sauerbraten {}; From f5b097b34606cee52021f28f7b86abff4b31a694 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Wed, 18 Apr 2018 21:23:13 +0100 Subject: [PATCH 06/12] Build QGIS with SAGA plugins --- pkgs/applications/gis/qgis/default.nix | 7 +++++-- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/gis/qgis/default.nix b/pkgs/applications/gis/qgis/default.nix index 8f06a659f60..d76557b0a41 100644 --- a/pkgs/applications/gis/qgis/default.nix +++ b/pkgs/applications/gis/qgis/default.nix @@ -1,14 +1,15 @@ { stdenv, fetchurl, 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]) ++ @@ -60,6 +61,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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 56088c77e84..10ce58081ba 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17950,6 +17950,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 { }; From 115027abe153ceb7872be82f13959a9e5136d2f2 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Sat, 11 Aug 2018 17:18:58 +0000 Subject: [PATCH 07/12] Fix linux build --- pkgs/applications/gis/saga/lts.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/gis/saga/lts.nix b/pkgs/applications/gis/saga/lts.nix index a0e9d64ac8e..ed2fb1a65ad 100644 --- a/pkgs/applications/gis/saga/lts.nix +++ b/pkgs/applications/gis/saga/lts.nix @@ -9,7 +9,8 @@ stdenv.mkDerivation rec { # for why the have additional buildInputs on darwin buildInputs = [ autoreconfHook gdal wxGTK30 proj libharu opencv vigra postgresql libiodbc lzma jasper - Cocoa unixODBC poppler hdf4.out hdf5 netcdf sqlite ]; + unixODBC poppler hdf4.out hdf5 netcdf sqlite ] + ++ stdenv.lib.optional stdenv.isDarwin Cocoa ; enableParallelBuilding = true; From bcab40610be6e1b31c14c95fe7b195f43536459f Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Sat, 11 Aug 2018 23:08:17 +0100 Subject: [PATCH 08/12] Remove duplicated attribute --- pkgs/top-level/all-packages.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 10ce58081ba..a2da185795c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19877,8 +19877,6 @@ with pkgs; rrootage = callPackage ../games/rrootage { }; - saga = callPackage ../applications/gis/saga { }; - saga = callPackage ../applications/gis/saga { inherit (darwin.apple_sdk.frameworks) Cocoa; }; From 5caa3fcae9a757d67d97caa0ada7732d79f6642e Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Sun, 12 Aug 2018 10:36:43 +0100 Subject: [PATCH 09/12] Small fixes --- pkgs/applications/gis/saga/default.nix | 4 ++-- pkgs/desktops/gnome-2/platform/GConf/default.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/gis/saga/default.nix b/pkgs/applications/gis/saga/default.nix index 02f2de64811..b1ad81a6a3f 100644 --- a/pkgs/applications/gis/saga/default.nix +++ b/pkgs/applications/gis/saga/default.nix @@ -1,13 +1,13 @@ { stdenv, fetchurl, gdal, wxGTK30, proj, libiodbc, lzma, jasper, libharu, opencv, vigra, postgresql, Cocoa, - unixODBC , poppler, hdf4, hdf5, netcdf, sqlite }: + unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull }: stdenv.mkDerivation rec { name = "saga-6.3.0"; # 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 ] + buildInputs = [ gdal wxGTK30 proj libharu opencv vigra postgresql libiodbc lzma jasper qhull ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa unixODBC poppler hdf4.out hdf5 netcdf sqlite ]; diff --git a/pkgs/desktops/gnome-2/platform/GConf/default.nix b/pkgs/desktops/gnome-2/platform/GConf/default.nix index dd9264514d4..df3de11e738 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; }; } From 8a4661588af073fe6a3f8e90f66fdd2c11b99153 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Sun, 12 Aug 2018 22:13:00 +0100 Subject: [PATCH 10/12] Fixes for rebase --- pkgs/applications/gis/saga/finite.patch | 13 +++++++++++++ pkgs/applications/gis/saga/lts.nix | 10 +++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 pkgs/applications/gis/saga/finite.patch diff --git a/pkgs/applications/gis/saga/finite.patch b/pkgs/applications/gis/saga/finite.patch new file mode 100644 index 00000000000..7f60743534b --- /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 index ed2fb1a65ad..e69d52701be 100644 --- a/pkgs/applications/gis/saga/lts.nix +++ b/pkgs/applications/gis/saga/lts.nix @@ -1,6 +1,6 @@ { stdenv, fetchgit, gdal, wxGTK30, proj, libiodbc, lzma, jasper, libharu, opencv, vigra, postgresql, autoreconfHook, Cocoa - , unixODBC , poppler, hdf4, hdf5, netcdf, sqlite }: + , unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }: stdenv.mkDerivation rec { name = "saga-2.3.2"; @@ -9,14 +9,18 @@ stdenv.mkDerivation rec { # 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 ] + unixODBC poppler hdf4.out hdf5 netcdf sqlite qhull giflib ] ++ stdenv.lib.optional stdenv.isDarwin Cocoa ; enableParallelBuilding = true; + GDAL_CFLAGS = "-std=c++11"; + + CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11 -Wno-narrowing"; + sourceRoot = "code-b6f474f/saga-gis"; - patches = [ ./clang_patch.patch ]; + patches = [ ./clang_patch.patch ./finite.patch]; src = fetchgit { url = "https://git.code.sf.net/p/saga-gis/code.git"; From 86b966f10862862f77f44ac7bc25d786d148a6f2 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Wed, 15 Aug 2018 09:10:28 +0100 Subject: [PATCH 11/12] Patches for saga-6.3.0 --- pkgs/applications/gis/saga/default.nix | 9 ++- pkgs/applications/gis/saga/finite-6.3.0.patch | 55 +++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 pkgs/applications/gis/saga/finite-6.3.0.patch diff --git a/pkgs/applications/gis/saga/default.nix b/pkgs/applications/gis/saga/default.nix index b1ad81a6a3f..10cec193cc0 100644 --- a/pkgs/applications/gis/saga/default.nix +++ b/pkgs/applications/gis/saga/default.nix @@ -1,18 +1,23 @@ { stdenv, fetchurl, gdal, wxGTK30, proj, libiodbc, lzma, jasper, libharu, opencv, vigra, postgresql, Cocoa, - unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull }: + unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }: stdenv.mkDerivation rec { name = "saga-6.3.0"; # 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 ] + 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"; 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 00000000000..91c9543edfd --- /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& 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& probs) + double s = 0; + for (unsigned int f = 0; fsecond+c]; + } + probs[c] = s; +@@ -142,10 +142,10 @@ double MaxEntModel::getObsCounts(EventSet& events, vector& obsCounts) + double ftSum = 0; + for (unsigned long j=0; jsecond+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]); From 1c9af2d89cdeb62eef0c9d3798fdd2203f21f221 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Wed, 15 Aug 2018 09:10:42 +0100 Subject: [PATCH 12/12] Remove unecessary option --- pkgs/applications/gis/saga/lts.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/applications/gis/saga/lts.nix b/pkgs/applications/gis/saga/lts.nix index e69d52701be..ca0034aa970 100644 --- a/pkgs/applications/gis/saga/lts.nix +++ b/pkgs/applications/gis/saga/lts.nix @@ -14,8 +14,6 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - GDAL_CFLAGS = "-std=c++11"; - CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11 -Wno-narrowing"; sourceRoot = "code-b6f474f/saga-gis";