nixpkgs/pkgs/applications/gis/grass/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

151 lines
3.2 KiB
Nix
Raw Normal View History

{ lib
, stdenv
2023-07-02 21:36:36 +00:00
, callPackage
, fetchFromGitHub
, makeWrapper
, wrapGAppsHook
, bison
, blas
, cairo
, ffmpeg
, fftw
, flex
, gdal
, geos
, libiconv
, libmysqlclient
, libpng
, libtiff
, libxml2
, netcdf
, pdal
, pkg-config
, postgresql
, proj
, python3Packages
, readline
, sqlite
, wxGTK32
, zlib
, zstd
2015-09-18 17:01:01 +00:00
}:
stdenv.mkDerivation (finalAttrs: {
2022-03-22 16:57:23 +00:00
pname = "grass";
2024-03-07 15:04:48 +00:00
version = "8.3.2";
2019-07-11 20:12:09 +00:00
src = fetchFromGitHub {
2019-07-11 20:12:09 +00:00
owner = "OSGeo";
repo = "grass";
rev = finalAttrs.version;
2024-03-07 15:04:48 +00:00
hash = "sha256-loeg+7h676d2WdYOMcJFyzeEZcxjBynir6Hz0J/GBns=";
2015-09-18 17:01:01 +00:00
};
2022-10-15 18:36:51 +00:00
nativeBuildInputs = [
makeWrapper
wrapGAppsHook
bison
flex
gdal # for `gdal-config`
geos # for `geos-config`
libmysqlclient # for `mysql_config`
netcdf # for `nc-config`
pkg-config
] ++ (with python3Packages; [ python-dateutil numpy wxpython ]);
2022-10-15 18:36:51 +00:00
buildInputs = [
blas
cairo
ffmpeg
fftw
gdal
geos
libmysqlclient
libpng
libtiff
libxml2
netcdf
pdal
postgresql
proj
readline
sqlite
wxGTK32
zlib
zstd
2022-10-15 18:36:51 +00:00
] ++ lib.optionals stdenv.isDarwin [ libiconv ];
strictDeps = true;
2015-09-18 17:01:01 +00:00
patches = lib.optionals stdenv.isDarwin [
# Fix conversion of const char* to unsigned int.
./clang-integer-conversion.patch
];
2018-03-13 09:04:18 +00:00
2019-11-06 07:26:33 +00:00
# Correct mysql_config query
postPatch = ''
2019-11-06 07:26:33 +00:00
substituteInPlace configure --replace "--libmysqld-libs" "--libs"
'';
2015-09-18 17:01:01 +00:00
configureFlags = [
"--with-blas"
2015-09-18 17:01:01 +00:00
"--with-geos"
# It complains about missing libmysqld but doesn't really seem to need it
2017-12-28 08:58:46 +00:00
"--with-mysql"
2020-09-09 19:17:23 +00:00
"--with-mysql-includes=${lib.getDev libmysqlclient}/include/mysql"
"--with-mysql-libs=${libmysqlclient}/lib/mysql"
"--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"
"--with-pthread"
"--with-readline"
"--without-opengl"
2022-01-26 12:44:26 +00:00
] ++ lib.optionals stdenv.isDarwin [
"--without-cairo"
"--without-freetype"
"--without-x"
2015-09-18 17:01:01 +00:00
];
# Otherwise a very confusing "Can't load GDAL library" error
2021-01-15 13:21:58 +00:00
makeFlags = lib.optional stdenv.isDarwin "GDAL_DYNAMIC=";
2015-09-18 17:01:01 +00:00
/* Ensures that the python script run at build time are actually executable;
* otherwise, patchShebangs ignores them. */
postConfigure = ''
2022-03-22 20:14:36 +00:00
for f in $(find . -name '*.py'); do
chmod +x $f
2015-09-18 17:01:01 +00:00
done
2022-03-22 20:14:36 +00:00
patchShebangs */
2015-09-18 17:01:01 +00:00
'';
postInstall = ''
2022-03-22 20:14:36 +00:00
wrapProgram $out/bin/grass \
2015-09-18 17:01:01 +00:00
--set PYTHONPATH $PYTHONPATH \
--set GRASS_PYTHON ${python3Packages.python.interpreter} \
--suffix LD_LIBRARY_PATH ':' '${gdal}/lib'
2019-07-11 20:12:09 +00:00
ln -s $out/grass*/lib $out/lib
ln -s $out/grass*/include $out/include
2015-09-18 17:01:01 +00:00
'';
enableParallelBuilding = true;
2023-07-02 21:36:36 +00:00
passthru.tests = {
grass = callPackage ./tests.nix { grass = finalAttrs.finalPackage; };
};
meta = with lib; {
2015-09-18 17:01:01 +00:00
description = "GIS software suite used for geospatial data management and analysis, image processing, graphics and maps production, spatial modeling, and visualization";
homepage = "https://grass.osgeo.org/";
license = licenses.gpl2Plus;
maintainers = with maintainers; teams.geospatial.members ++ [ mpickering ];
platforms = platforms.all;
2023-11-27 01:17:53 +00:00
mainProgram = "grass";
2015-09-18 17:01:01 +00:00
};
2023-07-02 21:36:36 +00:00
})