gnu: automake: Use 'modify-phases'.

* gnu/packages/autotools.scm (automake)[arguments]: Use 'modify-phases'
syntax.
This commit is contained in:
Efraim Flashner 2017-10-18 16:30:20 +03:00
parent 79272039a9
commit 759807e872
No known key found for this signature in database
GPG Key ID: 41AAE7DCCA3D8351
1 changed files with 38 additions and 38 deletions

View File

@ -267,47 +267,47 @@ output is indexed in many ways to simplify browsing.")
(srfi srfi-1) (srfi srfi-1)
(srfi srfi-26) (srfi srfi-26)
(rnrs io ports)) (rnrs io ports))
#:phases (alist-cons-before #:phases
'patch-source-shebangs 'patch-tests-shebangs (modify-phases %standard-phases
(lambda _ (add-before 'patch-source-shebangs 'patch-tests-shebangs
(let ((sh (which "sh"))) (lambda _
(substitute* (find-files "t" "\\.(sh|tap)$") (let ((sh (which "sh")))
(("#![[:blank:]]?/bin/sh") (substitute* (find-files "t" "\\.(sh|tap)$")
(string-append "#!" sh))) (("#![[:blank:]]?/bin/sh")
(string-append "#!" sh)))
;; Set these variables for all the `configure' runs ;; Set these variables for all the `configure' runs
;; that occur during the test suite. ;; that occur during the test suite.
(setenv "SHELL" sh) (setenv "SHELL" sh)
(setenv "CONFIG_SHELL" sh))) (setenv "CONFIG_SHELL" sh)
#t)))
;; Files like `install-sh', `mdate.sh', etc. must use ;; Files like `install-sh', `mdate.sh', etc. must use
;; #!/bin/sh, otherwise users could leak erroneous shebangs ;; #!/bin/sh, otherwise users could leak erroneous shebangs
;; in the wild. See <http://bugs.gnu.org/14201> for an ;; in the wild. See <http://bugs.gnu.org/14201> for an
;; example. ;; example.
(alist-cons-after (add-after 'install 'unpatch-shebangs
'install 'unpatch-shebangs (lambda* (#:key outputs #:allow-other-keys)
(lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out"))
(let* ((out (assoc-ref outputs "out")) (dir (string-append out "/share")))
(dir (string-append out "/share"))) (define (starts-with-shebang? file)
(define (starts-with-shebang? file) (equal? (call-with-input-file file
(equal? (call-with-input-file file (lambda (p)
(lambda (p) (list (get-u8 p) (get-u8 p))))
(list (get-u8 p) (get-u8 p)))) (map char->integer '(#\# #\!))))
(map char->integer '(#\# #\!))))
(for-each (lambda (file) (for-each (lambda (file)
(when (and (starts-with-shebang? file) (when (and (starts-with-shebang? file)
(executable-file? file)) (executable-file? file))
(format #t "restoring shebang on `~a'~%" (format #t "restoring shebang on `~a'~%"
file) file)
(substitute* file (substitute* file
(("^#!.*/bin/sh") (("^#!.*/bin/sh")
"#!/bin/sh") "#!/bin/sh")
(("^#!.*/bin/env(.*)$" _ args) (("^#!.*/bin/env(.*)$" _ args)
(string-append "#!/usr/bin/env" (string-append "#!/usr/bin/env"
args))))) args)))))
(find-files dir ".*")))) (find-files dir ".*"))))))))
%standard-phases))))
(home-page "https://www.gnu.org/software/automake/") (home-page "https://www.gnu.org/software/automake/")
(synopsis "Making GNU standards-compliant Makefiles") (synopsis "Making GNU standards-compliant Makefiles")
(description (description