gnu: Perl: Resolve TODO.

* gnu/packages/perl.scm (perl)[inputs]: Add COREUTILS-MINIMAL.
[arguments]: Unconditionally patch /bin/pwd in Cwd.pm.  While at it, remove
trailing #t's.
This commit is contained in:
Marius Bakke 2021-07-18 13:43:16 +02:00
parent d672c57a77
commit 9840ec8cab
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA

View file

@ -123,20 +123,19 @@ (define-public perl
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(add-before 'configure 'setup-configure (add-before 'configure 'setup-configure
(lambda _ (lambda* (#:key inputs #:allow-other-keys)
;; Use the right path for `pwd'. (let ((coreutils (or (assoc-ref inputs "coreutils-minimal")
;; TODO: use coreutils from INPUTS instead of 'which' (assoc-ref inputs "coreutils"))))
;; in next rebuild cycle, see fixup below. ;; Use the right path for `pwd'.
(substitute* "dist/PathTools/Cwd.pm" (substitute* "dist/PathTools/Cwd.pm"
(("/bin/pwd") (("'/bin/pwd'")
(which "pwd"))) (string-append "'" coreutils "/bin/pwd'")))
;; Build in GNU89 mode to tolerate C++-style comment in libc's ;; Build in GNU89 mode to tolerate C++-style comment in libc's
;; <bits/string3.h>. ;; <bits/string3.h>.
(substitute* "cflags.SH" (substitute* "cflags.SH"
(("-std=c89") (("-std=c89")
"-std=gnu89")) "-std=gnu89")))))
#t))
,@(if (%current-target-system) ,@(if (%current-target-system)
`((add-after 'unpack 'unpack-cross `((add-after 'unpack 'unpack-cross
(lambda* (#:key native-inputs inputs #:allow-other-keys) (lambda* (#:key native-inputs inputs #:allow-other-keys)
@ -155,8 +154,7 @@ (define-public perl
(("! */bin/sh") (string-append "! " bash "/bin/bash")) (("! */bin/sh") (string-append "! " bash "/bin/bash"))
((" /bin/sh") (string-append bash "/bin/bash"))) ((" /bin/sh") (string-append bash "/bin/bash")))
(substitute* '("ext/Errno/Errno_pm.PL") (substitute* '("ext/Errno/Errno_pm.PL")
(("\\$cpp < errno.c") "$Config{cc} -E errno.c"))) (("\\$cpp < errno.c") "$Config{cc} -E errno.c")))))
#t))
(replace 'configure (replace 'configure
(lambda* (#:key configure-flags outputs inputs #:allow-other-keys) (lambda* (#:key configure-flags outputs inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
@ -172,22 +170,18 @@ (define-public perl
(lambda (x) (or (string-prefix? "-d" x) (lambda (x) (or (string-prefix? "-d" x)
(string-prefix? "-Dcc=" x)))) (string-prefix? "-Dcc=" x))))
configure-flags))) configure-flags)))
(bash (assoc-ref inputs "bash")) (bash (assoc-ref inputs "bash")))
(coreutils (assoc-ref inputs "coreutils")))
(format (current-error-port) (format (current-error-port)
"running ./configure ~a\n" (string-join configure-flags)) "running ./configure ~a\n"
(string-join configure-flags))
(apply invoke (cons "./configure" configure-flags)) (apply invoke (cons "./configure" configure-flags))
(substitute* "config.sh" (substitute* "config.sh"
(((string-append store-directory "/[^/]*-bash-[^/]*")) (((string-append store-directory "/[^/]*-bash-[^/]*"))
bash)) bash))
(substitute* '("config.h") (substitute* '("config.h")
(("^#define SH_PATH .*") (("^#define SH_PATH .*")
(string-append "#define SH_PATH \"" bash "/bin/bash\"\n"))) (string-append "#define SH_PATH \""
;;TODO: fix this in setup-configure next rebuild cycle bash "/bin/bash\"\n"))))))
(substitute* "dist/PathTools/Cwd.pm"
(((string-append store-directory "/[^/]*-coreutils-[^/]*"))
coreutils))
#t)))
(add-after 'build 'touch-non-built-files-for-install (add-after 'build 'touch-non-built-files-for-install
(lambda _ (lambda _
;; `make install' wants to install these although they do ;; `make install' wants to install these although they do
@ -201,8 +195,7 @@ (define-public perl
'("Pod-Usage/blib/script/pod2text" '("Pod-Usage/blib/script/pod2text"
"Pod-Usage/blib/script/pod2usage" "Pod-Usage/blib/script/pod2usage"
"Pod-Checker/blib/script/podchecker" "Pod-Checker/blib/script/podchecker"
"Pod-Parser/blib/script/podselect"))) "Pod-Parser/blib/script/podselect"))))))
#t)))
`((replace 'configure `((replace 'configure
(lambda* (#:key configure-flags #:allow-other-keys) (lambda* (#:key configure-flags #:allow-other-keys)
(format #t "Perl configure flags: ~s~%" configure-flags) (format #t "Perl configure flags: ~s~%" configure-flags)
@ -233,13 +226,12 @@ (define-public perl
(("libpth => .*$") (("libpth => .*$")
(string-append "libpth => '" libc (string-append "libpth => '" libc
"/lib',\n")))) "/lib',\n"))))
config2) config2)))))))
#t))))))
(inputs (inputs
(if (%current-target-system) (append (list coreutils-minimal)
`(("bash" ,bash-minimal) (if (%current-target-system)
("coreutils" ,coreutils)) (list bash-minimal)
'())) '())))
(native-inputs (native-inputs
(if (%current-target-system) (if (%current-target-system)
`(("perl-cross" `(("perl-cross"