nixpkgs/pkgs/development/libraries/eccodes/default.nix

66 lines
1.7 KiB
Nix
Raw Normal View History

2021-09-23 15:12:39 +02:00
{ fetchurl
, lib
, stdenv
, cmake
, netcdf
, openjpeg
, libpng
, gfortran
, perl
, enablePython ? false
, pythonPackages
2016-02-10 17:09:38 +01:00
, enablePosixThreads ? false
2021-09-23 15:12:39 +02:00
, enableOpenMPThreads ? false
}:
2016-02-10 17:09:38 +01:00
stdenv.mkDerivation rec {
pname = "eccodes";
2021-09-20 15:09:59 +02:00
version = "2.23.0";
2016-02-10 17:09:38 +01:00
src = fetchurl {
url = "https://confluence.ecmwf.int/download/attachments/45757960/eccodes-${version}-Source.tar.gz";
2021-09-20 15:09:59 +02:00
sha256 = "sha256-y9yFMlN+loLxqT3bA0QEFrZpBqTMJd7Dy9c5QNGUvww=";
2016-02-10 17:09:38 +01:00
};
postPatch = ''
substituteInPlace cmake/FindOpenJPEG.cmake --replace openjpeg-2.1 ${openjpeg.incDir}
'';
nativeBuildInputs = [ cmake gfortran perl ];
2016-02-10 17:09:38 +01:00
2021-09-23 15:12:39 +02:00
buildInputs = [
netcdf
openjpeg
libpng
];
2021-09-23 16:37:37 +02:00
propagatedBuildInputs = lib.optionals enablePython [
2021-09-23 15:12:39 +02:00
pythonPackages.python
pythonPackages.numpy
];
2016-02-10 17:09:38 +01:00
2021-09-23 15:12:39 +02:00
cmakeFlags = [
"-DENABLE_PYTHON=${if enablePython then "ON" else "OFF"}"
"-DENABLE_PNG=ON"
"-DENABLE_ECCODES_THREADS=${if enablePosixThreads then "ON" else "OFF"}"
"-DENABLE_ECCODES_OMP_THREADS=${if enableOpenMPThreads then "ON" else "OFF"}"
];
2016-02-10 17:09:38 +01:00
doCheck = true;
# Only do tests that don't require downloading 120MB of testdata
checkPhase = lib.optionalString (stdenv.isDarwin) ''
2016-02-10 17:09:38 +01:00
substituteInPlace "tests/include.sh" --replace "set -ea" "set -ea; export DYLD_LIBRARY_PATH=$(pwd)/lib"
'' + ''
ctest -R "eccodes_t_(definitions|calendar|unit_tests|md5|uerra|grib_2nd_order_numValues|julian)" -VV
'';
2021-09-23 16:37:37 +02:00
meta = with lib; {
homepage = "https://confluence.ecmwf.int/display/ECC/";
2016-02-10 17:09:38 +01:00
license = licenses.asl20;
maintainers = with maintainers; [ knedlsepp ];
platforms = platforms.unix;
description = "ECMWF library for reading and writing GRIB, BUFR and GTS abbreviated header";
};
}