gnu: hdf4-alt: Disinherit from hdf4.

* gnu/packages/maths.scm (hdf4-alt)[inherit]: Remove field.
[version, source, build-system, native-inputs, inputs, home-page,
synopsis, description, license]: Copy and paste from hdf4.
[arguments]: Adapt from hdf4 without changing the derivation.

Change-Id: I37cb97d7d97ea4426158b6970b98695d4f514332
This commit is contained in:
Andreas Enge 2026-01-11 12:51:19 +01:00
parent 8106900960
commit 7f3f6cfdb7
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3

View file

@ -1751,13 +1751,76 @@ incompatible with HDF5.")
(define-public hdf4-alt
(package
(inherit hdf4)
(name "hdf4-alt")
(version "4.2.16-2")
(source
(origin
(method url-fetch)
(uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
version "/src/hdf-" version ".tar.bz2"))
(sha256
(base32 "0b395czhqr43mmbiifmg2mhb488wnd4zccj45vpql98ja15j7hy5"))
(patches (search-patches "hdf4-reproducibility.patch"
"hdf4-shared-fortran.patch"))))
(build-system gnu-build-system)
(native-inputs
(list gfortran bison flex))
(inputs
`(("zlib" ,zlib)
("libjpeg" ,libjpeg-turbo)
("libtirpc" ,libtirpc)))
(arguments
(substitute-keyword-arguments (package-arguments hdf4)
((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
`(#:parallel-tests? #f
;; Twisted expression to avoid rebuilding when dropping inheritance.
#:configure-flags (cons* "--disable-netcdf"
(list "--enable-shared"
"FCFLAGS=-fallow-argument-mismatch"
"FFLAGS=-fallow-argument-mismatch"
"--enable-hdf4-xdr"))
#:phases
(modify-phases %standard-phases
;; This is inspired by two of Debian's patches.
(add-before 'configure 'add-more-architecture-support
(lambda _
(substitute* '("mfhdf/ncgen/ncgen.l"
"mfhdf/ncgen/ncgenyy.c"
"mfhdf/libsrc/netcdf.h.in")
(("AIX5L64") "__aarch64__ || ( __riscv && __riscv_xlen == 64)"))))
(add-before 'configure 'patchbuild
(lambda _
(substitute*
'("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
(("/bin/rm") "rm")
(("/bin/mkdir") "mkdir"))))
(add-after 'configure 'patch-settings
(lambda _
;; libhdf4.settings contains the full path of the
;; compilers used, and its contents are included in
;; .so-files. We truncate the hashes to avoid
;; unnecessary store references to those compilers:
(substitute* "libhdf4.settings"
(("(/gnu/store/)([0-9A-Za-z]*)" all prefix hash)
(string-append prefix (string-take hash 10) "...")))
#t))
(add-after 'install 'provide-absolute-libjpeg-reference
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(libjpeg (assoc-ref inputs "libjpeg")))
;; libjpeg-turbo does not provide a .la file, so libtool is
;; unable to add an absolute reference for -ljpeg in the .la
;; files. Fix it manually to avoid having to propagate it.
(substitute* (find-files (string-append out "/lib") "\\.la$")
(("-ljpeg")
(string-append "-L" libjpeg "/lib -ljpeg")))))))))
(home-page "https://www.hdfgroup.org/products/hdf4/")
(synopsis
"HDF4 without netCDF API, can be combined with the regular netCDF library")))
"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 hdf5-1.8
(package