gnu: petsc: Clean some more leaked chroot references

* gnu/packages/maths.scm (petsc)[arguments]: Scrub some
  config-generated header files before build.  Only remove files if
  they exist.
This commit is contained in:
Eric Bavier 2014-05-08 11:39:59 -05:00
parent fb0e370928
commit 10b11968c8

View file

@ -420,32 +420,40 @@ (define-public petsc
(format #t "configure flags: ~s~%" flags) (format #t "configure flags: ~s~%" flags)
(zero? (apply system* "./configure" flags)))) (zero? (apply system* "./configure" flags))))
(alist-cons-after (alist-cons-after
'install 'clean-local-references 'configure 'clean-local-references
;; Try to keep installed files from leaking build directory names. ;; Try to keep build directory names from leaking into compiled code
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")) (let ((out (assoc-ref outputs "out")))
(fortran (assoc-ref inputs "gfortran"))) (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
(substitute* (map (lambda (file) (((getcwd)) out))))
(string-append out "/" file)) (alist-cons-after
'("conf/petscvariables" 'install 'clean-install
"conf/PETScConfig.cmake" ;; Try to keep installed files from leaking build directory names.
"include/petscconf.h" (lambda* (#:key inputs outputs #:allow-other-keys)
"include/petscmachineinfo.h")) (let ((out (assoc-ref outputs "out"))
(((getcwd)) out)) (fortran (assoc-ref inputs "gfortran")))
;; Make compiler references point to the store (substitute* (map (lambda (file)
(substitute* (string-append out "/conf/petscvariables") (string-append out "/" file))
(("= g(cc|\\+\\+|fortran)" _ suffix) '("conf/petscvariables"
(string-append "= " fortran "/bin/g" suffix))) "conf/PETScConfig.cmake"))
;; PETSc installs some build logs, which aren't necessary. (((getcwd)) out))
(for-each (lambda (file) ;; Make compiler references point to the store
(delete-file (string-append out "/" file))) (substitute* (string-append out "/conf/petscvariables")
'("conf/configure.log" (("= g(cc|\\+\\+|fortran)" _ suffix)
"conf/make.log" (string-append "= " fortran "/bin/g" suffix)))
"conf/test.log" ;; PETSc installs some build logs, which aren't necessary.
"conf/RDict.db" (for-each (lambda (file)
;; Once installed, should uninstall with Guix (let ((f (string-append out "/" file)))
"conf/uninstall.py")))) (when (file-exists? f)
%standard-phases)))) (delete-file f))))
'("conf/configure.log"
"conf/make.log"
"conf/test.log"
"conf/error.log"
"conf/RDict.db"
;; Once installed, should uninstall with Guix
"conf/uninstall.py"))))
%standard-phases)))))
(home-page "http://www.mcs.anl.gov/petsc") (home-page "http://www.mcs.anl.gov/petsc")
(synopsis "Library to solve ODEs and algebraic equations") (synopsis "Library to solve ODEs and algebraic equations")
(description "PETSc, pronounced PET-see (the S is silent), is a suite of (description "PETSc, pronounced PET-see (the S is silent), is a suite of