diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-10-09 18:17:41 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-10-20 16:30:16 +0200 |
commit | 6aeda81602555fbeac0c0a209e74f5262093b513 (patch) | |
tree | 21a6873e63738c99f30b0336e8e2544c98a46175 /guix | |
parent | ccf3dcba3dbddd4fd8daf0b5641ba997de12647a (diff) |
guix build: Add '--with-debug-info'.
* guix/scripts/build.scm (transform-package-with-debug-info): New
procedure.
(%transformations): Add 'with-debug-info'.
(%transformation-options, show-transformation-options-help): Add
'--with-debug-info'.
* tests/scripts-build.scm ("options->transformation, with-debug-info"):
New test.
* doc/guix.texi (Package Transformation Options): Document
'--with-debug-info'.
(Installing Debugging Files): Introduce sections. Remove bit about
eventual "opt-out" since this is not happening. Document
'--with-debug-info' under "Rebuilding with Debugging Info".
Diffstat (limited to 'guix')
-rw-r--r-- | guix/scripts/build.scm | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index e59e0ee67f..6ca669d172 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -474,6 +474,40 @@ the equal sign." obj) obj))) +(define (transform-package-with-debug-info specs) + "Return a procedure that, when passed a package, set its 'replacement' field +to the same package but with #:strip-binaries? #f in its 'arguments' field." + (define (non-stripped p) + (package + (inherit p) + (arguments + (substitute-keyword-arguments (package-arguments p) + ((#:strip-binaries? _ #f) #f))))) + + (define (package-with-debug-info p) + (if (member "debug" (package-outputs p)) + p + (let loop ((p p)) + (match (package-replacement p) + (#f + (package + (inherit p) + (replacement (non-stripped p)))) + (next + (package + (inherit p) + (replacement (loop next)))))))) + + (define rewrite + (package-input-rewriting/spec (map (lambda (spec) + (cons spec package-with-debug-info)) + specs))) + + (lambda (store obj) + (if (package? obj) + (rewrite obj) + obj))) + (define (transform-package-tests specs) "Return a procedure that, when passed a package, sets #:tests? #f in its 'arguments' field." @@ -505,6 +539,7 @@ the equal sign." (with-commit . ,transform-package-source-commit) (with-git-url . ,transform-package-source-git-url) (with-c-toolchain . ,transform-package-toolchain) + (with-debug-info . ,transform-package-with-debug-info) (without-tests . ,transform-package-tests))) (define (transformation-procedure key) @@ -536,6 +571,8 @@ the equal sign." (parser 'with-git-url)) (option '("with-c-toolchain") #t #f (parser 'with-c-toolchain)) + (option '("with-debug-info") #t #f + (parser 'with-debug-info)) (option '("without-tests") #t #f (parser 'without-tests))))) @@ -562,6 +599,9 @@ the equal sign." --with-c-toolchain=PACKAGE=TOOLCHAIN build PACKAGE and its dependents with TOOLCHAIN")) (display (G_ " + --with-debug-info=PACKAGE + build PACKAGE and preserve its debug info")) + (display (G_ " --without-tests=PACKAGE build PACKAGE without running its tests"))) |