|
| 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 | +}) |
0 commit comments