aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-01-23 23:21:59 +0100
committerLudovic Courtès <ludo@gnu.org>2013-01-23 23:33:09 +0100
commit21c203a53a617962586ef645b22f80814b05fd65 (patch)
tree7536f5bcbec7e749164155e74ee8784afe02a202
parent9c9da07f4c28192a05b3a88c7d5d1817ea392d79 (diff)
downloadpatches-21c203a53a617962586ef645b22f80814b05fd65.tar
patches-21c203a53a617962586ef645b22f80814b05fd65.tar.gz
packages: Mark the `arguments' field of <package> as thunked.
* guix/packages.scm (<package>): Mark `arguments' as thunked. (package-derivation): Adjust accordingly. Parameterize %CURRENT-SYSTEM to SYSTEM, so that arguments can refer to it. * guix/build-system/gnu.scm (package-with-explicit-inputs): Expect `package-arguments' to always return a list, and return a list. (package-with-extra-configure-variable): Likewise. (static-package): Likewise. * gnu/packages/base.scm (patch, findutils, gcc-4.7, binutils-boot0, gcc-boot0, glibc-final-with-bootstrap-bash, cross-gcc-wrapper, static-bash-for-glibc, binutils-final, gcc-final): Change `arguments' from a lambda to a list, and use (%current-system) as needed. (nix-system->gnu-triplet, boot-triplet): Have the first argument default to (%current-system). * gnu/packages/bootstrap.scm (glibc-dynamic-linker): Have `system' default to (%current-system). (%bootstrap-gcc): Change `arguments' to a list. * gnu/packages/gawk.scm (gawk): Likewise. * gnu/packages/m4.scm (m4): Likewise. * gnu/packages/make-bootstrap.scm (%glibc-for-bootstrap): Likewise, and expect `package-arguments' to return a list. (%static-inputs, %gcc-static, tarball-package): Likewise. * gnu/packages/ncurses.scm (ncurses): Likewise.
-rw-r--r--gnu/packages/base.scm487
-rw-r--r--gnu/packages/bootstrap.scm61
-rw-r--r--gnu/packages/gawk.scm28
-rw-r--r--gnu/packages/m4.scm52
-rw-r--r--gnu/packages/make-bootstrap.scm127
-rw-r--r--gnu/packages/ncurses.scm48
-rw-r--r--guix/build-system/gnu.scm63
-rw-r--r--guix/packages.scm40
8 files changed, 432 insertions, 474 deletions
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 4764039afd..23bf00b241 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -162,10 +162,10 @@ files (as archives).")
(build-system gnu-build-system)
(native-inputs '()) ; FIXME: needs `ed' for the tests
(arguments
- (case-lambda
- ((system) '(#:tests? #f))
- ((system cross-system)
- '(#:configure-flags '("ac_cv_func_strnlen_working=yes")))))
+ '(#:tests? #f)
+ ;; TODO: When cross-compiling, add this:
+ ;; '(#:configure-flags '("ac_cv_func_strnlen_working=yes"))
+ )
(synopsis "GNU Patch, a program to apply differences to files")
(description
"GNU Patch takes a patch file containing a difference listing produced by
@@ -235,14 +235,13 @@ You can use the sdiff command to merge two files interactively.")
`(("patch/absolute-paths"
,(search-patch "findutils-absolute-paths.patch"))))
(arguments
- (case-lambda
- ((system)
- `(#:patches (list (assoc-ref %build-inputs "patch/absolute-paths"))))
- ((system cross-system)
- ;; Work around cross-compilation failure.
- ;; See <http://savannah.gnu.org/bugs/?27299#comment1>.
- `(#:configure-flags '("gl_cv_func_wcwidth_works=yes")
- ,@(arguments cross-system)))))
+ `(#:patches (list (assoc-ref %build-inputs "patch/absolute-paths")))
+
+ ;; TODO: Work around cross-compilation failure.
+ ;; See <http://savannah.gnu.org/bugs/?27299#comment1>.
+ ;; `(#:configure-flags '("gl_cv_func_wcwidth_works=yes")
+ ;; ,@(arguments cross-system))
+ )
(synopsis "Basic directory searching utilities of the GNU operating
system")
(description
@@ -396,90 +395,89 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
("mpfr" ,mpfr)
("mpc" ,mpc))) ; TODO: libelf, ppl, cloog, zlib, etc.
(arguments
- (lambda (system)
- `(#:out-of-source? #t
- #:strip-binaries? ,stripped?
- #:configure-flags
- `("--enable-plugin"
- "--enable-languages=c,c++"
- "--disable-multilib"
-
- "--with-local-prefix=/no-gcc-local-prefix"
-
- ,(let ((libc (assoc-ref %build-inputs "libc")))
- (if libc
- (string-append "--with-native-system-header-dir=" libc
- "/include")
- "--without-headers")))
- #:make-flags
- (let ((libc (assoc-ref %build-inputs "libc")))
- `(,@(if libc
- (list (string-append "LDFLAGS_FOR_BUILD="
- "-L" libc "/lib "
- "-Wl,-dynamic-linker "
- "-Wl," libc
- ,(glibc-dynamic-linker system)))
- '())
- ,(string-append "BOOT_CFLAGS=-O2 "
- ,(if stripped? "-g0" "-g"))))
-
- #:tests? #f
- #:phases
- (alist-cons-before
- 'configure 'pre-configure
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (libc (assoc-ref inputs "libc")))
- (when libc
- ;; The following is not performed for `--without-headers'
- ;; cross-compiler builds.
-
- ;; Fix the dynamic linker's file name.
- (substitute* (find-files "gcc/config"
- "^linux(64|-elf)?\\.h$")
- (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
- (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
- suffix
- (string-append libc ,(glibc-dynamic-linker system)))))
-
- ;; Tell where to find libstdc++, libc, and `?crt*.o', except
- ;; `crt{begin,end}.o', which come with GCC.
- (substitute* (find-files "gcc/config"
- "^(gnu-user(64)?|linux-elf)\\.h$")
- (("#define LIB_SPEC (.*)$" _ suffix)
- ;; Note that with this "lib" spec, we may still add a
- ;; RUNPATH to GCC even when `libgcc_s' is not NEEDED.
- ;; There's not much that can be done to avoid it, though.
- (format #f "#define LIB_SPEC \"-L~a/lib %{!static:-rpath=~a/lib \
+ `(#:out-of-source? #t
+ #:strip-binaries? ,stripped?
+ #:configure-flags
+ `("--enable-plugin"
+ "--enable-languages=c,c++"
+ "--disable-multilib"
+
+ "--with-local-prefix=/no-gcc-local-prefix"
+
+ ,(let ((libc (assoc-ref %build-inputs "libc")))
+ (if libc
+ (string-append "--with-native-system-header-dir=" libc
+ "/include")
+ "--without-headers")))
+ #:make-flags
+ (let ((libc (assoc-ref %build-inputs "libc")))
+ `(,@(if libc
+ (list (string-append "LDFLAGS_FOR_BUILD="
+ "-L" libc "/lib "
+ "-Wl,-dynamic-linker "
+ "-Wl," libc
+ ,(glibc-dynamic-linker)))
+ '())
+ ,(string-append "BOOT_CFLAGS=-O2 "
+ ,(if stripped? "-g0" "-g"))))
+
+ #:tests? #f
+ #:phases
+ (alist-cons-before
+ 'configure 'pre-configure
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (libc (assoc-ref inputs "libc")))
+ (when libc
+ ;; The following is not performed for `--without-headers'
+ ;; cross-compiler builds.
+
+ ;; Fix the dynamic linker's file name.
+ (substitute* (find-files "gcc/config"
+ "^linux(64|-elf)?\\.h$")
+ (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
+ (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
+ suffix
+ (string-append libc ,(glibc-dynamic-linker)))))
+
+ ;; Tell where to find libstdc++, libc, and `?crt*.o', except
+ ;; `crt{begin,end}.o', which come with GCC.
+ (substitute* (find-files "gcc/config"
+ "^(gnu-user(64)?|linux-elf)\\.h$")
+ (("#define LIB_SPEC (.*)$" _ suffix)
+ ;; Note that with this "lib" spec, we may still add a
+ ;; RUNPATH to GCC even when `libgcc_s' is not NEEDED.
+ ;; There's not much that can be done to avoid it, though.
+ (format #f "#define LIB_SPEC \"-L~a/lib %{!static:-rpath=~a/lib \
%{!static-libgcc:-rpath=~a/lib64 -rpath=~a/lib}} \" ~a~%"
- libc libc out out suffix))
- (("#define STARTFILE_SPEC.*$" line)
- (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
+ libc libc out out suffix))
+ (("#define STARTFILE_SPEC.*$" line)
+ (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
#define STANDARD_STARTFILE_PREFIX_2 \"\"
~a~%"
- libc line))))
-
- ;; Don't retain a dependency on the build-time sed.
- (substitute* "fixincludes/fixincl.x"
- (("static char const sed_cmd_z\\[\\] =.*;")
- "static char const sed_cmd_z[] = \"sed\";"))))
-
- (alist-cons-after
- 'configure 'post-configure
- (lambda _
- ;; Don't store configure flags, to avoid retaining references to
- ;; build-time dependencies---e.g., `--with-ppl=/nix/store/xxx'.
- (substitute* "Makefile"
- (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
- "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))
- (alist-replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (zero?
- (system* "make"
- ,(if stripped?
- "install-strip"
- "install"))))
- %standard-phases))))))
+ libc line))))
+
+ ;; Don't retain a dependency on the build-time sed.
+ (substitute* "fixincludes/fixincl.x"
+ (("static char const sed_cmd_z\\[\\] =.*;")
+ "static char const sed_cmd_z[] = \"sed\";"))))
+
+ (alist-cons-after
+ 'configure 'post-configure
+ (lambda _
+ ;; Don't store configure flags, to avoid retaining references to
+ ;; build-time dependencies---e.g., `--with-ppl=/nix/store/xxx'.
+ (substitute* "Makefile"
+ (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
+ "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))
+ (alist-replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (zero?
+ (system* "make"
+ ,(if stripped?
+ "install-strip"
+ "install"))))
+ %standard-phases)))))
(properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
(synopsis "The GNU Compiler Collection")
@@ -653,7 +651,8 @@ with the Linux kernel.")
("findutils" ,findutils-boot0)
,@%bootstrap-inputs))
-(define* (nix-system->gnu-triplet system #:optional (vendor "unknown"))
+(define* (nix-system->gnu-triplet
+ #:optional (system (%current-system)) (vendor "unknown"))
"Return an a guess of the GNU triplet corresponding to Nix system
identifier SYSTEM."
(let* ((dash (string-index system #\-))
@@ -665,10 +664,10 @@ identifier SYSTEM."
"linux-gnu"
os))))
-(define boot-triplet
+(define* (boot-triplet #:optional (system (%current-system)))
;; Return the triplet used to create the cross toolchain needed in the
;; first bootstrapping stage.
- (cut nix-system->gnu-triplet <> "guix"))
+ (nix-system->gnu-triplet system "guix"))
;; Following Linux From Scratch, build a cross-toolchain in stage 0. That
;; toolchain actually targets the same OS and arch, but it has the advantage
@@ -680,12 +679,11 @@ identifier SYSTEM."
(package (inherit binutils)
(name "binutils-cross-boot0")
(arguments
- (lambda (system)
- `(#:guile ,%bootstrap-guile
- #:implicit-inputs? #f
- ,@(substitute-keyword-arguments (package-arguments binutils)
- ((#:configure-flags cf)
- `(list ,(string-append "--target=" (boot-triplet system))))))))
+ `(#:guile ,%bootstrap-guile
+ #:implicit-inputs? #f
+ ,@(substitute-keyword-arguments (package-arguments binutils)
+ ((#:configure-flags cf)
+ `(list ,(string-append "--target=" (boot-triplet)))))))
(inputs %boot0-inputs))))
(define gcc-boot0
@@ -693,82 +691,80 @@ identifier SYSTEM."
(package (inherit gcc-4.7)
(name "gcc-cross-boot0")
(arguments
- (lambda (system)
- `(#:guile ,%bootstrap-guile
- #:implicit-inputs? #f
- #:modules ((guix build gnu-build-system)
- (guix build utils)
- (ice-9 regex)
- (srfi srfi-1)
- (srfi srfi-26))
- ,@(substitute-keyword-arguments ((package-arguments gcc-4.7) system)
- ((#:configure-flags flags)
- `(append (list ,(string-append "--target="
- (boot-triplet system))
-
- ;; No libc yet.
- "--without-headers"
-
- ;; Disable features not needed at this stage.
- "--disable-shared"
- "--enable-languages=c"
- "--disable-libmudflap"
- "--disable-libgomp"
- "--disable-libssp"
- "--disable-libquadmath"
- "--disable-decimal-float")
- (remove (cut string-match "--enable-languages.*" <>)
- ,flags)))
- ((#:phases phases)
- `(alist-cons-after
- 'unpack 'unpack-gmp&co
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((gmp (assoc-ref %build-inputs "gmp-source"))
- (mpfr (assoc-ref %build-inputs "mpfr-source"))
- (mpc (assoc-ref %build-inputs "mpc-source")))
-
- ;; To reduce the set of pre-built bootstrap inputs, build
- ;; GMP & co. from GCC.
- (for-each (lambda (source)
- (or (zero? (system* "tar" "xvf" source))
- (error "failed to unpack tarball"
- source)))
- (list gmp mpfr mpc))
-
- ;; Create symlinks like `gmp' -> `gmp-5.0.5'.
- ,@(map (lambda (lib)
- `(symlink ,(package-full-name lib)
- ,(package-name lib)))
- (list gmp mpfr mpc))
-
- ;; MPFR headers/lib are found under $(MPFR)/src, but
- ;; `configure' wrongfully tells MPC too look under
- ;; $(MPFR), so fix that.
- (substitute* "configure"
- (("extra_mpc_mpfr_configure_flags(.+)--with-mpfr-include=([^/]+)/mpfr(.*)--with-mpfr-lib=([^ ]+)/mpfr"
- _ equals include middle lib)
- (string-append "extra_mpc_mpfr_configure_flags" equals
- "--with-mpfr-include=" include
- "/mpfr/src" middle
- "--with-mpfr-lib=" lib
- "/mpfr/src"))
- (("gmpinc='-I([^ ]+)/mpfr -I([^ ]+)/mpfr" _ a b)
- (string-append "gmpinc='-I" a "/mpfr/src "
- "-I" b "/mpfr/src"))
- (("gmplibs='-L([^ ]+)/mpfr" _ a)
- (string-append "gmplibs='-L" a "/mpfr/src")))))
- (alist-cons-after
- 'install 'symlink-libgcc_eh
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
- ;; Glibc wants to link against libgcc_eh, so provide
- ;; it.
- (with-directory-excursion
- (string-append out "/lib/gcc/"
- ,(boot-triplet system)
- "/" ,(package-version gcc-4.7))
- (symlink "libgcc.a" "libgcc_eh.a"))))
- ,phases)))))))
+ `(#:guile ,%bootstrap-guile
+ #:implicit-inputs? #f
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 regex)
+ (srfi srfi-1)
+ (srfi srfi-26))
+ ,@(substitute-keyword-arguments (package-arguments gcc-4.7)
+ ((#:configure-flags flags)
+ `(append (list ,(string-append "--target=" (boot-triplet))
+
+ ;; No libc yet.
+ "--without-headers"
+
+ ;; Disable features not needed at this stage.
+ "--disable-shared"
+ "--enable-languages=c"
+ "--disable-libmudflap"
+ "--disable-libgomp"
+ "--disable-libssp"
+ "--disable-libquadmath"
+ "--disable-decimal-float")
+ (remove (cut string-match "--enable-languages.*" <>)
+ ,flags)))
+ ((#:phases phases)
+ `(alist-cons-after
+ 'unpack 'unpack-gmp&co
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((gmp (assoc-ref %build-inputs "gmp-source"))
+ (mpfr (assoc-ref %build-inputs "mpfr-source"))
+ (mpc (assoc-ref %build-inputs "mpc-source")))
+
+ ;; To reduce the set of pre-built bootstrap inputs, build
+ ;; GMP & co. from GCC.
+ (for-each (lambda (source)
+ (or (zero? (system* "tar" "xvf" source))
+ (error "failed to unpack tarball"
+ source)))
+ (list gmp mpfr mpc))
+
+ ;; Create symlinks like `gmp' -> `gmp-5.0.5'.
+ ,@(map (lambda (lib)
+ `(symlink ,(package-full-name lib)
+ ,(package-name lib)))
+ (list gmp mpfr mpc))
+
+ ;; MPFR headers/lib are found under $(MPFR)/src, but
+ ;; `configure' wrongfully tells MPC too look under
+ ;; $(MPFR), so fix that.
+ (substitute* "configure"
+ (("extra_mpc_mpfr_configure_flags(.+)--with-mpfr-include=([^/]+)/mpfr(.*)--with-mpfr-lib=([^ ]+)/mpfr"
+ _ equals include middle lib)
+ (string-append "extra_mpc_mpfr_configure_flags" equals
+ "--with-mpfr-include=" include
+ "/mpfr/src" middle
+ "--with-mpfr-lib=" lib
+ "/mpfr/src"))
+ (("gmpinc='-I([^ ]+)/mpfr -I([^ ]+)/mpfr" _ a b)
+ (string-append "gmpinc='-I" a "/mpfr/src "
+ "-I" b "/mpfr/src"))
+ (("gmplibs='-L([^ ]+)/mpfr" _ a)
+ (string-append "gmplibs='-L" a "/mpfr/src")))))
+ (alist-cons-after
+ 'install 'symlink-libgcc_eh
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ ;; Glibc wants to link against libgcc_eh, so provide
+ ;; it.
+ (with-directory-excursion
+ (string-append out "/lib/gcc/"
+ ,(boot-triplet)
+ "/" ,(package-version gcc-4.7))
+ (symlink "libgcc.a" "libgcc_eh.a"))))
+ ,phases))))))
(inputs `(("gmp-source" ,(package-source gmp))
("mpfr-source" ,(package-source mpfr))
@@ -812,20 +808,19 @@ identifier SYSTEM."
(package (inherit glibc)
(name "glibc-intermediate")
(arguments
- (lambda (system)
- `(#:guile ,%bootstrap-guile
- #:implicit-inputs? #f
-
- ,@(substitute-keyword-arguments (package-arguments glibc)
- ((#:configure-flags flags)
- `(append (list ,(string-append "--host=" (boot-triplet system))
- ,(string-append "--build="
- (nix-system->gnu-triplet system))
-
- ;; Build Sun/ONC RPC support. In particular,
- ;; install rpc/*.h.
- "--enable-obsolete-rpc")
- ,flags))))))
+ `(#:guile ,%bootstrap-guile
+ #:implicit-inputs? #f
+
+ ,@(substitute-keyword-arguments (package-arguments glibc)
+ ((#:configure-flags flags)
+ `(append (list ,(string-append "--host=" (boot-triplet))
+ ,(string-append "--build="
+ (nix-system->gnu-triplet))
+
+ ;; Build Sun/ONC RPC support. In particular,
+ ;; install rpc/*.h.
+ "--enable-obsolete-rpc")
+ ,flags)))))
(propagated-inputs `(("linux-headers" ,linux-libre-headers-boot0)))
(inputs
`( ;; A native GCC is needed to build `cross-rpcgen'.
@@ -847,40 +842,39 @@ that makes it available under the native tool names."
(source #f)
(build-system trivial-build-system)
(arguments
- (lambda (system)
- `(#:guile ,%bootstrap-guile
- #:modules ((guix build utils))
- #:builder (begin
- (use-modules (guix build utils))
-
- (let* ((binutils (assoc-ref %build-inputs "binutils"))
- (gcc (assoc-ref %build-inputs "gcc"))
- (libc (assoc-ref %build-inputs "libc"))
- (bash (assoc-ref %build-inputs "bash"))
- (out (assoc-ref %outputs "out"))
- (bindir (string-append out "/bin"))
- (triplet ,(boot-triplet system)))
- (mkdir-p bindir)
- (with-directory-excursion bindir
- (for-each (lambda (tool)
- (symlink (string-append binutils "/bin/"
- triplet "-" tool)
- tool))
- '("ar" "ranlib"))
-
- ;; GCC-BOOT0 is a libc-less cross-compiler, so it
- ;; needs to be told where to find the crt files and
- ;; the dynamic linker.
- (call-with-output-file "gcc"
- (lambda (p)
- (format p "#!~a/bin/bash
+ `(#:guile ,%bootstrap-guile
+ #:modules ((guix build utils))
+ #:builder (begin
+ (use-modules (guix build utils))
+
+ (let* ((binutils (assoc-ref %build-inputs "binutils"))
+ (gcc (assoc-ref %build-inputs "gcc"))
+ (libc (assoc-ref %build-inputs "libc"))
+ (bash (assoc-ref %build-inputs "bash"))
+ (out (assoc-ref %outputs "out"))
+ (bindir (string-append out "/bin"))
+ (triplet ,(boot-triplet)))
+ (mkdir-p bindir)
+ (with-directory-excursion bindir
+ (for-each (lambda (tool)
+ (symlink (string-append binutils "/bin/"
+ triplet "-" tool)
+ tool))
+ '("ar" "ranlib"))
+
+ ;; GCC-BOOT0 is a libc-less cross-compiler, so it
+ ;; needs to be told where to find the crt files and
+ ;; the dynamic linker.
+ (call-with-output-file "gcc"
+ (lambda (p)
+ (format p "#!~a/bin/bash
exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
- bash
- gcc triplet
- libc libc
- ,(glibc-dynamic-linker system))))
+ bash
+ gcc triplet
+ libc libc
+ ,(glibc-dynamic-linker))))
- (chmod "gcc" #o555)))))))
+ (chmod "gcc" #o555))))))
(native-inputs
`(("binutils" ,binutils)
("gcc" ,gcc)
@@ -896,9 +890,8 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(car (assoc-ref %boot1-inputs "bash"))))
(bash (package (inherit bash-light)
(arguments
- (lambda (system)
- `(#:guile ,%bootstrap-guile
- ,@(package-arguments bash-light)))))))
+ `(#:guile ,%bootstrap-guile
+ ,@(package-arguments bash-light))))))
(package-with-bootstrap-guile
(package-with-explicit-inputs (static-package bash)
`(("gcc" ,gcc)
@@ -932,10 +925,9 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(package-with-bootstrap-guile
(package (inherit binutils)
(arguments
- (lambda (system)
- `(#:guile ,%bootstrap-guile
- #:implicit-inputs? #f
- ,@(package-arguments binutils))))
+ `(#:guile ,%bootstrap-guile
+ #:implicit-inputs? #f
+ ,@(package-arguments binutils)))
(inputs %boot2-inputs))))
(define-public gcc-final
@@ -943,23 +935,22 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(package (inherit gcc-boot0)
(name "gcc")
(arguments
- (lambda (system)
- `(#:guile ,%bootstrap-guile
- #:implicit-inputs? #f
-
- ;; Build again GMP & co. within GCC's build process, because it's hard
- ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
- ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
- ,@(substitute-keyword-arguments ((package-arguments gcc-boot0) system)
- ((#:configure-flags boot-flags)
- (let loop ((args ((package-arguments gcc-4.7) system)))
- (match args
- ((#:configure-flags normal-flags _ ...)
- normal-flags)
- ((_ rest ...)
- (loop rest)))))
- ((#:phases phases)
- `(alist-delete 'symlink-libgcc_eh ,phases))))))
+ `(#:guile ,%bootstrap-guile
+ #:implicit-inputs? #f
+
+ ;; Build again GMP & co. within GCC's build process, because it's hard
+ ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
+ ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
+ ,@(substitute-keyword-arguments (package-arguments gcc-boot0)
+ ((#:configure-flags boot-flags)
+ (let loop ((args (package-arguments gcc-4.7)))
+ (match args
+ ((#:configure-flags normal-flags _ ...)
+ normal-flags)
+ ((_ rest ...)
+ (loop rest)))))
+ ((#:phases phases)
+ `(alist-delete 'symlink-libgcc_eh ,phases)))))
(inputs `(("gmp-source" ,(package-source gmp))
("mpfr-source" ,(package-source mpfr))
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 39cdea2f62..ea2cf618f2 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -133,7 +133,7 @@ check whether everything is alright."
(propagated-inputs (map rewritten-input
(package-propagated-inputs p)))))))
-(define (glibc-dynamic-linker system)
+(define* (glibc-dynamic-linker #:optional (system (%current-system)))
"Return the name of Glibc's dynamic linker for SYSTEM."
(cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
((string=? system "i686-linux") "/lib/ld-linux.so.2")
@@ -301,42 +301,41 @@ $out/bin/guile --version~%"
(source #f)
(build-system trivial-build-system)
(arguments
- (lambda (system)
- `(#:guile ,%bootstrap-guile
- #:modules ((guix build utils))
- #:builder
- (let ((out (assoc-ref %outputs "out"))
- (tar (assoc-ref %build-inputs "tar"))
- (xz (assoc-ref %build-inputs "xz"))
- (bash (assoc-ref %build-inputs "bash"))
- (libc (assoc-ref %build-inputs "libc"))
- (tarball (assoc-ref %build-inputs "tarball")))
- (use-modules (guix build utils)
- (ice-9 popen))
+ `(#:guile ,%bootstrap-guile
+ #:modules ((guix build utils))
+ #:builder
+ (let ((out (assoc-ref %outputs "out"))
+ (tar (assoc-ref %build-inputs "tar"))
+ (xz (assoc-ref %build-inputs "xz"))
+ (bash (assoc-ref %build-inputs "bash"))
+ (libc (assoc-ref %build-inputs "libc"))
+ (tarball (assoc-ref %build-inputs "tarball")))
+ (use-modules (guix build utils)
+ (ice-9 popen))
- (mkdir out)
- (copy-file tarball "binaries.tar.xz")
- (system* xz "-d" "binaries.tar.xz")
- (let ((builddir (getcwd))
- (bindir (string-append out "/bin")))
- (with-directory-excursion out
- (system* tar "xvf"
- (string-append builddir "/binaries.tar")))
+ (mkdir out)
+ (copy-file tarball "binaries.tar.xz")
+ (system* xz "-d" "binaries.tar.xz")
+ (let ((builddir (getcwd))
+ (bindir (string-append out "/bin")))
+ (with-directory-excursion out
+ (system* tar "xvf"
+ (string-append builddir "/binaries.tar")))
- (with-directory-excursion bindir
- (chmod "." #o755)
- (rename-file "gcc" ".gcc-wrapped")
- (call-with-output-file "gcc"
- (lambda (p)
- (format p "#!~a
+ (with-directory-excursion bindir
+ (chmod "." #o755)
+ (rename-file "gcc" ".gcc-wrapped")
+ (call-with-output-file "gcc"
+ (lambda (p)
+ (format p "#!~a
exec ~a/bin/.gcc-wrapped -B~a/lib \
-Wl,-rpath -Wl,~a/lib \
-Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
- bash
- out libc libc libc
- ,(glibc-dynamic-linker system))))
+ bash
+ out libc libc libc
+ ,(glibc-dynamic-linker))))
- (chmod "gcc" #o555)))))))
+ (chmod "gcc" #o555))))))
(inputs
`(("tar" ,(lambda (system)
(search-bootstrap-binary "tar" system)))
diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 802042665a..ad87043d96 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -36,24 +36,20 @@
(base32 "0sss7rhpvizi2a88h6giv0i7w5h07s2fxkw3s6n1hqvcnhrfgbb0"))))
(build-system gnu-build-system)
(arguments
- (case-lambda
- ((system)
- `(#:parallel-tests? #f ; test suite fails in parallel
+ `(#:parallel-tests? #f ; test suite fails in parallel
- ;; Work around test failure on Cygwin.
- #:tests? ,(not (string=? system "i686-cygwin"))
+ ;; Work around test failure on Cygwin.
+ #:tests? ,(not (string=? (%current-system) "i686-cygwin"))
- #:phases (alist-cons-before
- 'configure 'set-shell-file-name
- (lambda* (#:key inputs #:allow-other-keys)
- ;; Refer to the right shell.
- (let ((bash (assoc-ref inputs "bash")))
- (substitute* "io.c"
- (("/bin/sh")
- (string-append bash "/bin/bash")))))
- %standard-phases)))
- ((system cross-system)
- '(#:parallel-tests? #f))))
+ #:phases (alist-cons-before
+ 'configure 'set-shell-file-name
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Refer to the right shell.
+ (let ((bash (assoc-ref inputs "bash")))
+ (substitute* "io.c"
+ (("/bin/sh")
+ (string-append bash "/bin/bash")))))
+ %standard-phases)))
(inputs `(("libsigsegv" ,libsigsegv)))
(home-page "http://www.gnu.org/software/gawk/")
(synopsis "GNU implementation of the Awk programming language")
diff --git a/gnu/packages/m4.scm b/gnu/packages/m4.scm
index fdf55f802d..2a8bc5c72c 100644
--- a/gnu/packages/m4.scm
+++ b/gnu/packages/m4.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -36,34 +36,28 @@
(base32
"035r7ma272j2cwni2961jp22k6bn3n9xwn3b3qbcn2yrvlghql22"))))
(build-system gnu-build-system)
- (arguments (case-lambda
- ((system)
- ;; XXX: Disable tests on those platforms with know issues.
- `(#:tests? ,(not (member system
- '("x86_64-darwin"
- "i686-cygwin"
- "i686-sunos")))
- #:patches (list (assoc-ref %build-inputs "patch/s_isdir")
- (assoc-ref %build-inputs
- "patch/readlink-EINVAL")
- (assoc-ref %build-inputs "patch/gets"))
- #:phases (alist-cons-before
- 'check 'pre-check
- (lambda* (#:key inputs #:allow-other-keys)
- ;; Fix references to /bin/sh.
- (let ((bash (assoc-ref inputs "bash")))
- (for-each patch-shebang
- (find-files "tests" "\\.sh$"))
- (substitute* (find-files "tests"
- "posix_spawn")
- (("/bin/sh")
- (format #f "~a/bin/bash" bash)))))
- %standard-phases)))
- ((system cross-system)
- `(#:patches (list (assoc-ref %build-inputs "patch/s_isdir")
- (assoc-ref %build-inputs
- "patch/readlink-EINVAL")
- (assoc-ref %build-inputs "patch/gets"))))))
+ (arguments
+ ;; XXX: Disable tests on those platforms with know issues.
+ `(#:tests? ,(not (member (%current-system)
+ '("x86_64-darwin"
+ "i686-cygwin"
+ "i686-sunos")))
+ #:patches (list (assoc-ref %build-inputs "patch/s_isdir")
+ (assoc-ref %build-inputs
+ "patch/readlink-EINVAL")
+ (assoc-ref %build-inputs "patch/gets"))
+ #:phases (alist-cons-before
+ 'check 'pre-check
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Fix references to /bin/sh.
+ (let ((bash (assoc-ref inputs "bash")))
+ (for-each patch-shebang
+ (find-files "tests" "\\.sh$"))
+ (substitute* (find-files "tests"
+ "posix_spawn")
+ (("/bin/sh")
+ (format #f "~a/bin/bash" bash)))))
+ %standard-phases)))
(inputs `(("patch/s_isdir" ,(search-patch "m4-s_isdir.patch"))
("patch/readlink-EINVAL"
,(search-patch "m4-readlink-EINVAL.patch"))
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index a252848a47..091b5c0417 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -52,17 +52,15 @@
;; without nscd, and with static NSS modules.
(package (inherit glibc-final)
(arguments
- (lambda (system)
- (substitute-keyword-arguments ((package-arguments glibc-final) system)
- ((#:patches patches)
- `(cons (assoc-ref %build-inputs "patch/system")
- ,patches))
- ((#:configure-flags flags)
- ;; Arrange so that getaddrinfo & co. do not contact the nscd,
- ;; and can use statically-linked NSS modules.
- `(cons* "--disable-nscd" "--disable-build-nscd"
- "--enable-static-nss"
- ,flags)))))
+ (substitute-keyword-arguments (package-arguments glibc-final)
+ ((#:patches patches)
+ `(cons (assoc-ref %build-inputs "patch/system") ,patches))
+ ((#:configure-flags flags)
+ ;; Arrange so that getaddrinfo & co. do not contact the nscd,
+ ;; and can use statically-linked NSS modules.
+ `(cons* "--disable-nscd" "--disable-build-nscd"
+ "--enable-static-nss"
+ ,flags))))
(inputs
`(("patch/system" ,(search-patch "glibc-bootstrap-system.patch"))
,@(package-inputs glibc-final)))))
@@ -119,19 +117,17 @@
%standard-phases)))))
(gawk (package (inherit gawk)
(arguments
- (lambda (system)
- `(#:patches (list (assoc-ref %build-inputs "patch/sh"))
- ,@(substitute-keyword-arguments
- ((package-arguments gawk) system)
- ((#:phases phases)
- `(alist-cons-before
- 'configure 'no-export-dynamic
- (lambda _
- ;; Since we use `-static', remove
- ;; `-export-dynamic'.
- (substitute* "configure"
- (("-export-dynamic") "")))
- ,phases))))))
+ `(#:patches (list (assoc-ref %build-inputs "patch/sh"))
+ ,@(substitute-keyword-arguments (package-arguments gawk)
+ ((#:phases phases)
+ `(alist-cons-before
+ 'configure 'no-export-dynamic
+ (lambda _
+ ;; Since we use `-static', remove
+ ;; `-export-dynamic'.
+ (substitute* "configure"
+ (("-export-dynamic") "")))
+ ,phases)))))
(inputs `(("patch/sh" ,(search-patch "gawk-shell.patch"))))))
(finalize (lambda (p)
(static-package (package-with-explicit-inputs
@@ -332,29 +328,28 @@
(package (inherit gcc-final)
(name "gcc-static")
(arguments
- (lambda (system)
- `(#:modules ((guix build utils)
- (guix build gnu-build-system)
- (srfi srfi-1)
- (srfi srfi-26)
- (ice-9 regex))
- ,@(substitute-keyword-arguments ((package-arguments gcc-final) system)
- ((#:guile _) #f)
- ((#:implicit-inputs? _) #t)
- ((#:configure-flags flags)
- `(append (list
- "--disable-shared"
- "--disable-plugin"
- "--enable-languages=c"
- "--disable-libmudflap"
- "--disable-libgomp"
- "--disable-libssp"
- "--disable-libquadmath"
- "--disable-decimal-float")
- (remove (cut string-match "--(.*plugin|enable-languages)" <>)
- ,flags)))
- ((#:make-flags flags)
- `(cons "BOOT_LDFLAGS=-static" ,flags))))))
+ `(#:modules ((guix build utils)
+ (guix build gnu-build-system)
+ (srfi srfi-1)
+ (srfi srfi-26)
+ (ice-9 regex))
+ ,@(substitute-keyword-arguments (package-arguments gcc-final)
+ ((#:guile _) #f)
+ ((#:implicit-inputs? _) #t)
+ ((#:configure-flags flags)
+ `(append (list
+ "--disable-shared"
+ "--disable-plugin"
+ "--enable-languages=c"
+ "--disable-libmudflap"
+ "--disable-libgomp"
+ "--disable-libssp"
+ "--disable-libquadmath"
+ "--disable-decimal-float")
+ (remove (cut string-match "--(.*plugin|enable-languages)" <>)
+ ,flags)))
+ ((#:make-flags flags)
+ `(cons "BOOT_LDFLAGS=-static" ,flags)))))
(inputs `(("gmp-source" ,(package-source gmp))
("mpfr-source" ,(package-source mpfr))
("mpc-source" ,(package-source mpc))
@@ -482,25 +477,25 @@
("xz" ,xz)
("input" ,pkg)))
(arguments
- (lambda (system)
- (let ((name (package-name pkg))
- (version (package-version pkg)))
- `(#:modules ((guix build utils))
- #:builder
- (begin
- (use-modules (guix build utils))
- (let ((out (assoc-ref %outputs "out"))
- (input (assoc-ref %build-inputs "input"))
- (tar (assoc-ref %build-inputs "tar"))
- (xz (assoc-ref %build-inputs "xz")))
- (mkdir out)
- (set-path-environment-variable "PATH" '("bin") (list tar xz))
- (with-directory-excursion input
- (zero? (system* "tar" "cJvf"
- (string-append out "/"
- ,name "-" ,version
- "-" ,system ".tar.xz")
- ".")))))))))))
+ (let ((name (package-name pkg))
+ (version (package-version pkg)))
+ `(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let ((out (assoc-ref %outputs "out"))
+ (input (assoc-ref %build-inputs "input"))
+ (tar (assoc-ref %build-inputs "tar"))
+ (xz (assoc-ref %build-inputs "xz")))
+ (mkdir out)
+ (set-path-environment-variable "PATH" '("bin") (list tar xz))
+ (with-directory-excursion input
+ (zero? (system* "tar" "cJvf"
+ (string-append out "/"
+ ,name "-" ,version
+ "-" ,(%current-system)
+ ".tar.xz")
+ "."))))))))))
(define %bootstrap-binaries-tarball
;; A tarball with the statically-linked bootstrap binaries.
diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm
index 1be2551a63..52864a6c77 100644
--- a/gnu/packages/ncurses.scm
+++ b/gnu/packages/ncurses.scm
@@ -83,34 +83,30 @@
"0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh"))))
(build-system gnu-build-system)
(arguments
- (case-lambda
- ((system)
- `(#:configure-flags
- `("--with-shared" "--without-debug" "--enable-widec"
+ `(#:configure-flags
+ `("--with-shared" "--without-debug" "--enable-widec"
- ;; By default headers land in an `ncursesw' subdir, which is not
- ;; what users expect.
- ,(string-append "--includedir=" (assoc-ref %outputs "out")
- "/include")
+ ;; By default headers land in an `ncursesw' subdir, which is not
+ ;; what users expect.
+ ,(string-append "--includedir=" (assoc-ref %outputs "out")
+ "/include")
- ;; C++ bindings fail to build on
- ;; `i386-pc-solaris2.11' with GCC 3.4.3:
- ;; <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6395191>.
- ,,@(if (string=? system "i686-solaris")
- '("--without-cxx-binding")
- '()))
- #:tests? #f ; no "check" target
- #:phases (alist-cons-after
- 'install 'post-install ,post-install-phase
- (alist-cons-before
- 'configure 'patch-makefile-SHELL
- ,patch-makefile-phase
- (alist-replace
- 'configure
- ,configure-phase
- %standard-phases)))))
- ((system cross-system)
- (arguments cross-system))))
+ ;; C++ bindings fail to build on
+ ;; `i386-pc-solaris2.11' with GCC 3.4.3:
+ ;; <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6395191>.
+ ,,@(if (string=? (%current-system) "i686-solaris")
+ '("--without-cxx-binding")
+ '()))
+ #:tests? #f ; no "check" target
+ #:phases (alist-cons-after
+ 'install 'post-install ,post-install-phase
+ (alist-cons-before
+ 'configure 'patch-makefile-SHELL
+ ,patch-makefile-phase
+ (alist-replace
+ 'configure
+ ,configure-phase
+ %standard-phases)))))
(self-native-input? #t)
(synopsis
"GNU Ncurses, a free software emulation of curses in SVR4 and more")
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index 4f84b3ccee..fa3b3b14b6 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -66,12 +66,8 @@ when GUILE is #f."
(location (if (pair? loc) (source-properties->location loc) loc))
(arguments
(let ((args (package-arguments p)))
- (if (procedure? args)
- (lambda (system)
- `(#:guile ,guile
- #:implicit-inputs? #f ,@(args system)))
- `(#:guile ,guile
- #:implicit-inputs? #f ,@args))))
+ `(#:guile ,guile
+ #:implicit-inputs? #f ,@args)))
(native-inputs (map rewritten-input
(filtered-inputs (package-native-inputs p))))
(propagated-inputs (map rewritten-input
@@ -95,23 +91,19 @@ configure flags for VARIABLE, the associated value is augmented."
(package (inherit p)
(arguments
- (lambda (system)
- (let ((args (match (package-arguments p)
- ((? procedure? proc)
- (proc system))
- (x x))))
- (substitute-keyword-arguments args
- ((#:configure-flags flags)
- (let* ((var= (string-append variable "="))
- (len (string-length var=)))
- `(cons ,(string-append var= value)
- (map (lambda (flag)
- (if (string-prefix? ,var= flag)
- (string-append
- ,(string-append var= value " ")
- (substring flag ,len))
- flag))
- ,flags))))))))
+ (let ((args (package-arguments p)))
+ (substitute-keyword-arguments args
+ ((#:configure-flags flags)
+ (let* ((var= (string-append variable "="))
+ (len (string-length var=)))
+ `(cons ,(string-append var= value)
+ (map (lambda (flag)
+ (if (string-prefix? ,var= flag)
+ (string-append
+ ,(string-append var= value " ")
+ (substring flag ,len))
+ flag))
+ ,flags)))))))
(inputs (rewritten-inputs (package-inputs p)))
(propagated-inputs (rewritten-inputs (package-propagated-inputs p))))))
@@ -125,21 +117,14 @@ configure flags for VARIABLE, the associated value is augmented."
(package (inherit p)
(location (source-properties->location loc))
(arguments
- (let ((augment (lambda (args)
- (let ((a (default-keyword-arguments args
- '(#:configure-flags '()
- #:strip-flags #f))))
- (substitute-keyword-arguments a
- ((#:configure-flags flags)
- `(cons* "--disable-shared"
- "LDFLAGS=-static"
- ,flags))
- ((#:strip-flags _)
- ''("--strip-all")))))))
- (if (procedure? args)
- (lambda x
- (augment (apply args x)))
- (augment args)))))))
+ (let ((a (default-keyword-arguments args
+ '(#:configure-flags '()
+ #:strip-flags #f))))
+ (substitute-keyword-arguments a
+ ((#:configure-flags flags)
+ `(cons* "--disable-shared" "LDFLAGS=-static" ,flags))
+ ((#:strip-flags _)
+ ''("--strip-all"))))))))
(define %store
diff --git a/guix/packages.scm b/guix/packages.scm
index a9534adfec..a76e51a5d0 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -110,7 +110,7 @@ representation."
(source package-source) ; <origin> instance
(build-system package-build-system) ; build system
(arguments package-arguments ; arguments for the build method
- (default '()))
+ (default '()) (thunked))
(inputs package-inputs ; input packages or derivations
(default '()))
@@ -290,24 +290,26 @@ PACKAGE for SYSTEM."
;; because some derivations, such as the implicit inputs of the GNU build
;; system, will be queried many, many times in a row.
(cached package system
- (match package
- (($ <package> name version source (= build-system-builder builder)
- args inputs propagated-inputs native-inputs self-native-input?
- outputs)
- ;; TODO: For `search-paths', add a builder prologue that calls
- ;; `set-path-environment-variable'.
- (let ((inputs (map expand-input
- (package-transitive-inputs package))))
-
- (apply builder
- store (package-full-name package)
- (and source
- (package-source-derivation store source system))
- inputs
- #:outputs outputs #:system system
- (if (procedure? args)
- (args system)
- args)))))))
+
+ ;; Bind %CURRENT-SYSTEM so that thunked field values can refer
+ ;; to it.
+ (parameterize ((%current-system system))
+ (match package
+ (($ <package> name version source (= build-system-builder builder)
+ args inputs propagated-inputs native-inputs self-native-input?
+ outputs)
+ ;; TODO: For `search-paths', add a builder prologue that calls
+ ;; `set-path-environment-variable'.
+ (let ((inputs (map expand-input
+ (package-transitive-inputs package))))
+
+ (apply builder
+ store (package-full-name package)
+ (and source
+ (package-source-derivation store source system))
+ inputs
+ #:outputs outputs #:system system
+ (args))))))))
(define* (package-cross-derivation store package)
;; TODO