Skip to content

Commit eae1f31

Browse files
authored
gmt: fix build (NixOS#343919)
2 parents 05d71c7 + fafffdd commit eae1f31

File tree

5 files changed

+124
-129
lines changed

5 files changed

+124
-129
lines changed

pkgs/applications/gis/gmt/default.nix

Lines changed: 0 additions & 112 deletions
This file was deleted.
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
{ lib, stdenv, fetchurl }:
1+
{
2+
lib,
3+
stdenv,
4+
fetchurl,
5+
}:
26

3-
stdenv.mkDerivation rec {
7+
stdenv.mkDerivation (finalAttrs: {
48
pname = "dcw-gmt";
59
version = "2.1.2";
610
src = fetchurl {
7-
url = "ftp://ftp.soest.hawaii.edu/gmt/dcw-gmt-${version}.tar.gz";
11+
url = "ftp://ftp.soest.hawaii.edu/gmt/dcw-gmt-${finalAttrs.version}.tar.gz";
812
sha256 = "sha256-S7hA0HXIuj4UrrQc8XwkI2v/eHVmMU+f91irmXd0XZk=";
913
};
1014

@@ -29,4 +33,4 @@ stdenv.mkDerivation rec {
2933
maintainers = lib.teams.geospatial.members ++ (with lib.maintainers; [ tviti ]);
3034
};
3135

32-
}
36+
})

pkgs/by-name/gm/gmt/package.nix

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
cmake,
6+
curl,
7+
darwin,
8+
fftwSinglePrec,
9+
netcdf,
10+
pcre,
11+
gdal,
12+
blas,
13+
lapack,
14+
ghostscript,
15+
dcw-gmt,
16+
gshhg-gmt,
17+
libxml2,
18+
}:
19+
stdenv.mkDerivation (finalAttrs: {
20+
pname = "gmt";
21+
version = "6.5.0";
22+
23+
src = fetchFromGitHub {
24+
owner = "GenericMappingTools";
25+
repo = "gmt";
26+
rev = "refs/tags/${finalAttrs.version}";
27+
hash = "sha256-KKIYhljCtk9t9CuvTLsSGvUkUwazWTm9ymBB3wLwSoI=";
28+
};
29+
30+
nativeBuildInputs = [ cmake ];
31+
32+
env = {
33+
NIX_LDFLAGS = "-lxml2 -L${lib.getLib (libxml2.override { enableHttp = true; })}/lib";
34+
NIX_CFLAGS_COMPILE =
35+
lib.optionalString stdenv.cc.isClang "-Wno-implicit-function-declaration "
36+
+ lib.optionalString (
37+
stdenv.isDarwin
38+
&& lib.versionOlder (darwin.apple_sdk.MacOSX-SDK.version or darwin.apple_sdk.sdk.version) "13.3"
39+
) "-D__LAPACK_int=int";
40+
};
41+
42+
buildInputs =
43+
[
44+
curl
45+
gdal
46+
netcdf
47+
pcre
48+
dcw-gmt
49+
gshhg-gmt
50+
]
51+
++ (
52+
if stdenv.isDarwin then
53+
with darwin.apple_sdk.frameworks;
54+
[
55+
Accelerate
56+
CoreGraphics
57+
CoreVideo
58+
]
59+
else
60+
[
61+
fftwSinglePrec
62+
blas
63+
lapack
64+
]
65+
);
66+
67+
propagatedBuildInputs = [ ghostscript ];
68+
69+
cmakeFlags =
70+
[
71+
(lib.cmakeFeature "GMT_DOCDIR" "share/doc/gmt")
72+
(lib.cmakeFeature "GMT_MANDIR" "share/man")
73+
(lib.cmakeFeature "GMT_LIBDIR" "lib")
74+
(lib.cmakeBool "COPY_GSHHG" false)
75+
(lib.cmakeFeature "GSHHG_ROOT" "${gshhg-gmt.out}/share/gshhg-gmt")
76+
(lib.cmakeBool "COPY_DCW" false)
77+
(lib.cmakeFeature "DCW_ROOT" "${dcw-gmt.out}/share/dcw-gmt")
78+
(lib.cmakeFeature "GDAL_ROOT" "${gdal.out}")
79+
(lib.cmakeFeature "NETCDF_ROOT" "${netcdf.out}")
80+
(lib.cmakeFeature "PCRE_ROOT" "${pcre.out}")
81+
(lib.cmakeBool "GMT_INSTALL_TRADITIONAL_FOLDERNAMES" false)
82+
(lib.cmakeBool "GMT_ENABLE_OPENMP" true)
83+
(lib.cmakeBool "GMT_INSTALL_MODULE_LINKS" false)
84+
(lib.cmakeFeature "LICENSE_RESTRICTED" "LGPL")
85+
]
86+
++ (lib.optionals (!stdenv.isDarwin) [
87+
(lib.cmakeFeature "FFTW3_ROOT" "${fftwSinglePrec.dev}")
88+
(lib.cmakeFeature "LAPACK_LIBRARY" "${lib.getLib lapack}/lib/liblapack.so")
89+
(lib.cmakeFeature "BLAS_LIBRARY" "${lib.getLib blas}/lib/libblas.so")
90+
]);
91+
92+
meta = {
93+
homepage = "https://www.generic-mapping-tools.org";
94+
description = "Tools for manipulating geographic and cartesian data sets";
95+
longDescription = ''
96+
GMT is an open-source collection of command-line tools for manipulating
97+
geographic and Cartesian data sets (including filtering, trend fitting,
98+
gridding, projecting, etc.) and producing high-quality illustrations
99+
ranging from simple x–y plots via contour maps to artificially illuminated
100+
surfaces and 3D perspective views. It supports many map projections and
101+
transformations and includes supporting data such as coastlines, rivers,
102+
and political boundaries and optionally country polygons.
103+
'';
104+
platforms = lib.platforms.unix;
105+
license = lib.licenses.lgpl3Plus;
106+
maintainers = with lib.maintainers; [ tviti ];
107+
};
108+
})
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
{ lib, stdenv, fetchurl }:
1+
{
2+
lib,
3+
stdenv,
4+
fetchurl,
5+
}:
26

3-
stdenv.mkDerivation rec {
7+
stdenv.mkDerivation (finalAttrs: {
48
pname = "gshhg-gmt";
59
version = "2.3.7";
610
src = fetchurl {
7-
url = "ftp://ftp.soest.hawaii.edu/gmt/gshhg-gmt-${version}.tar.gz";
11+
url = "ftp://ftp.soest.hawaii.edu/gmt/gshhg-gmt-${finalAttrs.version}.tar.gz";
812
sha256 = "9bb1a956fca0718c083bef842e625797535a00ce81f175df08b042c2a92cfe7f";
913
};
1014

@@ -28,4 +32,4 @@ stdenv.mkDerivation rec {
2832
maintainers = lib.teams.geospatial.members ++ (with lib.maintainers; [ tviti ]);
2933
};
3034

31-
}
35+
})

pkgs/top-level/all-packages.nix

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27746,15 +27746,6 @@ with pkgs;
2774627746

2774727747
### APPLICATIONS / GIS
2774827748

27749-
gmt = callPackage ../applications/gis/gmt {
27750-
inherit (darwin.apple_sdk.frameworks)
27751-
Accelerate CoreGraphics CoreVideo;
27752-
};
27753-
27754-
gshhg-gmt = callPackage ../applications/gis/gmt/gshhg.nix { };
27755-
27756-
dcw-gmt = callPackage ../applications/gis/gmt/dcw.nix { };
27757-
2775827749
grass = callPackage ../applications/gis/grass {
2775927750
stdenv = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv;
2776027751
};

0 commit comments

Comments
 (0)