diff --git a/gnu/local.mk b/gnu/local.mk index a81c6195cf..432c0737dc 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -573,6 +573,8 @@ dist_patch_DATA = \ %D%/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch \ %D%/packages/patches/gtk3-respect-GUIX_GTK3_IM_MODULE_FILE.patch \ %D%/packages/patches/gtkglext-disable-disable-deprecated.patch \ + %D%/packages/patches/hdf4-shared-fortran.patch \ + %D%/packages/patches/hdf4-reproducibility.patch \ %D%/packages/patches/hdf5-config-date.patch \ %D%/packages/patches/hdf-eos5-build-shared.patch \ %D%/packages/patches/hdf-eos5-remove-gctp.patch \ diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index d5e82bb4fa..07934e3114 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -445,6 +445,65 @@ (define-public gctp (home-page "https://github.com/OkoSanto/GCTP") (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html +(define-public hdf4 + (package + (name "hdf4") + (version "4.2.11") + (source + (origin + (method url-fetch) + (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF" + version "/src/hdf-" version ".tar.bz2")) + (sha256 + (base32 "16yr50j845zlfx20skmw3y75ww77akk9gg0affjqkg66ih5r03mv")) + (patches (search-patches "hdf4-reproducibility.patch" + "hdf4-shared-fortran.patch")))) + + (build-system gnu-build-system) + (native-inputs + `(("gfortran" ,gfortran) + ("bison" ,bison) + ("flex" ,flex))) + (inputs + `(("zlib" ,zlib) + ("libjpeg" ,libjpeg))) + (arguments + `(#:parallel-tests? #f + #:configure-flags '("--enable-shared") + #:phases + (modify-phases %standard-phases + (add-before 'configure 'patchbuild + (lambda _ + (substitute* + '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in") + (("/bin/rm") "rm") + (("/bin/mkdir") "mkdir")) + (substitute* (find-files "." "^Makefile\\.in$") + (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \ +-R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "") + (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \ +-R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \ +-R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") ""))))))) + (home-page "https://www.hdfgroup.org/products/hdf4/") + (synopsis + "Library and multi-object file format for storing and managing data") + (description "HDF4 is a library and multi-object file format for storing +and managing data between machines. HDF4 is an older hierarchical data format, +incompatible with HDF5.") + (license + (license:non-copyleft + "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING")))) + +(define-public hdf4-alt + (package + (inherit hdf4) + (name "hdf4-alt") + (arguments + (substitute-keyword-arguments (package-arguments hdf4) + ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags)))) + (synopsis + "HDF4 without netCDF API, can be combined with the regular netCDF library"))) + (define-public hdf5 (package (name "hdf5") diff --git a/gnu/packages/patches/hdf4-reproducibility.patch b/gnu/packages/patches/hdf4-reproducibility.patch new file mode 100644 index 0000000000..9b5fea6269 --- /dev/null +++ b/gnu/packages/patches/hdf4-reproducibility.patch @@ -0,0 +1,35 @@ +Remove/patch unreproducible config data. + +diff --git a/configure b/configure +index eb9f346..ebab94d 100755 +--- a/configure ++++ b/configure +@@ -23163,7 +23163,7 @@ H4_VERSION="`cut -d' ' -f3 $srcdir/README.txt | head -1`" + + + ## Configuration date +- CONFIG_DATE="`date`" ++CONFIG_DATE=`date -u -d "@$SOURCE_DATE_EPOCH"` + + ## User doing the configuration + CONFIG_USER="`whoami`@`hostname`" +diff --git a/libhdf4.settings.in b/libhdf4.settings.in +index 1d9bbb9..4180d72 100644 +--- a/libhdf4.settings.in ++++ b/libhdf4.settings.in +@@ -5,10 +5,10 @@ General Information: + ------------------- + HDF4 Version: @H4_VERSION@ + Configured on: @CONFIG_DATE@ +- Configured by: @CONFIG_USER@ ++ Configured by: guix + Configure mode: @CONFIG_MODE@ +- Host system: @host_cpu@-@host_vendor@-@host_os@ +- Uname information: @UNAME_INFO@ ++ Host system: guix ++ Uname information: guix + Libraries: @STATIC_SHARED@ + Installation point: @prefix@ + +-- +2.10.0 diff --git a/gnu/packages/patches/hdf4-shared-fortran.patch b/gnu/packages/patches/hdf4-shared-fortran.patch new file mode 100644 index 0000000000..60db355bea --- /dev/null +++ b/gnu/packages/patches/hdf4-shared-fortran.patch @@ -0,0 +1,25 @@ +Allow building a shared library with Fortran. +--- + configure | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/configure b/configure +index f37d2fa..eb9f346 100755 +--- a/configure ++++ b/configure +@@ -6141,12 +6141,6 @@ if test "X${enable_shared}" != "Xyes"; then + enable_shared="no" + fi + +-if test "X${enable_shared}" = "Xyes"; then +- if test "X${BUILD_FORTRAN}" = "Xyes"; then +- as_fn_error $? "Cannot build shared fortran libraries. Please configure with --disable-fortran flag." "$LINENO" 5 +- fi +-fi +- + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 + $as_echo_n "checking whether ln -s works... " >&6; } +-- +2.10.0 +