emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#28214: closed ([PATCH] gnu: hdf5: Add output for F


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#28214: closed ([PATCH] gnu: hdf5: Add output for Fortran interface.)
Date: Fri, 01 Sep 2017 07:33:01 +0000

Your message dated Fri, 01 Sep 2017 09:32:12 +0200 (CEST)
with message-id <address@hidden>
and subject line Re: [bug#28217] [PATCH] gnu: hdf4: Avoid unneeded store 
references to compilers.
has caused the debbugs.gnu.org bug report #28214,
regarding [PATCH] gnu: hdf5: Add output for Fortran interface.
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
28214: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=28214
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH] gnu: hdf5: Add output for Fortran interface. Date: Thu, 24 Aug 2017 11:53:09 +0200 (CEST)
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
>From ea5b67230713bf79d625743eb18f57bf36d40407 Mon Sep 17 00:00:00 2001
From: Thomas Danckaert <address@hidden>
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


--- End Message ---
--- Begin Message --- Subject: Re: [bug#28217] [PATCH] gnu: hdf4: Avoid unneeded store references to compilers. Date: Fri, 01 Sep 2017 09:32:12 +0200 (CEST)
From: address@hidden (Ludovic Courtès)
Subject: Re: [bug#28217] [PATCH] gnu: hdf4: Avoid unneeded store references to compilers.
Date: Thu, 31 Aug 2017 15:00:34 +0200

I assume hdf4 doesn’t rely on these file names at all for its
functionality, right?

No, it's just some extra information.

I pushed this, as well as the hdf5 patches.  Thanks for having a look!

Thomas

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]