Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ fetchurl 2, lib 3, stdenv 4, cmake 5, netcdf 6, openjpeg 7, libaec 8, libpng 9, gfortran 10, perl 11, enablePython ? false 12, pythonPackages 13, enablePosixThreads ? false 14, enableOpenMPThreads ? false 15}: 16 17stdenv.mkDerivation rec { 18 pname = "eccodes"; 19 version = "2.30.0"; 20 21 src = fetchurl { 22 url = "https://confluence.ecmwf.int/download/attachments/45757960/eccodes-${version}-Source.tar.gz"; 23 sha256 = "sha256-s9yTidBYQaLpyVeqUgmIpUwmBRY95kt+c8CEqu0fw8Q="; 24 }; 25 26 postPatch = '' 27 substituteInPlace cmake/FindOpenJPEG.cmake --replace openjpeg-2.1 ${openjpeg.incDir} 28 29 # https://github.com/ecmwf/ecbuild/issues/40 30 substituteInPlace cmake/ecbuild_config.h.in \ 31 --replace @CMAKE_INSTALL_PREFIX@/@INSTALL_LIB_DIR@ @eccodes_FULL_INSTALL_LIB_DIR@ \ 32 --replace @CMAKE_INSTALL_PREFIX@/@INSTALL_BIN_DIR@ @eccodes_FULL_INSTALL_BIN_DIR@ 33 substituteInPlace cmake/pkg-config.pc.in \ 34 --replace '$'{prefix}/@INSTALL_LIB_DIR@ @eccodes_FULL_INSTALL_LIB_DIR@ \ 35 --replace '$'{prefix}/@INSTALL_INCLUDE_DIR@ @eccodes_FULL_INSTALL_INCLUDE_DIR@ \ 36 --replace '$'{prefix}/@INSTALL_BIN_DIR@ @eccodes_FULL_INSTALL_BIN_DIR@ 37 substituteInPlace cmake/ecbuild_install_project.cmake \ 38 --replace '$'{CMAKE_INSTALL_PREFIX}/'$'{INSTALL_INCLUDE_DIR} '$'{'$'{PROJECT_NAME}_FULL_INSTALL_INCLUDE_DIR} 39 ''; 40 41 nativeBuildInputs = [ cmake gfortran perl ]; 42 43 buildInputs = [ 44 netcdf 45 openjpeg 46 libaec 47 libpng 48 ]; 49 50 propagatedBuildInputs = lib.optionals enablePython [ 51 pythonPackages.python 52 pythonPackages.numpy 53 ]; 54 55 cmakeFlags = [ 56 "-DENABLE_PYTHON=${if enablePython then "ON" else "OFF"}" 57 "-DENABLE_PNG=ON" 58 "-DENABLE_ECCODES_THREADS=${if enablePosixThreads then "ON" else "OFF"}" 59 "-DENABLE_ECCODES_OMP_THREADS=${if enableOpenMPThreads then "ON" else "OFF"}" 60 ]; 61 62 doCheck = true; 63 64 # Only do tests that don't require downloading 120MB of testdata 65 checkPhase = '' 66 ctest -R "eccodes_t_(definitions|calendar|unit_tests|md5|uerra|grib_2nd_order_numValues|julian)" -VV 67 ''; 68 69 meta = with lib; { 70 homepage = "https://confluence.ecmwf.int/display/ECC/"; 71 license = licenses.asl20; 72 maintainers = with maintainers; [ knedlsepp ]; 73 platforms = platforms.unix; 74 description = "ECMWF library for reading and writing GRIB, BUFR and GTS abbreviated header"; 75 }; 76}