2021-01-21 17:00:13 +00:00
|
|
|
{ fetchurl, fetchpatch, lib, stdenv,
|
2019-11-17 18:48:55 +00:00
|
|
|
cmake, netcdf, gfortran, libpng, openjpeg,
|
2021-03-25 14:57:11 +00:00
|
|
|
enablePython ? false, pythonPackages ? null }:
|
2015-12-18 15:16:39 +00:00
|
|
|
|
2020-06-07 22:11:08 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "grib-api";
|
2018-12-16 01:45:32 +00:00
|
|
|
version = "1.28.0";
|
2015-12-18 15:16:39 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-12-15 19:44:02 +00:00
|
|
|
url = "https://software.ecmwf.int/wiki/download/attachments/3473437/grib_api-${version}-Source.tar.gz";
|
2018-12-16 01:45:32 +00:00
|
|
|
sha256 = "0qbj12ap7yy2rl1pq629chnss2jl73wxdj1lwzv0xp87r6z5qdfl";
|
2015-12-18 15:16:39 +00:00
|
|
|
};
|
|
|
|
|
2019-11-17 18:48:55 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://salsa.debian.org/science-team/grib-api/raw/debian/1.28.0-2/debian/patches/openjpeg2.patch";
|
|
|
|
sha256 = "05faxh51vlidiazxq1ssd3k4cjivk1adyn30k94mxqa1xnb2r2pc";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2016-12-15 19:44:02 +00:00
|
|
|
preConfigure = ''
|
|
|
|
# Fix "no member named 'inmem_' in 'jas_image_t'"
|
|
|
|
substituteInPlace "src/grib_jasper_encoding.c" --replace "image.inmem_ = 1;" ""
|
|
|
|
'';
|
|
|
|
|
2020-12-31 07:48:55 +00:00
|
|
|
nativeBuildInputs = [ cmake gfortran ];
|
|
|
|
buildInputs = [ netcdf
|
2016-12-15 19:44:02 +00:00
|
|
|
libpng
|
2019-11-17 18:48:55 +00:00
|
|
|
openjpeg
|
2021-01-21 17:00:13 +00:00
|
|
|
] ++ lib.optionals enablePython [
|
2016-12-15 19:44:02 +00:00
|
|
|
pythonPackages.python
|
2015-12-18 15:16:39 +00:00
|
|
|
];
|
2016-12-15 19:44:02 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
propagatedBuildInputs = lib.optionals enablePython [
|
2017-05-22 14:08:20 +01:00
|
|
|
pythonPackages.numpy
|
|
|
|
];
|
|
|
|
|
2016-12-15 19:44:02 +00:00
|
|
|
cmakeFlags = [ "-DENABLE_PYTHON=${if enablePython then "ON" else "OFF"}"
|
|
|
|
"-DENABLE_PNG=ON"
|
|
|
|
"-DENABLE_FORTRAN=ON"
|
2019-11-17 18:48:55 +00:00
|
|
|
"-DOPENJPEG_INCLUDE_DIR=${openjpeg.dev}/include/${openjpeg.incDir}"
|
2016-12-15 19:44:02 +00:00
|
|
|
];
|
|
|
|
|
2015-12-18 15:16:39 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2016-12-15 19:44:02 +00:00
|
|
|
# Only do tests that don't require downloading 120MB of testdata
|
|
|
|
# We fix the darwin checkPhase, which searches for libgrib_api.dylib
|
|
|
|
# in /nix/store by setting DYLD_LIBRARY_PATH
|
2021-01-21 17:00:13 +00:00
|
|
|
checkPhase = lib.optionalString (stdenv.isDarwin) ''
|
2016-12-15 19:44:02 +00:00
|
|
|
substituteInPlace "tests/include.sh" --replace "set -ea" "set -ea; export DYLD_LIBRARY_PATH=$(pwd)/lib"
|
|
|
|
'' + ''
|
|
|
|
ctest -R "t_definitions|t_calendar|t_unit_tests" -VV
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://software.ecmwf.int/wiki/display/GRIB/Home";
|
2015-12-18 15:16:39 +00:00
|
|
|
license = licenses.asl20;
|
2016-12-15 19:44:02 +00:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2019-11-17 18:48:55 +00:00
|
|
|
description = "ECMWF Library for the GRIB file format -- DEPRECATED";
|
2015-12-18 15:16:39 +00:00
|
|
|
longDescription = ''
|
|
|
|
The ECMWF GRIB API is an application program interface accessible from C,
|
|
|
|
FORTRAN and Python programs developed for encoding and decoding WMO FM-92
|
|
|
|
GRIB edition 1 and edition 2 messages.
|
2019-11-17 18:48:55 +00:00
|
|
|
|
|
|
|
Please note: GRIB-API support is being discontinued at the end of 2018.
|
|
|
|
After which there will be no further releases. Please upgrade to ecCodes
|
2015-12-18 15:16:39 +00:00
|
|
|
'';
|
2016-12-15 19:44:02 +00:00
|
|
|
maintainers = with maintainers; [ knedlsepp ];
|
2015-12-18 15:16:39 +00:00
|
|
|
};
|
|
|
|
}
|