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)
(name "gash-utils-boot")
(arguments
`(#:implicit-inputs? #f
(list #:implicit-inputs? #f
#:tests? #f
#:guile ,%bootstrap-guile
#:imported-modules ((guix build gnu-bootstrap)
#:guile %bootstrap-guile
#:imported-modules `((guix build gnu-bootstrap)
,@%default-gnu-imported-modules)
#:modules `((guix build gnu-bootstrap)
,@%default-gnu-modules)
#:phases
(begin
(use-modules (guix build gnu-bootstrap))
(modify-phases %standard-phases
#~(modify-phases %standard-phases
(add-after 'unpack 'set-load-path
(lambda* (#:key inputs #:allow-other-keys)
(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))))))
(add-before 'configure 'pre-configure
(lambda _
@ -255,13 +256,17 @@ pure Scheme to Tar and decompression in one easy step.")
(copy-file "gash/commands/test.scm"
"gash/commands/testb.scm")
(substitute* "gash/commands/testb.scm"
(("gash commands test") "gash commands testb")
(("apply test [(]cdr") "apply test/bracket (cdr"))
(("gash commands test")
"gash commands testb")
(("apply test [(]cdr")
"apply test/bracket (cdr"))
(for-each (lambda (script)
(let ((target (string-append "scripts/"
script ".in")))
(format #t "Creating scripts/~a~%" target)
(copy-file "scripts/template.in" target)
(let ((target (string-append
"scripts/" script ".in")))
(format #t "Creating scripts/~a~%"
target)
(copy-file "scripts/template.in"
target)
(substitute* target
(("@UTILITY@") script))))
'("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~%")
(copy-file "scripts/template.in" "scripts/[.in")
(substitute* "scripts/[.in"
(("@UTILITY@") "testb"))
(("@UTILITY@")
"testb"))
(delete-file "scripts/template.in")))
(replace 'configure
(bootstrap-configure "Gash-Utils" ,(package-version gash-utils)
'("gash" "gash-utils") "scripts"))
(replace 'build (bootstrap-build '("gash" "gash-utils")))
(bootstrap-configure "Gash-Utils"
#$(package-version gash-utils)
'("gash" "gash-utils")
"scripts"))
(replace 'build
(bootstrap-build '("gash" "gash-utils")))
(replace 'install
(bootstrap-install '("gash" "gash-utils") "scripts"))
;; 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
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(moddir (string-append out "/share/guile/site/"
(moddir (string-append out
"/share/guile/site/"
(effective-version)))
(godir (string-append out "/lib/guile/"
(effective-version)
"/site-ccache"))
(gash (assoc-ref inputs "gash"))
(gash-moddir (string-append gash "/share/guile/site/"
(gash-moddir (string-append gash
"/share/guile/site/"
(effective-version)))
(gash-godir (string-append gash "/lib/guile/"
(gash-godir (string-append gash
"/lib/guile/"
(effective-version)
"/site-ccache")))
(copy-file (string-append gash-moddir "/gash/compat.scm")
(string-append moddir "/gash/compat.scm"))
(copy-recursively (string-append gash-moddir "/gash/compat")
(string-append moddir "/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")))))
(copy-file (string-append gash-moddir
"/gash/compat.scm")
(string-append moddir
"/gash/compat.scm"))
(copy-recursively (string-append gash-moddir
"/gash/compat")
(string-append moddir
"/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.
(add-after 'install 'make-echo
(lambda* (#:key inputs outputs #:allow-other-keys)
(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")
(lambda ()
(display (string-append "#!" gash "/bin/gash\n"))
(display (string-append "#!" gash "\n"))
(newline)
(display "echo \"$@\"")
(newline)))
(chmod (string-append out "/bin/echo") #o755))))))))
(chmod (string-append out "/bin/echo") #o755)))))))
(inputs `(("gash" ,gash-boot)
("guile" ,%bootstrap-guile)))
(native-inputs `(("bootar" ,bootar)))))