2016-12-15 19:44:02 +00:00
|
|
|
{ fetchurl, stdenv,
|
|
|
|
cmake, netcdf, gfortran, jasper, libpng,
|
|
|
|
enablePython ? false, pythonPackages }:
|
2015-12-18 15:16:39 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec{
|
|
|
|
name = "grib-api-${version}";
|
2018-04-24 21:23:53 +01:00
|
|
|
version = "1.26.1";
|
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-04-24 21:23:53 +01:00
|
|
|
sha256 = "1v1apx9421m8zkjmych5yr66mvqjrrygc98bvyl4miasmsb4ndfs";
|
2015-12-18 15:16:39 +00:00
|
|
|
};
|
|
|
|
|
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;" ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ cmake
|
|
|
|
netcdf
|
|
|
|
gfortran
|
2015-12-18 15:16:39 +00:00
|
|
|
jasper
|
2016-12-15 19:44:02 +00:00
|
|
|
libpng
|
|
|
|
] ++ stdenv.lib.optionals enablePython [
|
|
|
|
pythonPackages.python
|
2015-12-18 15:16:39 +00:00
|
|
|
];
|
2016-12-15 19:44:02 +00:00
|
|
|
|
2017-05-22 14:08:20 +01:00
|
|
|
propagatedBuildInputs = stdenv.lib.optionals enablePython [
|
|
|
|
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"
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
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
|
|
|
|
checkPhase = stdenv.lib.optionalString (stdenv.isDarwin) ''
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
2015-12-18 15:16:39 +00:00
|
|
|
meta = with stdenv.lib; {
|
2017-08-01 21:03:30 +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;
|
2015-12-18 15:16:39 +00:00
|
|
|
description = "ECMWF Library for the GRIB file format";
|
|
|
|
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.
|
|
|
|
'';
|
2016-12-15 19:44:02 +00:00
|
|
|
maintainers = with maintainers; [ knedlsepp ];
|
2015-12-18 15:16:39 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|