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
1 changed files with 33 additions and 25 deletions

View File

@ -420,7 +420,14 @@ ASCII text files using Gmsh's own scripting language.")
(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 build directory names from leaking into compiled code
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(substitute* (find-files "." "^petsc(conf|machineinfo).h$")
(((getcwd)) out))))
(alist-cons-after
'install 'clean-install
;; Try to keep installed files from leaking build directory names. ;; Try to keep installed files from leaking build directory names.
(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"))
@ -428,9 +435,7 @@ ASCII text files using Gmsh's own scripting language.")
(substitute* (map (lambda (file) (substitute* (map (lambda (file)
(string-append out "/" file)) (string-append out "/" file))
'("conf/petscvariables" '("conf/petscvariables"
"conf/PETScConfig.cmake" "conf/PETScConfig.cmake"))
"include/petscconf.h"
"include/petscmachineinfo.h"))
(((getcwd)) out)) (((getcwd)) out))
;; Make compiler references point to the store ;; Make compiler references point to the store
(substitute* (string-append out "/conf/petscvariables") (substitute* (string-append out "/conf/petscvariables")
@ -438,14 +443,17 @@ ASCII text files using Gmsh's own scripting language.")
(string-append "= " fortran "/bin/g" suffix))) (string-append "= " fortran "/bin/g" suffix)))
;; PETSc installs some build logs, which aren't necessary. ;; PETSc installs some build logs, which aren't necessary.
(for-each (lambda (file) (for-each (lambda (file)
(delete-file (string-append out "/" file))) (let ((f (string-append out "/" file)))
(when (file-exists? f)
(delete-file f))))
'("conf/configure.log" '("conf/configure.log"
"conf/make.log" "conf/make.log"
"conf/test.log" "conf/test.log"
"conf/error.log"
"conf/RDict.db" "conf/RDict.db"
;; Once installed, should uninstall with Guix ;; Once installed, should uninstall with Guix
"conf/uninstall.py")))) "conf/uninstall.py"))))
%standard-phases)))) %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