gnu: petsc: Reduce closure size.

Reduces closure size from 828 MiB to 463 MiB (44%) by removing
references to build dependencies such as GCC.

* gnu/packages/maths.scm (petsc)[arguments]: Add
‘clear-reference-to-compiler’ phase.
In ‘clean-install’ phase, also remove “configure-hash”.

Change-Id: I2e6900747b2118546f0a39ceb109b3f2f90e6949
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Lars Bilke 2024-01-09 19:15:04 +01:00 committed by Ludovic Courtès
parent 99e5f3cd14
commit dcdc0a5592
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 12 additions and 0 deletions

View File

@ -3487,8 +3487,20 @@ September 2004}")
'("configure.log" "make.log" "gmake.log"
"test.log" "error.log" "RDict.db"
"PETScBuildInternal.cmake"
"configure-hash"
;; Once installed, should uninstall with Guix
"uninstall.py")))))
(add-after 'clean-install 'clear-reference-to-compiler
(lambda* (#:key inputs outputs #:allow-other-keys)
;; Do not retain a reference to GCC and other build only inputs.
(let ((out (assoc-ref outputs "out")))
(substitute* (string-append out "/lib/petsc/conf/petscvariables")
(("([[:graph:]]+)/bin/gcc") "gcc")
(("([[:graph:]]+)/bin/g\\+\\+") "g++")
(("([[:graph:]]+)/bin/make") "make")
(("([[:graph:]]+)/bin/diff") "diff")
(("([[:graph:]]+)/bin/sed") "sed")
(("([[:graph:]]+)/bin/gfortran") "gfortran")))))
(add-after 'install 'move-examples
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))