build-system/gnu: Patch /usr/bin/file in all 'configure' files.
* guix/build/utils.scm (patch-/usr/bin/file): New procedure. * guix/build/gnu-build-system.scm (patch-usr-bin-file): Rewrite using it. Patch all the files returned by 'find-files' that are executable. * gnu/packages/gawk.scm (gawk)[arguments]: Remove use of 'substitute*' for 'extension/configure'.
This commit is contained in:
parent
aa1e19477b
commit
4eb01e5442
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
|
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
|
@ -55,14 +55,6 @@
|
||||||
'((substitute* "extension/Makefile.in"
|
'((substitute* "extension/Makefile.in"
|
||||||
(("^.*: check-for-shared-lib-support" match)
|
(("^.*: check-for-shared-lib-support" match)
|
||||||
(string-append "### " match))))
|
(string-append "### " match))))
|
||||||
'())
|
|
||||||
|
|
||||||
;; XXX FIXME prerelease libtool fails on MIPS in the
|
|
||||||
;; absence of /usr/bin/file.
|
|
||||||
,@(if (string-prefix? "mips64" (or (%current-target-system)
|
|
||||||
(%current-system)))
|
|
||||||
'((substitute* "extension/configure"
|
|
||||||
(("/usr/bin/file") (which "file"))))
|
|
||||||
'())))
|
'())))
|
||||||
|
|
||||||
(alist-cons-before
|
(alist-cons-before
|
||||||
|
|
|
@ -115,29 +115,15 @@ working directory."
|
||||||
(define* (patch-usr-bin-file #:key native-inputs inputs
|
(define* (patch-usr-bin-file #:key native-inputs inputs
|
||||||
(patch-/usr/bin/file? #t)
|
(patch-/usr/bin/file? #t)
|
||||||
#:allow-other-keys)
|
#:allow-other-keys)
|
||||||
"Patch occurrences of /usr/bin/file in configure, if present."
|
"Patch occurrences of \"/usr/bin/file\" in all the executable 'configure'
|
||||||
|
files found in the source tree. This works around Libtool's Autoconf macros,
|
||||||
|
which generates invocations of \"/usr/bin/file\" that are used to determine
|
||||||
|
things like the ABI being used."
|
||||||
(when patch-/usr/bin/file?
|
(when patch-/usr/bin/file?
|
||||||
(let ((file "configure")
|
(for-each (lambda (file)
|
||||||
(file-command (or (and=> (assoc-ref (or native-inputs inputs) "file")
|
(when (executable-file? file)
|
||||||
(cut string-append <> "/bin/file"))
|
(patch-/usr/bin/file file)))
|
||||||
(which "file"))))
|
(find-files "." "^configure$")))
|
||||||
(cond ((not (file-exists? file))
|
|
||||||
(format (current-error-port)
|
|
||||||
"patch-usr-bin-file: warning: `~a' not found~%"
|
|
||||||
file))
|
|
||||||
((not file-command)
|
|
||||||
(format (current-error-port)
|
|
||||||
"patch-usr-bin-file: warning: `file' not found in PATH~%"))
|
|
||||||
(else
|
|
||||||
(let ((st (stat file)))
|
|
||||||
(substitute* file
|
|
||||||
(("/usr/bin/file")
|
|
||||||
(begin
|
|
||||||
(format (current-error-port)
|
|
||||||
"patch-usr-bin-file: ~a: changing `~a' to `~a'~%"
|
|
||||||
file "/usr/bin/file" file-command)
|
|
||||||
file-command)))
|
|
||||||
(set-file-time file st))))))
|
|
||||||
#t)
|
#t)
|
||||||
|
|
||||||
(define* (patch-source-shebangs #:key source #:allow-other-keys)
|
(define* (patch-source-shebangs #:key source #:allow-other-keys)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
|
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
|
||||||
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
|
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
|
||||||
;;;
|
;;;
|
||||||
|
@ -61,6 +61,7 @@
|
||||||
set-file-time
|
set-file-time
|
||||||
patch-shebang
|
patch-shebang
|
||||||
patch-makefile-SHELL
|
patch-makefile-SHELL
|
||||||
|
patch-/usr/bin/file
|
||||||
fold-port-matches
|
fold-port-matches
|
||||||
remove-store-references
|
remove-store-references
|
||||||
wrap-program))
|
wrap-program))
|
||||||
|
@ -681,6 +682,29 @@ When KEEP-MTIME? is true, the atime/mtime of FILE are kept unchanged."
|
||||||
(when keep-mtime?
|
(when keep-mtime?
|
||||||
(set-file-time file st))))
|
(set-file-time file st))))
|
||||||
|
|
||||||
|
(define* (patch-/usr/bin/file file
|
||||||
|
#:key
|
||||||
|
(file-command (which "file"))
|
||||||
|
(keep-mtime? #t))
|
||||||
|
"Patch occurrences of \"/usr/bin/file\" in FILE, replacing them with
|
||||||
|
FILE-COMMAND. When KEEP-MTIME? is true, keep FILE's modification time
|
||||||
|
unchanged."
|
||||||
|
(if (not file-command)
|
||||||
|
(format (current-error-port)
|
||||||
|
"patch-/usr/bin/file: warning: \
|
||||||
|
no replacement 'file' command, doing nothing~%")
|
||||||
|
(let ((st (stat file)))
|
||||||
|
(substitute* file
|
||||||
|
(("/usr/bin/file")
|
||||||
|
(begin
|
||||||
|
(format (current-error-port)
|
||||||
|
"patch-/usr/bin/file: ~a: changing `~a' to `~a'~%"
|
||||||
|
file "/usr/bin/file" file-command)
|
||||||
|
file-command)))
|
||||||
|
|
||||||
|
(when keep-mtime?
|
||||||
|
(set-file-time file st)))))
|
||||||
|
|
||||||
(define* (fold-port-matches proc init pattern port
|
(define* (fold-port-matches proc init pattern port
|
||||||
#:optional (unmatched (lambda (_ r) r)))
|
#:optional (unmatched (lambda (_ r) r)))
|
||||||
"Read from PORT character-by-character; for each match against
|
"Read from PORT character-by-character; for each match against
|
||||||
|
|
Loading…
Reference in New Issue