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:
Ludovic Courtès 2012-10-26 09:07:37 +02:00
parent 450ccdc3aa
commit 20d83444dd
2 changed files with 44 additions and 36 deletions

View File

@ -759,7 +759,7 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
;; Tell where to find libstdc++, libc, and `?crt*.o', except
;; `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-user64.h")
(("#define LIB_SPEC (.*)$" _ suffix)
@ -2310,7 +2310,7 @@ store.")
;; The `-all-static' libtool flag can only be passed
;; after `configure', since configure tests don't use
;; libtool, and only for executables built with libtool.
(substitute* ("binutils/Makefile.in"
(substitute* '("binutils/Makefile.in"
"gas/Makefile.in"
"ld/Makefile.in")
(("^LDFLAGS =(.*)$" line)

View File

@ -323,13 +323,15 @@ the complete match, LETTERS is bound to the first sub-expression, and END is
bound to the last one.
When one of the MATCH-VAR is `_', no variable is bound to the corresponding
match substring."
((substitute* (file ...) clause ...)
(begin
(substitute* file clause ...)
...))
match substring.
Alternatively, FILE may be a list of file names, in which case they are
all subject to the substitutions."
((substitute* file ((regexp match-var ...) body ...) ...)
(substitute file
(let ()
(define (substitute-one-file file-name)
(substitute
file-name
(list (cons regexp
(lambda (l m+)
;; Iterate over matches M+ and return the
@ -349,7 +351,13 @@ match substring."
(begin body ...)
(substring l o (match:start m))
r))))))))
...)))))
...)))
(match file
((files (... ...))
(for-each substitute-one-file files))
((? string? f)
(substitute-one-file f)))))))
;;;