summary refs log tree commit diff
path: root/distro/base.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-09-01 19:21:06 +0200
committerLudovic Courtès <ludo@gnu.org>2012-09-01 19:21:31 +0200
commit8197c978efb3fff61db42e80dd7358e7ee15bf20 (patch)
treee3fb53962dc1cf64d4fd2243474e04b8c6505e4a /distro/base.scm
parent9dd036f35c9a825c30aecc9eb3a3f6266481cfe3 (diff)
downloadguix-8197c978efb3fff61db42e80dd7358e7ee15bf20.tar.gz
utils: Change `substitute*' to allow iteration over several matches.
* guix/build/utils.scm (substitute): Do not pass the OUT to PROC; use
  `list-matches' instead of `regexp-exec' and pass a list of matches to
  PROC. Expect PROC to return a string, and output that.  Fold over
  RX+PROC in order.  Use `(read-line p 'concat)' to include the trailing
  delimiter in LINE.
  (substitute*): Produce code to iterate over the matches, and return a
  string, which includes anything from the original line that's in
  between matches.

* distro/base.scm (gcc-4.7, glibc): Adjust accordingly: remove use
  of (ice-9 regex) and `regexp-substitute/global'; return a string.
Diffstat (limited to 'distro/base.scm')
-rw-r--r--distro/base.scm25
1 files changed, 6 insertions, 19 deletions
diff --git a/distro/base.scm b/distro/base.scm
index c3a6846581..7ff15ad2eb 100644
--- a/distro/base.scm
+++ b/distro/base.scm
@@ -588,10 +588,7 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
                ("mpfr" ,mpfr)
                ("mpc" ,mpc)))           ; TODO: libelf, ppl, cloog, zlib, etc.
      (arguments
-      `(#:modules ((guix build utils)
-                   (guix build gnu-build-system)
-                   (ice-9 regex))                 ; we need this one
-        #:out-of-source? #t
+      `(#:out-of-source? #t
         #:strip-binaries? ,stripped?
         #:configure-flags
         `("--enable-plugin"
@@ -639,12 +636,8 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
                (("#define LIB_SPEC (.*)$" _ suffix)
                 (format #f "#define LIB_SPEC \"-L~a/lib -rpath=~a/lib64 -rpath=~a/lib \" ~a~%"
                         libc out out suffix))
-               (("^.*crt([^\\.])\\.o.*$" line)
-                (regexp-substitute/global #f
-                                          "([a-zA-Z]?)crt([^\\.])\\.o"
-                                          (string-append line "\n")
-                                          'pre libc "/lib/" 1 "crt" 2 ".o"
-                                          'post)))))
+               (("([^ ]*)crt([^\\.])\\.o" _ prefix suffix)
+                (string-append libc "/lib/" prefix "crt" suffix ".o")))))
          (alist-cons-after
           'configure 'post-configure
           (lambda _
@@ -1121,10 +1114,7 @@ call interface, and powerful string processing.")
    (build-system gnu-build-system)
    (native-inputs `(("linux-headers" ,linux-headers)))
    (arguments
-    `(#:modules ((guix build utils)
-                 (guix build gnu-build-system)
-                 (ice-9 regex))
-      #:out-of-source? #t
+    `(#:out-of-source? #t
       #:configure-flags
       (list "--enable-add-ons"
             "--sysconfdir=/etc"
@@ -1145,13 +1135,10 @@ call interface, and powerful string processing.")
                   (let ((out (assoc-ref outputs "out")))
                     ;; Use `pwd', not `/bin/pwd'.
                     (substitute* "configure"
-                      (("^.*/bin/pwd.*$" line)
-                       (regexp-substitute/global #f
-                                                 "/bin/pwd"
-                                                 (string-append line "\n")
-                                                 'pre "pwd" 'post)))
+                      (("/bin/pwd" _) "pwd"))
 
                     ;; Install the rpc data base file under `$out/etc/rpc'.
+                    ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
                     (substitute* "sunrpc/Makefile"
                       (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
                        (string-append out "/etc/rpc" suffix "\n"))