2021-09-23 15:35:13 +00:00
|
|
|
{ fetchurl
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
, cmake
|
|
|
|
, netcdf
|
|
|
|
, openjpeg
|
|
|
|
, libpng
|
|
|
|
, gfortran
|
|
|
|
, perl
|
|
|
|
, enablePython ? false
|
|
|
|
, pythonPackages
|
2020-04-24 23:36:52 +00:00
|
|
|
, enablePosixThreads ? false
|
2021-09-23 15:35:13 +00:00
|
|
|
, enableOpenMPThreads ? false
|
|
|
|
}:
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "eccodes";
|
2021-09-23 15:35:13 +00:00
|
|
|
version = "2.23.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://confluence.ecmwf.int/download/attachments/45757960/eccodes-${version}-Source.tar.gz";
|
2021-09-23 15:35:13 +00:00
|
|
|
sha256 = "sha256-y9yFMlN+loLxqT3bA0QEFrZpBqTMJd7Dy9c5QNGUvww=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace cmake/FindOpenJPEG.cmake --replace openjpeg-2.1 ${openjpeg.incDir}
|
|
|
|
'';
|
|
|
|
|
2021-09-26 12:46:18 +00:00
|
|
|
nativeBuildInputs = [ cmake gfortran perl ];
|
2021-09-23 15:35:13 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
netcdf
|
|
|
|
openjpeg
|
|
|
|
libpng
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-23 15:35:13 +00:00
|
|
|
propagatedBuildInputs = lib.optionals enablePython [
|
|
|
|
pythonPackages.python
|
|
|
|
pythonPackages.numpy
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-23 15:35:13 +00: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"}"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
# Only do tests that don't require downloading 120MB of testdata
|
2021-02-05 17:12:51 +00:00
|
|
|
checkPhase = lib.optionalString (stdenv.isDarwin) ''
|
2020-04-24 23:36:52 +00: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 15:35:13 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://confluence.ecmwf.int/display/ECC/";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ knedlsepp ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
description = "ECMWF library for reading and writing GRIB, BUFR and GTS abbreviated header";
|
|
|
|
};
|
|
|
|
}
|