1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-28 03:51:53 +02:00

gnu: make-autoconf-wrapper: Remove input labels.

* gnu/packages/autotools.scm (make-autoconf-wrapper)[inputs]: Remove labels.
[arguments]: Use G-expression and SEARCH-INPUT-FILE.
This commit is contained in:
Marius Bakke
2022-07-17 00:00:48 +02:00
parent 8fa17cb6d5
commit 9e4b3391c5
+47 -52
View File
@@ -205,70 +205,65 @@ know anything about Autoconf or M4.")
use our own Bash instead of /bin/sh in shebangs. For that reason, it should use our own Bash instead of /bin/sh in shebangs. For that reason, it should
only be used internally---users should not end up distributing `configure' only be used internally---users should not end up distributing `configure'
files with a system-specific shebang." files with a system-specific shebang."
(package (inherit autoconf) (package
(inherit autoconf)
(name (string-append (package-name autoconf) "-wrapper")) (name (string-append (package-name autoconf) "-wrapper"))
(build-system trivial-build-system) (build-system trivial-build-system)
(inputs `(("guile" (inputs
;; XXX: Kludge to hide the circular dependency. (list
,(module-ref (resolve-interface '(gnu packages guile)) ;; XXX: Kludge to hide the circular dependency.
'guile-3.0/fixed)) (module-ref (resolve-interface '(gnu packages guile))
("autoconf" ,autoconf) 'guile-3.0/fixed)
("bash" ,bash-minimal))) autoconf
bash-minimal))
(arguments (arguments
'(#:modules ((guix build utils)) (list
#:builder #:modules '((guix build utils))
(begin #:builder
(use-modules (guix build utils)) #~(begin
(let* ((out (assoc-ref %outputs "out")) (use-modules (guix build utils))
(bin (string-append out "/bin")) (let ((bin (string-append #$output "/bin"))
(autoconf (string-append (autoconf (search-input-file %build-inputs "/bin/autoconf"))
(assoc-ref %build-inputs "autoconf") (guile (search-input-file %build-inputs "/bin/guile"))
"/bin/autoconf")) (sh (search-input-file %build-inputs "/bin/sh"))
(guile (string-append
(assoc-ref %build-inputs "guile")
"/bin/guile"))
(sh (string-append
(assoc-ref %build-inputs "bash")
"/bin/sh"))
(modules ((compose dirname dirname dirname) (modules ((compose dirname dirname dirname)
(search-path %load-path (search-path %load-path
"guix/build/utils.scm")))) "guix/build/utils.scm"))))
(mkdir-p bin) (mkdir-p bin)
;; Symlink all the binaries but `autoconf'. ;; Symlink all the binaries but `autoconf'.
(with-directory-excursion bin (with-directory-excursion bin
(for-each (lambda (file) (for-each (lambda (file)
(unless (string=? (basename file) "autoconf") (unless (string=? (basename file) "autoconf")
(symlink file (basename file)))) (symlink file (basename file))))
(find-files (dirname autoconf) ".*"))) (find-files (dirname autoconf) ".*")))
;; Add an `autoconf' binary that wraps the real one. ;; Add an `autoconf' binary that wraps the real one.
(call-with-output-file (string-append bin "/autoconf") (call-with-output-file (string-append bin "/autoconf")
(lambda (port) (lambda (port)
;; Shamefully, Guile can be used in shebangs only if a ;; Shamefully, Guile can be used in shebangs only if a
;; single argument is passed (-ds); otherwise it gets ;; single argument is passed (-ds); otherwise it gets
;; them all as a single argument and fails to parse them. ;; them all as a single argument and fails to parse them.
(format port "#!~a (format port "#!~a
export GUILE_LOAD_PATH=\"~a\" export GUILE_LOAD_PATH=\"~a\"
export GUILE_LOAD_COMPILED_PATH=\"~a\" export GUILE_LOAD_COMPILED_PATH=\"~a\"
exec ~a --no-auto-compile \"$0\" \"$@\" exec ~a --no-auto-compile \"$0\" \"$@\"
!#~%" !#~%"
sh modules modules guile) sh modules modules guile)
(write (write
`(begin `(begin
(use-modules (guix build utils)) (use-modules (guix build utils))
(let ((result (apply system* ,autoconf (let ((result (apply system* ,autoconf
(cdr (command-line))))) (cdr (command-line)))))
(when (and (file-exists? "configure") (when (and (file-exists? "configure")
(not (file-exists? "/bin/sh"))) (not (file-exists? "/bin/sh")))
;; Patch regardless of RESULT, because `autoconf ;; Patch regardless of RESULT, because `autoconf
;; -Werror' can both create a `configure' file and ;; -Werror' can both create a `configure' file and
;; return a non-zero exit code. ;; return a non-zero exit code.
(patch-shebang "configure")) (patch-shebang "configure"))
(exit (status:exit-val result)))) (exit (status:exit-val result))))
port))) port)))
(chmod (string-append bin "/autoconf") #o555) (chmod (string-append bin "/autoconf") #o555)))))
#t))))
;; Do not show it in the UI since it's meant for internal use. ;; Do not show it in the UI since it's meant for internal use.
(properties '((hidden? . #t))))) (properties '((hidden? . #t)))))