[bug#77590,v2,1/3] gnu: hdf5: Update to 1.14.6.
Commit Message
* gnu/packages/maths.scm (hdf5): Update to 1.14.6. Do not inherit from
hdf5-1.8.
[source]: Switch to git-fetch. Add modules field and snippet. Use different
patch file.
[outputs]: Remove field.
[arguments]<#:phases>: Use gexps. Add 'hide-gfortran, 'make-gen-deterministic,
'generate-flexbison, 'patch-trace-shebang, 'patch-configure.ac,
'fix-fortran-i686-test, 'generate-headers, and 'remove-subfiling-cppflags
phases. Adjust 'patch-configure, 'patch-settings and 'patch-references phases.
Remove 'split phase.
[license]: Adjust URL.
* gnu/packages/patches/hdf5-reproducibility.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
---
gnu/local.mk | 1 +
gnu/packages/maths.scm | 209 +++++++++++++++---
.../patches/hdf5-reproducibility.patch | 20 ++
3 files changed, 197 insertions(+), 33 deletions(-)
create mode 100644 gnu/packages/patches/hdf5-reproducibility.patch
Comments
Hello David,
I only had a very cursory look at your patches; they are not picked up
by QA, did you use "git send-email" for submitting them?
I do not think the hdf5-examples package makes sense if the examples are
not installed as some kind of documentation. What is its goal? We could
either drop it altogether. Or include its phases somehow into the main
hdf5 package so that its tests constitute an additional check phase.
Or also install the examples.
I suppose you wrote the reproducibility patch for hdf(5)-java yourself;
would it make sense to upstream it?
Andreas
Hello,
Andreas Enge <andreas@enge.fr> writes:
> I only had a very cursory look at your patches; they are not picked up
> by QA, did you use "git send-email" for submitting them?
Yes, I sent them as usual.
> I do not think the hdf5-examples package makes sense if the examples are
> not installed as some kind of documentation. What is its goal? We could
> either drop it altogether. Or include its phases somehow into the main
> hdf5 package so that its tests constitute an additional check phase.
> Or also install the examples.
I'm also not sure how useful installing the examples would be, as they
are included in the source already, so I think we should just remove the
package.
> I suppose you wrote the reproducibility patch for hdf(5)-java yourself;
> would it make sense to upstream it?
No, I adapted the previous patch in Guix, which modifies the "configure"
script, to change "configure.ac" instead.
For hdf5-java, I added the 'strip-jar-timestamps phase.
Anyway, I just noticed that upstream removed the Autotools build scripts
(in favor of CMake) last month. :)
I'll change the packages to already use CMake instead.
Best,
David
Am Thu, Apr 10, 2025 at 01:22:19PM +0000 schrieb David Elsing:
> Anyway, I just noticed that upstream removed the Autotools build scripts
> (in favor of CMake) last month. :)
> I'll change the packages to already use CMake instead.
It fails like so:
https://bordeaux.guix.gnu.org/build/fd03d80a-ba7b-4b60-b370-50f63edc2e84/log
starting phase `configure'
source directory: "/tmp/guix-build-hdf5-parallel-openmpi-1.14.6.drv-0/source" (relative from build: "../source")
build directory: "/tmp/guix-build-hdf5-parallel-openmpi-1.14.6.drv-0/build"
running 'cmake' with arguments ("../source" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "-DCMAKE_INSTALL_PREFIX=/gnu/store/fmbv1qibdpvadm83wxkjlwbvab6pv862-hdf5-parallel-openmpi-1.14.6" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE" "-DCMAKE_INSTALL_RPATH=/gnu/store/fmbv1qibdpvadm83wxkjlwbvab6pv862-hdf5-parallel-openmpi-1.14.6/lib" "-DCMAKE_VERBOSE_MAKEFILE=ON" "--enable-parallel" "-DHD5F_ENABLE_THREADSAFE=ON" "-DHDF5_BUILD_CPP_LIB=ON" "-DHDF5_BUILD_DOC=ON" "-DHDF5_BUILD_FORTRAN=ON")
CMake Error: Unknown argument --enable-parallel
CMake Error: Run 'cmake --help' for all supported options.
Andreas
@@ -1575,6 +1575,7 @@ dist_patch_DATA = \
%D%/packages/patches/hdf4-reproducibility.patch \
%D%/packages/patches/hdf4-shared-fortran.patch \
%D%/packages/patches/hdf5-config-date.patch \
+ %D%/packages/patches/hdf5-reproducibility.patch \
%D%/packages/patches/hdf-eos2-build-shared.patch \
%D%/packages/patches/hdf-eos2-remove-gctp.patch \
%D%/packages/patches/hdf-eos2-fortrantests.patch \
@@ -62,7 +62,7 @@
;;; Copyright © 2022 Roman Scherer <roman.scherer@burningswell.com>
;;; Copyright © 2023 Jake Leporte <jakeleporte@outlook.com>
;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
-;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
+;;; Copyright © 2023, 2025 David Elsing <david.elsing@posteo.net>
;;; Copyright © 2024 Herman Rimm <herman@rimm.ee>
;;; Copyright © 2024 Foundation Devices, Inc. <hello@foundation.xyz>
;;; Copyright © 2024, 2025 Artyom V. Poptsov <poptsov.artyom@gmail.com>
@@ -1834,44 +1834,187 @@ (define-public hdf5-1.10
(base32 "14gih7kmjx4h3lc7pg4fwcl28hf1qqkf2x7rljpxqvzkjrqbxi00"))
(patches (search-patches "hdf5-config-date.patch"))))))
-;; When updating this package, please also update hdf-java.
(define-public hdf5
(package
- (inherit hdf5-1.8)
- (version "1.14.3")
+ (name "hdf5")
+ (version "1.14.6")
(source
(origin
- (method url-fetch)
- (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
- "hdf5-" (version-major+minor version)
- "/hdf5-" version "/src/hdf5-"
- version ".tar.bz2")
- (string-append "https://support.hdfgroup.org/ftp/HDF5/"
- "current"
- (apply string-append
- (take (string-split version #\.) 2))
- "/src/hdf5-" version ".tar.bz2")))
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/HDFGroup/hdf5")
+ (commit (string-append "hdf5_" version))))
+ (file-name (git-file-name name version))
(sha256
- (base32 "05zr11y3bivfwrbvzbky1q2gjf6r7n92cvvdnh5jilbmxljg49cl"))
- (patches (search-patches "hdf5-config-date.patch"))))
+ (base32
+ "1f7yv0xra465c3qy8c79fzddib653wzj5dsakb0bs02nwp3xm54q"))
+ (patches (search-patches "hdf5-reproducibility.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ '(for-each
+ delete-file
+ (append
+ (find-files "." "Makefile\\.in$")
+ (find-files "java/lib" "\\.jar$")
+ (list "aclocal.m4"
+ "bin/compile"
+ "bin/config.guess"
+ "bin/config.sub"
+ "bin/depcomp"
+ "bin/install-sh"
+ "bin/ltmain.sh"
+ "bin/missing"
+ "bin/test-driver"
+ "configure"
+ "HDF5Examples/aclocal.m4"
+ "HDF5Examples/compile"
+ "HDF5Examples/configure"
+ "HDF5Examples/depcomp"
+ "HDF5Examples/missing"
+ "HDF5Examples/test-driver"
+ "hl/src/H5LTanalyze.c"
+ "hl/src/H5LTparse.c"
+ "hl/src/H5LTparse.h"
+ "hl/tools/gif2h5/testfiles/ex_image2.h5"
+ "hl/tools/gif2h5/testfiles/h52giftst.h5"
+ "m4/ax_prog_doxygen.m4"
+ "m4/libtool.m4"
+ "m4/lt~obsolete.m4"
+ "m4/ltoptions.m4"
+ "m4/ltsugar.m4"
+ "m4/ltversion.m4"
+ "src/H5config.h.in"
+ "src/H5Edefin.h"
+ "src/H5Einit.h"
+ "src/H5Epubgen.h"
+ "src/H5Eterm.h"
+ "src/H5overflow.h"
+ "src/H5version.h"))))))
+ (build-system gnu-build-system)
+ (inputs
+ (list zlib))
+ (native-inputs
+ (list autoconf-2.71
+ autoconf-archive
+ automake
+ bison
+ flex
+ gfortran
+ libtool
+ ;; Needed to generate some headers and for tests
+ perl
+ which))
(arguments
- (substitute-keyword-arguments (package-arguments hdf5-1.8)
- ((#:phases phases #~%standard-phases)
- #~(modify-phases #$phases
- (add-after 'configure 'skip-version-test
- (lambda _
- ;; Skip test_check_version since the 'patch-settings' phase
- ;; modifies the test reference.
- (substitute* "test/test_check_version.sh.in"
- (("TESTING\\(\\).*" all)
- (string-append all "\nSKIP; exit 0\n")))))
- (add-after 'patch-configure 'patch-configure-build-settings
- (lambda _
- (substitute* "src/H5build_settings.autotools.c.in"
- ;; Don't record the build-time kernel version to make the
- ;; library file reproducible.
- (("@UNAME_INFO@")
- "Linux"))))))))))
+ (list
+ ;; Some of the users, notably Flann, need the C++ interface.
+ #:configure-flags
+ ''("--enable-cxx"
+ "--enable-fortran"
+ "--enable-fortran2003"
+
+ ;; Build a thread-safe library. Unfortunately,
+ ;; 'configure' invites you to either turn off C++,
+ ;; Fortran, and the high-level interface (HL), or
+ ;; to pass '--enable-unsupported'. Debian
+ ;; packagers chose to pass '--enable-unsupported'
+ ;; and we follow their lead here.
+ "--enable-threadsafe"
+ "--with-pthread"
+ "--enable-unsupported")
+ ;; Use -fPIC to allow the R bindings to link with the static libraries
+ #:make-flags ''("CFLAGS=-fPIC" "CXXFLAGS=-fPIC")
+ #:phases
+ #~(modify-phases %standard-phases
+ ;; XXX: src/H5private.h includes <fenv.h> and fails to find the
+ ;; stdlib types when the gfortran header is used. Remove gfortran
+ ;; from CPLUS_INCLUDE_PATH as a workaround.
+ (add-after 'set-paths 'hide-gfortran
+ (lambda _
+ (let ((gfortran #$(this-package-native-input "gfortran")))
+ (setenv "CPLUS_INCLUDE_PATH"
+ (string-join
+ (delete (string-append gfortran "/include/c++")
+ (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
+ ":")))))
+ (add-after 'unpack 'make-gen-deterministic
+ (lambda _
+ (substitute* "bin/make_err"
+ (("keys %major" all)
+ (string-append "sort " all))
+ (("while.*each \\(%section\\).*")
+ (string-append
+ "foreach $sect_name (sort keys %section) {\n"
+ " $sect_desc = $section{$sect_name};\n")))))
+ (add-after 'unpack 'generate-flexbison
+ (lambda _
+ (invoke "bash" "bin/genparser" "hl/src")))
+ (add-after 'unpack 'patch-trace-shebang
+ (lambda _
+ (for-each patch-shebang
+ (find-files "bin" (lambda (file stat)
+ (executable-file? file))))))
+ ;; Fixes build on i686, see
+ ;; https://github.com/HDFGroup/hdf5/commit/0af668f4091f1c35f621d2acdeadd34db6756976
+ (add-after 'unpack 'patch-configure.ac
+ (lambda _
+ (substitute* "configure.ac"
+ (("AC_DEFINE.*HAVE_FLOAT128.*" orig)
+ (string-append orig "\nAC_CHECK_SIZEOF([__float128])\n")))))
+ ;; This is a known issue on i686, see
+ ;; https://github.com/HDFGroup/hdf5/issues/4926
+ (add-after 'unpack 'fix-fortran-i686-test
+ (lambda _
+ (substitute* "fortran/test/tH5R.F90"
+ (((string-append
+ "CALL h5rget_obj_name_f\\(C_LOC\\(ref_ptr\\(2\\)\\),"
+ " \"\", error, name_len=buf_size \\)"))
+ (string-append
+ "CALL h5rget_obj_name_f(C_LOC(ref_ptr(2)),"
+ " \"xxxxxxxxxxxxxx\", error, name_len=buf_size)")))))
+ (add-before 'configure 'patch-configure
+ (lambda _
+ (substitute* "configure"
+ (("/bin/mv") "mv"))))
+ (add-after 'configure 'patch-settings
+ (lambda _
+ ;; libhdf5.settings contains the full path of the compilers
+ ;; used, and its contents are included in libhdf5.so. We
+ ;; truncate the hashes to avoid unnecessary store references to
+ ;; those compilers:
+ (substitute* '("src/H5build_settings.c"
+ "src/libhdf5.settings")
+ (("(/gnu/store/)([a-zA-Z0-9]*)" all prefix hash)
+ (string-append prefix (string-take hash 10) "..."))
+ ;; Don't record the build-time kernel version to make the
+ ;; settings file reproducible.
+ (("Uname information:[^\"\n\\\\]*")
+ "Uname information: Linux"))))
+ (add-after 'configure 'generate-headers
+ (lambda _
+ (invoke "perl" "bin/make_err" "src/H5err.txt")
+ (invoke "perl" "bin/make_vers" "src/H5vers.txt")
+ (invoke "perl" "bin/make_overflow" "src/H5overflow.txt")))
+ ;; Remove include flag to directory in source tree
+ (add-after 'configure 'remove-subfiling-cppflags
+ (lambda _
+ (substitute* '("src/H5build_settings.c"
+ "src/libhdf5.settings"
+ "bin/h5cc"
+ "c++/src/h5c++")
+ (("-I.*/src/H5FDsubfiling") ""))))
+ (add-after 'install 'patch-references
+ (lambda _
+ (let ((bin (string-append #$output "/bin"))
+ (zlib #$(this-package-input "zlib")))
+ (substitute* (find-files bin "h5p?cc")
+ (("-lz" lib)
+ (string-append "-L" zlib "/lib " lib)))))))))
+ (home-page "https://www.hdfgroup.org")
+ (synopsis "Management suite for extremely large and complex data")
+ (description "HDF5 is a suite that makes possible the management of
+extremely large and complex data collections.")
+ (license (license:x11-style
+ "https://support.hdfgroup.org/ftp/HDF5/releases/COPYING.html"))))
;; Keep this in sync with the current hdf5 package.
(define-public hdf-java
new file mode 100644
@@ -0,0 +1,20 @@
+Honor SOURCE_DATE_EPOCH when exporting configuration date.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -3566,7 +3566,14 @@
+ AC_SUBST([H5_VERSION])
+
+ ## Configuration date
+-AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date`"
++AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date -u`"
++if test -n "$SOURCE_DATE_EPOCH"; then
++ CONFIG_DATE=`date -u -d "@$SOURCE_DATE_EPOCH" 2>/dev/null \
++ || date -u -r "$SOURCE_DATE_EPOCH" 2>/dev/null`
++ if test -z "$CONFIG_DATE"; then
++ as_fn_error $? "malformed SOURCE_DATE_EPOCH" "$LINENO" 5
++ fi
++fi
+
+ ## User doing the configuration
+ AC_SUBST([CONFIG_USER]) CONFIG_USER="`whoami`@`hostname`"