1{ stdenv, fetchurl, lib
2, hdf5, libpng, libjpeg
3, hdf4 ? null
4, libmatheval ? null
5}:
6
7stdenv.mkDerivation rec {
8 version = "1.13.2";
9 pname = "h5utils";
10
11 # fetchurl is used instead of fetchFromGitHub because the git repo version requires
12 # additional tools to build compared to the tarball release; see the README for details.
13 src = fetchurl {
14 url = "https://github.com/stevengj/h5utils/releases/download/${version}/h5utils-${version}.tar.gz";
15 sha256 = "sha256-7qeFWoI1+st8RU5hEDCY5VZY2g3fS23luCqZLl8CQ1E=";
16 };
17
18 # libdf is an alternative name for libhdf (hdf4)
19 preConfigure = lib.optionalString (hdf4 != null)
20 ''
21 substituteInPlace configure \
22 --replace "-ldf" "-lhdf" \
23 '';
24
25 preBuild = lib.optionalString hdf5.mpiSupport "export CC=${hdf5.mpi}/bin/mpicc";
26
27 buildInputs = with lib; [ hdf5 libjpeg libpng ] ++ optional hdf5.mpiSupport hdf5.mpi
28 ++ optional (hdf4 != null) hdf4
29 ++ optional (libmatheval != null) libmatheval;
30
31 meta = with lib; {
32 description = "A set of utilities for visualization and conversion of scientific data in the free, portable HDF5 format";
33 homepage = "https://github.com/stevengj/h5utils";
34 changelog = "https://github.com/NanoComp/h5utils/releases/tag/${version}";
35 license = with licenses; [ mit gpl2 ];
36 maintainers = with maintainers; [ sfrijters ];
37 };
38
39}