utils: Remove special `substitute*' syntax for lists of files.
* guix/build/utils.scm (substitute*): Remove special syntax for list-of-files; instead, check whether FILE is `list?' at run time. * distro/packages/base.scm (gcc-4.7, %binutils-static): Adjust accordingly.
This commit is contained in:
parent
450ccdc3aa
commit
20d83444dd
|
@ -759,9 +759,9 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
|
||||||
|
|
||||||
;; Tell where to find libstdc++, libc, and `?crt*.o', except
|
;; Tell where to find libstdc++, libc, and `?crt*.o', except
|
||||||
;; `crt{begin,end}.o', which come with GCC.
|
;; `crt{begin,end}.o', which come with GCC.
|
||||||
(substitute* ("gcc/config/gnu-user.h"
|
(substitute* '("gcc/config/gnu-user.h"
|
||||||
"gcc/config/i386/gnu-user.h"
|
"gcc/config/i386/gnu-user.h"
|
||||||
"gcc/config/i386/gnu-user64.h")
|
"gcc/config/i386/gnu-user64.h")
|
||||||
(("#define LIB_SPEC (.*)$" _ suffix)
|
(("#define LIB_SPEC (.*)$" _ suffix)
|
||||||
(format #f "#define LIB_SPEC \"-L~a/lib -rpath=~a/lib \
|
(format #f "#define LIB_SPEC \"-L~a/lib -rpath=~a/lib \
|
||||||
-rpath=~a/lib64 -rpath=~a/lib \" ~a~%"
|
-rpath=~a/lib64 -rpath=~a/lib \" ~a~%"
|
||||||
|
@ -2310,9 +2310,9 @@ store.")
|
||||||
;; The `-all-static' libtool flag can only be passed
|
;; The `-all-static' libtool flag can only be passed
|
||||||
;; after `configure', since configure tests don't use
|
;; after `configure', since configure tests don't use
|
||||||
;; libtool, and only for executables built with libtool.
|
;; libtool, and only for executables built with libtool.
|
||||||
(substitute* ("binutils/Makefile.in"
|
(substitute* '("binutils/Makefile.in"
|
||||||
"gas/Makefile.in"
|
"gas/Makefile.in"
|
||||||
"ld/Makefile.in")
|
"ld/Makefile.in")
|
||||||
(("^LDFLAGS =(.*)$" line)
|
(("^LDFLAGS =(.*)$" line)
|
||||||
(string-append line
|
(string-append line
|
||||||
"\nAM_LDFLAGS = -static -all-static\n"))))
|
"\nAM_LDFLAGS = -static -all-static\n"))))
|
||||||
|
|
|
@ -312,10 +312,10 @@ evaluated with each MATCH-VAR bound to the corresponding positional regexp
|
||||||
sub-expression. For example:
|
sub-expression. For example:
|
||||||
|
|
||||||
(substitute* file
|
(substitute* file
|
||||||
((\"hello\")
|
((\"hello\")
|
||||||
\"good morning\\n\")
|
\"good morning\\n\")
|
||||||
((\"foo([a-z]+)bar(.*)$\" all letters end)
|
((\"foo([a-z]+)bar(.*)$\" all letters end)
|
||||||
(string-append \"baz\" letter end)))
|
(string-append \"baz\" letter end)))
|
||||||
|
|
||||||
Here, anytime a line of FILE contains \"hello\", it is replaced by \"good
|
Here, anytime a line of FILE contains \"hello\", it is replaced by \"good
|
||||||
morning\". Anytime a line of FILE matches the second regexp, ALL is bound to
|
morning\". Anytime a line of FILE matches the second regexp, ALL is bound to
|
||||||
|
@ -323,33 +323,41 @@ the complete match, LETTERS is bound to the first sub-expression, and END is
|
||||||
bound to the last one.
|
bound to the last one.
|
||||||
|
|
||||||
When one of the MATCH-VAR is `_', no variable is bound to the corresponding
|
When one of the MATCH-VAR is `_', no variable is bound to the corresponding
|
||||||
match substring."
|
match substring.
|
||||||
((substitute* (file ...) clause ...)
|
|
||||||
(begin
|
Alternatively, FILE may be a list of file names, in which case they are
|
||||||
(substitute* file clause ...)
|
all subject to the substitutions."
|
||||||
...))
|
|
||||||
((substitute* file ((regexp match-var ...) body ...) ...)
|
((substitute* file ((regexp match-var ...) body ...) ...)
|
||||||
(substitute file
|
(let ()
|
||||||
(list (cons regexp
|
(define (substitute-one-file file-name)
|
||||||
(lambda (l m+)
|
(substitute
|
||||||
;; Iterate over matches M+ and return the
|
file-name
|
||||||
;; modified line based on L.
|
(list (cons regexp
|
||||||
(let loop ((m* m+) ; matches
|
(lambda (l m+)
|
||||||
(o 0) ; offset in L
|
;; Iterate over matches M+ and return the
|
||||||
(r '())) ; result
|
;; modified line based on L.
|
||||||
(match m*
|
(let loop ((m* m+) ; matches
|
||||||
(()
|
(o 0) ; offset in L
|
||||||
(let ((r (cons (substring l o) r)))
|
(r '())) ; result
|
||||||
(string-concatenate-reverse r)))
|
(match m*
|
||||||
((m . rest)
|
(()
|
||||||
(let-matches 0 m (match-var ...)
|
(let ((r (cons (substring l o) r)))
|
||||||
(loop rest
|
(string-concatenate-reverse r)))
|
||||||
(match:end m)
|
((m . rest)
|
||||||
(cons*
|
(let-matches 0 m (match-var ...)
|
||||||
(begin body ...)
|
(loop rest
|
||||||
(substring l o (match:start m))
|
(match:end m)
|
||||||
r))))))))
|
(cons*
|
||||||
...)))))
|
(begin body ...)
|
||||||
|
(substring l o (match:start m))
|
||||||
|
r))))))))
|
||||||
|
...)))
|
||||||
|
|
||||||
|
(match file
|
||||||
|
((files (... ...))
|
||||||
|
(for-each substitute-one-file files))
|
||||||
|
((? string? f)
|
||||||
|
(substitute-one-file f)))))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
|
Loading…
Reference in New Issue