2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, callPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, wrapGAppsHook
|
|
|
|
|
|
|
|
, bison
|
|
|
|
, blas
|
|
|
|
, cairo
|
|
|
|
, ffmpeg
|
|
|
|
, fftw
|
|
|
|
, flex
|
|
|
|
, gdal
|
|
|
|
, geos
|
|
|
|
, libiconv
|
|
|
|
, libmysqlclient
|
|
|
|
, libpng
|
|
|
|
, libtiff
|
|
|
|
, libxml2
|
|
|
|
, netcdf
|
|
|
|
, pdal
|
|
|
|
, pkg-config
|
|
|
|
, postgresql
|
|
|
|
, proj
|
|
|
|
, proj-datumgrid
|
|
|
|
, python3Packages
|
|
|
|
, readline
|
|
|
|
, sqlite
|
|
|
|
, wxGTK32
|
|
|
|
, zlib
|
|
|
|
, zstd
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-03-30 09:31:56 +00:00
|
|
|
pname = "grass";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "8.3.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
src = fetchFromGitHub {
|
2020-04-24 23:36:52 +00:00
|
|
|
owner = "OSGeo";
|
|
|
|
repo = "grass";
|
2023-10-09 19:29:22 +00:00
|
|
|
rev = finalAttrs.version;
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-SoJq4SuDYImfkM2e991s47vYusrmnrQaXn7p3xwyOOQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
nativeBuildInputs = [
|
2023-07-15 17:15:38 +00:00
|
|
|
makeWrapper
|
|
|
|
wrapGAppsHook
|
|
|
|
|
|
|
|
bison
|
|
|
|
flex
|
|
|
|
gdal # for `gdal-config`
|
|
|
|
geos # for `geos-config`
|
|
|
|
libmysqlclient # for `mysql_config`
|
|
|
|
netcdf # for `nc-config`
|
|
|
|
pkg-config
|
2024-01-13 08:15:51 +00:00
|
|
|
] ++ (with python3Packages; [ python-dateutil numpy wxpython ]);
|
2022-10-21 18:38:19 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2023-07-15 17:15:38 +00:00
|
|
|
blas
|
|
|
|
cairo
|
|
|
|
ffmpeg
|
|
|
|
fftw
|
|
|
|
gdal
|
|
|
|
geos
|
|
|
|
libmysqlclient
|
|
|
|
libpng
|
|
|
|
libtiff
|
|
|
|
libxml2
|
|
|
|
netcdf
|
|
|
|
pdal
|
|
|
|
postgresql
|
|
|
|
proj
|
|
|
|
proj-datumgrid
|
|
|
|
readline
|
|
|
|
sqlite
|
|
|
|
wxGTK32
|
|
|
|
zlib
|
|
|
|
zstd
|
2022-10-21 18:38:19 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [ libiconv ];
|
|
|
|
|
|
|
|
strictDeps = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
patches = lib.optionals stdenv.isDarwin [
|
|
|
|
# Fix conversion of const char* to unsigned int.
|
|
|
|
./clang-integer-conversion.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Correct mysql_config query
|
2023-11-16 04:20:00 +00:00
|
|
|
postPatch = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace configure --replace "--libmysqld-libs" "--libs"
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
2023-07-15 17:15:38 +00:00
|
|
|
"--with-blas"
|
|
|
|
"--with-fftw"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-geos"
|
2023-07-15 17:15:38 +00:00
|
|
|
# It complains about missing libmysqld but doesn't really seem to need it
|
2020-04-24 23:36:52 +00:00
|
|
|
"--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"
|
2023-07-15 17:15:38 +00:00
|
|
|
"--with-netcdf"
|
|
|
|
"--with-postgres"
|
|
|
|
"--with-postgres-libs=${postgresql.lib}/lib/"
|
|
|
|
"--with-proj-includes=${proj.dev}/include"
|
|
|
|
"--with-proj-libs=${proj}/lib"
|
|
|
|
"--with-proj-share=${proj}/share/proj"
|
2022-01-27 00:19:43 +00:00
|
|
|
"--with-pthread"
|
2023-07-15 17:15:38 +00:00
|
|
|
"--with-readline"
|
|
|
|
"--with-zstd"
|
|
|
|
"--without-opengl"
|
2022-01-27 00:19:43 +00:00
|
|
|
] ++ 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;
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru.tests = {
|
|
|
|
grass = callPackage ./tests.nix { grass = finalAttrs.finalPackage; };
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "GIS software suite used for geospatial data management and analysis, image processing, graphics and maps production, spatial modeling, and visualization";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://grass.osgeo.org/";
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; teams.geospatial.members ++ [ mpickering ];
|
|
|
|
platforms = platforms.all;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "grass";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|