From: Thomas Danckaert <post@thomasdanckaert.be>
To: 28214@debbugs.gnu.org
Subject: [bug#28214] [PATCH] gnu: hdf5: Add output for Fortran interface.
Date: Thu, 24 Aug 2017 11:53:09 +0200 (CEST) [thread overview]
Message-ID: <20170824.115309.1248640013266066348.post@thomasdanckaert.be> (raw)
[-- Attachment #1: Type: Text/Plain, Size: 196 bytes --]
Hi Guix,
this patch adds the Fortran interface as a separate output to the
hdf5 package.
It also considerably reduces the footprint of the hdf5 package, by
removing references to gcc.
Thomas
[-- Attachment #2: 0001-gnu-hdf5-Add-output-for-fortran-interface.patch --]
[-- Type: Text/X-Patch, Size: 5372 bytes --]
From ea5b67230713bf79d625743eb18f57bf36d40407 Mon Sep 17 00:00:00 2001
From: Thomas Danckaert <post@thomasdanckaert.be>
Date: Thu, 24 Aug 2017 11:00:59 +0200
Subject: [PATCH] gnu: hdf5: Add output for fortran interface.
* gnu/packages/maths.scm (hdf5) [native-inputs]: Add gfortran.
[outputs]: Add "fortran".
[arguments]: Enable Fortran compilation; add "/lib" directory of the fortran
output to the runpath of the Fortran libs; patch "libhdf5.settings" to
remove references to the C/C++/Fortran compilers; add a 'split phase to move
all Fortran-related files to the the Fortran output store location.
---
gnu/packages/maths.scm | 67 +++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 64 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index d1651e5a7..5306daa14 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -648,16 +648,44 @@ incompatible with HDF5.")
(build-system gnu-build-system)
(inputs
`(("zlib" ,zlib)))
+ (native-inputs
+ `(("gfortran" ,gfortran)))
+ (outputs '("out" ; core library
+ "fortran")) ; fortran interface
(arguments
`(;; Some of the users, notably Flann, need the C++ interface.
- #:configure-flags '("--enable-cxx")
+ #:configure-flags '("--enable-cxx"
+ "--enable-fortran"
+ "--enable-fortran2003")
#:phases
(modify-phases %standard-phases
(add-before 'configure 'patch-configure
- (lambda _
+ (lambda* (#:key outputs #:allow-other-keys)
(substitute* "configure"
(("/bin/mv") "mv"))
+ (substitute* "fortran/src/Makefile.in"
+ (("libhdf5_fortran_la_LDFLAGS =")
+ (string-append "libhdf5_fortran_la_LDFLAGS = -Wl-rpath="
+ (assoc-ref outputs "fortran") "/lib")))
+ (substitute* "hl/fortran/src/Makefile.in"
+ (("libhdf5hl_fortran_la_LDFLAGS =")
+ (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
+ (assoc-ref outputs "fortran") "/lib")))
+ #t))
+ (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/libhdf5.settings"
+ (("(Fortran Compiler: /gnu/store/)([a-Z0-9]*)" all prefix hash)
+ (string-append prefix (string-take hash 10) "..."))
+ (("(C Compiler: /gnu/store/)([a-Z0-9]*)" all prefix hash)
+ (string-append prefix (string-take hash 10) "..."))
+ (("(C\\+\\+ Compiler: /gnu/store/)([a-Z0-9]*)" all prefix hash)
+ (string-append prefix (string-take hash 10) "...")))
#t))
(add-after 'install 'patch-references
(lambda* (#:key inputs outputs #:allow-other-keys)
@@ -666,7 +694,40 @@ incompatible with HDF5.")
(substitute* (find-files bin "h5p?cc")
(("-lz" lib)
(string-append "-L" zlib "/lib " lib)))
- #t))))))
+ #t)))
+ (add-after 'install 'split
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ ;; Move all fortran-related files
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin"))
+ (lib (string-append out "/lib"))
+ (inc (string-append out "/include"))
+ (ex (string-append out "/share/hdf5_examples/fortran"))
+ (fort (assoc-ref outputs "fortran"))
+ (fbin (string-append fort "/bin"))
+ (flib (string-append fort "/lib"))
+ (finc (string-append fort "/include"))
+ (fex (string-append fort "/share/hdf5_examples/fortran")))
+ (mkdir-p fbin)
+ (mkdir-p flib)
+ (mkdir-p finc)
+ (mkdir-p fex)
+ (rename-file (string-append bin "/h5fc")
+ (string-append fbin "/h5fc"))
+ (for-each (lambda (file)
+ (rename-file file
+ (string-append flib "/" (basename file))))
+ (find-files lib ".*fortran.*"))
+ (for-each (lambda (file)
+ (rename-file file
+ (string-append finc "/" (basename file))))
+ (find-files inc ".*mod"))
+ (for-each (lambda (file)
+ (rename-file file
+ (string-append fex "/" (basename file))))
+ (find-files ex ".*"))
+ (delete-file-recursively ex))
+ #t)))))
(home-page "http://www.hdfgroup.org")
(synopsis "Management suite for extremely large and complex data")
(description "HDF5 is a suite that makes possible the management of
--
2.14.1
next reply other threads:[~2017-08-24 9:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-24 9:53 Thomas Danckaert [this message]
2017-08-31 12:56 ` [bug#28214] [PATCH] gnu: hdf5: Add output for Fortran interface Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170824.115309.1248640013266066348.post@thomasdanckaert.be \
--to=post@thomasdanckaert.be \
--cc=28214@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.