nixpkgs/pkgs/development/libraries/netcdf/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

87 lines
2.0 KiB
Nix
Raw Normal View History

{ lib, stdenv
, fetchurl, unzip
2016-05-26 13:27:04 +00:00
, hdf5
, bzip2
, libzip
, zstd
, szipSupport ? false
, szip
, libxml2
2016-05-26 13:27:04 +00:00
, m4
, curl # for DAP
, removeReferencesTo
}:
2016-05-26 13:27:04 +00:00
let
2021-10-03 19:16:35 +00:00
inherit (hdf5) mpiSupport mpi;
2016-05-26 13:27:04 +00:00
in stdenv.mkDerivation rec {
pname = "netcdf" + lib.optionalString mpiSupport "-mpi";
version = "4.9.2";
2018-01-28 16:52:39 +00:00
src = fetchurl {
url = "https://downloads.unidata.ucar.edu/netcdf-c/${version}/netcdf-c-${version}.tar.gz";
hash = "sha256-zxG6u725lj8J9VB54LAZ9tA3H1L44SZKW6jp/asabEg=";
2018-01-28 16:52:39 +00:00
};
2016-05-26 13:27:04 +00:00
2018-08-09 15:26:46 +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
# Prevent building the tests from prepending `#!/bin/bash` and wiping out the patched shenbangs.
substituteInPlace nczarr_test/Makefile.in \
--replace '#!/bin/bash' '${stdenv.shell}'
2018-08-09 15:26:46 +00:00
'';
nativeBuildInputs = [ m4 removeReferencesTo ];
buildInputs = [
curl
hdf5
libxml2
mpi
bzip2
libzip
zstd
] ++ lib.optional szipSupport szip;
2018-01-28 16:52:39 +00:00
passthru = {
2021-10-03 19:16:35 +00:00
inherit mpiSupport mpi;
2018-01-28 16:52:39 +00:00
};
2018-01-28 16:52:39 +00:00
configureFlags = [
"--enable-netcdf-4"
"--enable-dap"
"--enable-shared"
"--disable-dap-remote-tests"
"--with-plugin-dir=${placeholder "out"}/lib/hdf5-plugins"
2018-01-28 16:52:39 +00:00
]
2024-01-18 09:32:02 +00:00
++ (lib.optionals mpiSupport [ "--enable-parallel-tests" "CC=${lib.getDev mpi}/bin/mpicc" ]);
2018-01-28 16:52:39 +00:00
2023-02-27 20:31:37 +00:00
enableParallelBuilding = true;
disallowedReferences = [ stdenv.cc ];
postFixup = ''
remove-references-to -t ${stdenv.cc} "$(readlink -f $out/lib/libnetcdf.settings)"
'';
2023-09-07 01:33:28 +00:00
doCheck = !mpiSupport;
nativeCheckInputs = [ unzip ];
preCheck = ''
export HOME=$TEMP
'';
2018-01-28 16:52:39 +00:00
meta = {
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;
2018-01-28 16:52:39 +00:00
};
2014-11-10 14:54:37 +00:00
}