about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/gis
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/gis')
-rw-r--r--nixpkgs/pkgs/applications/gis/grass/default.nix103
-rw-r--r--nixpkgs/pkgs/applications/gis/grass/no_symbolic_links.patch37
-rw-r--r--nixpkgs/pkgs/applications/gis/openorienteering-mapper/default.nix65
-rw-r--r--nixpkgs/pkgs/applications/gis/qgis/default.nix27
-rw-r--r--nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix57
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/clang_patch.patch19
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/default.nix33
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/finite.patch13
-rw-r--r--nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix24
9 files changed, 378 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/gis/grass/default.nix b/nixpkgs/pkgs/applications/gis/grass/default.nix
new file mode 100644
index 000000000000..360d94d1b825
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/grass/default.nix
@@ -0,0 +1,103 @@
+{ stdenv, fetchFromGitHub, flex, bison, pkgconfig, zlib, libtiff, libpng, fftw
+, cairo, readline, ffmpeg, makeWrapper, wxGTK30, netcdf, blas
+, proj, gdal, geos, sqlite, postgresql, mysql, python2Packages, libLAS, proj-datumgrid
+}:
+
+stdenv.mkDerivation rec {
+  name = "grass";
+  version = "7.6.1";
+
+  src = with stdenv.lib; fetchFromGitHub {
+    owner = "OSGeo";
+    repo = "grass";
+    rev = "${name}_${replaceStrings ["."] ["_"] version}";
+    sha256 = "1amjk9rz7vw5ha7nyl5j2bfwj5if9w62nlwx5qbp1x7spldimlll";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ flex bison zlib proj gdal libtiff libpng fftw sqlite cairo proj
+  readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql mysql.connector-c blas
+  libLAS proj-datumgrid ]
+    ++ (with python2Packages; [ python dateutil wxPython30 numpy ]);
+
+  # On Darwin the installer tries to symlink the help files into a system
+  # directory
+  patches = [ ./no_symbolic_links.patch ];
+
+  configureFlags = [
+    "--with-proj-share=${proj}/share/proj"
+    "--with-proj-includes=${proj.dev}/include"
+    "--with-proj-lib=${proj}/lib"
+    "--without-opengl"
+    "--with-readline"
+    "--with-wxwidgets"
+    "--with-netcdf"
+    "--with-geos"
+    "--with-postgres"
+    "--with-postgres-libs=${postgresql.lib}/lib/"
+    # it complains about missing libmysqld but doesn't really seem to need it
+    "--with-mysql"
+    "--with-mysql-includes=${mysql.connector-c}/include/mysql"
+    "--with-mysql-libs=${mysql.connector-c}/lib/mysql"
+    "--with-blas"
+    "--with-liblas=${libLAS}/bin/liblas-config"
+  ];
+
+  # Otherwise a very confusing "Can't load GDAL library" error
+  makeFlags = stdenv.lib.optional stdenv.isDarwin "GDAL_DYNAMIC=";
+
+  /* Ensures that the python script run at build time are actually executable;
+   * otherwise, patchShebangs ignores them.  */
+  postConfigure = ''
+    chmod +x scripts/d.out.file/d.out.file.py \
+      scripts/d.to.rast/d.to.rast.py \
+      scripts/d.what.rast/d.what.rast.py \
+      scripts/d.what.vect/d.what.vect.py \
+      scripts/g.extension/g.extension.py \
+      scripts/g.extension.all/g.extension.all.py \
+      scripts/r.drain/r.drain.py \
+      scripts/r.pack/r.pack.py \
+      scripts/r.tileset/r.tileset.py \
+      scripts/r.unpack/r.unpack.py \
+      scripts/v.clip/v.clip.py \
+      scripts/v.rast.stats/v.rast.stats.py \
+      scripts/v.to.lines/v.to.lines.py \
+      scripts/v.what.strds/v.what.strds.py \
+      scripts/v.unpack/v.unpack.py \
+      scripts/wxpyimgview/*.py \
+      gui/wxpython/animation/g.gui.animation.py \
+      gui/wxpython/datacatalog/g.gui.datacatalog.py \
+      gui/wxpython/rlisetup/g.gui.rlisetup.py \
+      gui/wxpython/vdigit/g.gui.vdigit.py \
+      temporal/t.rast.accumulate/t.rast.accumulate.py \
+      temporal/t.rast.accdetect/t.rast.accdetect.py \
+      temporal/t.rast.algebra/t.rast.algebra.py \
+      temporal/t.rast3d.algebra/t.rast3d.algebra.py \
+      temporal/t.vect.algebra/t.vect.algebra.py \
+      temporal/t.select/t.select.py
+    for d in gui lib scripts temporal tools; do
+      patchShebangs $d
+    done
+  '';
+
+  NIX_CFLAGS_COMPILE = [ "-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1" ];
+
+  postInstall = ''
+    wrapProgram $out/bin/grass76 \
+    --set PYTHONPATH $PYTHONPATH \
+    --set GRASS_PYTHON ${python2Packages.python}/bin/${python2Packages.python.executable} \
+    --suffix LD_LIBRARY_PATH ':' '${gdal}/lib'
+    ln -s $out/grass*/lib $out/lib
+    ln -s $out/grass*/include $out/include
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = https://grass.osgeo.org/;
+    description = "GIS software suite used for geospatial data management and analysis, image processing, graphics and maps production, spatial modeling, and visualization";
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.all;
+    maintainers = with stdenv.lib.maintainers; [mpickering];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/gis/grass/no_symbolic_links.patch b/nixpkgs/pkgs/applications/gis/grass/no_symbolic_links.patch
new file mode 100644
index 000000000000..ef09b97b7037
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/grass/no_symbolic_links.patch
@@ -0,0 +1,37 @@
+diff --git a/include/Make/Install.make b/include/Make/Install.make
+index 0aba138..8ba74bc 100644
+--- a/include/Make/Install.make
++++ b/include/Make/Install.make
+@@ -116,11 +116,6 @@ real-install: | $(INST_DIR) $(UNIX_BIN)
+ 	-$(INSTALL) config.status $(INST_DIR)/config.status
+ 	-$(CHMOD) -R a+rX $(INST_DIR) 2>/dev/null
+ 
+-ifneq ($(findstring darwin,$(ARCH)),)
+-	@# enable OSX Help Viewer
+-	@/bin/ln -sfh "$(INST_DIR)/docs/html" /Library/Documentation/Help/GRASS-$(GRASS_VERSION_MAJOR).$(GRASS_VERSION_MINOR)
+-endif
+-
+ $(INST_DIR) $(UNIX_BIN):
+ 	$(MAKE_DIR_CMD) $@
+ 
+diff --git a/macosx/app/build_html_user_index.sh b/macosx/app/build_html_user_index.sh
+index 04e63eb..c9d9c2c 100755
+--- a/macosx/app/build_html_user_index.sh
++++ b/macosx/app/build_html_user_index.sh
+@@ -140,7 +140,6 @@ else
+ #      echo "<tr><td valign=\"top\"><a href=\"$HTMLDIRG/$i\">$BASENAME</a></td> <td>$SHORTDESC</td></tr>" >> $FULLINDEX
+       # make them local to user to simplify page links
+       echo "<tr><td valign=\"top\"><a href=\"global_$i\">$BASENAME</a></td> <td>$SHORTDESC</td></tr>" >> $FULLINDEX
+-      ln -sf "$HTMLDIRG/$i" global_$i
+     done
+   done
+ fi
+@@ -183,8 +182,3 @@ echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
+ </html>" > $i.html
+ done
+ 
+-# add Help Viewer links in user docs folder
+-
+-mkdir -p $HOME/Library/Documentation/Help/
+-ln -sfh ../../GRASS/$GRASS_MMVER/Modules/docs/html $HOME/Library/Documentation/Help/GRASS-$GRASS_MMVER-addon
+-ln -sfh $GISBASE/docs/html $HOME/Library/Documentation/Help/GRASS-$GRASS_MMVER
diff --git a/nixpkgs/pkgs/applications/gis/openorienteering-mapper/default.nix b/nixpkgs/pkgs/applications/gis/openorienteering-mapper/default.nix
new file mode 100644
index 000000000000..38aeee6d13ef
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/openorienteering-mapper/default.nix
@@ -0,0 +1,65 @@
+{ stdenv, fetchFromGitHub, gdal, cmake, ninja, proj, clipper, zlib, qtbase, qttools
+, qtlocation, qtsensors, doxygen, cups, wrapQtAppsHook, qtimageformats
+}:
+
+stdenv.mkDerivation rec {
+  name = "OpenOrienteering-Mapper-${version}";
+  version = "0.8.4";
+
+  buildInputs = [ gdal qtbase qttools qtlocation qtimageformats
+                  qtsensors clipper zlib proj doxygen cups];
+
+  nativeBuildInputs = [ cmake wrapQtAppsHook ninja ];
+
+  src = fetchFromGitHub {
+    owner = "OpenOrienteering";
+    repo = "mapper";
+    rev = "v${version}";
+    sha256 = "0rw34kp2vd1la97vnk9plwvis6lvyib2bvs7lgkhpnm4p5l7dp1g";
+  };
+
+  cmakeFlags =
+    [
+    # Building the manual and bundling licenses fails
+    "-DLICENSING_PROVIDER:BOOL=OFF"
+    "-DMapper_MANUAL_QTHELP:BOOL=OFF"
+    ] ++
+    (stdenv.lib.optionals stdenv.isDarwin
+    [
+    # Usually enabled on Darwin
+    "-DCMAKE_FIND_FRAMEWORK=never"
+    # FindGDAL is broken and always finds /Library/Framework unless this is
+    # specified
+    "-DGDAL_INCLUDE_DIR=${gdal}/include"
+    "-DGDAL_CONFIG=${gdal}/bin/gdal-config"
+    "-DGDAL_LIBRARY=${gdal}/lib/libgdal.dylib"
+    # Don't bundle libraries
+    "-DMapper_PACKAGE_PROJ=0"
+    "-DMapper_PACKAGE_QT=0"
+    "-DMapper_PACKAGE_ASSISTANT=0"
+    "-DMapper_PACKAGE_GDAL=0"
+    ]);
+
+  # Needs to be available when proj_api.h gets evaluted by CPP
+  NIX_CFLAGS_COMPILE = [ "-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" ];
+
+  postInstall =
+    stdenv.lib.optionalString stdenv.isDarwin ''
+    # Fixes "This application failed to start because it could not find or load the Qt
+    # platform plugin "cocoa"."
+    wrapQtApp $out/Mapper.app/Contents/MacOS/Mapper
+    mkdir -p $out/bin
+    ln -s $out/Mapper.app/Contents/MacOS/Mapper $out/bin/mapper
+    '';
+
+  meta = with stdenv.lib; {
+    description = ''
+      OpenOrienteering Mapper is an orienteering mapmaking program
+      and provides a free alternative to the existing proprietary solution.
+    '';
+    homepage = https://www.openorienteering.org/apps/mapper/;
+    license = licenses.gpl3;
+    platforms = with platforms; linux ++ darwin;
+    maintainers = with maintainers; [mpickering];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/gis/qgis/default.nix b/nixpkgs/pkgs/applications/gis/qgis/default.nix
new file mode 100644
index 000000000000..f272fd04dd0d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/qgis/default.nix
@@ -0,0 +1,27 @@
+{ lib, makeWrapper, symlinkJoin
+, qgis-unwrapped, extraPythonPackages ? (ps: [ ])
+}:
+with lib;
+symlinkJoin rec {
+  inherit (qgis-unwrapped) version;
+  name = "qgis-${version}";
+
+  paths = [ qgis-unwrapped ];
+
+  nativeBuildInputs = [ makeWrapper qgis-unwrapped.python3Packages.wrapPython ];
+
+  # extend to add to the python environment of QGIS without rebuilding QGIS application.
+  pythonInputs = qgis-unwrapped.pythonBuildInputs ++ (extraPythonPackages qgis-unwrapped.python3Packages);
+
+  postBuild = ''
+    # unpackPhase
+
+    buildPythonPath "$pythonInputs"
+
+    wrapProgram $out/bin/qgis \
+      --prefix PATH : $program_PATH \
+      --set PYTHONPATH $program_PYTHONPATH
+  '';
+
+  meta = qgis-unwrapped.meta;
+}
diff --git a/nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix b/nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix
new file mode 100644
index 000000000000..a57b180d5b23
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix
@@ -0,0 +1,57 @@
+{ stdenv, lib, fetchFromGitHub, cmake, ninja, flex, bison, proj, geos, xlibsWrapper, sqlite, gsl
+, qwt, fcgi, python3Packages, libspatialindex, libspatialite, postgresql
+, txt2tags, openssl, libzip, hdf5, netcdf, exiv2
+, qtbase, qtwebkit, qtsensors, qca-qt5, qtkeychain, qscintilla, qtserialport, qtxmlpatterns
+, withGrass ? true, grass
+}:
+with lib;
+let
+  pythonBuildInputs = with python3Packages;
+    [ qscintilla-qt5 gdal jinja2 numpy psycopg2
+      chardet dateutil pyyaml pytz requests urllib3 pygments pyqt5 sip owslib six ];
+in stdenv.mkDerivation rec {
+  version = "3.8.0";
+  pname = "qgis";
+  name = "${pname}-unwrapped-${version}";
+
+  src = fetchFromGitHub {
+    owner = "qgis";
+    repo = "QGIS";
+    rev = "final-${lib.replaceStrings ["."] ["_"] version}";
+    sha256 = "11jqj6lavpw9piv0rm8vvbgd99zhcxl6yfjg699wlrjlyf71xac5";
+  };
+
+  passthru = {
+    inherit pythonBuildInputs;
+    inherit python3Packages;
+  };
+
+  buildInputs = [ openssl proj geos xlibsWrapper sqlite gsl qwt exiv2
+    fcgi libspatialindex libspatialite postgresql txt2tags libzip hdf5 netcdf
+    qtbase qtwebkit qtsensors qca-qt5 qtkeychain qscintilla qtserialport qtxmlpatterns] ++
+    (stdenv.lib.optional withGrass grass) ++ pythonBuildInputs;
+
+  nativeBuildInputs = [ cmake flex bison ninja ];
+
+  # Force this pyqt_sip_dir variable to point to the sip dir in PyQt5
+  #
+  # TODO: Correct PyQt5 to provide the expected directory and fix
+  # build to use PYQT5_SIP_DIR consistently.
+  postPatch = ''
+     substituteInPlace cmake/FindPyQt5.py \
+       --replace 'sip_dir = cfg.default_sip_dir' 'sip_dir = "${python3Packages.pyqt5}/share/sip/PyQt5"'
+   '';
+
+  cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF"
+                 "-DPYQT5_SIP_DIR=${python3Packages.pyqt5}/share/sip/PyQt5"
+                 "-DQSCI_SIP_DIR=${python3Packages.qscintilla-qt5}/share/sip/PyQt5" ] ++
+                 stdenv.lib.optional withGrass "-DGRASS_PREFIX7=${grass}/${grass.name}";
+
+  meta = {
+    description = "A Free and Open Source Geographic Information System";
+    homepage = http://www.qgis.org;
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with stdenv.lib.maintainers; [ lsix ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/gis/saga/clang_patch.patch b/nixpkgs/pkgs/applications/gis/saga/clang_patch.patch
new file mode 100644
index 000000000000..e6af8d130514
--- /dev/null
+++ b/nixpkgs/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/nixpkgs/pkgs/applications/gis/saga/default.nix b/nixpkgs/pkgs/applications/gis/saga/default.nix
new file mode 100644
index 000000000000..7440e2633a33
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/saga/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, gdal, wxGTK30, proj, libiodbc, lzma, jasper,
+  libharu, opencv, vigra, postgresql, Cocoa,
+  unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }:
+
+stdenv.mkDerivation rec {
+  pname = "saga";
+  version = "7.3.0";
+  name = "${pname}-${version}";
+
+  # 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;
+
+  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.3.0/saga-7.3.0.tar.gz";
+    sha256 = "1g7v6vx7b8mfhbbg03pdk4kyks20maqbcdbasnxazhs8pl2zih7k";
+  };
+
+  meta = with stdenv.lib; {
+    description = "System for Automated Geoscientific Analyses";
+    homepage = http://www.saga-gis.org;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ michelk mpickering ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/gis/saga/finite.patch b/nixpkgs/pkgs/applications/gis/saga/finite.patch
new file mode 100644
index 000000000000..7f60743534bd
--- /dev/null
+++ b/nixpkgs/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/nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix b/nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix
new file mode 100644
index 000000000000..d82bdc665498
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, rustPlatform , fetchFromGitHub, Security }:
+rustPlatform.buildRustPackage rec {
+  name = "whitebox_tools-${version}";
+  version = "0.9.0";
+
+  src = fetchFromGitHub {
+    owner = "jblindsay";
+    repo = "whitebox-tools";
+    rev = "6221cdf327be70f0ee4f2053b76bfa01c3f37caa";
+    sha256 = "1423ga964mz7qkl88vkcm8qfprsksx04aq4sz9v5ghnmdzzvl89x";
+  };
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
+
+  cargoSha256 = "11m13h9b75xz8dfisfcykar53qsl1crrp3l75s73gkkkvczlfd24";
+
+  meta = with stdenv.lib; {
+    description = "An advanced geospatial data analysis platform";
+    homepage = http://www.uoguelph.ca/~hydrogeo/WhiteboxTools/index.html;
+    license = licenses.mit;
+    maintainers = [ maintainers.mpickering ];
+    platforms = platforms.all;
+  };
+}