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; add a 'split phase to move all Fortran-related files to the the Fortran output store location.
This commit is contained in:
		
							parent
							
								
									a0596a2f27
								
							
						
					
					
						commit
						e3a1a1deda
					
				
					 1 changed files with 50 additions and 3 deletions
				
			
		| 
						 | 
					@ -648,16 +648,30 @@ incompatible with HDF5.")
 | 
				
			||||||
    (build-system gnu-build-system)
 | 
					    (build-system gnu-build-system)
 | 
				
			||||||
    (inputs
 | 
					    (inputs
 | 
				
			||||||
     `(("zlib" ,zlib)))
 | 
					     `(("zlib" ,zlib)))
 | 
				
			||||||
 | 
					    (native-inputs
 | 
				
			||||||
 | 
					     `(("gfortran" ,gfortran)))
 | 
				
			||||||
 | 
					    (outputs '("out"       ; core library
 | 
				
			||||||
 | 
					               "fortran")) ; fortran interface
 | 
				
			||||||
    (arguments
 | 
					    (arguments
 | 
				
			||||||
     `(;; Some of the users, notably Flann, need the C++ interface.
 | 
					     `(;; Some of the users, notably Flann, need the C++ interface.
 | 
				
			||||||
       #:configure-flags '("--enable-cxx")
 | 
					       #:configure-flags '("--enable-cxx"
 | 
				
			||||||
 | 
					                           "--enable-fortran"
 | 
				
			||||||
 | 
					                           "--enable-fortran2003")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       #:phases
 | 
					       #:phases
 | 
				
			||||||
       (modify-phases %standard-phases
 | 
					       (modify-phases %standard-phases
 | 
				
			||||||
         (add-before 'configure 'patch-configure
 | 
					         (add-before 'configure 'patch-configure
 | 
				
			||||||
           (lambda _
 | 
					           (lambda* (#:key outputs #:allow-other-keys)
 | 
				
			||||||
             (substitute* "configure"
 | 
					             (substitute* "configure"
 | 
				
			||||||
               (("/bin/mv") "mv"))
 | 
					               (("/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))
 | 
					             #t))
 | 
				
			||||||
         (add-after 'install 'patch-references
 | 
					         (add-after 'install 'patch-references
 | 
				
			||||||
           (lambda* (#:key inputs outputs #:allow-other-keys)
 | 
					           (lambda* (#:key inputs outputs #:allow-other-keys)
 | 
				
			||||||
| 
						 | 
					@ -666,7 +680,40 @@ incompatible with HDF5.")
 | 
				
			||||||
               (substitute* (find-files bin "h5p?cc")
 | 
					               (substitute* (find-files bin "h5p?cc")
 | 
				
			||||||
                 (("-lz" lib)
 | 
					                 (("-lz" lib)
 | 
				
			||||||
                  (string-append "-L" zlib "/lib " 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")
 | 
					    (home-page "http://www.hdfgroup.org")
 | 
				
			||||||
    (synopsis "Management suite for extremely large and complex data")
 | 
					    (synopsis "Management suite for extremely large and complex data")
 | 
				
			||||||
    (description "HDF5 is a suite that makes possible the management of
 | 
					    (description "HDF5 is a suite that makes possible the management of
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue