mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-18 13:36:36 +01:00
doc: cookbook: Update "Build system arguments" section.
* doc/guix-cookbook.texi (Build system arguments) Remove recommendation on phase return value. Ensure code examples can run and are up-to-date. Change-Id: I143babf79983751578d6d4e20b20195ea000656d Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
d081b41d2e
commit
73e413b6cd
1 changed files with 23 additions and 14 deletions
|
@ -1255,6 +1255,7 @@ definition in @samp{$GUIX_CHECKOUT/guix/build/gnu-build-system.scm}:
|
||||||
validate-documentation-location
|
validate-documentation-location
|
||||||
delete-info-dir-file
|
delete-info-dir-file
|
||||||
patch-dot-desktop-files
|
patch-dot-desktop-files
|
||||||
|
make-dynamic-linker-cache
|
||||||
install-license-files
|
install-license-files
|
||||||
reset-gzip-timestamps
|
reset-gzip-timestamps
|
||||||
compress-documentation)))
|
compress-documentation)))
|
||||||
|
@ -1265,8 +1266,8 @@ Or from the REPL:
|
||||||
@lisp
|
@lisp
|
||||||
(add-to-load-path "/path/to/guix/checkout")
|
(add-to-load-path "/path/to/guix/checkout")
|
||||||
,use (guix build gnu-build-system)
|
,use (guix build gnu-build-system)
|
||||||
(map first %standard-phases)
|
(map car %standard-phases)
|
||||||
@result{} (set-SOURCE-DATE-EPOCH set-paths install-locale unpack bootstrap patch-usr-bin-file patch-source-shebangs configure patch-generated-file-shebangs build check install patch-shebangs strip validate-runpath validate-documentation-location delete-info-dir-file patch-dot-desktop-files install-license-files reset-gzip-timestamps compress-documentation)
|
@result{} (set-SOURCE-DATE-EPOCH set-paths install-locale unpack bootstrap patch-usr-bin-file patch-source-shebangs configure patch-generated-file-shebangs build check install patch-shebangs strip validate-runpath validate-documentation-location delete-info-dir-file patch-dot-desktop-files make-dynamic-linker-cache install-license-files reset-gzip-timestamps compress-documentation)
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
If you want to know more about what happens during those phases, consult the
|
If you want to know more about what happens during those phases, consult the
|
||||||
|
@ -1288,13 +1289,25 @@ working directory."
|
||||||
;; Preserve timestamps (set to the Epoch) on the copied tree so that
|
;; Preserve timestamps (set to the Epoch) on the copied tree so that
|
||||||
;; things work deterministically.
|
;; things work deterministically.
|
||||||
(copy-recursively source "."
|
(copy-recursively source "."
|
||||||
#:keep-mtime? #true))
|
#:keep-mtime? #t)
|
||||||
|
;; Make the source checkout files writable, for convenience.
|
||||||
|
(for-each (lambda (f)
|
||||||
|
(false-if-exception (make-file-writable f)))
|
||||||
|
(find-files ".")))
|
||||||
(begin
|
(begin
|
||||||
(if (string-suffix? ".zip" source)
|
(cond
|
||||||
(invoke "unzip" source)
|
((string-suffix? ".zip" source)
|
||||||
(invoke "tar" "xvf" source))
|
(invoke "unzip" source))
|
||||||
(chdir (first-subdirectory "."))))
|
((tarball? source)
|
||||||
#true)
|
(invoke "tar" "xvf" source))
|
||||||
|
(else
|
||||||
|
(let ((name (strip-store-file-name source))
|
||||||
|
(command (compressor source)))
|
||||||
|
(copy-file source name)
|
||||||
|
(when command
|
||||||
|
(invoke command "--decompress" name)))))
|
||||||
|
;; Attempt to change into child directory.
|
||||||
|
(and=> (first-subdirectory ".") chdir))))
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
Note the @code{chdir} call: it changes the working directory to where the source was
|
Note the @code{chdir} call: it changes the working directory to where the source was
|
||||||
|
@ -1330,14 +1343,10 @@ this:
|
||||||
(let ((bash-directory (assoc-ref inputs "bash"))
|
(let ((bash-directory (assoc-ref inputs "bash"))
|
||||||
(output-directory (assoc-ref outputs "out"))
|
(output-directory (assoc-ref outputs "out"))
|
||||||
(doc-directory (assoc-ref outputs "doc")))
|
(doc-directory (assoc-ref outputs "doc")))
|
||||||
;; ...
|
;; ... ))
|
||||||
#true))
|
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
The procedure must return @code{#true} on success. It's brittle to rely on the return
|
Its return value is ignored.
|
||||||
value of the last expression used to tweak the phase because there is no
|
|
||||||
guarantee it would be a @code{#true}. Hence the trailing @code{#true} to ensure the right value
|
|
||||||
is returned on success.
|
|
||||||
|
|
||||||
@subsubsection Code staging
|
@subsubsection Code staging
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue