2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, flex, bison, pkg-config, zlib, libtiff, libpng, fftw
|
2022-10-21 18:38:19 +00:00
|
|
|
, cairo, readline, ffmpeg, makeWrapper, wxGTK32, libiconv, netcdf, blas
|
|
|
|
, proj, gdal, geos, sqlite, postgresql, libmysqlclient, python3Packages, proj-datumgrid
|
2022-01-27 00:19:43 +00:00
|
|
|
, zstd, pdal, wrapGAppsHook
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-03-30 09:31:56 +00:00
|
|
|
pname = "grass";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "8.2.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-17 00:15:33 +00:00
|
|
|
src = with lib; fetchFromGitHub {
|
2020-04-24 23:36:52 +00:00
|
|
|
owner = "OSGeo";
|
|
|
|
repo = "grass";
|
2022-01-27 00:19:43 +00:00
|
|
|
rev = version;
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-VK9FCqIwHGmeJe5lk12lpAGcsC1aPRBiI+XjACXjDd4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config bison flex makeWrapper wrapGAppsHook
|
|
|
|
gdal geos libmysqlclient netcdf pdal
|
2022-11-21 17:40:18 +00:00
|
|
|
] ++ (with python3Packages; [ python-dateutil numpy wxPython_4_2 ]);
|
2022-10-21 18:38:19 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
cairo zlib proj libtiff libpng fftw sqlite
|
|
|
|
readline ffmpeg postgresql blas wxGTK32
|
|
|
|
proj-datumgrid zstd
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [ libiconv ];
|
|
|
|
|
|
|
|
strictDeps = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# On Darwin the installer tries to symlink the help files into a system
|
|
|
|
# directory
|
|
|
|
patches = [ ./no_symbolic_links.patch ];
|
|
|
|
|
|
|
|
# Correct mysql_config query
|
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace configure --replace "--libmysqld-libs" "--libs"
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-proj-share=${proj}/share/proj"
|
|
|
|
"--with-proj-includes=${proj.dev}/include"
|
2022-01-27 00:19:43 +00:00
|
|
|
"--with-proj-libs=${proj}/lib"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--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"
|
2020-10-16 20:44:37 +00:00
|
|
|
"--with-mysql-includes=${lib.getDev libmysqlclient}/include/mysql"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-mysql-libs=${libmysqlclient}/lib/mysql"
|
|
|
|
"--with-blas"
|
2022-01-27 00:19:43 +00:00
|
|
|
"--with-zstd"
|
|
|
|
"--with-fftw"
|
|
|
|
"--with-pthread"
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"--with-pdal"
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
"--without-cairo"
|
|
|
|
"--without-freetype"
|
|
|
|
"--without-x"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# Otherwise a very confusing "Can't load GDAL library" error
|
2021-01-17 00:15:33 +00:00
|
|
|
makeFlags = lib.optional stdenv.isDarwin "GDAL_DYNAMIC=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
/* Ensures that the python script run at build time are actually executable;
|
|
|
|
* otherwise, patchShebangs ignores them. */
|
|
|
|
postConfigure = ''
|
2022-04-27 09:35:20 +00:00
|
|
|
for f in $(find . -name '*.py'); do
|
|
|
|
chmod +x $f
|
2020-04-24 23:36:52 +00:00
|
|
|
done
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
patchShebangs */
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
2022-04-27 09:35:20 +00:00
|
|
|
wrapProgram $out/bin/grass \
|
2020-04-24 23:36:52 +00:00
|
|
|
--set PYTHONPATH $PYTHONPATH \
|
2022-01-27 00:19:43 +00:00
|
|
|
--set GRASS_PYTHON ${python3Packages.python.interpreter} \
|
2020-04-24 23:36:52 +00:00
|
|
|
--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";
|
2021-01-17 00:15:33 +00:00
|
|
|
license = lib.licenses.gpl2Plus;
|
|
|
|
platforms = lib.platforms.all;
|
2022-04-27 09:35:20 +00:00
|
|
|
maintainers = with lib.maintainers; [ mpickering willcohen ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|