2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2022-04-27 09:35:20 +00:00
|
|
|
, fetchurl, unzip
|
2020-04-24 23:36:52 +00:00
|
|
|
, hdf5
|
2022-07-14 12:49:19 +00:00
|
|
|
, libxml2
|
2020-04-24 23:36:52 +00:00
|
|
|
, m4
|
|
|
|
, curl # for DAP
|
2020-08-20 17:08:02 +00:00
|
|
|
, removeReferencesTo
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-10-17 09:34:42 +00:00
|
|
|
inherit (hdf5) mpiSupport mpi;
|
2020-04-24 23:36:52 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2022-03-05 16:20:37 +00:00
|
|
|
pname = "netcdf" + lib.optionalString mpiSupport "-mpi";
|
2022-07-14 12:49:19 +00:00
|
|
|
version = "4.9.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2022-04-27 09:35:20 +00:00
|
|
|
url = "https://downloads.unidata.ucar.edu/netcdf-c/${version}/netcdf-c-${version}.tar.gz";
|
2022-07-14 12:49:19 +00:00
|
|
|
hash = "sha256-TJVgIrecCOXhTu6N9RsTwo5hIcK35/qtwhs3WUlAC0k=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs .
|
|
|
|
|
|
|
|
# this test requires the net
|
|
|
|
for a in ncdap_test/Makefile.am ncdap_test/Makefile.in; do
|
|
|
|
substituteInPlace $a --replace testurl.sh " "
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
nativeBuildInputs = [ m4 removeReferencesTo ];
|
2022-07-14 12:49:19 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
curl
|
|
|
|
hdf5
|
|
|
|
libxml2
|
|
|
|
mpi
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
passthru = {
|
2021-10-17 09:34:42 +00:00
|
|
|
inherit mpiSupport mpi;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-netcdf-4"
|
|
|
|
"--enable-dap"
|
|
|
|
"--enable-shared"
|
|
|
|
"--disable-dap-remote-tests"
|
|
|
|
]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ (lib.optionals mpiSupport [ "--enable-parallel-tests" "CC=${mpi}/bin/mpicc" ]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
disallowedReferences = [ stdenv.cc ];
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
remove-references-to -t ${stdenv.cc} "$(readlink -f $out/lib/libnetcdf.settings)"
|
|
|
|
'';
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
doCheck = !(mpiSupport || (stdenv.isDarwin && stdenv.isAarch64));
|
2022-04-27 09:35:20 +00:00
|
|
|
checkInputs = [ unzip ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TEMP
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
2022-07-14 12:49:19 +00:00
|
|
|
description = "Libraries for the Unidata network Common Data Format";
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
homepage = "https://www.unidata.ucar.edu/software/netcdf/";
|
|
|
|
changelog = "https://docs.unidata.ucar.edu/netcdf-c/${version}/RELEASE_NOTES.html";
|
|
|
|
license = lib.licenses.bsd3;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|