summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-12-04 15:00:23 +0100
committerGabriel Wicki <gabriel@erlikon.ch>2025-12-08 15:34:15 +0100
commit15e79d93ad61e719ab63a8f775b9093219d85771 (patch)
treed54d7787a30c96473d654dcb05111895b0f30c15 /doc
parent7b861c82613cc1aa4da3755ff235361533a75e60 (diff)
doc: Use a gexp in “Defining Packages”.
* doc/guix.texi (Defining Packages): Update ‘arguments’ field in example to use ‘list’ and a gexp. Remove description of quote/unquote; document gexps instead. Change-Id: I2ed1f5796d76e8c389227aed58fd31aa76edbb9a Signed-off-by: Gabriel Wicki <gabriel@erlikon.ch>
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi37
1 files changed, 18 insertions, 19 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 8292b251e28..b88e35ce965 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7888,7 +7888,8 @@ package looks like this:
7888 (base32 7888 (base32
7889 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) 7889 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
7890 (build-system gnu-build-system) 7890 (build-system gnu-build-system)
7891 (arguments '(#:configure-flags '("--enable-silent-rules"))) 7891 (arguments
7892 (list #:configure-flags #~(list "--enable-silent-rules")))
7892 (inputs (list gawk)) 7893 (inputs (list gawk))
7893 (synopsis "Hello, GNU world: An example GNU package") 7894 (synopsis "Hello, GNU world: An example GNU package")
7894 (description "Guess what GNU Hello prints!") 7895 (description "Guess what GNU Hello prints!")
@@ -7899,7 +7900,7 @@ package looks like this:
7899@noindent 7900@noindent
7900Without being a Scheme expert, the reader may have guessed the meaning 7901Without being a Scheme expert, the reader may have guessed the meaning
7901of the various fields here. This expression binds the variable 7902of the various fields here. This expression binds the variable
7902@code{hello} to a @code{<package>} object, which is essentially a record 7903@code{hello} to a @code{<package>} record
7903(@pxref{SRFI-9, Scheme records,, guile, GNU Guile Reference Manual}). 7904(@pxref{SRFI-9, Scheme records,, guile, GNU Guile Reference Manual}).
7904This package object can be inspected using procedures found in the 7905This package object can be inspected using procedures found in the
7905@code{(guix packages)} module; for instance, @code{(package-name hello)} 7906@code{(guix packages)} module; for instance, @code{(package-name hello)}
@@ -7957,32 +7958,30 @@ The @code{arguments} field specifies options for the build system
7957@code{gnu-build-system} as a request run @file{configure} with the 7958@code{gnu-build-system} as a request run @file{configure} with the
7958@option{--enable-silent-rules} flag. 7959@option{--enable-silent-rules} flag.
7959 7960
7960@cindex quote 7961The value of the @code{arguments} field is a list of arguments passed to
7961@cindex quoting 7962the build system and that end up being applied, as with @code{apply}
7962@findex '
7963@findex quote
7964@cindex backquote (quasiquote)
7965@findex `
7966@findex quasiquote
7967@cindex comma (unquote)
7968@findex ,
7969@findex unquote
7970What about these quote (@code{'}) characters? They are Scheme syntax to
7971introduce a literal list; @code{'} is synonymous with @code{quote}.
7972Sometimes you'll also see @code{`} (a backquote, synonymous with
7973@code{quasiquote}) and @code{,} (a comma, synonymous with @code{unquote}).
7974@xref{Expression Syntax, quoting,, guile, GNU Guile Reference Manual},
7975for details. Here the value of the @code{arguments} field is a list of
7976arguments passed to the build system down the road, as with @code{apply}
7977(@pxref{Fly Evaluation, @code{apply},, guile, GNU Guile Reference 7963(@pxref{Fly Evaluation, @code{apply},, guile, GNU Guile Reference
7978Manual}). 7964Manual}).
7979 7965
7966@cindex keyword arguments, for build systems
7980The hash-colon (@code{#:}) sequence defines a Scheme @dfn{keyword} 7967The hash-colon (@code{#:}) sequence defines a Scheme @dfn{keyword}
7981(@pxref{Keywords,,, guile, GNU Guile Reference Manual}), and 7968(@pxref{Keywords,,, guile, GNU Guile Reference Manual}), and
7982@code{#:configure-flags} is a keyword used to pass a keyword argument 7969@code{#:configure-flags} is a keyword used to pass a keyword argument
7983to the build system (@pxref{Coding With Keywords,,, guile, GNU Guile 7970to the build system (@pxref{Coding With Keywords,,, guile, GNU Guile
7984Reference Manual}). 7971Reference Manual}).
7985 7972
7973@findex #~
7974@findex gexp
7975@cindex staging, for build system arguments
7976@cindex code staging, in package definitions
7977What about these hash-tilde (@code{#~}) characters? This is
7978Guix-specific syntax introducing a so-called @dfn{G-expression}
7979(@pxref{G-Expressions}), which denotes code that is @dfn{staged} for
7980eventual evaluation: this staged code is only evaluated if and when
7981attempting to build the package, by the build daemon. In this example,
7982the staged code is the @code{(list @dots{})} expression, which builds a
7983list of one element, the configure flag.
7984
7986@item 7985@item
7987The @code{inputs} field specifies inputs to the build process---i.e., 7986The @code{inputs} field specifies inputs to the build process---i.e.,
7988build-time or run-time dependencies of the package. Here, we add 7987build-time or run-time dependencies of the package. Here, we add