2021-09-23 14:12:39 +01:00
|
|
|
{ fetchurl
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
, cmake
|
|
|
|
, netcdf
|
|
|
|
, openjpeg
|
|
|
|
, libpng
|
|
|
|
, gfortran
|
|
|
|
, perl
|
|
|
|
, enablePython ? false
|
|
|
|
, pythonPackages
|
2016-02-10 16:09:38 +00:00
|
|
|
, enablePosixThreads ? false
|
2021-09-23 14:12:39 +01:00
|
|
|
, enableOpenMPThreads ? false
|
|
|
|
}:
|
|
|
|
|
2016-02-10 16:09:38 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "eccodes";
|
2021-12-21 10:07:42 +00:00
|
|
|
version = "2.24.0";
|
2016-02-10 16:09:38 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-10-12 16:47:44 +01:00
|
|
|
url = "https://confluence.ecmwf.int/download/attachments/45757960/eccodes-${version}-Source.tar.gz";
|
2021-12-21 10:07:42 +00:00
|
|
|
sha256 = "sha256-MHrit59KfTF4mCS8od8UEvYMrWj0m/xJu8HUeA8+W5Y=";
|
2016-02-10 16:09:38 +00:00
|
|
|
};
|
|
|
|
|
2018-10-25 18:44:19 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace cmake/FindOpenJPEG.cmake --replace openjpeg-2.1 ${openjpeg.incDir}
|
|
|
|
'';
|
|
|
|
|
2021-09-24 02:43:00 +01:00
|
|
|
nativeBuildInputs = [ cmake gfortran perl ];
|
2016-02-10 16:09:38 +00:00
|
|
|
|
2021-09-23 14:12:39 +01:00
|
|
|
buildInputs = [
|
|
|
|
netcdf
|
|
|
|
openjpeg
|
|
|
|
libpng
|
|
|
|
];
|
2021-09-03 12:33:32 +01:00
|
|
|
|
2021-09-23 15:37:37 +01:00
|
|
|
propagatedBuildInputs = lib.optionals enablePython [
|
2021-09-23 14:12:39 +01:00
|
|
|
pythonPackages.python
|
|
|
|
pythonPackages.numpy
|
|
|
|
];
|
2016-02-10 16:09:38 +00:00
|
|
|
|
2021-09-23 14:12:39 +01: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 16:09:38 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
# Only do tests that don't require downloading 120MB of testdata
|
2021-01-21 17:00:13 +00:00
|
|
|
checkPhase = lib.optionalString (stdenv.isDarwin) ''
|
2016-02-10 16:09:38 +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:37:37 +01:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://confluence.ecmwf.int/display/ECC/";
|
2016-02-10 16:09:38 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ knedlsepp ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
description = "ECMWF library for reading and writing GRIB, BUFR and GTS abbreviated header";
|
|
|
|
};
|
|
|
|
}
|