diff mbox series

[bug#62754,v2] doc: Use G-Expressions for package definition example.

Message ID 2db67ea84f7a23bf04280ad1e365ac8709167d66.1681215490.git.mirai@makinata.eu
State New
Headers show
Series [bug#62754,v2] doc: Use G-Expressions for package definition example. | expand

Commit Message

Bruno Victal April 11, 2023, 12:19 p.m. UTC
* doc/guix.texi (Build Phases): Use G-Expressions for example.
---
 doc/guix.texi | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)


base-commit: 0356087f4e669a79d62d413498c32e4ecb79ba6b

Comments

Nicolas Goaziou April 21, 2023, 8:21 a.m. UTC | #1
Hello,

Bruno Victal <mirai@makinata.eu> writes:

> +     (list
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (delete 'configure)
> +          (add-before 'build 'set-prefix-in-makefile
> +            (lambda* (#:key inputs #:allow-other-keys)
> +              ;; Modify the makefile so that its
> +              ;; 'PREFIX' variable points to #$output and
> +              ;; 'XMLLINT' points to the correct path.
> +              (substitute* "Makefile"
> +                (("PREFIX =.*")
> +                 (string-append "PREFIX = " #$output "\n"))
> +                (("XMLLINT =.*")
> +                 (string-append "XMLLINT = "
> +                                (search-input-file inputs "/bin/xmllint")
> +                                "\n"))))))))))
>  @end lisp
>  
>  The new phase that is inserted is written as an anonymous procedure,
> -introduced with @code{lambda*}; it honors the @code{outputs} parameter
> -we have seen before.  @xref{Build Utilities}, for more about the helpers
> -used by this phase, and for more examples of @code{modify-phases}.
> +introduced with @code{lambda*}.  @xref{Build Utilities}, for more about
> +the helpers used by this phase, and for more examples of
> +@code{modify-phases}.

I think it still makes sense to refer to `inputs'; it could be
unsettling otherwise. Maybe something along those lines:

    ... introduced with @code{lambda*}; it looks for the @file{xmllint}
    executable in a @file{"/bin"} directory among package's inputs
    (@pxref{package Reference}).  It also honors the @code{outputs}
    parameter we have seen before@xref{Build Utilities}, for more...


WDYT?

Regards,
Simon Tournier May 5, 2023, 2:06 p.m. UTC | #2
Hi,

On ven., 21 avril 2023 at 10:21, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

>>  The new phase that is inserted is written as an anonymous procedure,
>> -introduced with @code{lambda*}; it honors the @code{outputs} parameter
>> -we have seen before.  @xref{Build Utilities}, for more about the helpers
>> -used by this phase, and for more examples of @code{modify-phases}.
>> +introduced with @code{lambda*}.  @xref{Build Utilities}, for more about
>> +the helpers used by this phase, and for more examples of
>> +@code{modify-phases}.
>
> I think it still makes sense to refer to `inputs'; it could be
> unsettling otherwise. Maybe something along those lines:
>
>     ... introduced with @code{lambda*}; it looks for the @file{xmllint}
>     executable in a @file{"/bin"} directory among package's inputs
>     (@pxref{package Reference}).  It also honors the @code{outputs}
>     parameter we have seen before@xref{Build Utilities}, for more...

This tweak looks better to me.  Well, Bruno could you send a v3?  Or
Nicolas, could you amend the patch and directly apply it?

(Note the typo in « before@xref{Build Utilities} », I guess.)

Cheers,
simon
diff mbox series

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index fa6c9f46a3..62513a4182 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -10131,23 +10131,28 @@  Build Phases
     ;; other fields omitted
     (build-system gnu-build-system)
     (arguments
-     '(#:phases (modify-phases %standard-phases
-                  (delete 'configure)
-                  (add-before 'build 'set-prefix-in-makefile
-                    (lambda* (#:key outputs #:allow-other-keys)
-                      ;; Modify the makefile so that its
-                      ;; 'PREFIX' variable points to "out".
-                      (let ((out (assoc-ref outputs "out")))
-                        (substitute* "Makefile"
-                          (("PREFIX =.*")
-                           (string-append "PREFIX = "
-                                          out "\n")))))))))))
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure)
+          (add-before 'build 'set-prefix-in-makefile
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; Modify the makefile so that its
+              ;; 'PREFIX' variable points to #$output and
+              ;; 'XMLLINT' points to the correct path.
+              (substitute* "Makefile"
+                (("PREFIX =.*")
+                 (string-append "PREFIX = " #$output "\n"))
+                (("XMLLINT =.*")
+                 (string-append "XMLLINT = "
+                                (search-input-file inputs "/bin/xmllint")
+                                "\n"))))))))))
 @end lisp
 
 The new phase that is inserted is written as an anonymous procedure,
-introduced with @code{lambda*}; it honors the @code{outputs} parameter
-we have seen before.  @xref{Build Utilities}, for more about the helpers
-used by this phase, and for more examples of @code{modify-phases}.
+introduced with @code{lambda*}.  @xref{Build Utilities}, for more about
+the helpers used by this phase, and for more examples of
+@code{modify-phases}.
 
 @cindex code staging
 @cindex staging, of code