1 { fetchurl, lib, stdenv
2 , cmake, netcdf, openjpeg, libpng, gfortran
3 , enablePython ? false, pythonPackages
4 , enablePosixThreads ? false
5 , enableOpenMPThreads ? false}:
7 stdenv.mkDerivation rec {
12 url = "https://confluence.ecmwf.int/download/attachments/45757960/eccodes-${version}-Source.tar.gz";
13 sha256 = "0576fccng4nvmq5gma1nb1v00if5cwl81w4nv5zkb80q5wicn50c";
17 substituteInPlace cmake/FindOpenJPEG.cmake --replace openjpeg-2.1 ${openjpeg.incDir}
20 nativeBuildInputs = [ cmake ];
22 buildInputs = [ netcdf
27 propagatedBuildInputs = optionals enablePython [
32 cmakeFlags = [ "-DENABLE_PYTHON=${if enablePython then "ON" else "OFF"}"
34 "-DENABLE_ECCODES_THREADS=${if enablePosixThreads then "ON" else "OFF"}"
35 "-DENABLE_ECCODES_OMP_THREADS=${if enableOpenMPThreads then "ON" else "OFF"}"
40 # Only do tests that don't require downloading 120MB of testdata
41 checkPhase = lib.optionalString (stdenv.isDarwin) ''
42 substituteInPlace "tests/include.sh" --replace "set -ea" "set -ea; export DYLD_LIBRARY_PATH=$(pwd)/lib"
44 ctest -R "eccodes_t_(definitions|calendar|unit_tests|md5|uerra|grib_2nd_order_numValues|julian)" -VV
48 homepage = "https://confluence.ecmwf.int/display/ECC/";
49 license = licenses.asl20;
50 maintainers = with maintainers; [ knedlsepp ];
51 platforms = platforms.unix;
52 description = "ECMWF library for reading and writing GRIB, BUFR and GTS abbreviated header";