gmt: fix build (#343919)

This commit is contained in:
Weijia Wang 2024-11-03 17:24:18 +01:00 committed by GitHub
commit eae1f31968
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 124 additions and 129 deletions

View File

@ -1,112 +0,0 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
curl,
Accelerate,
CoreGraphics,
CoreVideo,
fftwSinglePrec,
netcdf,
libxml2,
pcre,
gdal,
blas,
lapack,
glibc,
ghostscript,
dcw-gmt,
gshhg-gmt,
}:
/*
The onus is on the user to also install:
- ffmpeg for webm or mp4 output
- graphicsmagick for gif output
*/
let
# Certainly not an ideal situation, See:
# https://github.com/NixOS/nixpkgs/pull/340707#issuecomment-2361894717
netcdf' = netcdf.override {
libxml2 = libxml2.override {
enableHttp = true;
};
};
in stdenv.mkDerivation (finalAttrs: {
pname = "gmt";
version = "6.5.0";
src = fetchFromGitHub {
owner = "GenericMappingTools";
repo = "gmt";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-KKIYhljCtk9t9CuvTLsSGvUkUwazWTm9ymBB3wLwSoI=";
};
nativeBuildInputs = [
cmake
];
buildInputs =
[
curl
gdal
netcdf'
pcre
dcw-gmt
gshhg-gmt
]
++ (
if stdenv.hostPlatform.isDarwin then
[
Accelerate
CoreGraphics
CoreVideo
]
else
[
glibc
fftwSinglePrec
blas
lapack
]
);
propagatedBuildInputs = [
ghostscript
];
cmakeFlags =
[
"-DGMT_DOCDIR=share/doc/gmt"
"-DGMT_MANDIR=share/man"
"-DGMT_LIBDIR=lib"
"-DCOPY_GSHHG:BOOL=FALSE"
"-DGSHHG_ROOT=${gshhg-gmt.out}/share/gshhg-gmt"
"-DCOPY_DCW:BOOL=FALSE"
"-DDCW_ROOT=${dcw-gmt.out}/share/dcw-gmt"
"-DGMT_INSTALL_TRADITIONAL_FOLDERNAMES:BOOL=FALSE"
"-DGMT_ENABLE_OPENMP:BOOL=TRUE"
"-DGMT_INSTALL_MODULE_LINKS:BOOL=FALSE"
"-DLICENSE_RESTRICTED=LGPL" # "GPL" and "no" also valid
];
meta = {
homepage = "https://www.generic-mapping-tools.org";
description = "Tools for manipulating geographic and cartesian data sets";
longDescription = ''
GMT is an open-source collection of command-line tools for manipulating
geographic and Cartesian data sets (including filtering, trend fitting,
gridding, projecting, etc.) and producing high-quality illustrations
ranging from simple xy plots via contour maps to artificially illuminated
surfaces and 3D perspective views. It supports many map projections and
transformations and includes supporting data such as coastlines, rivers,
and political boundaries and optionally country polygons.
'';
platforms = lib.platforms.unix;
license = lib.licenses.lgpl3Plus;
maintainers = lib.teams.geospatial.members ++ (with lib.maintainers; [ tviti ]);
};
})

View File

@ -1,10 +1,14 @@
{ lib, stdenv, fetchurl }:
{
lib,
stdenv,
fetchurl,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "dcw-gmt";
version = "2.1.2";
src = fetchurl {
url = "ftp://ftp.soest.hawaii.edu/gmt/dcw-gmt-${version}.tar.gz";
url = "ftp://ftp.soest.hawaii.edu/gmt/dcw-gmt-${finalAttrs.version}.tar.gz";
sha256 = "sha256-S7hA0HXIuj4UrrQc8XwkI2v/eHVmMU+f91irmXd0XZk=";
};
@ -29,4 +33,4 @@ stdenv.mkDerivation rec {
maintainers = lib.teams.geospatial.members ++ (with lib.maintainers; [ tviti ]);
};
}
})

View File

@ -0,0 +1,108 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
curl,
darwin,
fftwSinglePrec,
netcdf,
pcre,
gdal,
blas,
lapack,
ghostscript,
dcw-gmt,
gshhg-gmt,
libxml2,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "gmt";
version = "6.5.0";
src = fetchFromGitHub {
owner = "GenericMappingTools";
repo = "gmt";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-KKIYhljCtk9t9CuvTLsSGvUkUwazWTm9ymBB3wLwSoI=";
};
nativeBuildInputs = [ cmake ];
env = {
NIX_LDFLAGS = "-lxml2 -L${lib.getLib (libxml2.override { enableHttp = true; })}/lib";
NIX_CFLAGS_COMPILE =
lib.optionalString stdenv.cc.isClang "-Wno-implicit-function-declaration "
+ lib.optionalString (
stdenv.isDarwin
&& lib.versionOlder (darwin.apple_sdk.MacOSX-SDK.version or darwin.apple_sdk.sdk.version) "13.3"
) "-D__LAPACK_int=int";
};
buildInputs =
[
curl
gdal
netcdf
pcre
dcw-gmt
gshhg-gmt
]
++ (
if stdenv.isDarwin then
with darwin.apple_sdk.frameworks;
[
Accelerate
CoreGraphics
CoreVideo
]
else
[
fftwSinglePrec
blas
lapack
]
);
propagatedBuildInputs = [ ghostscript ];
cmakeFlags =
[
(lib.cmakeFeature "GMT_DOCDIR" "share/doc/gmt")
(lib.cmakeFeature "GMT_MANDIR" "share/man")
(lib.cmakeFeature "GMT_LIBDIR" "lib")
(lib.cmakeBool "COPY_GSHHG" false)
(lib.cmakeFeature "GSHHG_ROOT" "${gshhg-gmt.out}/share/gshhg-gmt")
(lib.cmakeBool "COPY_DCW" false)
(lib.cmakeFeature "DCW_ROOT" "${dcw-gmt.out}/share/dcw-gmt")
(lib.cmakeFeature "GDAL_ROOT" "${gdal.out}")
(lib.cmakeFeature "NETCDF_ROOT" "${netcdf.out}")
(lib.cmakeFeature "PCRE_ROOT" "${pcre.out}")
(lib.cmakeBool "GMT_INSTALL_TRADITIONAL_FOLDERNAMES" false)
(lib.cmakeBool "GMT_ENABLE_OPENMP" true)
(lib.cmakeBool "GMT_INSTALL_MODULE_LINKS" false)
(lib.cmakeFeature "LICENSE_RESTRICTED" "LGPL")
]
++ (lib.optionals (!stdenv.isDarwin) [
(lib.cmakeFeature "FFTW3_ROOT" "${fftwSinglePrec.dev}")
(lib.cmakeFeature "LAPACK_LIBRARY" "${lib.getLib lapack}/lib/liblapack.so")
(lib.cmakeFeature "BLAS_LIBRARY" "${lib.getLib blas}/lib/libblas.so")
]);
meta = {
homepage = "https://www.generic-mapping-tools.org";
description = "Tools for manipulating geographic and cartesian data sets";
longDescription = ''
GMT is an open-source collection of command-line tools for manipulating
geographic and Cartesian data sets (including filtering, trend fitting,
gridding, projecting, etc.) and producing high-quality illustrations
ranging from simple xy plots via contour maps to artificially illuminated
surfaces and 3D perspective views. It supports many map projections and
transformations and includes supporting data such as coastlines, rivers,
and political boundaries and optionally country polygons.
'';
platforms = lib.platforms.unix;
license = lib.licenses.lgpl3Plus;
maintainers = with lib.maintainers; [ tviti ];
};
})

View File

@ -1,10 +1,14 @@
{ lib, stdenv, fetchurl }:
{
lib,
stdenv,
fetchurl,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "gshhg-gmt";
version = "2.3.7";
src = fetchurl {
url = "ftp://ftp.soest.hawaii.edu/gmt/gshhg-gmt-${version}.tar.gz";
url = "ftp://ftp.soest.hawaii.edu/gmt/gshhg-gmt-${finalAttrs.version}.tar.gz";
sha256 = "9bb1a956fca0718c083bef842e625797535a00ce81f175df08b042c2a92cfe7f";
};
@ -28,4 +32,4 @@ stdenv.mkDerivation rec {
maintainers = lib.teams.geospatial.members ++ (with lib.maintainers; [ tviti ]);
};
}
})

View File

@ -27746,15 +27746,6 @@ with pkgs;
### APPLICATIONS / GIS
gmt = callPackage ../applications/gis/gmt {
inherit (darwin.apple_sdk.frameworks)
Accelerate CoreGraphics CoreVideo;
};
gshhg-gmt = callPackage ../applications/gis/gmt/gshhg.nix { };
dcw-gmt = callPackage ../applications/gis/gmt/dcw.nix { };
grass = callPackage ../applications/gis/grass {
stdenv = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv;
};