gnu: gash-utils-boot: Use a gexp.

* gnu/packages/commencement.scm (gash-utils-boot)[arguments]: Use #:modules
instead of a non-top-level ‘use-modules’.  Turn #:phases into a gexp.
Use ‘search-input-file’ in ‘make-echo’ phase.
[inputs, native-inputs]: Remove labels.

Change-Id: Ib0eaa8a9ba4272b423fdb34a0eaf56b3a93ac7d4
This commit is contained in:
Ludovic Courtès 2025-03-23 01:29:24 +01:00 committed by Andreas Enge
parent cf46fefb0b
commit 1dff4c2e1f
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3

View file

@ -235,19 +235,20 @@ pure Scheme to Tar and decompression in one easy step.")
(inherit gash-utils) (inherit gash-utils)
(name "gash-utils-boot") (name "gash-utils-boot")
(arguments (arguments
`(#:implicit-inputs? #f (list #:implicit-inputs? #f
#:tests? #f #:tests? #f
#:guile ,%bootstrap-guile #:guile %bootstrap-guile
#:imported-modules ((guix build gnu-bootstrap) #:imported-modules `((guix build gnu-bootstrap)
,@%default-gnu-imported-modules) ,@%default-gnu-imported-modules)
#:modules `((guix build gnu-bootstrap)
,@%default-gnu-modules)
#:phases #:phases
(begin #~(modify-phases %standard-phases
(use-modules (guix build gnu-bootstrap))
(modify-phases %standard-phases
(add-after 'unpack 'set-load-path (add-after 'unpack 'set-load-path
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let ((gash (assoc-ref inputs "gash"))) (let ((gash (assoc-ref inputs "gash")))
(add-to-load-path (string-append gash "/share/guile/site/" (add-to-load-path (string-append gash
"/share/guile/site/"
(effective-version)))))) (effective-version))))))
(add-before 'configure 'pre-configure (add-before 'configure 'pre-configure
(lambda _ (lambda _
@ -255,13 +256,17 @@ pure Scheme to Tar and decompression in one easy step.")
(copy-file "gash/commands/test.scm" (copy-file "gash/commands/test.scm"
"gash/commands/testb.scm") "gash/commands/testb.scm")
(substitute* "gash/commands/testb.scm" (substitute* "gash/commands/testb.scm"
(("gash commands test") "gash commands testb") (("gash commands test")
(("apply test [(]cdr") "apply test/bracket (cdr")) "gash commands testb")
(("apply test [(]cdr")
"apply test/bracket (cdr"))
(for-each (lambda (script) (for-each (lambda (script)
(let ((target (string-append "scripts/" (let ((target (string-append
script ".in"))) "scripts/" script ".in")))
(format #t "Creating scripts/~a~%" target) (format #t "Creating scripts/~a~%"
(copy-file "scripts/template.in" target) target)
(copy-file "scripts/template.in"
target)
(substitute* target (substitute* target
(("@UTILITY@") script)))) (("@UTILITY@") script))))
'("awk" "basename" "cat" "chmod" "cmp" "command" '("awk" "basename" "cat" "chmod" "cmp" "command"
@ -273,12 +278,16 @@ pure Scheme to Tar and decompression in one easy step.")
(format #t "Creating scripts/[.in~%") (format #t "Creating scripts/[.in~%")
(copy-file "scripts/template.in" "scripts/[.in") (copy-file "scripts/template.in" "scripts/[.in")
(substitute* "scripts/[.in" (substitute* "scripts/[.in"
(("@UTILITY@") "testb")) (("@UTILITY@")
"testb"))
(delete-file "scripts/template.in"))) (delete-file "scripts/template.in")))
(replace 'configure (replace 'configure
(bootstrap-configure "Gash-Utils" ,(package-version gash-utils) (bootstrap-configure "Gash-Utils"
'("gash" "gash-utils") "scripts")) #$(package-version gash-utils)
(replace 'build (bootstrap-build '("gash" "gash-utils"))) '("gash" "gash-utils")
"scripts"))
(replace 'build
(bootstrap-build '("gash" "gash-utils")))
(replace 'install (replace 'install
(bootstrap-install '("gash" "gash-utils") "scripts")) (bootstrap-install '("gash" "gash-utils") "scripts"))
;; XXX: The scripts should add Gash to their load paths and ;; XXX: The scripts should add Gash to their load paths and
@ -286,37 +295,48 @@ pure Scheme to Tar and decompression in one easy step.")
(add-after 'install 'copy-gash (add-after 'install 'copy-gash
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(moddir (string-append out "/share/guile/site/" (moddir (string-append out
"/share/guile/site/"
(effective-version))) (effective-version)))
(godir (string-append out "/lib/guile/" (godir (string-append out "/lib/guile/"
(effective-version) (effective-version)
"/site-ccache")) "/site-ccache"))
(gash (assoc-ref inputs "gash")) (gash (assoc-ref inputs "gash"))
(gash-moddir (string-append gash "/share/guile/site/" (gash-moddir (string-append gash
"/share/guile/site/"
(effective-version))) (effective-version)))
(gash-godir (string-append gash "/lib/guile/" (gash-godir (string-append gash
"/lib/guile/"
(effective-version) (effective-version)
"/site-ccache"))) "/site-ccache")))
(copy-file (string-append gash-moddir "/gash/compat.scm") (copy-file (string-append gash-moddir
(string-append moddir "/gash/compat.scm")) "/gash/compat.scm")
(copy-recursively (string-append gash-moddir "/gash/compat") (string-append moddir
(string-append moddir "/gash/compat")) "/gash/compat.scm"))
(copy-file (string-append gash-godir "/gash/compat.go") (copy-recursively (string-append gash-moddir
(string-append godir "/gash/compat.go")) "/gash/compat")
(copy-recursively (string-append gash-godir "/gash/compat") (string-append moddir
(string-append godir "/gash/compat"))))) "/gash/compat"))
(copy-file (string-append gash-godir
"/gash/compat.go")
(string-append godir
"/gash/compat.go"))
(copy-recursively (string-append gash-godir
"/gash/compat")
(string-append godir
"/gash/compat")))))
;; We need an external echo. ;; We need an external echo.
(add-after 'install 'make-echo (add-after 'install 'make-echo
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(gash (assoc-ref inputs "gash"))) (gash (search-input-file inputs "/bin/gash")))
(with-output-to-file (string-append out "/bin/echo") (with-output-to-file (string-append out "/bin/echo")
(lambda () (lambda ()
(display (string-append "#!" gash "/bin/gash\n")) (display (string-append "#!" gash "\n"))
(newline) (newline)
(display "echo \"$@\"") (display "echo \"$@\"")
(newline))) (newline)))
(chmod (string-append out "/bin/echo") #o755)))))))) (chmod (string-append out "/bin/echo") #o755)))))))
(inputs `(("gash" ,gash-boot) (inputs `(("gash" ,gash-boot)
("guile" ,%bootstrap-guile))) ("guile" ,%bootstrap-guile)))
(native-inputs `(("bootar" ,bootar))))) (native-inputs `(("bootar" ,bootar)))))