From 8e1cd713767b7e8266dbf54211d94f687f0301d9 Mon Sep 17 00:00:00 2001 From: Andreas Enge Date: Wed, 12 Dec 2012 20:03:07 +0100 Subject: [PATCH 01/71] distro: mpc: Update to 1.0.1. * distro/packages/multiprecision.scm (mpc): Update to 1.0.1. --- distro/packages/multiprecision.scm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/distro/packages/multiprecision.scm b/distro/packages/multiprecision.scm index 9cfde88c3d..73bceb3e4a 100644 --- a/distro/packages/multiprecision.scm +++ b/distro/packages/multiprecision.scm @@ -95,14 +95,13 @@ double-precision floating-point arithmetic (53-bit mantissa).") (define-public mpc (package (name "mpc") - (version "1.0") + (version "1.0.1") (source (origin (method url-fetch) (uri (string-append - "http://www.multiprecision.org/mpc/download/mpc-" - version ".tar.gz")) + "mirror://gnu/mpc/mpc-" version ".tar.gz")) (sha256 (base32 - "00rxjmkpqnv6zzcyw9aa5w6rzaav32ys87km25zgfcv9i32km5cw")))) + "1zq0fidp1jii2j5k5n9hmx55a6wwid33gjzhimvxq9d5zrf82npd")))) (build-system gnu-build-system) (inputs `(("gmp" ,gmp) ("mpfr" ,mpfr))) @@ -110,7 +109,11 @@ double-precision floating-point arithmetic (53-bit mantissa).") with exact rounding") (description "GNU MPC is a C library for the arithmetic of complex numbers with -arbitrarily high precision and correct rounding of the result. It is built -upon and follows the same principles as GNU MPFR.") +arbitrarily high precision and correct rounding of the result. It extends +the principles of the IEEE-754 standard for fixed precision real floating +point numbers to complex numbers, providing well-defined semantics for +every operation. At the same time, speed of operation at high precision +is a major design goal. The library is built upon and follows the same +principles as GNU MPFR.") (license "LGPLv3+") (home-page "http://mpc.multiprecision.org/"))) From 53f974fd45ae9fb8401fd541adf25bcfae3c36af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 13 Dec 2012 22:53:05 +0100 Subject: [PATCH 02/71] guix-package: Use directory names from (guix config). * guix-package.in (%profile-directory): Use %STATE-DIRECTORY instead of a hard-coded directory. --- guix-package.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guix-package.in b/guix-package.in index ff7f38383e..dbd2ee24c7 100644 --- a/guix-package.in +++ b/guix-package.in @@ -35,6 +35,7 @@ exec ${GUILE-@GUILE@} -L "@guilemoduledir@" -l "$0" \ #:use-module (guix derivations) #:use-module (guix packages) #:use-module (guix utils) + #:use-module (guix config) #:use-module (ice-9 ftw) #:use-module (ice-9 format) #:use-module (ice-9 match) @@ -61,8 +62,7 @@ exec ${GUILE-@GUILE@} -L "@guilemoduledir@" -l "$0" \ (cut string-append <> "/.guix-profile"))) (define %profile-directory - (string-append "/nix/var/nix/profiles/" - "guix/" + (string-append %state-directory "/profiles/" (or (and=> (getenv "USER") (cut string-append "per-user/" <>)) "default"))) From cb1427dd0835379fa1e05af87c1c6ea585d478e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 13 Dec 2012 22:53:45 +0100 Subject: [PATCH 03/71] release.nix: tarball: Fix typo. * release.nix (tarball): Replace "gnulib" by "nix". --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index 2d3a70f524..2cc7be4794 100644 --- a/release.nix +++ b/release.nix @@ -50,7 +50,7 @@ let src = ; buildInputs = with pkgs; [ guile sqlite bzip2 git libgcrypt ]; buildNativeInputs = with pkgs; [ texinfo gettext cvs pkgconfig ]; - preAutoconf = ''git config submodule.gnulib.url "${}"''; + preAutoconf = ''git config submodule.nix.url "${}"''; configureFlags = [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}" "--localstatedir=/nix/var/nix" From 9d1d434cd07d8a0372b113c2c0efacd2eb6e258a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 13 Dec 2012 23:38:32 +0100 Subject: [PATCH 04/71] build-system/gnu: Avoid using /bin/sh. * guix/build/gnu-build-system.scm (configure): Add `inputs' keyword parameter. Take Bash from there, falling back to /bin/sh. Set `CONFIG_SHELL' and `SHELL' to that Bash. Run "bash ./configure" instead of just "./configure". * distro/packages/bootstrap.scm (%bootstrap-inputs): Add "bash". * distro/packages/base.scm (gcc-boot0-wrapped): Use "bash" from %BOOT1-INPUTS instead of /bin/sh. --- distro/packages/base.scm | 7 +++++-- distro/packages/bootstrap.scm | 5 ++++- guix/build/gnu-build-system.scm | 16 +++++++++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index ea6297107f..30bd804b56 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -774,6 +774,7 @@ identifier SYSTEM." (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))) @@ -790,8 +791,9 @@ identifier SYSTEM." ;; the dynamic linker. (call-with-output-file "gcc" (lambda (p) - (format p "#!/bin/sh + (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)))) @@ -800,7 +802,8 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (native-inputs `(("binutils" ,binutils-boot0) ("gcc" ,gcc-boot0) - ("libc" ,glibc-final))) + ("libc" ,glibc-final) + ("bash" ,(assoc-ref %boot1-inputs "bash")))) (inputs '()))) (define %boot2-inputs diff --git a/distro/packages/bootstrap.scm b/distro/packages/bootstrap.scm index 63e8109800..963b6526da 100644 --- a/distro/packages/bootstrap.scm +++ b/distro/packages/bootstrap.scm @@ -366,6 +366,9 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \ `(("libc" ,%bootstrap-glibc) ("gcc" ,%bootstrap-gcc) ("binutils" ,%bootstrap-binutils) - ("coreutils&co" ,%bootstrap-coreutils&co))) + ("coreutils&co" ,%bootstrap-coreutils&co) + + ;; In gnu-build-system.scm, we rely on the availability of Bash. + ("bash" ,%bootstrap-coreutils&co))) ;;; bootstrap.scm ends here diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 2b7d1c180e..efee570292 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -90,12 +90,17 @@ (append patch-flags (list "--input" p))))) patches)) -(define* (configure #:key outputs (configure-flags '()) out-of-source? +(define* (configure #:key inputs outputs (configure-flags '()) out-of-source? #:allow-other-keys) (let* ((prefix (assoc-ref outputs "out")) (libdir (assoc-ref outputs "lib")) (includedir (assoc-ref outputs "include")) - (flags `(,(string-append "--prefix=" prefix) + (bash (or (and=> (assoc-ref inputs "bash") + (cut string-append <> "/bin/bash")) + "/bin/sh")) + (flags `(,(string-append "CONFIG_SHELL=" bash) + ,(string-append "SHELL=" bash) + ,(string-append "--prefix=" prefix) "--enable-fast-install" ; when using Libtool ;; Produce multiple outputs when specific output names @@ -121,10 +126,15 @@ (format #t "build directory: ~s~%" (getcwd)) (format #t "configure flags: ~s~%" flags) + ;; Use BASH to reduce reliance on /bin/sh since it may not always be + ;; reliable (see + ;; + ;; for a summary of the situation.) + ;; ;; Call `configure' with a relative path. Otherwise, GCC's build system ;; (for instance) records absolute source file names, which typically ;; contain the hash part of the `.drv' file, leading to a reference leak. - (zero? (apply system* + (zero? (apply system* bash (string-append srcdir "/configure") flags)))) From 7f131cf3681afe62c84db66e48430de9e54e7d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 14 Dec 2012 18:04:27 +0100 Subject: [PATCH 05/71] distro: Fix incorrect "bash" input for gcc-boot0-wrapped. * distro/packages/base.scm (gcc-boot0-wrapped): Fix incorrect "bash" input. --- distro/packages/base.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 30bd804b56..f782d78895 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -803,7 +803,7 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" `(("binutils" ,binutils-boot0) ("gcc" ,gcc-boot0) ("libc" ,glibc-final) - ("bash" ,(assoc-ref %boot1-inputs "bash")))) + ,(assoc "bash" %boot1-inputs))) (inputs '()))) (define %boot2-inputs From 74baf333bf591cf3c91447d912d200783472d913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 15 Dec 2012 15:54:29 +0100 Subject: [PATCH 06/71] utils: Make the buffer size of `dump-port' a parameter. * guix/build/utils.scm (dump-port): Make `buffer-size' a keyword parameter. --- guix/build/utils.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 8ae190f656..8f0eb66d39 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -364,9 +364,9 @@ all subject to the substitutions." ;;; Patching shebangs---e.g., /bin/sh -> /nix/store/xyz...-bash/bin/sh. ;;; -(define (dump-port in out) - "Read as much data as possible from IN and write it to OUT." - (define buffer-size 4096) +(define* (dump-port in out #:key (buffer-size 16384)) + "Read as much data as possible from IN and write it to OUT, using +chunks of BUFFER-SIZE bytes." (define buffer (make-bytevector buffer-size)) From c1c94acf3206a086358e2ea39aa011c8299d29e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 15 Dec 2012 16:01:52 +0100 Subject: [PATCH 07/71] build-system/gnu: Make the error port line-buffered. * guix/build/gnu-build-system.scm (gnu-build): Make the error port line-buffered. --- guix/build/gnu-build-system.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index efee570292..3b139a99b8 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -242,6 +242,7 @@ "Build from SOURCE to OUTPUTS, using INPUTS, and by running all of PHASES in order. Return #t if all the PHASES succeeded, #f otherwise." (setvbuf (current-output-port) _IOLBF) + (setvbuf (current-error-port) _IOLBF) ;; The trick is to #:allow-other-keys everywhere, so that each procedure in ;; PHASES can pick the keyword arguments it's interested in. From d008415219df27f0b0ab000ceed12226183cd9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 15 Dec 2012 16:35:26 +0100 Subject: [PATCH 08/71] build-system/gnu: Patch shebangs in executable source files. This allows many packages to build in a chroot that lacks /bin and thus /bin/sh. * guix/build/gnu-build-system.scm (patch-source-shebangs): New procedure. (%standard-phases): Add it. * guix/build/utils.scm (executable-file?): New procedure. * distro/packages/perl.scm (perl): Don't use /bin/sh to run `Configure'. --- distro/packages/perl.scm | 2 +- guix/build/gnu-build-system.scm | 21 ++++++++++++++++++++- guix/build/utils.scm | 7 +++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/distro/packages/perl.scm b/distro/packages/perl.scm index b17342f7ad..26b25b154d 100644 --- a/distro/packages/perl.scm +++ b/distro/packages/perl.scm @@ -55,7 +55,7 @@ (("/bin/pwd") pwd)) (zero? - (system* "/bin/sh" "./Configure" + (system* "./Configure" (string-append "-Dprefix=" out) (string-append "-Dman1dir=" out "/share/man/man1") (string-append "-Dman3dir=" out "/share/man/man3") diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 3b139a99b8..b67918552c 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -82,6 +82,24 @@ (and (zero? (system* "tar" "xvf" source)) (chdir (first-subdirectory ".")))) +(define* (patch-source-shebangs #:key source #:allow-other-keys) + ;; Patch shebangs in executable source files. Most scripts honor + ;; $SHELL and $CONFIG_SHELL, but some don't, such as `mkinstalldirs' + ;; or Automake's `missing' script. + (for-each patch-shebang + (filter (lambda (file) + (and (executable-file? file) + (not (file-is-directory? file)))) + (find-files "." ".*"))) + + ;; Gettext-generated po/Makefile.in.in does not honor $SHELL. + (let ((bash (search-path (search-path-as-string->list (getenv "PATH")) + "bash"))) + (when (file-exists? "po/Makefile.in.in") + (substitute* "po/Makefile.in.in" + (("^SHELL[[:blank:]]*=.*$") + (string-append "SHELL = " bash)))))) + (define* (patch #:key (patches '()) (patch-flags '("--batch" "-p1")) #:allow-other-keys) (every (lambda (p) @@ -231,7 +249,8 @@ ;; Standard build phases, as a list of symbol/procedure pairs. (let-syntax ((phases (syntax-rules () ((_ p ...) `((p . ,p) ...))))) - (phases set-paths unpack patch configure build check install + (phases set-paths unpack patch-source-shebangs patch configure + build check install patch-shebangs strip))) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 8f0eb66d39..99a43cfebd 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -26,6 +26,7 @@ #:use-module (rnrs bytevectors) #:use-module (rnrs io ports) #:export (directory-exists? + executable-file? with-directory-excursion mkdir-p copy-recursively @@ -56,6 +57,12 @@ (and s (eq? 'directory (stat:type s))))) +(define (executable-file? file) + "Return #t if FILE exists and is executable." + (let ((s (stat file #f))) + (and s + (not (zero? (logand (stat:mode s) #o100)))))) + (define-syntax-rule (with-directory-excursion dir body ...) "Run BODY with DIR as the process's current directory." (let ((init (getcwd))) From 325285d5818cadd510a47910970234c7205b3bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 18 Dec 2012 22:16:21 +0100 Subject: [PATCH 09/71] distro: guile: Switch to 2.0.7. * distro/packages/guile.scm (guile-2.0/fixed): Alias GUILE-2.0. --- distro/packages/guile.scm | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/distro/packages/guile.scm b/distro/packages/guile.scm index e7ed613670..a5d37eb40b 100644 --- a/distro/packages/guile.scm +++ b/distro/packages/guile.scm @@ -134,15 +134,7 @@ call interface, and powerful string processing.") (define-public guile-2.0/fixed ;; A package of Guile 2.0 that's rarely changed. It is the one used ;; in the `base' module, and thus changing it entails a full rebuild. - (package (inherit guile-2.0) - (version "2.0.6") - (source (origin - (method url-fetch) - (uri (string-append "mirror://gnu/guile/guile-" version - ".tar.xz")) - (sha256 - (base32 - "000ng5qsq3cl1k35jvzvhwxj92wx4q87745n2fppkd4irh58vv5l")))))) + guile-2.0) ;;; From 45298f8fd28635763507417e6ac026a52d51c060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 19 Dec 2012 00:47:39 +0100 Subject: [PATCH 10/71] distro: Linux-Libre: Set $ARCH based on the actual system type. * distro/packages/linux.scm (linux-libre-headers): Set $ARCH based on the `system' keyword argument. --- distro/packages/linux.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/distro/packages/linux.scm b/distro/packages/linux.scm index 0ec18300fc..bbb583455c 100644 --- a/distro/packages/linux.scm +++ b/distro/packages/linux.scm @@ -32,8 +32,13 @@ (define-public linux-libre-headers (let* ((version* "3.3.8") (build-phase - '(lambda* (#:key outputs #:allow-other-keys) - (setenv "ARCH" "x86_64") ; XXX + '(lambda* (#:key system #:allow-other-keys) + (let ((arch (car (string-split system #\-)))) + (setenv "ARCH" + (cond ((string=? arch "i686") "i386") + (else arch))) + (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))) + (and (zero? (system* "make" "defconfig")) (zero? (system* "make" "mrproper" "headers_check"))))) (install-phase From c3ee7448c9c10d0fdcc52fd1d57031cf6677aafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 18 Dec 2012 22:21:21 +0100 Subject: [PATCH 11/71] build-system/gnu: Change the order of `patch-source-shebangs' and `patch'. * guix/build/gnu-build-system.scm (patch-source-shebangs): Add a newline after the "SHELL =" line in po/Makefile.in.in. (%standard-phases): Move `patch-source-shebangs' after `patch'. --- guix/build/gnu-build-system.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index b67918552c..5e899403e8 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -98,7 +98,7 @@ (when (file-exists? "po/Makefile.in.in") (substitute* "po/Makefile.in.in" (("^SHELL[[:blank:]]*=.*$") - (string-append "SHELL = " bash)))))) + (string-append "SHELL = " bash "\n")))))) (define* (patch #:key (patches '()) (patch-flags '("--batch" "-p1")) #:allow-other-keys) @@ -249,7 +249,7 @@ ;; Standard build phases, as a list of symbol/procedure pairs. (let-syntax ((phases (syntax-rules () ((_ p ...) `((p . ,p) ...))))) - (phases set-paths unpack patch-source-shebangs patch configure + (phases set-paths unpack patch patch-source-shebangs configure build check install patch-shebangs strip))) From ea8fbbf2f2d8beccad1c7a98077c0a31fb40e578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 19 Dec 2012 12:34:53 +0100 Subject: [PATCH 12/71] distro: make: Change default shell from /bin/sh to the actual shell. * distro/packages/base.scm (gnu-make): Add `set-default-shell' phase. (gnu-make-boot0): Adjust phases accordingly. --- distro/packages/base.scm | 46 +++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index f0dd150e12..4bd8070827 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -289,8 +289,18 @@ are expected to exist on every operating system.") (build-system gnu-build-system) (native-inputs `(("patch/impure-dirs" ,(search-patch "make-impure-dirs.patch")))) - (arguments `(#:patches (list (assoc-ref %build-inputs - "patch/impure-dirs")))) + (arguments + '(#:patches (list (assoc-ref %build-inputs "patch/impure-dirs")) + #:phases (alist-cons-before + 'build 'set-default-shell + (lambda* (#:key inputs #:allow-other-keys) + ;; Change the default shell from /bin/sh. + (let ((bash (assoc-ref inputs "bash"))) + (substitute* "job.c" + (("default_shell\\[\\] =.*$") + (format #f "default_shell[] = \"~a/bin/bash\";\n" + bash))))) + %standard-phases))) (synopsis "GNU Make, a program controlling the generation of non-source files from sources") (description @@ -534,21 +544,23 @@ with the Linux kernel.") (package (inherit gnu-make) (name "make-boot0") (location (source-properties->location (current-source-location))) - (arguments `(#:guile ,%bootstrap-guile - #:implicit-inputs? #f - #:tests? #f ; cannot run "make check" - #:phases - (alist-replace - 'build (lambda _ - (zero? (system* "./build.sh"))) - (alist-replace - 'install (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (bin (string-append out "/bin"))) - (mkdir-p bin) - (copy-file "make" - (string-append bin "/make")))) - %standard-phases)))) + (arguments + `(#:guile ,%bootstrap-guile + #:implicit-inputs? #f + #:tests? #f ; cannot run "make check" + ,@(substitute-keyword-arguments (package-arguments gnu-make) + ((#:phases phases) + `(alist-replace + 'build (lambda _ + (zero? (system* "./build.sh"))) + (alist-replace + 'install (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (mkdir-p bin) + (copy-file "make" + (string-append bin "/make")))) + ,phases)))))) (inputs %bootstrap-inputs)))) (define diffutils-boot0 From dfb53ee2324689f5f7843b87c7dfd6cdd4eb49bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 19 Dec 2012 23:49:31 +0100 Subject: [PATCH 13/71] distro: ld-wrapper: Use the current Bash instead of /bin/sh. * distro/packages/ld-wrapper.scm: Use @BASH@ in shebang. Change module name to (gnu build-support ld-wrapper). * distro/packages/base.scm (ld-wrapper-boot3): Substitute @BASH@. (ld-wrapper): Use BASH-FINAL. --- distro/packages/base.scm | 14 ++++++++++---- distro/packages/ld-wrapper.scm | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 4bd8070827..5e7380581d 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -872,9 +872,10 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (source #f) (build-system trivial-build-system) (inputs `(("binutils" ,binutils-final) - ("guile" ,%bootstrap-guile) - ("wrapper" ,(search-path %load-path - "distro/packages/ld-wrapper.scm")))) + ("guile" ,%bootstrap-guile) + ("bash" ,@(assoc-ref %boot2-inputs "bash")) + ("wrapper" ,(search-path %load-path + "distro/packages/ld-wrapper.scm")))) (arguments `(#:guile ,%bootstrap-guile #:modules ((guix build utils)) @@ -898,6 +899,9 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (("@GUILE@") (string-append (assoc-ref %build-inputs "guile") "/bin/guile")) + (("@BASH@") + (string-append (assoc-ref %build-inputs "bash") + "/bin/bash")) (("@LD@") (string-append (assoc-ref %build-inputs "binutils") "/bin/ld"))) @@ -946,7 +950,9 @@ store.") (package (inherit ld-wrapper-boot3) (name "ld-wrapper") (inputs `(("guile" ,guile-final) - ,@(alist-delete "guile" (package-inputs ld-wrapper-boot3)))))) + ("bash" ,bash-final) + ,@(fold alist-delete (package-inputs ld-wrapper-boot3) + '("guile" "bash")))))) (define-public %final-inputs ;; Final derivations used as implicit inputs by `gnu-build-system'. diff --git a/distro/packages/ld-wrapper.scm b/distro/packages/ld-wrapper.scm index 9b8a09f067..5c98375814 100644 --- a/distro/packages/ld-wrapper.scm +++ b/distro/packages/ld-wrapper.scm @@ -1,4 +1,4 @@ -#!/bin/sh +#!@BASH@ # -*- mode: scheme; coding: utf-8; -*- # XXX: We have to go through Bash because there's no command-line switch to @@ -7,7 +7,7 @@ # Use `load-compiled' because `load' (and `-l') doesn't otherwise load our # .go file (see ). -main="(@ (distro packages ld-wrapper) ld-wrapper)" +main="(@ (gnu build-support ld-wrapper) ld-wrapper)" exec @GUILE@ -c "(load-compiled \"$0.go\") (apply $main (cdr (command-line)))" "$@" !# ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- @@ -28,7 +28,7 @@ exec @GUILE@ -c "(load-compiled \"$0.go\") (apply $main (cdr (command-line)))" " ;;; You should have received a copy of the GNU General Public License ;;; along with Guix. If not, see . -(define-module (distro packages ld-wrapper) +(define-module (gnu build-support ld-wrapper) #:use-module (srfi srfi-1) #:export (ld-wrapper)) From d6f80f187c4bc109dd4d8fc839cc376e7b11e593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 19 Dec 2012 23:24:13 +0100 Subject: [PATCH 14/71] distro: gcc: Patch to allow builds without /bin/sh. * distro/packages/base.scm (gcc-4.7): In `pre-configure' phase, patch shebang in `gcc/exec-tool.in'. --- distro/packages/base.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 5e7380581d..58c39ce7cd 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -428,6 +428,9 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.") ~a~%" libc line)))) + ;; Adjust hard-coded #!/bin/sh. + (patch-shebang "gcc/exec-tool.in") + ;; Don't retain a dependency on the build-time sed. (substitute* "fixincludes/fixincl.x" (("static char const sed_cmd_z\\[\\] =.*;") From 6e32f6c019c35a8092f1285be67aaa7dd04c0f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 00:49:06 +0100 Subject: [PATCH 15/71] distro: glibc: Add a statically-linked Bash to $out/bin. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * distro/packages/base.scm (glibc): Pass `ac_cv_path_BASH_SHELL' in the configure flags. During the `pre-configure' phase, copy the "static-bash" input to $out/bin, and change `system' and `popen' to use it instead of /bin/sh. Add the "static-bash" input. Suggested by Shea Levy and Lluís Batlle i Rossell . --- distro/packages/base.scm | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 58c39ce7cd..7cb2dc116e 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -499,12 +499,19 @@ used in the GNU system including the GNU/Linux variant.") "--enable-kernel=2.6.30" ;; XXX: Work around "undefined reference to `__stack_chk_guard'". - "libc_cv_ssp=no") + "libc_cv_ssp=no" + + ;; Use our Bash instead of /bin/sh. + (string-append "ac_cv_path_BASH_SHELL=" + (assoc-ref %build-inputs "bash") + "/bin/bash")) + #:tests? #f ; XXX #:phases (alist-cons-before 'configure 'pre-configure - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out"))) + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) ;; Use `pwd', not `/bin/pwd'. (substitute* "configure" (("/bin/pwd") "pwd")) @@ -522,10 +529,28 @@ used in the GNU system including the GNU/Linux variant.") ;; , ;; linking against libgcc_s is not needed with GCC ;; 4.7.1. - ((" -lgcc_s") "")))) + ((" -lgcc_s") "")) + + ;; Copy a statically-linked Bash in the output. + (mkdir-p bin) + (copy-file (assoc-ref inputs "static-bash") + (string-append bin "/bash")) + (chmod (string-append bin "/bash") #o555) + + ;; Have `system' use that Bash. + (substitute* "sysdeps/posix/system.c" + (("#define[[:blank:]]+SHELL_PATH.*$") + (format #f "#define SHELL_PATH \"~a/bin/bash\"\n" + out))) + + ;; Same for `popen'. + (substitute* "libio/iopopen.c" + (("/bin/sh") + (string-append out "/bin/bash"))))) %standard-phases))) (inputs `(("patch/ld.so.cache" - ,(search-patch "glibc-no-ld-so-cache.patch")))) + ,(search-patch "glibc-no-ld-so-cache.patch")) + ("static-bash" ,(cut search-bootstrap-binary "bash" <>)))) (synopsis "The GNU C Library") (description "Any Unix-like operating system needs a C library: the library which From 5d4fd2671aaadc5b0b7e0c331fa5e2a1d7e5c4d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 01:29:56 +0100 Subject: [PATCH 16/71] distro: make-bootstrap: Have libc's functions search for `sh' in $PATH. * distro/packages/make-bootstrap.scm (%glibc-with-relocatable-system, %standard-inputs-with-relocatable-glibc): New variables. (%static-inputs)[gawk]: Apply `gawk-shell.patch'. [finalize]: New procedure. Build all the packages against %STANDARD-INPUTS-WITH-RELOCATABLE-GLIBC. (%glibc-stripped): Inherit from %GLIBC-WITH-RELOCATABLE-SYSTEM. (%gcc-static, %guile-static): Build against %STANDARD-INPUTS-WITH-RELOCATABLE-GLIBC. * distro/packages/patches/gawk-shell.patch, distro/packages/patches/glibc-bootstrap-system.patch: New files. * Makefile.am (dist_patch_DATA): Add them. --- Makefile.am | 2 + distro/packages/make-bootstrap.scm | 187 +++++++++++------- distro/packages/patches/gawk-shell.patch | 34 ++++ .../patches/glibc-bootstrap-system.patch | 28 +++ 4 files changed, 176 insertions(+), 75 deletions(-) create mode 100644 distro/packages/patches/gawk-shell.patch create mode 100644 distro/packages/patches/glibc-bootstrap-system.patch diff --git a/Makefile.am b/Makefile.am index 0b59f8901c..f256e47995 100644 --- a/Makefile.am +++ b/Makefile.am @@ -102,7 +102,9 @@ dist_patch_DATA = \ distro/packages/patches/cpio-gets-undeclared.patch \ distro/packages/patches/diffutils-gets-undeclared.patch \ distro/packages/patches/flex-bison-tests.patch \ + distro/packages/patches/gawk-shell.patch \ distro/packages/patches/gettext-gets-undeclared.patch \ + distro/packages/patches/glibc-bootstrap-system.patch \ distro/packages/patches/glibc-no-ld-so-cache.patch \ distro/packages/patches/guile-1.8-cpp-4.5.patch \ distro/packages/patches/guile-default-utf8.patch \ diff --git a/distro/packages/make-bootstrap.scm b/distro/packages/make-bootstrap.scm index bbed4a6e1d..4f182da853 100644 --- a/distro/packages/make-bootstrap.scm +++ b/distro/packages/make-bootstrap.scm @@ -20,6 +20,7 @@ #:use-module (guix utils) #:use-module (guix packages) #:use-module (guix build-system trivial) + #:use-module ((guix build-system gnu) #:select (package-with-explicit-inputs)) #:use-module ((distro) #:select (search-patch)) #:use-module (distro packages base) #:use-module (distro packages bash) @@ -29,6 +30,7 @@ #:use-module (distro packages linux) #:use-module (distro packages multiprecision) #:use-module (ice-9 match) + #:use-module (srfi srfi-1) #:export (%bootstrap-binaries-tarball %binutils-bootstrap-tarball %glibc-bootstrap-tarball @@ -66,6 +68,29 @@ (augment (apply args x))) (augment args))))))) +(define %glibc-with-relocatable-system + ;; A libc whose `system' and `popen' functions looks for `sh' in $PATH. + (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))))) + (inputs + `(("patch/system" ,(search-patch "glibc-bootstrap-system.patch")) + ,@(package-inputs glibc-final))))) + +(define %standard-inputs-with-relocatable-glibc + ;; Standard inputs with the above libc and corresponding GCC. + `(("libc", %glibc-with-relocatable-system) + ("gcc" ,(package-with-explicit-inputs + gcc-4.7 + `(("libc",%glibc-with-relocatable-system) + ,@(alist-delete "libc" %final-inputs)) + (current-source-location))) + ,@(fold alist-delete %final-inputs '("libc" "gcc")))) + (define %bash-static (let ((bash-light (package (inherit bash-final) (inputs '()) ; no readline, no curses @@ -121,7 +146,8 @@ (gawk (package (inherit gawk) (arguments (lambda (system) - `(#:phases (alist-cons-before + `(#:patches (list (assoc-ref %build-inputs "patch/sh")) + #:phases (alist-cons-before 'build 'no-export-dynamic (lambda* (#:key outputs #:allow-other-keys) ;; Since we use `-static', remove @@ -129,10 +155,16 @@ (substitute* "configure" (("-export-dynamic") ""))) %standard-phases) - ,@((package-arguments gawk) system))))))) + ,@((package-arguments gawk) system)))) + (inputs `(("patch/sh" ,(search-patch "gawk-shell.patch")))))) + (finalize (lambda (p) + (static-package (package-with-explicit-inputs + p + %standard-inputs-with-relocatable-glibc) + (current-source-location))))) `(,@(map (match-lambda ((name package) - (list name (static-package package (current-source-location))))) + (list name (finalize package)))) `(("tar" ,tar) ("gzip" ,gzip) ("bzip2" ,bzip2) @@ -272,84 +304,87 @@ ;; GNU libc's essential shared libraries, dynamic linker, and headers, ;; with all references to store directories stripped. As a result, ;; libc.so is unusable and need to be patched for proper relocation. - (package (inherit glibc-final) - (name "glibc-stripped") - (build-system trivial-build-system) - (arguments - `(#:modules ((guix build utils)) - #:builder - (begin - (use-modules (guix build utils)) + (let ((glibc %glibc-with-relocatable-system)) + (package (inherit glibc) + (name "glibc-stripped") + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) - (setvbuf (current-output-port) _IOLBF) - (let* ((out (assoc-ref %outputs "out")) - (libdir (string-append out "/lib")) - (incdir (string-append out "/include")) - (libc (assoc-ref %build-inputs "libc")) - (linux (assoc-ref %build-inputs "linux-headers"))) - (mkdir-p libdir) - (for-each (lambda (file) - (let ((target (string-append libdir "/" - (basename file)))) - (copy-file file target) - (remove-store-references target))) - (find-files (string-append libc "/lib") - "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so(\\..*)?|libc_nonshared\\.a)$")) + (setvbuf (current-output-port) _IOLBF) + (let* ((out (assoc-ref %outputs "out")) + (libdir (string-append out "/lib")) + (incdir (string-append out "/include")) + (libc (assoc-ref %build-inputs "libc")) + (linux (assoc-ref %build-inputs "linux-headers"))) + (mkdir-p libdir) + (for-each (lambda (file) + (let ((target (string-append libdir "/" + (basename file)))) + (copy-file file target) + (remove-store-references target))) + (find-files (string-append libc "/lib") + "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so(\\..*)?|libc_nonshared\\.a)$")) - (copy-recursively (string-append libc "/include") incdir) + (copy-recursively (string-append libc "/include") incdir) - ;; Copy some of the Linux-Libre headers that glibc headers - ;; refer to. - (mkdir (string-append incdir "/linux")) - (for-each (lambda (file) - (copy-file (string-append linux "/include/linux/" file) - (string-append incdir "/linux/" - (basename file)))) - '("limits.h" "errno.h" "socket.h" "kernel.h" - "sysctl.h" "param.h" "ioctl.h" "types.h" - "posix_types.h" "stddef.h")) + ;; Copy some of the Linux-Libre headers that glibc headers + ;; refer to. + (mkdir (string-append incdir "/linux")) + (for-each (lambda (file) + (copy-file (string-append linux "/include/linux/" file) + (string-append incdir "/linux/" + (basename file)))) + '("limits.h" "errno.h" "socket.h" "kernel.h" + "sysctl.h" "param.h" "ioctl.h" "types.h" + "posix_types.h" "stddef.h")) - (copy-recursively (string-append linux "/include/asm") - (string-append incdir "/asm")) - (copy-recursively (string-append linux "/include/asm-generic") - (string-append incdir "/asm-generic")) - #t)))) - (inputs `(("libc" ,glibc-final) - ("linux-headers" ,linux-libre-headers))))) + (copy-recursively (string-append linux "/include/asm") + (string-append incdir "/asm")) + (copy-recursively (string-append linux "/include/asm-generic") + (string-append incdir "/asm-generic")) + #t)))) + (inputs `(("libc" ,glibc) + ("linux-headers" ,linux-libre-headers)))))) (define %gcc-static ;; A statically-linked GCC, with stripped-down functionality. - (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)))))) - (inputs `(("gmp-source" ,(package-source gmp)) - ("mpfr-source" ,(package-source mpfr)) - ("mpc-source" ,(package-source mpc)) - ("binutils" ,binutils-final) - ,@(package-inputs gcc-4.7))))) + (package-with-explicit-inputs + (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)))))) + (inputs `(("gmp-source" ,(package-source gmp)) + ("mpfr-source" ,(package-source mpfr)) + ("mpc-source" ,(package-source mpc)) + ("binutils" ,binutils-final) + ,@(package-inputs gcc-4.7)))) + %standard-inputs-with-relocatable-glibc)) (define %gcc-stripped ;; The subset of GCC files needed for bootstrap. @@ -429,7 +464,9 @@ ;; There are uses of `dynamic-link' in ;; {foreign,coverage}.test that don't fly here. #:tests? #f))))) - (static-package guile (current-source-location)))) + (package-with-explicit-inputs (static-package guile) + %standard-inputs-with-relocatable-glibc + (current-source-location)))) (define %guile-static-stripped ;; A stripped static Guile binary, for use during bootstrap. diff --git a/distro/packages/patches/gawk-shell.patch b/distro/packages/patches/gawk-shell.patch new file mode 100644 index 0000000000..89b8540a8d --- /dev/null +++ b/distro/packages/patches/gawk-shell.patch @@ -0,0 +1,34 @@ +As for libc's `system', change Awk to look for `sh' in $PATH. This patch is +only meant to be used during bootstrapping, where we don't know in advance the +absolute file name of `sh'. + +--- gawk-4.0.0/io.c 2011-05-18 20:47:29.000000000 +0200 ++++ gawk-4.0.0/io.c 2012-12-18 15:56:06.000000000 +0100 +@@ -1759,7 +1759,7 @@ two_way_open(const char *str, struct red + + signal(SIGPIPE, SIG_DFL); + +- execl("/bin/sh", "sh", "-c", str, NULL); ++ execlp("sh", "sh", "-c", str, NULL); + _exit(errno == ENOENT ? 127 : 126); + + case -1: +@@ -1924,7 +1924,7 @@ use_pipes: + || close(ctop[0]) == -1 || close(ctop[1]) == -1) + fatal(_("close of pipe failed (%s)"), strerror(errno)); + /* stderr does NOT get dup'ed onto child's stdout */ +- execl("/bin/sh", "sh", "-c", str, NULL); ++ execlp("sh", "sh", "-c", str, NULL); + _exit(errno == ENOENT ? 127 : 126); + } + #endif /* NOT __EMX__ */ +@@ -2074,7 +2074,7 @@ gawk_popen(const char *cmd, struct redir + fatal(_("moving pipe to stdout in child failed (dup: %s)"), strerror(errno)); + if (close(p[0]) == -1 || close(p[1]) == -1) + fatal(_("close of pipe failed (%s)"), strerror(errno)); +- execl("/bin/sh", "sh", "-c", cmd, NULL); ++ execlp("sh", "sh", "-c", cmd, NULL); + _exit(errno == ENOENT ? 127 : 126); + } + #endif /* NOT __EMX__ */ + diff --git a/distro/packages/patches/glibc-bootstrap-system.patch b/distro/packages/patches/glibc-bootstrap-system.patch new file mode 100644 index 0000000000..7208cce3f4 --- /dev/null +++ b/distro/packages/patches/glibc-bootstrap-system.patch @@ -0,0 +1,28 @@ +We want to allow builds in chroots that lack /bin/sh. Thus, system(3) +and popen(3) need to be tweaked to use the right shell. For the bootstrap +glibc, we just use whatever `sh' can be found in $PATH. The final glibc +instead uses the hard-coded absolute file name of `bash'. + +--- a/sysdeps/posix/system.c ++++ b/sysdeps/posix/system.c +@@ -134,7 +134,7 @@ do_system (const char *line) + INIT_LOCK (); + + /* Exec the shell. */ +- (void) __execve (SHELL_PATH, (char *const *) new_argv, __environ); ++ (void) __execvpe (SHELL_NAME, (char *const *) new_argv, __environ); + _exit (127); + } + else if (pid < (pid_t) 0) + +--- b/libio/iopopen.c 2012-06-30 21:12:34.000000000 +0200 ++++ b/libio/iopopen.c 2012-12-19 12:52:29.000000000 +0100 +@@ -226,7 +226,7 @@ _IO_new_proc_open (fp, command, mode) + _IO_close (fd); + } + +- _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0); ++ execlp ("sh", "sh", "-c", command, (char *) 0); + _IO__exit (127); + } + _IO_close (child_end); From 0f0995521393b9ec1733de3475bf74c89732e556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 01:33:29 +0100 Subject: [PATCH 17/71] distro: Update bootstrap binaries. Use bootstrap binaries that were generated with the `make-bootstrap' changes introduced in previous commit. * Makefile.am (nodist_bootstrap_x86_64_linux_DATA, nodist_bootstrap_i686_linux_DATA): Change Guile tarball name. (distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz, distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz): New targets. (distro/packages/bootstrap/x86_64-linux/guile-bootstrap-2.0.6.tar.xz, distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz): Remove. * build-aux/download.scm (file-name->uri): Use "20121219" directory. * distro/packages/bootstrap.scm (%bootstrap-guile): Update file name. (%bootstrap-coreutils&co, %bootstrap-binutils, %bootstrap-glibc, %bootstrap-gcc): Update directory name and hashes. --- Makefile.am | 12 ++++++------ build-aux/download.scm | 2 +- distro/packages/bootstrap.scm | 24 ++++++++++++------------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Makefile.am b/Makefile.am index f256e47995..0f58d09d8b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -142,9 +142,9 @@ dist_bootstrap_i686_linux_DATA = \ # Big bootstrap binaries are not included in the tarball. Instead, they # are downloaded. nodist_bootstrap_x86_64_linux_DATA = \ - distro/packages/bootstrap/x86_64-linux/guile-bootstrap-2.0.6.tar.xz + distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz nodist_bootstrap_i686_linux_DATA = \ - distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz + distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz # Those files must remain executable, so they remain executable once # imported into the store. @@ -161,12 +161,12 @@ DOWNLOAD_FILE = \ $(GUILE) --no-auto-compile -L "$(top_builddir)" -L "$(top_srcdir)" \ "$(top_srcdir)/build-aux/download.scm" -distro/packages/bootstrap/x86_64-linux/guile-bootstrap-2.0.6.tar.xz: +distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz: $(MKDIR_P) `dirname "$@"` - $(DOWNLOAD_FILE) "$@" "0467a82cbe4136f60a79eb4176011bf88cf28ea19c9ad9defa365811ff8e11cf" -distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz: + $(DOWNLOAD_FILE) "$@" "953fbcc8db6e310626be79b67319cf4141dc23b296447952a99d95425b3a4dc1" +distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz: $(MKDIR_P) `dirname "$@"` - $(DOWNLOAD_FILE) "$@" "93b537766dfab3ad287143523751e3ec02dd32d3ccaf88ad2d31c63158f342ee" + $(DOWNLOAD_FILE) "$@" "45d1f9bfb9e4531a8f1c5a105f7ab094cd481b8a179ccc63cbabb73ce6b8437f" nobase_nodist_guilemodule_DATA = $(GOBJECTS) guix/config.scm diff --git a/build-aux/download.scm b/build-aux/download.scm index 4c1a1a6e5d..f5d23f2701 100644 --- a/build-aux/download.scm +++ b/build-aux/download.scm @@ -35,7 +35,7 @@ (match (string-tokenize file (char-set-complement (char-set #\/))) ((_ ... system basename) (string->uri (string-append %url-base "/" system - "/20121115/" basename))))) + "/20121219/" basename))))) (match (command-line) ((_ file expected-hash) diff --git a/distro/packages/bootstrap.scm b/distro/packages/bootstrap.scm index 6dc9c3d965..222f087372 100644 --- a/distro/packages/bootstrap.scm +++ b/distro/packages/bootstrap.scm @@ -167,7 +167,7 @@ check whether everything is alright." (xz (->store "xz")) (mkdir (->store "mkdir")) (bash (->store "bash")) - (guile (->store "guile-bootstrap-2.0.6.tar.xz")) + (guile (->store "guile-2.0.7.tar.xz")) (builder (add-text-to-store store "build-bootstrap-guile.sh" @@ -205,15 +205,15 @@ $out/bin/guile --version~%" (method url-fetch) (uri (string-append %bootstrap-base-url "/" - system "/20121115/static-binaries.tar.xz")) + system "/20121219/static-binaries.tar.xz")) (sha256 (match system ("x86_64-linux" (base32 - "0azisn8l2b3cvgni9k0ahzsxs5cxrj0hmf38zgpq3k6pggk3zbfm")) + "1vvdr1hfbjxlincpgfwhz9l4mbrjf502bv5nivapk5b2d3xxfyvv")) ("i686-linux" (base32 - "16v60frbh0naccanwxcxz0z3444dd8salbg8p7cp7vwz8245nhfk")))))) + "18ky02ifa0w5afyil04fh5whlsqdw0h8kn2fkibfhwfsm5q9d5fx")))))) "true" ; the program to test "Bootstrap binaries of Coreutils, Awk, etc.")) @@ -224,7 +224,7 @@ $out/bin/guile --version~%" (method url-fetch) (uri (string-append %bootstrap-base-url "/" - system "/20121115/binutils-2.22.tar.xz")) + system "/20121219/binutils-2.22.tar.xz")) (sha256 (match system ("x86_64-linux" @@ -232,7 +232,7 @@ $out/bin/guile --version~%" "0ms6i035v40n7mhi91n4b8ivwv2qni3mcd5dj9sj9qmvgqb50r84")) ("i686-linux" (base32 - "193x62ach4l4x16rbzglrqa1d0a825z2as6czdiv9xjiizmcr0ad")))))) + "16yr3jxqjvd979vvpikfn4rl9fqrbcs5viwd2r8xzf5bakc2mq9p")))))) "ld" ; the program to test "Bootstrap binaries of the GNU Binutils")) @@ -277,15 +277,15 @@ $out/bin/guile --version~%" (origin (method url-fetch) (uri (string-append %bootstrap-base-url "/" system - "/20121115/glibc-2.16.0.tar.xz")) + "/20121219/glibc-2.16.0.tar.xz")) (sha256 (match system ("x86_64-linux" (base32 - "1cz587p3scrrx0zgqnmp4nnfj0vvf01zdqdgkz445dnbfh64nl0v")) + "1mqpb2sxfa5whdq0adyrgg7j3ci5v4d42wna8hg4j3dbcr5b2vpi")) ("i686-linux" (base32 - "0vzybz1577vflm0p0zg1slqj32carj5102b45k7iskkj46viy14z")))))))))) + "03wb29srsdswc775ppzwllys0dqyy235shm1n64jl6njw4l7c5x6")))))))))) (synopsis "Bootstrap binaries and headers of the GNU C Library") (description #f) (home-page #f))) @@ -348,15 +348,15 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \ (origin (method url-fetch) (uri (string-append %bootstrap-base-url "/" system - "/20121115/gcc-4.7.2.tar.xz")) + "/20121219/gcc-4.7.2.tar.xz")) (sha256 (match system ("x86_64-linux" (base32 - "0fg65i2qcym8ls5ig3g1cc9ida5cxwwsd6zi95xi1d8dnfrja4zz")) + "1k374q9v1bph8605sirzmaxnawbddahpgq8d99x1527gj5n2xws1")) ("i686-linux" (base32 - "01hlz98qmc8yhqrxqajpg5kbkhpvqq6wjnbfvplys32n895avzxg")))))))))) + "040jkqkh0qyva5z6gy4d95khhhvsw4vp8x3l818gpi6hfknwb9l8")))))))))) (synopsis "Bootstrap binaries of the GNU Compiler Collection") (description #f) (home-page #f))) From a18b4d085bf7d39cb089f9f67d6089516ebb345a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 01:34:42 +0100 Subject: [PATCH 18/71] utils: Add a `progress' parameter to `dump-port'. * guix/build/utils.scm (dump-port): Add a `progress' keyword parameter. Call it after each transfer. --- guix/build/utils.scm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 99a43cfebd..0de7392620 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -371,17 +371,25 @@ all subject to the substitutions." ;;; Patching shebangs---e.g., /bin/sh -> /nix/store/xyz...-bash/bin/sh. ;;; -(define* (dump-port in out #:key (buffer-size 16384)) +(define* (dump-port in out + #:key (buffer-size 16384) + (progress (lambda (t k) (k)))) "Read as much data as possible from IN and write it to OUT, using -chunks of BUFFER-SIZE bytes." +chunks of BUFFER-SIZE bytes. Call PROGRESS after each successful +transfer of BUFFER-SIZE bytes or less, passing it the total number of +bytes transferred and the continuation of the transfer as a thunk." (define buffer (make-bytevector buffer-size)) - (let loop ((bytes (get-bytevector-n! in buffer 0 buffer-size))) + (let loop ((total 0) + (bytes (get-bytevector-n! in buffer 0 buffer-size))) (or (eof-object? bytes) - (begin + (let ((total (+ total bytes))) (put-bytevector out buffer 0 bytes) - (loop (get-bytevector-n! in buffer 0 buffer-size)))))) + (progress total + (lambda () + (loop total + (get-bytevector-n! in buffer 0 buffer-size)))))))) (define patch-shebang (let ((shebang-rx (make-regexp "^[[:blank:]]*([[:graph:]]+)(.*)$"))) From 49f5a21698f4e47b381c9c1f2ecc13d19d1faaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 01:35:58 +0100 Subject: [PATCH 19/71] distro: ncurses: Patch references to /bin/sh. * distro/packages/ncurses.scm (ncurses): Add `patch-makefile-phase' and `pre-install-phase'. --- distro/packages/ncurses.scm | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/distro/packages/ncurses.scm b/distro/packages/ncurses.scm index 9764474c93..868222ef83 100644 --- a/distro/packages/ncurses.scm +++ b/distro/packages/ncurses.scm @@ -24,7 +24,14 @@ #:use-module (guix build-system gnu)) (define-public ncurses - (let ((post-install-phase + (let ((patch-makefile-phase + '(lambda _ + (substitute* (find-files "." "Makefile.in") + (("^SHELL[[:blank:]]*=.*$") "")))) + (pre-install-phase + '(lambda _ + (for-each patch-shebang (find-files "." "\\.sh$")))) + (post-install-phase '(lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) ;; When building a wide-character (Unicode) build, create backward @@ -81,9 +88,15 @@ '("--without-cxx-binding") '())) #:tests? #f ; no "check" target - #:phases (alist-cons-after 'install 'post-install - ,post-install-phase - %standard-phases) + #:phases (alist-cons-after + 'install 'post-install ,post-install-phase + (alist-cons-before + 'configure 'patch-makefile-SHELL + ,patch-makefile-phase + (alist-cons-before + 'install 'pre-install-phase + ,pre-install-phase + %standard-phases))) ;; The `ncursesw5-config' has a #!/bin/sh that we don't want to ;; patch, to avoid retaining a reference to the build-time Bash. From 8ccdbaa827c0be5a8c785f17d1eb5de165190ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 01:37:50 +0100 Subject: [PATCH 20/71] distro: Update `guile-final' to not fail during `patch-source-shebangs' phase. * distro/packages/base.scm (guile-final): Add workaround on top of GUILE-2.0/FIXED to avoid `patch-source-shebangs' failure on one of the source files. --- distro/packages/base.scm | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 7cb2dc116e..dacf8e46aa 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -967,11 +967,27 @@ store.") ;; FIXME: The Libtool used here, specifically its `bin/libtool' script, ;; holds a dependency on the bootstrap Binutils. Use multiple outputs for ;; Libtool, so that that dependency is isolated in the "bin" output. - (package-with-bootstrap-guile - (package-with-explicit-inputs guile-2.0/fixed - %boot4-inputs - (current-source-location) - #:guile %bootstrap-guile))) + (let ((guile (package (inherit guile-2.0/fixed) + (arguments + `(#:phases + (alist-cons-before + 'patch-source-shebangs 'delete-encoded-test + (lambda* (#:key inputs #:allow-other-keys) + ;; %BOOTSTRAP-GUILE doesn't know about encodings other + ;; than UTF-8. That test declares an ISO-8859-1 + ;; encoding, which prevents `patch-shebang' from + ;; working, so skip it. + (call-with-output-file + "test-suite/standalone/test-command-line-encoding2" + (lambda (p) + (format p "#!~a/bin/bash\nexit 77" + (assoc-ref inputs "bash"))))) + %standard-phases)))))) + (package-with-bootstrap-guile + (package-with-explicit-inputs guile + %boot4-inputs + (current-source-location) + #:guile %bootstrap-guile)))) (define-public ld-wrapper ;; The final `ld' wrapper, which uses the final Guile. From c20313637f1676a50c009db6da60d97a93467f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 17:59:10 +0100 Subject: [PATCH 21/71] distro: gawk: Use the right shell instead of /bin/sh. * distro/packages/gawk.scm (gawk): Patch shell file name in io.c. --- distro/packages/gawk.scm | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/distro/packages/gawk.scm b/distro/packages/gawk.scm index fd8f087509..d875386fc2 100644 --- a/distro/packages/gawk.scm +++ b/distro/packages/gawk.scm @@ -35,13 +35,25 @@ (sha256 (base32 "0sss7rhpvizi2a88h6giv0i7w5h07s2fxkw3s6n1hqvcnhrfgbb0")))) (build-system gnu-build-system) - (arguments (case-lambda - ((system) - (if (string=? system "i686-cygwin") - '(#:tests? #f) ; work around test failure on Cygwin - '(#:parallel-tests? #f))) ; test suite fails in parallel - ((system cross-system) - '(#:parallel-tests? #f)))) + (arguments + (case-lambda + ((system) + `(#:parallel-tests? #f ; test suite fails in parallel + + ;; Work around test failure on Cygwin. + #:tests? ,(not (string=? 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)))) (inputs `(("libsigsegv" ,libsigsegv) ; headers ("libsigsegv/lib" ,libsigsegv "lib"))) ; library (home-page "http://www.gnu.org/software/gawk/") From 530c169561b366d60457e499f7eb198929ffa917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 18:02:07 +0100 Subject: [PATCH 22/71] distro: bash, readline: Patch so that `make' uses the right shell. * distro/packages/readline.scm (readline): Add `pre-configure-phase' to patch `MAKE_SHELL' in `configure. Move `post-install-phase' body to a variable. * distro/packages/bash.scm (bash): Likewise. --- distro/packages/bash.scm | 30 ++++++++---- distro/packages/readline.scm | 90 ++++++++++++++++++++---------------- 2 files changed, 71 insertions(+), 49 deletions(-) diff --git a/distro/packages/bash.scm b/distro/packages/bash.scm index 944bd077a3..c2022fcf95 100644 --- a/distro/packages/bash.scm +++ b/distro/packages/bash.scm @@ -32,7 +32,20 @@ "-DSTANDARD_UTILS_PATH='\"/no-such-path\"'" "-DNON_INTERACTIVE_LOGIN_SHELLS" "-DSSH_SOURCE_BASHRC") - " "))) + " ")) + (pre-configure-phase + '(lambda* (#:key inputs #:allow-other-keys) + ;; Use the right shell for makefiles. + (let ((bash (assoc-ref inputs "bash"))) + (substitute* "configure" + (("MAKE_SHELL=[^ ]+") + (format #f "MAKE_SHELL=~a/bin/bash" bash)))))) + (post-install-phase + '(lambda* (#:key outputs #:allow-other-keys) + ;; Add a `bash' -> `sh' link. + (let ((out (assoc-ref outputs "out"))) + (with-directory-excursion (string-append out "/bin") + (symlink "bash" "sh")))))) (package (name "bash") (version "4.2") @@ -67,15 +80,12 @@ ;; for now. #:tests? #f - #:phases - (alist-cons-after 'install 'post-install - (lambda* (#:key outputs #:allow-other-keys) - ;; Add a `bash' -> `sh' link. - (let ((out (assoc-ref outputs "out"))) - (with-directory-excursion - (string-append out "/bin") - (symlink "bash" "sh")))) - %standard-phases))) + #:phases (alist-cons-before + 'configure 'pre-configure + ,pre-configure-phase + (alist-cons-after 'install 'post-install + ,post-install-phase + %standard-phases)))) (synopsis "GNU Bourne-Again Shell") (description "Bash is the shell, or command language interpreter, that will appear in diff --git a/distro/packages/readline.scm b/distro/packages/readline.scm index d474198c17..bf542e90b5 100644 --- a/distro/packages/readline.scm +++ b/distro/packages/readline.scm @@ -26,44 +26,56 @@ #:use-module (guix build-system gnu)) (define-public readline - (package - (name "readline") - (version "6.2") - (source (origin - (method url-fetch) - (uri (string-append "mirror://gnu/readline/readline-" - version ".tar.gz")) - (sha256 - (base32 - "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr")))) - (build-system gnu-build-system) - (propagated-inputs `(("ncurses" ,ncurses))) - (inputs `(("patch/link-ncurses" - ,(search-patch "readline-link-ncurses.patch")))) - (arguments `(#:patches (list (assoc-ref %build-inputs - "patch/link-ncurses")) - #:patch-flags '("-p0") - #:configure-flags - (list (string-append "LDFLAGS=-Wl,-rpath -Wl," - (assoc-ref %build-inputs "ncurses") - "/lib")) + (let ((post-install-phase + '(lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (lib (string-append out "/lib"))) + ;; Make libraries writable so that `strip' can work. + ;; Failing to do that, it bails out with "Permission + ;; denied". + (for-each (lambda (f) (chmod f #o755)) + (find-files lib "\\.so")) + (for-each (lambda (f) (chmod f #o644)) + (find-files lib "\\.a"))))) + (pre-configure-phase + '(lambda* (#:key inputs #:allow-other-keys) + ;; Use the right shell for makefiles. + (let ((bash (assoc-ref inputs "bash"))) + (substitute* "configure" + (("^MAKE_SHELL=.*") + (format #f "MAKE_SHELL=~a/bin/bash" bash))))))) + (package + (name "readline") + (version "6.2") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/readline/readline-" + version ".tar.gz")) + (sha256 + (base32 + "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr")))) + (build-system gnu-build-system) + (propagated-inputs `(("ncurses" ,ncurses))) + (inputs `(("patch/link-ncurses" + ,(search-patch "readline-link-ncurses.patch")))) + (arguments `(#:patches (list (assoc-ref %build-inputs + "patch/link-ncurses")) + #:patch-flags '("-p0") + #:configure-flags + (list (string-append "LDFLAGS=-Wl,-rpath -Wl," + (assoc-ref %build-inputs "ncurses") + "/lib")) - #:phases (alist-cons-after - 'install 'post-install - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (lib (string-append out "/lib"))) - ;; Make libraries writable so that `strip' can - ;; work. Failing to do that, it bails out with - ;; "Permission denied". - (for-each (lambda (f) (chmod f #o755)) - (find-files lib "\\.so")) - (for-each (lambda (f) (chmod f #o644)) - (find-files lib "\\.a")))) - %standard-phases))) - (synopsis "GNU Readline, a library for interactive line editing") - (description - "The GNU Readline library provides a set of functions for use by + #:phases (alist-cons-after + 'install 'post-install + ,post-install-phase + (alist-cons-before + 'configure 'pre-configure + ,pre-configure-phase + %standard-phases)))) + (synopsis "GNU Readline, a library for interactive line editing") + (description + "The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes additional functions to maintain a list of previously-entered command lines, @@ -73,5 +85,5 @@ expansion on previous commands. The history facilites are also placed into a separate library, the History library, as part of the build process. The History library may be used without Readline in applications which desire its capabilities.") - (license gpl3+) - (home-page "http://savannah.gnu.org/projects/readline/"))) + (license gpl3+) + (home-page "http://savannah.gnu.org/projects/readline/")))) From 42ff70e26263bfe4c55398a246a3ab0ad2b6200c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 19:00:14 +0100 Subject: [PATCH 23/71] distro: libtool: Run test suite in parallel; patch references to /bin/sh. * distro/packages/autotools.scm (libtool): Add `pre-check' phase. --- distro/packages/autotools.scm | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/distro/packages/autotools.scm b/distro/packages/autotools.scm index 238025b540..1c01b3d3db 100644 --- a/distro/packages/autotools.scm +++ b/distro/packages/autotools.scm @@ -100,8 +100,30 @@ Standards. Automake requires the use of Autoconf.") (native-inputs `(("m4" ,m4) ("perl" ,perl))) (arguments - ;; TODO: Use `TESTSUITEFLAGS=-jN' for tests. - `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests")))) + `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests")) + #:phases (alist-cons-before + 'check 'pre-check + (lambda* (#:key inputs #:allow-other-keys) + ;; Run the test suite in parallel, if possible. + (let ((ncores + (cond + ((getenv "NIX_BUILD_CORES") + => + (lambda (n) + (if (zero? (string->number n)) + (number->string (current-processor-count)) + n))) + (else "1")))) + (setenv "TESTSUITEFLAGS" + (string-append "-j" ncores))) + + ;; Path references to /bin/sh. + (patch-shebang "libtoolize") + (let ((bash (assoc-ref inputs "bash"))) + (substitute* "tests/testsuite" + (("/bin/sh") + (string-append bash "/bin/bash"))))) + %standard-phases))) (inputs `(("patch/skip-tests" ,(search-patch "libtool-skip-tests.patch")))) (synopsis "GNU Libtool, a generic library support script") From f5b7894942e91ae1cf01138f1ae81c140c9fab35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 19:01:14 +0100 Subject: [PATCH 24/71] distro: m4: Patch references to /bin/sh. * distro/packages/m4.scm (m4): Add `pre-check' phase. --- distro/packages/m4.scm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/distro/packages/m4.scm b/distro/packages/m4.scm index 19243a8c2d..ec0e1a868c 100644 --- a/distro/packages/m4.scm +++ b/distro/packages/m4.scm @@ -46,7 +46,19 @@ #:patches (list (assoc-ref %build-inputs "patch/s_isdir") (assoc-ref %build-inputs "patch/readlink-EINVAL") - (assoc-ref %build-inputs "patch/gets")))) + (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 From 4c377e861b11ed5c5689fdb3ba2d1d864c77cef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 22:31:08 +0100 Subject: [PATCH 25/71] build-system/gnu: Report the execution time of each phase. * guix/build/gnu-build-system.scm (gnu-build): Report the success or failure of each phase and its execution time. --- guix/build/gnu-build-system.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 5e899403e8..8692359bd8 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -20,6 +20,7 @@ #:use-module (guix build utils) #:use-module (ice-9 ftw) #:use-module (ice-9 match) + #:use-module (ice-9 format) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (%standard-phases @@ -267,6 +268,11 @@ in order. Return #t if all the PHASES succeeded, #f otherwise." ;; PHASES can pick the keyword arguments it's interested in. (every (match-lambda ((name . proc) - (format #t "starting phase `~a'~%" name) - (apply proc args))) + (let ((start (gettimeofday))) + (format #t "starting phase `~a'~%" name) + (let ((result (apply proc args)) + (end (gettimeofday))) + (format #t "phase `~a' ~:[failed~;succeeded~] after ~a seconds~%" + name result (- (car end) (car start))) + result)))) phases)) From eca63d3df8642587c35765af8446c1669e192789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 23:06:34 +0100 Subject: [PATCH 26/71] build-system/gnu: Patch shebangs after `configure'. * guix/build/gnu-build-system.scm (patch-generated-files): New procedure. (%standard-phases): Add it after `configure'. --- guix/build/gnu-build-system.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 8692359bd8..18c66e5256 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -101,6 +101,8 @@ (("^SHELL[[:blank:]]*=.*$") (string-append "SHELL = " bash "\n")))))) +(define patch-generated-files patch-source-shebangs) + (define* (patch #:key (patches '()) (patch-flags '("--batch" "-p1")) #:allow-other-keys) (every (lambda (p) @@ -250,7 +252,8 @@ ;; Standard build phases, as a list of symbol/procedure pairs. (let-syntax ((phases (syntax-rules () ((_ p ...) `((p . ,p) ...))))) - (phases set-paths unpack patch patch-source-shebangs configure + (phases set-paths unpack patch + patch-source-shebangs configure patch-generated-files build check install patch-shebangs strip))) From 8ffaa93bffdb08dfe175854863462211d61261be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Dec 2012 23:07:46 +0100 Subject: [PATCH 27/71] distro: guile: Patch (ice-9 popen) to use the right shell. * distro/packages/guile.scm (guile-2.0): Add `pre-configure'. * distro/packages/base.scm (guile-final): Adjust to preserve the `pre-configure' phase. --- distro/packages/base.scm | 30 ++++++++++++++++-------------- distro/packages/guile.scm | 10 ++++++++++ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index dacf8e46aa..971190ed6a 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -969,20 +969,22 @@ store.") ;; Libtool, so that that dependency is isolated in the "bin" output. (let ((guile (package (inherit guile-2.0/fixed) (arguments - `(#:phases - (alist-cons-before - 'patch-source-shebangs 'delete-encoded-test - (lambda* (#:key inputs #:allow-other-keys) - ;; %BOOTSTRAP-GUILE doesn't know about encodings other - ;; than UTF-8. That test declares an ISO-8859-1 - ;; encoding, which prevents `patch-shebang' from - ;; working, so skip it. - (call-with-output-file - "test-suite/standalone/test-command-line-encoding2" - (lambda (p) - (format p "#!~a/bin/bash\nexit 77" - (assoc-ref inputs "bash"))))) - %standard-phases)))))) + (substitute-keyword-arguments + (package-arguments guile-2.0/fixed) + ((#:phases phases) + `(alist-cons-before + 'patch-source-shebangs 'delete-encoded-test + (lambda* (#:key inputs #:allow-other-keys) + ;; %BOOTSTRAP-GUILE doesn't know about encodings other + ;; than UTF-8. That test declares an ISO-8859-1 + ;; encoding, which prevents `patch-shebang' from + ;; working, so skip it. + (call-with-output-file + "test-suite/standalone/test-command-line-encoding2" + (lambda (p) + (format p "#!~a/bin/bash\nexit 77" + (assoc-ref inputs "bash"))))) + ,phases))))))) (package-with-bootstrap-guile (package-with-explicit-inputs guile %boot4-inputs diff --git a/distro/packages/guile.scm b/distro/packages/guile.scm index a5d37eb40b..68c2fcc2ef 100644 --- a/distro/packages/guile.scm +++ b/distro/packages/guile.scm @@ -120,6 +120,16 @@ extensible. It supports many SRFIs.") (self-native-input? #t) + (arguments + '(#:phases (alist-cons-before + 'configure 'pre-configure + (lambda* (#:key inputs #:allow-other-keys) + (let ((bash (assoc-ref inputs "bash"))) + (substitute* "module/ice-9/popen.scm" + (("/bin/sh") + (string-append bash "/bin/bash"))))) + %standard-phases))) + (synopsis "GNU Guile 2.0, an embeddable Scheme implementation") (description "GNU Guile is an implementation of the Scheme programming language, with From 8722e80e82f6b2ca326b20a4b3179ed25115ce4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 21 Dec 2012 17:59:23 +0100 Subject: [PATCH 28/71] distro: coreutils: Update to 8.20. * distro/packages/base.scm (coreutils): Update to 8.20. --- distro/packages/base.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 971190ed6a..0a937486a4 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -252,14 +252,14 @@ The tools supplied with this package are: (define-public coreutils (package (name "coreutils") - (version "8.19") + (version "8.20") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/coreutils/coreutils-" version ".tar.xz")) (sha256 (base32 - "1rx9x3fp848w4nny7irdkcpkan9fcx24d99v5dkwgkyq7wc76f5d")))) + "1cly97xdy3v4nbbx631k43smqw0nnpn651kkprs0yyl2cj3pkjyv")))) (build-system gnu-build-system) (inputs `()) ; TODO: optional deps: SELinux, ACL, GMP (arguments From c089511288820cfb3efc5295e572be24aa83f068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 21 Dec 2012 22:31:25 +0100 Subject: [PATCH 29/71] build-system/gnu: Patch shebangs in all the source; patch SHELL in makefiles. * guix/build/utils.scm (call-with-ascii-input-file): New procedure. (patch-shebang): Use it. (patch-makefile-SHELL): New procedure. * guix/build/gnu-build-system.scm (patch-source-shebangs): Patch all the files, not just executables; remove `po/Makefile.in.in' patching. (patch-generated-files): Rename to... (patch-generated-file-shebangs): ... this. Patch executables and makefiles. (%standard-phases): Adjust accordingly. * distro/packages/autotools.scm (libtool): Remove call to `patch-shebang'. * distro/packages/base.scm (gcc-4.7): Likewise. (guile-final): Remove hack to skip `test-command-line-encoding2'. * distro/packages/bash.scm (bash): Remove `pre-configure-phase'. * distro/packages/readline.scm (readline): Likewise. * distro/packages/ncurses.scm (ncurses): Remove `pre-install-phase'. --- distro/packages/autotools.scm | 1 - distro/packages/base.scm | 31 ++---------- distro/packages/bash.scm | 16 ++---- distro/packages/ncurses.scm | 8 +-- distro/packages/readline.scm | 14 +---- guix/build/gnu-build-system.scm | 28 +++++----- guix/build/utils.scm | 90 ++++++++++++++++++++++++--------- 7 files changed, 92 insertions(+), 96 deletions(-) diff --git a/distro/packages/autotools.scm b/distro/packages/autotools.scm index 1c01b3d3db..171855b937 100644 --- a/distro/packages/autotools.scm +++ b/distro/packages/autotools.scm @@ -118,7 +118,6 @@ Standards. Automake requires the use of Autoconf.") (string-append "-j" ncores))) ;; Path references to /bin/sh. - (patch-shebang "libtoolize") (let ((bash (assoc-ref inputs "bash"))) (substitute* "tests/testsuite" (("/bin/sh") diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 0a937486a4..0289b6c688 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -428,9 +428,6 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.") ~a~%" libc line)))) - ;; Adjust hard-coded #!/bin/sh. - (patch-shebang "gcc/exec-tool.in") - ;; Don't retain a dependency on the build-time sed. (substitute* "fixincludes/fixincl.x" (("static char const sed_cmd_z\\[\\] =.*;") @@ -967,29 +964,11 @@ store.") ;; FIXME: The Libtool used here, specifically its `bin/libtool' script, ;; holds a dependency on the bootstrap Binutils. Use multiple outputs for ;; Libtool, so that that dependency is isolated in the "bin" output. - (let ((guile (package (inherit guile-2.0/fixed) - (arguments - (substitute-keyword-arguments - (package-arguments guile-2.0/fixed) - ((#:phases phases) - `(alist-cons-before - 'patch-source-shebangs 'delete-encoded-test - (lambda* (#:key inputs #:allow-other-keys) - ;; %BOOTSTRAP-GUILE doesn't know about encodings other - ;; than UTF-8. That test declares an ISO-8859-1 - ;; encoding, which prevents `patch-shebang' from - ;; working, so skip it. - (call-with-output-file - "test-suite/standalone/test-command-line-encoding2" - (lambda (p) - (format p "#!~a/bin/bash\nexit 77" - (assoc-ref inputs "bash"))))) - ,phases))))))) - (package-with-bootstrap-guile - (package-with-explicit-inputs guile - %boot4-inputs - (current-source-location) - #:guile %bootstrap-guile)))) + (package-with-bootstrap-guile + (package-with-explicit-inputs guile-2.0/fixed + %boot4-inputs + (current-source-location) + #:guile %bootstrap-guile))) (define-public ld-wrapper ;; The final `ld' wrapper, which uses the final Guile. diff --git a/distro/packages/bash.scm b/distro/packages/bash.scm index c2022fcf95..f32293d82f 100644 --- a/distro/packages/bash.scm +++ b/distro/packages/bash.scm @@ -33,13 +33,6 @@ "-DNON_INTERACTIVE_LOGIN_SHELLS" "-DSSH_SOURCE_BASHRC") " ")) - (pre-configure-phase - '(lambda* (#:key inputs #:allow-other-keys) - ;; Use the right shell for makefiles. - (let ((bash (assoc-ref inputs "bash"))) - (substitute* "configure" - (("MAKE_SHELL=[^ ]+") - (format #f "MAKE_SHELL=~a/bin/bash" bash)))))) (post-install-phase '(lambda* (#:key outputs #:allow-other-keys) ;; Add a `bash' -> `sh' link. @@ -80,12 +73,9 @@ ;; for now. #:tests? #f - #:phases (alist-cons-before - 'configure 'pre-configure - ,pre-configure-phase - (alist-cons-after 'install 'post-install - ,post-install-phase - %standard-phases)))) + #:phases (alist-cons-after 'install 'post-install + ,post-install-phase + %standard-phases))) (synopsis "GNU Bourne-Again Shell") (description "Bash is the shell, or command language interpreter, that will appear in diff --git a/distro/packages/ncurses.scm b/distro/packages/ncurses.scm index 868222ef83..8bde3c1989 100644 --- a/distro/packages/ncurses.scm +++ b/distro/packages/ncurses.scm @@ -28,9 +28,6 @@ '(lambda _ (substitute* (find-files "." "Makefile.in") (("^SHELL[[:blank:]]*=.*$") "")))) - (pre-install-phase - '(lambda _ - (for-each patch-shebang (find-files "." "\\.sh$")))) (post-install-phase '(lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) @@ -93,10 +90,7 @@ (alist-cons-before 'configure 'patch-makefile-SHELL ,patch-makefile-phase - (alist-cons-before - 'install 'pre-install-phase - ,pre-install-phase - %standard-phases))) + %standard-phases)) ;; The `ncursesw5-config' has a #!/bin/sh that we don't want to ;; patch, to avoid retaining a reference to the build-time Bash. diff --git a/distro/packages/readline.scm b/distro/packages/readline.scm index bf542e90b5..8e2a4cbb5d 100644 --- a/distro/packages/readline.scm +++ b/distro/packages/readline.scm @@ -36,14 +36,7 @@ (for-each (lambda (f) (chmod f #o755)) (find-files lib "\\.so")) (for-each (lambda (f) (chmod f #o644)) - (find-files lib "\\.a"))))) - (pre-configure-phase - '(lambda* (#:key inputs #:allow-other-keys) - ;; Use the right shell for makefiles. - (let ((bash (assoc-ref inputs "bash"))) - (substitute* "configure" - (("^MAKE_SHELL=.*") - (format #f "MAKE_SHELL=~a/bin/bash" bash))))))) + (find-files lib "\\.a")))))) (package (name "readline") (version "6.2") @@ -69,10 +62,7 @@ #:phases (alist-cons-after 'install 'post-install ,post-install-phase - (alist-cons-before - 'configure 'pre-configure - ,pre-configure-phase - %standard-phases)))) + %standard-phases))) (synopsis "GNU Readline, a library for interactive line editing") (description "The GNU Readline library provides a set of functions for use by diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 18c66e5256..b5eaa26bf5 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -84,24 +84,26 @@ (chdir (first-subdirectory ".")))) (define* (patch-source-shebangs #:key source #:allow-other-keys) - ;; Patch shebangs in executable source files. Most scripts honor - ;; $SHELL and $CONFIG_SHELL, but some don't, such as `mkinstalldirs' - ;; or Automake's `missing' script. + "Patch shebangs in all source files; this includes non-executable +files such as `.in' templates. Most scripts honor $SHELL and +$CONFIG_SHELL, but some don't, such as `mkinstalldirs' or Automake's +`missing' script." + (for-each patch-shebang + (remove file-is-directory? (find-files "." ".*")))) + +(define (patch-generated-file-shebangs . rest) + "Patch shebangs in generated files, including `SHELL' variables in +makefiles." + ;; Patch executable files, some of which might have been generated by + ;; `configure'. (for-each patch-shebang (filter (lambda (file) (and (executable-file? file) (not (file-is-directory? file)))) (find-files "." ".*"))) - ;; Gettext-generated po/Makefile.in.in does not honor $SHELL. - (let ((bash (search-path (search-path-as-string->list (getenv "PATH")) - "bash"))) - (when (file-exists? "po/Makefile.in.in") - (substitute* "po/Makefile.in.in" - (("^SHELL[[:blank:]]*=.*$") - (string-append "SHELL = " bash "\n")))))) - -(define patch-generated-files patch-source-shebangs) + ;; Patch `SHELL' in generated makefiles. + (for-each patch-makefile-SHELL (find-files "." "^(GNU)?[mM]akefile$"))) (define* (patch #:key (patches '()) (patch-flags '("--batch" "-p1")) #:allow-other-keys) @@ -253,7 +255,7 @@ (let-syntax ((phases (syntax-rules () ((_ p ...) `((p . ,p) ...))))) (phases set-paths unpack patch - patch-source-shebangs configure patch-generated-files + patch-source-shebangs configure patch-generated-file-shebangs build check install patch-shebangs strip))) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 0de7392620..c54c83883b 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -27,6 +27,7 @@ #:use-module (rnrs io ports) #:export (directory-exists? executable-file? + call-with-ascii-input-file with-directory-excursion mkdir-p copy-recursively @@ -43,6 +44,7 @@ substitute* dump-port patch-shebang + patch-makefile-SHELL fold-port-matches remove-store-references)) @@ -63,6 +65,21 @@ (and s (not (zero? (logand (stat:mode s) #o100)))))) +(define (call-with-ascii-input-file file proc) + "Open FILE as an ASCII or binary file, and pass the resulting port to +PROC. FILE is closed when PROC's dynamic extent is left. Return the +return values of applying PROC to the port." + (let ((port (with-fluids ((%default-port-encoding #f)) + ;; Use "b" so that `open-file' ignores `coding:' cookies. + (open-file file "rb")))) + (dynamic-wind + (lambda () + #t) + (lambda () + (proc port)) + (lambda () + (close-input-port port))))) + (define-syntax-rule (with-directory-excursion dir body ...) "Run BODY with DIR as the process's current directory." (let ((init (getcwd))) @@ -418,30 +435,55 @@ patched, #f otherwise." (false-if-exception (delete-file template)) #f)))) - (with-fluids ((%default-port-encoding #f)) ; ASCII - (call-with-input-file file - (lambda (p) - (and (eq? #\# (read-char p)) - (eq? #\! (read-char p)) - (let ((line (false-if-exception (read-line p)))) - (and=> (and line (regexp-exec shebang-rx line)) - (lambda (m) - (let* ((cmd (match:substring m 1)) - (bin (search-path path - (basename cmd)))) - (if bin - (if (string=? bin cmd) - #f ; nothing to do - (begin - (format (current-error-port) - "patch-shebang: ~a: changing `~a' to `~a'~%" - file cmd bin) - (patch p bin (match:substring m 2)))) - (begin - (format (current-error-port) - "patch-shebang: ~a: warning: no binary for interpreter `~a' found in $PATH~%" - file (basename cmd)) - #f))))))))))))) + (call-with-ascii-input-file file + (lambda (p) + (and (eq? #\# (read-char p)) + (eq? #\! (read-char p)) + (let ((line (false-if-exception (read-line p)))) + (and=> (and line (regexp-exec shebang-rx line)) + (lambda (m) + (let* ((cmd (match:substring m 1)) + (bin (search-path path (basename cmd)))) + (if bin + (if (string=? bin cmd) + #f ; nothing to do + (begin + (format (current-error-port) + "patch-shebang: ~a: changing `~a' to `~a'~%" + file cmd bin) + (patch p bin (match:substring m 2)))) + (begin + (format (current-error-port) + "patch-shebang: ~a: warning: no binary for interpreter `~a' found in $PATH~%" + file (basename cmd)) + #f)))))))))))) + +(define (patch-makefile-SHELL file) + "Patch the `SHELL' variable in FILE, which is supposedly a makefile." + + ;; For instance, Gettext-generated po/Makefile.in.in do not honor $SHELL. + + ;; XXX: Unlike with `patch-shebang', FILE is always touched. + + (define (find-shell name) + (let ((shell + (search-path (search-path-as-string->list (getenv "PATH")) + name))) + (unless shell + (format (current-error-port) + "patch-makefile-SHELL: warning: no binary for shell `~a' found in $PATH~%" + name)) + shell)) + + (substitute* file + (("^ *SHELL[[:blank:]]*=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)[[:blank:]]*" _ dir shell) + (let* ((old (string-append dir shell)) + (new (or (find-shell shell) old))) + (unless (string=? new old) + (format (current-error-port) + "patch-makefile-SHELL: ~a: changing `SHELL' from `~a' to `~a'~%" + file old new)) + (string-append "SHELL = " new "\n"))))) (define* (fold-port-matches proc init pattern port #:optional (unmatched (lambda (_ r) r))) From 380d5decfcd3a25c11dfa7e78e2197af98a35307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 21 Dec 2012 23:52:48 +0100 Subject: [PATCH 30/71] distro: attr: Fix references to /bin/sh. * distro/packages/attr.scm (attr): Add `patch-makefile-SHELL'. Patch `test/run' in `check' phase. --- distro/packages/attr.scm | 43 +++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/distro/packages/attr.scm b/distro/packages/attr.scm index 38c75fc2ae..ad2cd3987a 100644 --- a/distro/packages/attr.scm +++ b/distro/packages/attr.scm @@ -41,23 +41,34 @@ (build-system gnu-build-system) (arguments `(#:phases - (alist-replace 'install - (lambda _ - (zero? (system* "make" - "install" - "install-lib" - "install-dev"))) - (alist-replace 'check - (lambda _ - (for-each patch-shebang - (find-files "test" ".*")) - (system* "make" "tests" "-C" "test") + (alist-cons-after + 'configure 'patch-makefile-SHELL + (lambda _ + (patch-makefile-SHELL "include/buildmacros")) + (alist-replace + 'install + (lambda _ + (zero? (system* "make" + "install" + "install-lib" + "install-dev"))) + (alist-replace + 'check + (lambda _ + ;; Use the right shell. + (let ((bash (search-path (search-path-as-string->list + (getenv "PATH")) + "bash"))) + (substitute* "test/run" + (("/bin/sh") + (string-append bash "/bin/bash")))) - ;; XXX: Ignore the test result since - ;; this is dependent on the underlying - ;; file system. - #t) - %standard-phases)))) + (system* "make" "tests" "-C" "test") + + ;; XXX: Ignore the test result since this is dependent on the + ;; underlying file system. + #t) + %standard-phases))))) (inputs `(("perl" ,perl) ("gettext" ,guix:gettext))) (home-page From 6253961de2628ed9e65987c823935d669c0e20fc Mon Sep 17 00:00:00 2001 From: Andreas Enge Date: Sat, 29 Dec 2012 21:03:23 +0100 Subject: [PATCH 31/71] build-system/gnu: enable test-target during the check phase * guix/build-system/gnu.scm: add variable test-target --- guix/build-system/gnu.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index 9d94680d93..53fc4749f0 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -152,6 +152,7 @@ System: GCC, GNU Make, Bash, Coreutils, etc." (out-of-source? #f) (path-exclusions ''()) (tests? #t) + (test-target "check") (parallel-build? #t) (parallel-tests? #t) (patch-shebangs? #t) (strip-binaries? #t) @@ -193,6 +194,7 @@ which could lead to gratuitous input divergence." #:out-of-source? ,out-of-source? #:path-exclusions ,path-exclusions #:tests? ,tests? + #:test-target ,test-target #:parallel-build? ,parallel-build? #:parallel-tests? ,parallel-tests? #:patch-shebangs? ,patch-shebangs? From 98ea038b474def9b24fd2ba1c893e9c723e9f205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 31 Dec 2012 01:12:09 +0100 Subject: [PATCH 32/71] distro: libc: Update to 2.17. * distro/packages/base.scm (glibc): Update to 2.17. --- distro/packages/base.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 0289b6c688..6b4ee19a25 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -465,14 +465,14 @@ used in the GNU system including the GNU/Linux variant.") (define-public glibc (package (name "glibc") - (version "2.16.0") + (version "2.17") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz")) (sha256 (base32 - "092rdm49zh6l1pqkxbcpcaawgsgzxhpf1s7wf5wi5dvc5am3dp0y")))) + "0gmjnn4kma9vgizccw1jv979xw55a8n1nkk94gg0l3hy80vy6539")))) (build-system gnu-build-system) ;; Glibc's refers to , for instance, so glibc From f678f6d9132b1616fae5265e5abdb296e331dcd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 31 Dec 2012 01:13:04 +0100 Subject: [PATCH 33/71] distro: bzip2: Patch `SHELL' in `Makefile-libbz2_so'. * distro/packages/compression.scm (bzip2): Call `patch-makefile-SHELL' in BUILD-SHARED-LIB. --- distro/packages/compression.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/distro/packages/compression.scm b/distro/packages/compression.scm index fdc3d6081f..f85aa63f19 100644 --- a/distro/packages/compression.scm +++ b/distro/packages/compression.scm @@ -98,6 +98,7 @@ superior compression ratio of gzip is just a bonus.") (build-shared-lib ;; Build a shared library. '(lambda* (#:key inputs #:allow-other-keys) + (patch-makefile-SHELL "Makefile-libbz2_so") (zero? (system* "make" "-f" "Makefile-libbz2_so")))) (install-shared-lib '(lambda* (#:key outputs #:allow-other-keys) From bc5bf85fa222cf06e5d8236d01872c1bb89a8d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 31 Dec 2012 01:17:43 +0100 Subject: [PATCH 34/71] utils: Restore the mtime/atime of patched files. * guix/build/utils.scm (set-file-time): New procedure. (patch-shebang): New `keep-mtime?' parameter; call `set-file-time' when it's true. (patch-makefile-SHELL): Likewise. --- guix/build/utils.scm | 48 +++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index c54c83883b..11bd4cc163 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -43,6 +43,7 @@ substitute substitute* dump-port + set-file-time patch-shebang patch-makefile-SHELL fold-port-matches @@ -408,17 +409,29 @@ bytes transferred and the continuation of the transfer as a thunk." (loop total (get-bytevector-n! in buffer 0 buffer-size)))))))) +(define (set-file-time file stat) + "Set the atime/mtime of FILE to that specified by STAT." + (utime file + (stat:atime stat) + (stat:mtime stat) + (stat:atimensec stat) + (stat:mtimensec stat))) + (define patch-shebang (let ((shebang-rx (make-regexp "^[[:blank:]]*([[:graph:]]+)(.*)$"))) (lambda* (file - #:optional (path (search-path-as-string->list (getenv "PATH")))) + #:optional + (path (search-path-as-string->list (getenv "PATH"))) + #:key (keep-mtime? #t)) "Replace the #! interpreter file name in FILE by a valid one found in PATH, when FILE actually starts with a shebang. Return #t when FILE was -patched, #f otherwise." +patched, #f otherwise. When KEEP-MTIME? is true, the atime/mtime of +FILE are kept unchanged." (define (patch p interpreter rest-of-line) (let* ((template (string-append file ".XXXXXX")) (out (mkstemp! template)) - (mode (stat:mode (stat file)))) + (st (stat file)) + (mode (stat:mode st))) (with-throw-handler #t (lambda () (format out "#!~a~a~%" @@ -427,6 +440,8 @@ patched, #f otherwise." (close out) (chmod template mode) (rename-file template file) + (when keep-mtime? + (set-file-time file st)) #t) (lambda (key . args) (format (current-error-port) @@ -458,8 +473,9 @@ patched, #f otherwise." file (basename cmd)) #f)))))))))))) -(define (patch-makefile-SHELL file) - "Patch the `SHELL' variable in FILE, which is supposedly a makefile." +(define* (patch-makefile-SHELL file #:key (keep-mtime? #t)) + "Patch the `SHELL' variable in FILE, which is supposedly a makefile. +When KEEP-MTIME? is true, the atime/mtime of FILE are kept unchanged." ;; For instance, Gettext-generated po/Makefile.in.in do not honor $SHELL. @@ -475,15 +491,19 @@ patched, #f otherwise." name)) shell)) - (substitute* file - (("^ *SHELL[[:blank:]]*=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)[[:blank:]]*" _ dir shell) - (let* ((old (string-append dir shell)) - (new (or (find-shell shell) old))) - (unless (string=? new old) - (format (current-error-port) - "patch-makefile-SHELL: ~a: changing `SHELL' from `~a' to `~a'~%" - file old new)) - (string-append "SHELL = " new "\n"))))) + (let ((st (stat file))) + (substitute* file + (("^ *SHELL[[:blank:]]*=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)[[:blank:]]*" _ dir shell) + (let* ((old (string-append dir shell)) + (new (or (find-shell shell) old))) + (unless (string=? new old) + (format (current-error-port) + "patch-makefile-SHELL: ~a: changing `SHELL' from `~a' to `~a'~%" + file old new)) + (string-append "SHELL = " new "\n")))) + + (when keep-mtime? + (set-file-time file st)))) (define* (fold-port-matches proc init pattern port #:optional (unmatched (lambda (_ r) r))) From b2adb3ae04ce2b0e383b6c4a0b78c7e885350d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 1 Jan 2013 16:52:27 +0100 Subject: [PATCH 35/71] build-system/gnu: Add support for the "bin" output. * guix/build/gnu-build-system.scm (configure): Add support for "bin" output. --- guix/build/gnu-build-system.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index b5eaa26bf5..bd40289aac 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -116,6 +116,7 @@ makefiles." (define* (configure #:key inputs outputs (configure-flags '()) out-of-source? #:allow-other-keys) (let* ((prefix (assoc-ref outputs "out")) + (bindir (assoc-ref outputs "bin")) (libdir (assoc-ref outputs "lib")) (includedir (assoc-ref outputs "include")) (bash (or (and=> (assoc-ref inputs "bash") @@ -128,6 +129,9 @@ makefiles." ;; Produce multiple outputs when specific output names ;; are recognized. + ,@(if bindir + (list (string-append "--bindir=" bindir "/bin")) + '()) ,@(if libdir (list (string-append "--libdir=" libdir "/lib")) '()) From 450fb5a6b44f05dbaa35daf2b696dfc4d502be96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 1 Jan 2013 16:54:45 +0100 Subject: [PATCH 36/71] distro: Move lightweight Bash to (distro packages bash). * distro/packages/make-bootstrap.scm (%bash-static): Move BASH-LIGHT to... * distro/packages/bash.scm (bash-light): ... here. New variable. --- distro/packages/bash.scm | 21 +++++++++++++++++++++ distro/packages/make-bootstrap.scm | 21 ++------------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/distro/packages/bash.scm b/distro/packages/bash.scm index f32293d82f..429a683920 100644 --- a/distro/packages/bash.scm +++ b/distro/packages/bash.scm @@ -87,3 +87,24 @@ use. In addition, most sh scripts can be run by Bash without modification.") (license gpl3+) (home-page "http://www.gnu.org/software/bash/")))) + +(define-public bash-light + ;; A stripped-down Bash for non-interactive use. + (package (inherit bash) + (name "bash-light") + (inputs '()) ; no readline, no curses + (arguments + (let ((args `(#:modules ((guix build gnu-build-system) + (guix build utils) + (srfi srfi-1) + (srfi srfi-26)) + ,@(package-arguments bash)))) + (substitute-keyword-arguments args + ((#:configure-flags flags) + `(list "--without-bash-malloc" + "--disable-readline" + "--disable-history" + "--disable-help-builtin" + "--disable-progcomp" + "--disable-net-redirections" + "--disable-nls"))))))) diff --git a/distro/packages/make-bootstrap.scm b/distro/packages/make-bootstrap.scm index 4f182da853..28be0b8c49 100644 --- a/distro/packages/make-bootstrap.scm +++ b/distro/packages/make-bootstrap.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -92,24 +92,7 @@ ,@(fold alist-delete %final-inputs '("libc" "gcc")))) (define %bash-static - (let ((bash-light (package (inherit bash-final) - (inputs '()) ; no readline, no curses - (arguments - (let ((args `(#:modules ((guix build gnu-build-system) - (guix build utils) - (srfi srfi-1) - (srfi srfi-26)) - ,@(package-arguments bash)))) - (substitute-keyword-arguments args - ((#:configure-flags flags) - `(list "--without-bash-malloc" - "--disable-readline" - "--disable-history" - "--disable-help-builtin" - "--disable-progcomp" - "--disable-net-redirections" - "--disable-nls")))))))) - (static-package bash-light))) + (static-package bash-light)) (define %static-inputs ;; Packages that are to be used as %BOOTSTRAP-INPUTS. From 4d058c67929aa9d464fcb1ff0217122424078cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 1 Jan 2013 16:55:34 +0100 Subject: [PATCH 37/71] build-system/gnu: Add `static-package'. * distro/packages/make-bootstrap.scm (static-package): Move to... * guix/build-system/gnu.scm (static-package): ... here. New procedure. --- distro/packages/make-bootstrap.scm | 25 +------------------------ guix/build-system/gnu.scm | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/distro/packages/make-bootstrap.scm b/distro/packages/make-bootstrap.scm index 28be0b8c49..c0e5d8be5d 100644 --- a/distro/packages/make-bootstrap.scm +++ b/distro/packages/make-bootstrap.scm @@ -20,7 +20,7 @@ #:use-module (guix utils) #:use-module (guix packages) #:use-module (guix build-system trivial) - #:use-module ((guix build-system gnu) #:select (package-with-explicit-inputs)) + #:use-module (guix build-system gnu) #:use-module ((distro) #:select (search-patch)) #:use-module (distro packages base) #:use-module (distro packages bash) @@ -45,29 +45,6 @@ ;;; ;;; Code: -(define* (static-package p #:optional (loc (current-source-location))) - "Return a statically-linked version of package P." - ;; TODO: Move to (guix build-system gnu). - (let ((args (package-arguments p))) - (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))))))) - (define %glibc-with-relocatable-system ;; A libc whose `system' and `popen' functions looks for `sh' in $PATH. (package (inherit glibc-final) diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index 53fc4749f0..4d7ecd54de 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -21,6 +21,7 @@ #:use-module (guix utils) #:use-module (guix derivations) #:use-module (guix build-system) + #:use-module (guix build-system gnu) #:use-module (guix packages) #:use-module (srfi srfi-1) #:use-module (srfi srfi-39) @@ -29,7 +30,8 @@ gnu-build-system package-with-explicit-inputs package-with-extra-configure-variable - static-libgcc-package)) + static-libgcc-package + static-package)) ;; Commentary: ;; @@ -117,6 +119,28 @@ configure flags for VARIABLE, the associated value is augmented." "A version of P linked with `-static-gcc'." (package-with-extra-configure-variable p "LDFLAGS" "-static-libgcc")) +(define* (static-package p #:optional (loc (current-source-location))) + "Return a statically-linked version of package P." + (let ((args (package-arguments p))) + (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))))))) + (define %store ;; Store passed to STANDARD-INPUTS. From 93b035757554830d4f4e190aef7d5b90fa845bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 1 Jan 2013 23:12:34 +0100 Subject: [PATCH 38/71] utils: Use binary I/O primitives for `remove-store-references'. * guix/build/utils.scm (fold-port-matches)[get-char]: New procedure. (remove-store-references): Use `put-u8' and `put-bytevector'. --- guix/build/utils.scm | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 11bd4cc163..5729cdbf04 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -517,6 +517,14 @@ for each unmatched character." (map char-set (string->list pattern)) pattern)) + (define (get-char p) + ;; We call it `get-char', but that's really a binary version + ;; thereof. (The real `get-char' cannot be used here because our + ;; bootstrap Guile is hacked to always use UTF-8.) + (match (get-u8 p) + ((? integer? x) (integer->char x)) + (x x))) + ;; Note: we're not really striving for performance here... (let loop ((chars '()) (pattern initial-pattern) @@ -576,16 +584,17 @@ known as `nuke-refs' in Nixpkgs." (setvbuf in _IOFBF 65536) (setvbuf out _IOFBF 65536) (fold-port-matches (lambda (match result) - (put-string out store) - (put-char out #\/) - (put-string out - "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-") + (put-bytevector out (string->utf8 store)) + (put-u8 out (char->integer #\/)) + (put-bytevector out + (string->utf8 + "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-")) #t) #f pattern in (lambda (char result) - (put-char out char) + (put-u8 out (char->integer char)) result)))))) ;;; Local Variables: From 8cd8e97cb5e4a32c20cbab6c048f5213509c4ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 1 Jan 2013 23:50:52 +0100 Subject: [PATCH 39/71] distro: glibc: Fix contradicting settings of `BASH_SHELL'. * distro/packages/base.scm (glibc-final): Remove `ac_cv_path_BASH_SHELL' setting. (glibc): Set `BASH_SHELL' instead of `ac_cv_path_BASH_SHELL'. --- distro/packages/base.scm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 6b4ee19a25..4acf4c1538 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -495,13 +495,13 @@ used in the GNU system including the GNU/Linux variant.") ;; GNU libc for details. "--enable-kernel=2.6.30" - ;; XXX: Work around "undefined reference to `__stack_chk_guard'". - "libc_cv_ssp=no" - ;; Use our Bash instead of /bin/sh. - (string-append "ac_cv_path_BASH_SHELL=" + (string-append "BASH_SHELL=" (assoc-ref %build-inputs "bash") - "/bin/bash")) + "/bin/bash") + + ;; XXX: Work around "undefined reference to `__stack_chk_guard'". + "libc_cv_ssp=no") #:tests? #f ; XXX #:phases (alist-cons-before @@ -783,7 +783,6 @@ identifier SYSTEM." `(append (list ,(string-append "--host=" (boot-triplet system)) ,(string-append "--build=" (nix-system->gnu-triplet system)) - "BASH_SHELL=/bin/sh" ;; Build Sun/ONC RPC support. In particular, ;; install rpc/*.h. From 46866fadee576d3c1dfa4b3d3ab819bfae3fdf8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 1 Jan 2013 23:55:40 +0100 Subject: [PATCH 40/71] distro: glibc: Build the statically-linked Bash embedded in glibc. * distro/packages/base.scm (glibc): Expect "static-bash" to be a directory, not a single file. Call `remove-store-references' on the "bash" binary that is copied. Add an `sh' -> `bash' symlink. Change the "static-bash" input to (static-package bash-light). (glibc-final): Rename to... (glibc-final-with-bootstrap-bash): ... this. Change `name' to "glibc-intermediate". Remove #:patch-shebangs? setting. (cross-gcc-wrapper): New procedure, with code formerly in GCC-BOOT0-WRAPPED. (gcc-boot0-wrapped): Use it. (static-bash-for-glibc): New variable. (glibc-final): Inherit from GLIBC-FINAL-WITH-BOOTSTRAP-BASH, and use STATIC-BASH-FOR-GLIBC as the "static-bash" input. --- distro/packages/base.scm | 148 ++++++++++++++++++++++++++------------- 1 file changed, 98 insertions(+), 50 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 4acf4c1538..158a7d2f73 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; Copyright (C) 2012 Nikita Karetnikov ;;; ;;; This file is part of Guix. @@ -528,12 +528,19 @@ used in the GNU system including the GNU/Linux variant.") ;; 4.7.1. ((" -lgcc_s") "")) - ;; Copy a statically-linked Bash in the output. + ;; Copy a statically-linked Bash in the output, with + ;; no references to other store paths. (mkdir-p bin) - (copy-file (assoc-ref inputs "static-bash") + (copy-file (string-append (assoc-ref inputs "static-bash") + "/bin/bash") (string-append bin "/bash")) + (remove-store-references (string-append bin "/bash")) (chmod (string-append bin "/bash") #o555) + ;; Keep a symlink, for `patch-shebang' resolution. + (with-directory-excursion bin + (symlink "bash" "sh")) + ;; Have `system' use that Bash. (substitute* "sysdeps/posix/system.c" (("#define[[:blank:]]+SHELL_PATH.*$") @@ -547,7 +554,7 @@ used in the GNU system including the GNU/Linux variant.") %standard-phases))) (inputs `(("patch/ld.so.cache" ,(search-patch "glibc-no-ld-so-cache.patch")) - ("static-bash" ,(cut search-bootstrap-binary "bash" <>)))) + ("static-bash" ,(static-package bash-light)))) (synopsis "The GNU C Library") (description "Any Unix-like operating system needs a C library: the library which @@ -765,19 +772,19 @@ identifier SYSTEM." ;; cross-`as'. ,@%boot0-inputs)) -(define-public glibc-final +(define glibc-final-with-bootstrap-bash ;; The final libc, "cross-built". If everything went well, the resulting - ;; store path has no dependencies. + ;; store path has no dependencies. Actually, the really-final libc is + ;; built just below; the only difference is that this one uses the + ;; bootstrap Bash. (package-with-bootstrap-guile (package (inherit glibc) + (name "glibc-intermediate") (arguments (lambda (system) `(#:guile ,%bootstrap-guile #:implicit-inputs? #f - ;; Leave /bin/sh as the interpreter for `ldd', `sotruss', etc. to - ;; avoid keeping a reference to the bootstrap Bash. - #:patch-shebangs? #f ,@(substitute-keyword-arguments (package-arguments glibc) ((#:configure-flags flags) `(append (list ,(string-append "--host=" (boot-triplet system)) @@ -789,60 +796,101 @@ identifier SYSTEM." "--enable-obsolete-rpc") ,flags)))))) (propagated-inputs `(("linux-headers" ,linux-libre-headers-boot0))) - (inputs `( ;; A native GCC is needed to build `cross-rpcgen'. - ("native-gcc" ,@(assoc-ref %boot0-inputs "gcc")) - ,@%boot1-inputs - ,@(package-inputs glibc)))))) ; patches + (inputs + `( ;; A native GCC is needed to build `cross-rpcgen'. + ("native-gcc" ,@(assoc-ref %boot0-inputs "gcc")) -(define gcc-boot0-wrapped - ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the - ;; non-cross names. + ;; Here, we use the bootstrap Bash, which is not satisfactory + ;; because we don't want to depend on bootstrap tools. + ("static-bash" ,@(assoc-ref %boot0-inputs "bash")) + + ,@%boot1-inputs + ,@(alist-delete "static-bash" + (package-inputs glibc))))))) ; patches + +(define (cross-gcc-wrapper gcc binutils glibc bash) + "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC +that makes it available under the native tool names." (package (inherit gcc-4.7) - (name (string-append (package-name gcc-boot0) "-wrapped")) + (name (string-append (package-name gcc) "-wrapped")) (source #f) (build-system trivial-build-system) (arguments (lambda (system) - `(#:guile ,%bootstrap-guile - #:modules ((guix build utils)) - #:builder (begin - (use-modules (guix build utils)) + `(#: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")) + (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 + ;; 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 system)))) - (chmod "gcc" #o555))))))) + (chmod "gcc" #o555))))))) (native-inputs - `(("binutils" ,binutils-boot0) - ("gcc" ,gcc-boot0) - ("libc" ,glibc-final) - ,(assoc "bash" %boot1-inputs))) + `(("binutils" ,binutils) + ("gcc" ,gcc) + ("libc" ,glibc) + ("bash" ,bash))) (inputs '()))) +(define static-bash-for-glibc + ;; A statically-linked Bash to be embedded in GLIBC-FINAL, for use by + ;; system(3) & co. + (let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0 + glibc-final-with-bootstrap-bash + (car (assoc-ref %boot1-inputs "bash")))) + (bash (package (inherit bash-light) + (arguments + (lambda (system) + `(#:guile ,%bootstrap-guile + ,@(package-arguments bash-light))))))) + (package-with-bootstrap-guile + (package-with-explicit-inputs (static-package bash) + `(("gcc" ,gcc) + ("libc" ,glibc-final-with-bootstrap-bash) + ,@(fold alist-delete %boot1-inputs + '("gcc" "libc"))) + (current-source-location))))) + +(define-public glibc-final + ;; The final glibc, which embeds the statically-linked Bash built above. + (package (inherit glibc-final-with-bootstrap-bash) + (name "glibc") + (inputs `(("static-bash" ,static-bash-for-glibc) + ,@(alist-delete + "static-bash" + (package-inputs glibc-final-with-bootstrap-bash)))))) + +(define gcc-boot0-wrapped + ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the + ;; non-cross names. + (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final + (car (assoc-ref %boot1-inputs "bash")))) + (define %boot2-inputs ;; 3rd stage inputs. `(("libc" ,glibc-final) From 52b8e5fc30f42914c1dadeca4243a5b55467be48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Jan 2013 01:01:58 +0100 Subject: [PATCH 41/71] distro: sed: Patch references to /bin/sh in the test suite. * distro/packages/base.scm (sed): Add `patch-test-suite' phase. --- distro/packages/base.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 158a7d2f73..ad9561b5f4 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -97,6 +97,17 @@ lines.") "13wlsb4sf5d5a82xjhxqmdvrrn36rmw5f0pl9qyb9zkvldnb7hra")))) (build-system gnu-build-system) (synopsis "GNU sed, a batch stream editor") + (arguments + `(#:phases (alist-cons-before + 'patch-source-shebangs 'patch-test-suite + (lambda* (#:key inputs #:allow-other-keys) + (let ((bash (assoc-ref inputs "bash"))) + (patch-makefile-SHELL "testsuite/Makefile.tests") + (substitute* '("testsuite/bsd.sh" + "testsuite/bug-regex9.c") + (("/bin/sh") + (string-append bash "/bin/bash"))))) + %standard-phases))) (description "Sed (stream editor) isn't really a true text editor or text processor. Instead, it is used to filter text, i.e., it takes text input and performs From 97d3998e7a8a8e22fbef2e42db66456b826b1695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Jan 2013 01:04:37 +0100 Subject: [PATCH 42/71] tests: Adjust to not rely on /bin/sh. * tests/derivations.scm (%bash): New variable. Replace occurrences of "/bin/sh" by %BASH. * tests/union.scm ("union-build"): Delete duplicates from %BOOTSTRAP-INPUTS. --- tests/derivations.scm | 43 +++++++++++++++++++++++++------------------ tests/union.scm | 7 +++++-- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/tests/derivations.scm b/tests/derivations.scm index 46bab4e19d..c00f0efc98 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -23,6 +23,7 @@ #:use-module (guix utils) #:use-module (guix base32) #:use-module ((guix packages) #:select (package-derivation)) + #:use-module ((distro) #:select (search-bootstrap-binary)) #:use-module (distro packages bootstrap) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) @@ -47,6 +48,11 @@ (let ((drv (package-derivation %store %bootstrap-guile))) (%guile-for-build drv))) +(define %bash + (let ((bash (search-bootstrap-binary "bash" (%current-system)))) + (and %store + (add-to-store %store "bash" #t #t "sha256" bash)))) + (define (directory-contents dir) "Return an alist representing the contents of DIR." (define prefix-len (string-length dir)) @@ -96,10 +102,11 @@ (test-assert "derivation with no inputs" (let* ((builder (add-text-to-store %store "my-builder.sh" - "#!/bin/sh\necho hello, world\n" + "echo hello, world\n" '())) - (drv-path (derivation %store "foo" (%current-system) builder - '() '(("HOME" . "/homeless")) '()))) + (drv-path (derivation %store "foo" (%current-system) + %bash `("-e" ,builder) + '(("HOME" . "/homeless")) '()))) (and (store-path? drv-path) (valid-path? %store drv-path)))) @@ -110,7 +117,7 @@ '())) ((drv-path drv) (derivation %store "foo" (%current-system) - "/bin/sh" `(,builder) + %bash `(,builder) '(("HOME" . "/homeless") ("zzz" . "Z!") ("AAA" . "A!")) @@ -132,7 +139,7 @@ (input (search-path %load-path "ice-9/boot-9.scm")) (drv-path (derivation %store "derivation-with-input-file" (%current-system) - "/bin/sh" `(,builder) + %bash `(,builder) `(("in" ;; Cheat to pass the actual file ;; name to the builder. @@ -152,7 +159,7 @@ "echo -n hello > $out" '())) (hash (sha256 (string->utf8 "hello"))) (drv-path (derivation %store "fixed" (%current-system) - "/bin/sh" `(,builder) + %bash `(,builder) '() `((,builder)) ; optional #:hash hash #:hash-algo 'sha256)) @@ -170,11 +177,11 @@ "echo hey; echo -n hello > $out" '())) (hash (sha256 (string->utf8 "hello"))) (drv-path1 (derivation %store "fixed" (%current-system) - "/bin/sh" `(,builder1) + %bash `(,builder1) '() `() #:hash hash #:hash-algo 'sha256)) (drv-path2 (derivation %store "fixed" (%current-system) - "/bin/sh" `(,builder2) + %bash `(,builder2) '() `() #:hash hash #:hash-algo 'sha256)) (succeeded? (build-derivations %store @@ -193,11 +200,11 @@ "echo hey; echo -n hello > $out" '())) (hash (sha256 (string->utf8 "hello"))) (fixed1 (derivation %store "fixed" (%current-system) - "/bin/sh" `(,builder1) + %bash `(,builder1) '() `() #:hash hash #:hash-algo 'sha256)) (fixed2 (derivation %store "fixed" (%current-system) - "/bin/sh" `(,builder2) + %bash `(,builder2) '() `() #:hash hash #:hash-algo 'sha256)) (fixed-out (derivation-path->output-path fixed1)) @@ -206,11 +213,11 @@ ;; Use Bash hackery to avoid Coreutils. "echo $in ; (read -u 3 c; echo $c) 3< $in > $out" '())) (final1 (derivation %store "final" (%current-system) - "/bin/sh" `(,builder3) + %bash `(,builder3) `(("in" . ,fixed-out)) `((,builder3) (,fixed1)))) (final2 (derivation %store "final" (%current-system) - "/bin/sh" `(,builder3) + %bash `(,builder3) `(("in" . ,fixed-out)) `((,builder3) (,fixed2)))) (succeeded? (build-derivations %store @@ -224,7 +231,7 @@ "echo one > $out ; echo two > $second" '())) (drv-path (derivation %store "fixed" (%current-system) - "/bin/sh" `(,builder) + %bash `(,builder) '(("HOME" . "/homeless") ("zzz" . "Z!") ("AAA" . "A!")) @@ -244,7 +251,7 @@ "echo one > $out ; echo two > $AAA" '())) (drv-path (derivation %store "fixed" (%current-system) - "/bin/sh" `(,builder) + %bash `(,builder) '() `((,builder)) #:outputs '("out" "AAA"))) @@ -262,7 +269,7 @@ "echo one > $out ; echo two > $two" '())) (mdrv (derivation %store "multiple-output" (%current-system) - "/bin/sh" `(,builder1) + %bash `(,builder1) '() `((,builder1)) #:outputs '("out" "two"))) @@ -273,7 +280,7 @@ '())) (udrv (derivation %store "multiple-output-user" (%current-system) - "/bin/sh" `(,builder2) + %bash `(,builder2) `(("one" . ,(derivation-path->output-path mdrv "out")) ("two" . ,(derivation-path->output-path @@ -303,7 +310,7 @@ '())) (drv-path (derivation %store "foo" (%current-system) - "/bin/sh" `(,builder) + %bash `(,builder) `(("PATH" . ,(string-append (derivation-path->output-path %coreutils) diff --git a/tests/union.scm b/tests/union.scm index c839855ef4..b2242a834b 100644 --- a/tests/union.scm +++ b/tests/union.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -26,6 +26,7 @@ #:use-module ((guix build utils) #:select (with-directory-excursion directory-exists?)) #:use-module (distro packages bootstrap) + #:use-module (srfi srfi-1) #:use-module (srfi srfi-64) #:use-module (ice-9 match)) @@ -74,7 +75,9 @@ (let* ((inputs (map (match-lambda ((name package) `(,name ,(package-derivation %store package)))) - %bootstrap-inputs)) + (delete-duplicates %bootstrap-inputs + (lambda (i1 i2) + (eq? (second i1) (second i2)))))) (builder `(begin (use-modules (guix build union)) (union-build (assoc-ref %outputs "out") From bb1ff9aa0a6c7c54b133f0799f687fbab58f6a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Jan 2013 12:42:54 +0100 Subject: [PATCH 43/71] release.nix: Update to new bootstrap Guile tarball. * release.nix (bootstrap_guile): Update URLs and SHA256. (build)[preBuild]: Adjust tarball name. --- release.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/release.nix b/release.nix index b83de6c2a5..97eba8b403 100644 --- a/release.nix +++ b/release.nix @@ -32,13 +32,13 @@ let bootstrap_guile = let pkgs = import nixpkgs {}; in { i686 = pkgs.fetchurl { - url = http://www.fdn.fr/~lcourtes/software/guix/packages/i686-linux/guile-bootstrap-2.0.6.tar.xz; - sha256 = "93b537766dfab3ad287143523751e3ec02dd32d3ccaf88ad2d31c63158f342ee"; + url = http://www.fdn.fr/~lcourtes/software/guix/packages/i686-linux/20121219/guile-2.0.7.tar.xz; + sha256 = "45d1f9bfb9e4531a8f1c5a105f7ab094cd481b8a179ccc63cbabb73ce6b8437f"; }; x86_64 = pkgs.fetchurl { - url = http://www.fdn.fr/~lcourtes/software/guix/packages/x86_64-linux/guile-bootstrap-2.0.6.tar.xz; - sha256 = "0467a82cbe4136f60a79eb4176011bf88cf28ea19c9ad9defa365811ff8e11cf"; + url = http://www.fdn.fr/~lcourtes/software/guix/packages/x86_64-linux/20121219/guile-2.0.7.tar.xz; + sha256 = "953fbcc8db6e310626be79b67319cf4141dc23b296447952a99d95425b3a4dc1"; }; }; @@ -76,9 +76,9 @@ let # the build system download it over and over again. '' mkdir -p distro/packages/bootstrap/{i686,x86_64}-linux cp -v "${bootstrap_guile.i686}" \ - distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz + distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz cp -v "${bootstrap_guile.x86_64}" \ - distro/packages/bootstrap/x86_64-linux/guile-bootstrap-2.0.6.tar.xz + distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz ''; inherit succeedOnFailure keepBuildDirectory From f9975b5a49274e465ea29a5eeb83c4b51bc1f5da Mon Sep 17 00:00:00 2001 From: Andreas Enge Date: Sat, 29 Dec 2012 23:49:55 +0100 Subject: [PATCH 44/71] distro: Add OpenSSL. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * distro/packages/openssl.scm: New file. `patch-tests' phase added by Ludovic Courtès. * Makefile.am (MODULES): Add it. --- Makefile.am | 1 + distro/packages/openssl.scm | 65 +++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 distro/packages/openssl.scm diff --git a/Makefile.am b/Makefile.am index 0f58d09d8b..2dca557b7a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -78,6 +78,7 @@ MODULES = \ distro/packages/nano.scm \ distro/packages/ncurses.scm \ distro/packages/nettle.scm \ + distro/packages/openssl.scm \ distro/packages/perl.scm \ distro/packages/pkg-config.scm \ distro/packages/pth.scm \ diff --git a/distro/packages/openssl.scm b/distro/packages/openssl.scm new file mode 100644 index 0000000000..5ea9ace4f9 --- /dev/null +++ b/distro/packages/openssl.scm @@ -0,0 +1,65 @@ +;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- +;;; Copyright (C) 2012 Andreas Enge +;;; +;;; This file is part of Guix. +;;; +;;; Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Guix. If not, see . + +(define-module (distro packages openssl) + #:use-module (distro) + #:use-module (distro packages perl) + #:use-module (guix licenses) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix build-system gnu)) + +(define-public openssl + (package + (name "openssl") + (version "1.0.1c") + (source (origin + (method url-fetch) + (uri (string-append "ftp://ftp.openssl.org/source/openssl-" version + ".tar.gz")) + (sha256 (base32 + "1gjy6a7d8nszi9wq8jdzx3cffn0nss23h3cw2ywlw4cb9v6v77ia")))) + (build-system gnu-build-system) + (inputs `(("perl" ,perl))) + (arguments + (lambda (system) + `(#:parallel-build? #f + #:parallel-tests? #f + #:test-target "test" + #:phases + (alist-replace + 'configure + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (zero? + (system* "./config" (string-append "--prefix=" out))))) + (alist-cons-before + 'patch-source-shebangs 'patch-tests + (lambda* (#:key inputs #:allow-other-keys) + (let ((bash (assoc-ref inputs "bash"))) + (substitute* (find-files "test" ".*") + (("/bin/sh") + (string-append bash "/bin/bash")) + (("/bin/rm") + "rm")))) + %standard-phases))))) + (synopsis "OpenSSL, an SSL/TLS implementation") + (description + "OpenSSL is an implementation of SSL/TLS") + (license openssl) + (home-page "http://www.openssl.org/"))) From a974a0be5b6b8763b54ea23d4dea508898a82b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Jan 2013 13:48:15 +0100 Subject: [PATCH 45/71] distro: openssl: Build shared libraries. * distro/packages/openssl.scm (openssl): `configure' phase: pass "shared --libdir=lib". --- distro/packages/openssl.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/distro/packages/openssl.scm b/distro/packages/openssl.scm index 5ea9ace4f9..8f40307d4e 100644 --- a/distro/packages/openssl.scm +++ b/distro/packages/openssl.scm @@ -47,7 +47,10 @@ (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (zero? - (system* "./config" (string-append "--prefix=" out))))) + (system* "./config" + "shared" ; build shared libraries + "--libdir=lib" + (string-append "--prefix=" out))))) (alist-cons-before 'patch-source-shebangs 'patch-tests (lambda* (#:key inputs #:allow-other-keys) From 2aa4fb5f73711e133751c1a9336ec67632a62452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Jan 2013 21:17:46 +0100 Subject: [PATCH 46/71] distro: gettext: Fix references to /bin/sh. * distro/packages/gettext.scm (gettext): Add `patch-tests' phase. --- distro/packages/gettext.scm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/distro/packages/gettext.scm b/distro/packages/gettext.scm index a7b922f945..1ceae119f9 100644 --- a/distro/packages/gettext.scm +++ b/distro/packages/gettext.scm @@ -37,7 +37,20 @@ "1sa3ch12qxa4h3ya6hkz119yclcccmincl9j20dhrdx5mykp3b4k")))) (build-system gnu-build-system) (arguments - `(#:patches (list (assoc-ref %build-inputs "patch/gets")))) + `(#:patches (list (assoc-ref %build-inputs "patch/gets")) + #:phases (alist-cons-before + 'check 'patch-tests + (lambda* (#:key inputs #:allow-other-keys) + (let ((bash (assoc-ref inputs "bash"))) + (substitute* (find-files "gettext-tools/tests" + "^msgexec-[0-9]") + (("#![[:blank:]]/bin/sh") + (format #f "#!~a/bin/sh" bash))) + (substitute* (find-files "gettext-tools/gnulib-tests" + "posix_spawn") + (("/bin/sh") + (format #f "~a/bin/bash" bash))))) + %standard-phases))) (inputs `(("patch/gets" ,(search-patch "gettext-gets-undeclared.patch")))) From 2ea2baf16c63c8f98f5aa5d557a87b5dd53f3423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Jan 2013 21:21:40 +0100 Subject: [PATCH 47/71] distro: acl: Patch references to /bin/sh. * distro/packages/acl.scm (acl): Add `patch-makefile-SHELL' phase. --- distro/packages/acl.scm | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/distro/packages/acl.scm b/distro/packages/acl.scm index 1c39f2185b..a16ee8f35c 100644 --- a/distro/packages/acl.scm +++ b/distro/packages/acl.scm @@ -41,15 +41,19 @@ (build-system gnu-build-system) (arguments `(#:phases - (alist-replace 'check - (lambda _ - (patch-shebang "test/run") - (system* "make" "tests" "-C" "test") + (alist-cons-after + 'configure 'patch-makefile-SHELL + (lambda _ + (patch-makefile-SHELL "include/buildmacros")) + (alist-replace + 'check + (lambda _ + (system* "make" "tests" "-C" "test") - ;; XXX: Ignore the test result since this is - ;; dependent on the underlying file system. - #t) - %standard-phases))) + ;; XXX: Ignore the test result since this is + ;; dependent on the underlying file system. + #t) + %standard-phases)))) (inputs `(("attr" ,attr) ("gettext" ,guix:gettext) ("perl" ,perl))) From 8ba8aeb74d3f45fb46a69d2278086e3a44845b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Jan 2013 22:44:58 +0100 Subject: [PATCH 48/71] distro: coreutils: Enable tests; add dependency on ACL and GMP. * distro/packages/base.scm (coreutils): Set #:parallel-build? #f. Add `patch-shell-references' phase. Add 'acl', 'gmp', and 'perl' as inputs, as suggested by Nikita Karetnikov. --- distro/packages/base.scm | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index ad9561b5f4..2190fc528c 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -20,6 +20,7 @@ (define-module (distro packages base) #:use-module (guix licenses) #:use-module (distro) + #:use-module (distro packages acl) #:use-module (distro packages bash) #:use-module (distro packages bootstrap) #:use-module (distro packages compression) @@ -272,10 +273,24 @@ The tools supplied with this package are: (base32 "1cly97xdy3v4nbbx631k43smqw0nnpn651kkprs0yyl2cj3pkjyv")))) (build-system gnu-build-system) - (inputs `()) ; TODO: optional deps: SELinux, ACL, GMP + (inputs `(("acl" ,acl) + ("gmp" ,gmp) + ("perl" ,perl))) ; TODO: add SELinux (arguments - '(;; Perl is missing, and some tests are failing. - #:tests? #f)) + `(#:parallel-build? #f ; help2man may be called too early + #:phases (alist-cons-before + 'build 'patch-shell-references + (lambda* (#:key inputs #:allow-other-keys) + (let ((bash (assoc-ref inputs "bash"))) + (substitute* (cons "src/split.c" + (find-files "gnulib-tests" + "\\.c$")) + (("/bin/sh") + (format #f "~a/bin/sh" bash))) + (substitute* (find-files "tests" "\\.sh$") + (("#!/bin/sh") + (format #f "#!~a/bin/bash" bash))))) + %standard-phases))) (synopsis "The basic file, shell and text manipulation utilities of the GNU operating system") From feddc16c70d8271425563ceea9ca59c274279d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Jan 2013 23:12:27 +0100 Subject: [PATCH 49/71] distro: ncurses: Don't retain a reference to the bootstrap Bash. * distro/packages/ncurses.scm (ncurses): Remove #:patch-shebangs? argument since it now has no effect. Simplify PATCH-MAKEFILE-PHASE. Add `configure-phase', and use it. --- distro/packages/ncurses.scm | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/distro/packages/ncurses.scm b/distro/packages/ncurses.scm index 8bde3c1989..62f957ef13 100644 --- a/distro/packages/ncurses.scm +++ b/distro/packages/ncurses.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -26,8 +26,23 @@ (define-public ncurses (let ((patch-makefile-phase '(lambda _ - (substitute* (find-files "." "Makefile.in") - (("^SHELL[[:blank:]]*=.*$") "")))) + (for-each patch-makefile-SHELL + (find-files "." "Makefile.in")))) + (configure-phase + '(lambda* (#:key inputs outputs configure-flags + #:allow-other-keys) + ;; The `ncursesw5-config' has a #!/bin/sh. We want to patch + ;; it to point to libc's embedded Bash, to avoid retaining a + ;; reference to the bootstrap Bash. + (let* ((libc (assoc-ref inputs "libc")) + (bash (string-append libc "/bin/bash")) + (out (assoc-ref outputs "out"))) + (format #t "configure flags: ~s~%" configure-flags) + (zero? (apply system* bash "./configure" + (string-append "SHELL=" bash) + (string-append "CONFIG_SHELL=" bash) + (string-append "--prefix=" out) + configure-flags))))) (post-install-phase '(lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) @@ -90,11 +105,10 @@ (alist-cons-before 'configure 'patch-makefile-SHELL ,patch-makefile-phase - %standard-phases)) - - ;; The `ncursesw5-config' has a #!/bin/sh that we don't want to - ;; patch, to avoid retaining a reference to the build-time Bash. - #:patch-shebangs? #f)) + (alist-replace + 'configure + ,configure-phase + %standard-phases))))) ((system cross-system) (arguments cross-system)))) (self-native-input? #t) From 2f8a123ed32eba2d63822327f86eadfba2c12143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Jan 2013 23:40:56 +0100 Subject: [PATCH 50/71] distro: libtool: Add a "bin" output. * distro/packages/autotools.scm (libtool): Add a "bin" output. * distro/packages/base.scm (guile-final): Remove comment about retained dependency. --- distro/packages/autotools.scm | 9 ++++++++- distro/packages/base.scm | 3 --- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/distro/packages/autotools.scm b/distro/packages/autotools.scm index 171855b937..32e50a5b12 100644 --- a/distro/packages/autotools.scm +++ b/distro/packages/autotools.scm @@ -1,6 +1,6 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- ;;; Copyright (C) 2012 Nikita Karetnikov -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -99,6 +99,13 @@ Standards. Automake requires the use of Autoconf.") (build-system gnu-build-system) (native-inputs `(("m4" ,m4) ("perl" ,perl))) + + ;; Separate binaries from the rest. During bootstrap, only ltdl is + ;; used; not depending on the binaries allows us to avoid retaining + ;; a reference to the bootstrap bash. + (outputs '("bin" ; libtoolize, libtool, etc. + "out")) ; libltdl.so, ltdl.h, etc. + (arguments `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests")) #:phases (alist-cons-before diff --git a/distro/packages/base.scm b/distro/packages/base.scm index 2190fc528c..63eea603ef 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -1034,9 +1034,6 @@ store.") ,@(alist-delete "bash" %boot3-inputs))) (define-public guile-final - ;; FIXME: The Libtool used here, specifically its `bin/libtool' script, - ;; holds a dependency on the bootstrap Binutils. Use multiple outputs for - ;; Libtool, so that that dependency is isolated in the "bin" output. (package-with-bootstrap-guile (package-with-explicit-inputs guile-2.0/fixed %boot4-inputs From fdc78b72f8ba87a62c61f8acb6d7dbaf2b204fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 4 Jan 2013 17:42:59 +0100 Subject: [PATCH 51/71] distro: make-bootstrap: Fix arguments to gawk. * distro/packages/make-bootstrap.scm (%static-inputs)[gawk]: Use `substitute-keyword-arguments' to preserve the #:phases argument of GAWK. --- distro/packages/make-bootstrap.scm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/distro/packages/make-bootstrap.scm b/distro/packages/make-bootstrap.scm index c0e5d8be5d..a073ca8187 100644 --- a/distro/packages/make-bootstrap.scm +++ b/distro/packages/make-bootstrap.scm @@ -107,15 +107,17 @@ (arguments (lambda (system) `(#:patches (list (assoc-ref %build-inputs "patch/sh")) - #:phases (alist-cons-before - 'build 'no-export-dynamic - (lambda* (#:key outputs #:allow-other-keys) - ;; Since we use `-static', remove - ;; `-export-dynamic'. - (substitute* "configure" - (("-export-dynamic") ""))) - %standard-phases) - ,@((package-arguments gawk) system)))) + ,@(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)))))) (inputs `(("patch/sh" ,(search-patch "gawk-shell.patch")))))) (finalize (lambda (p) (static-package (package-with-explicit-inputs From c2d771fd1da27cc6393c16e7e0ad10336e629f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 4 Jan 2013 18:58:53 +0100 Subject: [PATCH 52/71] distro: make-bootstrap: Make the Coreutils smaller. * distro/packages/make-bootstrap.scm (%static-inputs)[coreutils]: Remove optional dependencies, except Perl; build with "-Os -g0"; disable tests. --- distro/packages/make-bootstrap.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/distro/packages/make-bootstrap.scm b/distro/packages/make-bootstrap.scm index a073ca8187..e4569c3173 100644 --- a/distro/packages/make-bootstrap.scm +++ b/distro/packages/make-bootstrap.scm @@ -79,8 +79,13 @@ '("--disable-nls" "--disable-silent-rules" "--enable-no-install-program=stdbuf,libstdbuf.so" + "CFLAGS=-Os -g0" ; smaller, please "LDFLAGS=-static -pthread") - ,@(package-arguments coreutils))))) + #:tests? #f ; signal-related Gnulib tests fail + ,@(package-arguments coreutils))) + + ;; Remove optional dependencies such as GMP. + (inputs `(,(assoc "perl" (package-inputs coreutils)))))) (bzip2 (package (inherit bzip2) (arguments (substitute-keyword-arguments (package-arguments bzip2) From d3b59727fb5a8a040bc9d5ca6ada1239ccf90c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 5 Jan 2013 12:41:05 +0100 Subject: [PATCH 53/71] distro: make-bootstrap: Build glibc without nscd, and with static NSS modules. * distro/packages/make-bootstrap.scm (%glibc-with-relocatable-system): Rename to... (%glibc-for-bootstrap): ... this. Add new configure flags. --- distro/packages/make-bootstrap.scm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/distro/packages/make-bootstrap.scm b/distro/packages/make-bootstrap.scm index e4569c3173..d54fdc444f 100644 --- a/distro/packages/make-bootstrap.scm +++ b/distro/packages/make-bootstrap.scm @@ -45,25 +45,32 @@ ;;; ;;; Code: -(define %glibc-with-relocatable-system - ;; A libc whose `system' and `popen' functions looks for `sh' in $PATH. +(define %glibc-for-bootstrap + ;; A libc whose `system' and `popen' functions looks for `sh' in $PATH, + ;; 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))))) + ,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))))) (define %standard-inputs-with-relocatable-glibc ;; Standard inputs with the above libc and corresponding GCC. - `(("libc", %glibc-with-relocatable-system) + `(("libc", %glibc-for-bootstrap) ("gcc" ,(package-with-explicit-inputs gcc-4.7 - `(("libc",%glibc-with-relocatable-system) + `(("libc",%glibc-for-bootstrap) ,@(alist-delete "libc" %final-inputs)) (current-source-location))) ,@(fold alist-delete %final-inputs '("libc" "gcc")))) @@ -271,7 +278,7 @@ ;; GNU libc's essential shared libraries, dynamic linker, and headers, ;; with all references to store directories stripped. As a result, ;; libc.so is unusable and need to be patched for proper relocation. - (let ((glibc %glibc-with-relocatable-system)) + (let ((glibc %glibc-for-bootstrap)) (package (inherit glibc) (name "glibc-stripped") (build-system trivial-build-system) From 312543dcfc2b19063f172bd10bb437d6bfe62cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 5 Jan 2013 15:46:08 +0100 Subject: [PATCH 54/71] distro: make-bootstrap: Add `%bootstrap-tarballs' package. * distro/packages/make-bootstrap.scm (%bootstrap-tarballs): New variable. --- distro/packages/make-bootstrap.scm | 41 +++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/distro/packages/make-bootstrap.scm b/distro/packages/make-bootstrap.scm index d54fdc444f..ea889d062b 100644 --- a/distro/packages/make-bootstrap.scm +++ b/distro/packages/make-bootstrap.scm @@ -19,6 +19,7 @@ (define-module (distro packages make-bootstrap) #:use-module (guix utils) #:use-module (guix packages) + #:use-module (guix licenses) #:use-module (guix build-system trivial) #:use-module (guix build-system gnu) #:use-module ((distro) #:select (search-patch)) @@ -35,7 +36,8 @@ %binutils-bootstrap-tarball %glibc-bootstrap-tarball %gcc-bootstrap-tarball - %guile-bootstrap-tarball)) + %guile-bootstrap-tarball + %bootstrap-tarballs)) ;;; Commentary: ;;; @@ -520,4 +522,41 @@ ;; A tarball with the statically-linked, relocatable Guile. (tarball-package %guile-static-stripped)) +(define %bootstrap-tarballs + ;; A single derivation containing all the bootstrap tarballs, for + ;; convenience. + (package + (name "bootstrap-tarballs") + (version "0") + (source #f) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (let ((out (assoc-ref %outputs "out"))) + (use-modules (guix build utils) + (ice-9 match) + (srfi srfi-26)) + + (setvbuf (current-output-port) _IOLBF) + (mkdir out) + (chdir out) + (for-each (match-lambda + ((name . directory) + (for-each (lambda (file) + (format #t "~a -> ~a~%" file out) + (symlink file (basename file))) + (find-files directory "\\.tar\\.")))) + %build-inputs) + #t))) + (inputs `(("guile-tarball" ,%guile-bootstrap-tarball) + ("gcc-tarball" ,%gcc-bootstrap-tarball) + ("binutils-tarball" ,%binutils-bootstrap-tarball) + ("glibc-tarball" ,%glibc-bootstrap-tarball) + ("coreutils&co-tarball" ,%bootstrap-binaries-tarball))) + (synopsis #f) + (description #f) + (home-page #f) + (license gpl3+))) + ;;; make-bootstrap.scm ends here From 7584f822bf076f4fc8aef9c1f4d48c179fe15fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 5 Jan 2013 16:02:32 +0100 Subject: [PATCH 55/71] utils: Add `which'. * guix/build/utils.scm (which): New procedure. * distro/packages/lsh.scm (lsh): Use `which' instead of `search-path'. * distro/packages/perl.scm (perl): Likewise. * distro/packages/attr.scm (attr): Likewise. --- distro/packages/attr.scm | 9 +++------ distro/packages/lsh.scm | 5 ++--- distro/packages/perl.scm | 10 ++++------ guix/build/utils.scm | 8 ++++++++ 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/distro/packages/attr.scm b/distro/packages/attr.scm index ad2cd3987a..c61f4d7031 100644 --- a/distro/packages/attr.scm +++ b/distro/packages/attr.scm @@ -56,12 +56,9 @@ 'check (lambda _ ;; Use the right shell. - (let ((bash (search-path (search-path-as-string->list - (getenv "PATH")) - "bash"))) - (substitute* "test/run" - (("/bin/sh") - (string-append bash "/bin/bash")))) + (substitute* "test/run" + (("/bin/sh") + (which "bash"))) (system* "make" "tests" "-C" "test") diff --git a/distro/packages/lsh.scm b/distro/packages/lsh.scm index aa74c77b60..8f44967726 100644 --- a/distro/packages/lsh.scm +++ b/distro/packages/lsh.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -114,8 +114,7 @@ (substitute* "src/testsuite/login-auth-test" (("/bin/cat") ;; Use the right path to `cat'. - (search-path (search-path-as-string->list (getenv "PATH")) - "cat")))) + (which "cat")))) %standard-phases))) (home-page "http://www.lysator.liu.se/~nisse/lsh/") (synopsis diff --git a/distro/packages/perl.scm b/distro/packages/perl.scm index 26b25b154d..c4bfb6b260 100644 --- a/distro/packages/perl.scm +++ b/distro/packages/perl.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -46,13 +46,11 @@ 'configure (lambda* (#:key inputs outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) - (libc (assoc-ref inputs "libc")) - (pwd (search-path (search-path-as-string->list - (getenv "PATH")) - "pwd"))) + (libc (assoc-ref inputs "libc"))) ;; Use the right path for `pwd'. (substitute* "dist/Cwd/Cwd.pm" - (("/bin/pwd") pwd)) + (("/bin/pwd") + (which "pwd"))) (zero? (system* "./Configure" diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 5729cdbf04..f365b0db05 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -36,6 +36,8 @@ set-path-environment-variable search-path-as-string->list list->search-path-as-string + which + alist-cons-before alist-cons-after alist-replace @@ -214,6 +216,12 @@ SEPARATOR-separated path accordingly. Example: (format #t "environment variable `~a' set to `~a'~%" env-var value))) +(define (which program) + "Return the complete file name for PROGRAM as found in $PATH, or #f if +PROGRAM could not be found." + (search-path (search-path-as-string->list (getenv "PATH")) + program)) + ;;; ;;; Phases. From 4155e2a9093617e1d920e794aa848ac733064df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 5 Jan 2013 16:08:07 +0100 Subject: [PATCH 56/71] Update license headers of builder-side code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change license headers with this script: (use-modules (guix build utils)) (fluid-set! %default-port-encoding "UTF-8") (substitute* (cons "distro/packages/ld-wrapper.scm" (find-files "guix/build" "\\.scm$")) (("^([[:graph:]]+) This file is part of Guix." _ comment-start) (string-append comment-start " This file is part of GNU Guix.")) (("^([[:graph:]]+) Guix --- Nix package management.*" _ comment-start) (string-append comment-start " GNU Guix --- Functional package management for GNU\n")) (("^([[:graph:]]+) Guix is " _ comment-start) (string-append comment-start " GNU Guix is ")) (("^([[:graph:]]+) along with Guix." _ comment-start) (string-append comment-start " along with GNU Guix.")) (("^([[:graph:]]+) Copyright \\(C\\)" _ comment-start) (string-append comment-start " Copyright ©"))) * distro/packages/ld-wrapper.scm, guix/build/download.scm, guix/build/gnu-build-system.scm, guix/build/union.scm, guix/build/utils.scm: Update license headers. --- distro/packages/ld-wrapper.scm | 12 ++++++------ guix/build/download.scm | 12 ++++++------ guix/build/gnu-build-system.scm | 12 ++++++------ guix/build/union.scm | 12 ++++++------ guix/build/utils.scm | 12 ++++++------ 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/distro/packages/ld-wrapper.scm b/distro/packages/ld-wrapper.scm index 5c98375814..fd5a4cbd0c 100644 --- a/distro/packages/ld-wrapper.scm +++ b/distro/packages/ld-wrapper.scm @@ -10,23 +10,23 @@ main="(@ (gnu build-support ld-wrapper) ld-wrapper)" exec @GUILE@ -c "(load-compiled \"$0.go\") (apply $main (cdr (command-line)))" "$@" !# -;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2012 Ludovic Courtès ;;; -;;; This file is part of Guix. +;;; This file is part of GNU Guix. ;;; -;;; Guix is free software; you can redistribute it and/or modify it +;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; -;;; Guix is distributed in the hope that it will be useful, but +;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License -;;; along with Guix. If not, see . +;;; along with GNU Guix. If not, see . (define-module (gnu build-support ld-wrapper) #:use-module (srfi srfi-1) diff --git a/guix/build/download.scm b/guix/build/download.scm index c09351cee4..5813ea81ea 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -1,20 +1,20 @@ -;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2012 Ludovic Courtès ;;; -;;; This file is part of Guix. +;;; This file is part of GNU Guix. ;;; -;;; Guix is free software; you can redistribute it and/or modify it +;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; -;;; Guix is distributed in the hope that it will be useful, but +;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License -;;; along with Guix. If not, see . +;;; along with GNU Guix. If not, see . (define-module (guix build download) #:use-module (web uri) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index bd40289aac..e9421000bf 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -1,20 +1,20 @@ -;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2012 Ludovic Courtès ;;; -;;; This file is part of Guix. +;;; This file is part of GNU Guix. ;;; -;;; Guix is free software; you can redistribute it and/or modify it +;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; -;;; Guix is distributed in the hope that it will be useful, but +;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License -;;; along with Guix. If not, see . +;;; along with GNU Guix. If not, see . (define-module (guix build gnu-build-system) #:use-module (guix build utils) diff --git a/guix/build/union.scm b/guix/build/union.scm index ffd367917a..317c38a1d5 100644 --- a/guix/build/union.scm +++ b/guix/build/union.scm @@ -1,20 +1,20 @@ -;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2012 Ludovic Courtès ;;; -;;; This file is part of Guix. +;;; This file is part of GNU Guix. ;;; -;;; Guix is free software; you can redistribute it and/or modify it +;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; -;;; Guix is distributed in the hope that it will be useful, but +;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License -;;; along with Guix. If not, see . +;;; along with GNU Guix. If not, see . (define-module (guix build union) #:use-module (ice-9 ftw) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index f365b0db05..6921e31bdd 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -1,20 +1,20 @@ -;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012, 2013 Ludovic Courtès +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2012, 2013 Ludovic Courtès ;;; -;;; This file is part of Guix. +;;; This file is part of GNU Guix. ;;; -;;; Guix is free software; you can redistribute it and/or modify it +;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; -;;; Guix is distributed in the hope that it will be useful, but +;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License -;;; along with Guix. If not, see . +;;; along with GNU Guix. If not, see . (define-module (guix build utils) #:use-module (srfi srfi-1) From 79580eb698d07e4b21334ddfbcbcf620d27b5e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 6 Jan 2013 01:16:14 +0100 Subject: [PATCH 57/71] distro: Update bootstrap binaries to an nscd-less libc. Update bootstrap binaries following changes in commit d3b5972 ("Build glibc without nscd, and with static NSS modules.") * Makefile.am (distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz, distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz): Update hashes. * build-aux/download.scm (file-name->uri): Update URL. * distro/packages/bootstrap.scm (%bootstrap-coreutils&co, %bootstrap-binutils, %bootstrap-glibc, %bootstrap-gcc): Update URLs and hashes. --- Makefile.am | 4 ++-- build-aux/download.scm | 4 ++-- distro/packages/bootstrap.scm | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2dca557b7a..41337fd272 100644 --- a/Makefile.am +++ b/Makefile.am @@ -164,10 +164,10 @@ DOWNLOAD_FILE = \ distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz: $(MKDIR_P) `dirname "$@"` - $(DOWNLOAD_FILE) "$@" "953fbcc8db6e310626be79b67319cf4141dc23b296447952a99d95425b3a4dc1" + $(DOWNLOAD_FILE) "$@" "bc43210dcd146d242bef4d354b0aeac12c4ef3118c07502d17ffa8d49e15aa2c" distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz: $(MKDIR_P) `dirname "$@"` - $(DOWNLOAD_FILE) "$@" "45d1f9bfb9e4531a8f1c5a105f7ab094cd481b8a179ccc63cbabb73ce6b8437f" + $(DOWNLOAD_FILE) "$@" "f9a7c6f4c556eaafa2a69bcf07d4ffbb6682ea831d4c9da9ba095aca3ccd217c" nobase_nodist_guilemodule_DATA = $(GOBJECTS) guix/config.scm diff --git a/build-aux/download.scm b/build-aux/download.scm index f5d23f2701..aad4fe3c76 100644 --- a/build-aux/download.scm +++ b/build-aux/download.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -35,7 +35,7 @@ (match (string-tokenize file (char-set-complement (char-set #\/))) ((_ ... system basename) (string->uri (string-append %url-base "/" system - "/20121219/" basename))))) + "/20130105/" basename))))) (match (command-line) ((_ file expected-hash) diff --git a/distro/packages/bootstrap.scm b/distro/packages/bootstrap.scm index 222f087372..2d35d3cdce 100644 --- a/distro/packages/bootstrap.scm +++ b/distro/packages/bootstrap.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -205,15 +205,15 @@ $out/bin/guile --version~%" (method url-fetch) (uri (string-append %bootstrap-base-url "/" - system "/20121219/static-binaries.tar.xz")) + system "/20130105/static-binaries.tar.xz")) (sha256 (match system ("x86_64-linux" (base32 - "1vvdr1hfbjxlincpgfwhz9l4mbrjf502bv5nivapk5b2d3xxfyvv")) + "0md23alzy6nc5f16pric7mkagczdzr8xbh074sb3rjzrls06j1ls")) ("i686-linux" (base32 - "18ky02ifa0w5afyil04fh5whlsqdw0h8kn2fkibfhwfsm5q9d5fx")))))) + "0nzj1lmm9b94g7k737cr4w1dv282w5nmhb53238ikax9r6pkc0yb")))))) "true" ; the program to test "Bootstrap binaries of Coreutils, Awk, etc.")) @@ -224,15 +224,15 @@ $out/bin/guile --version~%" (method url-fetch) (uri (string-append %bootstrap-base-url "/" - system "/20121219/binutils-2.22.tar.xz")) + system "/20130105/binutils-2.22.tar.xz")) (sha256 (match system ("x86_64-linux" (base32 - "0ms6i035v40n7mhi91n4b8ivwv2qni3mcd5dj9sj9qmvgqb50r84")) + "1ffmk2yy2pxvkqgzrkzp3s4jpn4qaaksyk3b5nsc5cjwfm7qkgzh")) ("i686-linux" (base32 - "16yr3jxqjvd979vvpikfn4rl9fqrbcs5viwd2r8xzf5bakc2mq9p")))))) + "1rafk6aq4sayvv3r3d2khn93nkyzf002xzh0xadlyci4mznr6b0a")))))) "ld" ; the program to test "Bootstrap binaries of the GNU Binutils")) @@ -277,15 +277,15 @@ $out/bin/guile --version~%" (origin (method url-fetch) (uri (string-append %bootstrap-base-url "/" system - "/20121219/glibc-2.16.0.tar.xz")) + "/20130105/glibc-2.17.tar.xz")) (sha256 (match system ("x86_64-linux" (base32 - "1mqpb2sxfa5whdq0adyrgg7j3ci5v4d42wna8hg4j3dbcr5b2vpi")) + "18kv1z9d8dr1j3hm9w7663kchqw9p6rsx11n1m143jgba2jz6jy3")) ("i686-linux" (base32 - "03wb29srsdswc775ppzwllys0dqyy235shm1n64jl6njw4l7c5x6")))))))))) + "08hv8i0axwnihrcgbz19x0a7s6zyv3yx38x8r29liwl8h82x9g88")))))))))) (synopsis "Bootstrap binaries and headers of the GNU C Library") (description #f) (home-page #f))) @@ -348,15 +348,15 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \ (origin (method url-fetch) (uri (string-append %bootstrap-base-url "/" system - "/20121219/gcc-4.7.2.tar.xz")) + "/20130105/gcc-4.7.2.tar.xz")) (sha256 (match system ("x86_64-linux" (base32 - "1k374q9v1bph8605sirzmaxnawbddahpgq8d99x1527gj5n2xws1")) + "1x1p7han5crnbw906iwdifykr6grzm0w27dy9gz75j0q1b32i4px")) ("i686-linux" (base32 - "040jkqkh0qyva5z6gy4d95khhhvsw4vp8x3l818gpi6hfknwb9l8")))))))))) + "06wqs0xxnpw3hn0xjb4c9cs0899p1xwkcysa2rvzhvpra0c5vsg2")))))))))) (synopsis "Bootstrap binaries of the GNU Compiler Collection") (description #f) (home-page #f))) From a9f8b72ee1d0a6b2837a49d89698304792b39b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 6 Jan 2013 17:42:59 +0100 Subject: [PATCH 58/71] distro: time: Adjust `configure' phase to old `configure' script. * distro/packages/time.scm (time): Add `arguments'. --- distro/packages/time.scm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/distro/packages/time.scm b/distro/packages/time.scm index b7eaec0c21..0b7bde9a1b 100644 --- a/distro/packages/time.scm +++ b/distro/packages/time.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012 Nikita Karetnikov +;;; Copyright © 2013 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -35,6 +36,18 @@ (base32 "0va9063fcn7xykv658v2s9gilj2fq4rcdxx2mn2mmy1v4ndafzp3")))) (build-system gnu-build-system) + (arguments + '(#:phases + (alist-replace 'configure + (lambda* (#:key outputs #:allow-other-keys) + ;; This old `configure' script doesn't support + ;; variables passed as arguments. + (let ((out (assoc-ref outputs "out"))) + (setenv "CONFIG_SHELL" (which "bash")) + (zero? + (system* "./configure" + (string-append "--prefix=" out))))) + %standard-phases))) (home-page "http://www.gnu.org/software/time/") (synopsis "GNU Time, a tool that runs programs and summarizes the system @@ -49,6 +62,5 @@ in a file instead of displaying it on the screen. The resources that 'time' can report on fall into the general categories of time, memory, and I/O and IPC calls. Some systems do not provide much information about program resource use; 'time' reports unavailable -information as zero values. -") - (license gpl2+))) \ No newline at end of file +information as zero values.") + (license gpl2+))) From fb83842efba5b4f08a151d2f8a0fd43de6c62778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 6 Jan 2013 18:23:44 +0100 Subject: [PATCH 59/71] ftp-client: Add `ftp-size'. * guix/ftp-client.scm (ftp-size): New procedure. --- guix/ftp-client.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/guix/ftp-client.scm b/guix/ftp-client.scm index 7e241f37b2..e3bacc3720 100644 --- a/guix/ftp-client.scm +++ b/guix/ftp-client.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2010, 2011, 2012 Ludovic Courtès +;;; Copyright © 2010, 2011, 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,6 +33,7 @@ ftp-open ftp-close ftp-chdir + ftp-size ftp-list ftp-retr)) @@ -133,6 +134,12 @@ or a TCP port number), and return it." (%ftp-command (string-append "CWD " dir) 250 (ftp-connection-socket conn))) +(define (ftp-size conn file) + "Return the size in bytes of FILE." + (let ((message (%ftp-command (string-append "SIZE " file) 213 + (ftp-connection-socket conn)))) + (string->number (string-trim-both message)))) + (define (ftp-pasv conn) (define %pasv-rx (make-regexp "([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+)")) From e47bac790228d4f622bce9981fc4b6ed4767b973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 6 Jan 2013 18:24:53 +0100 Subject: [PATCH 60/71] download: Report the progress of FTP downloads. * guix/build/download.scm (progress-proc): New procedure. (ftp-fetch): Call `ftp-size' on URI. Use `progress-proc', and pass the result to `dump-port', along with #:buffer-size. --- guix/build/download.scm | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/guix/build/download.scm b/guix/build/download.scm index 27f5557692..8a715cf50b 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012 Ludovic Courtès +;;; Copyright © 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -27,6 +27,7 @@ #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (ice-9 match) + #:use-module (ice-9 format) #:export (url-fetch)) ;;; Commentary: @@ -35,17 +36,39 @@ ;;; ;;; Code: +(define* (progress-proc file size #:optional (log-port (current-output-port))) + "Return a procedure to show the progress of FILE's download, which is +SIZE byte long. The returned procedure is suitable for use as an +argument to `dump-port'. The progress report is written to LOG-PORT." + (if (number? size) + (lambda (transferred cont) + (let ((% (* 100.0 (/ transferred size)))) + (display #\cr log-port) + (format log-port "~a\t~5,1f% of ~,1f KiB" + file % (/ size 1024.0)) + (flush-output-port log-port) + (cont))) + (lambda (transferred cont) + (display #\cr log-port) + (format log-port "~a\t~6,1f KiB transferred" + file (/ transferred 1024.0)) + (flush-output-port log-port) + (cont)))) + (define (ftp-fetch uri file) "Fetch data from URI and write it to FILE. Return FILE on success." (let* ((conn (ftp-open (uri-host uri))) + (size (false-if-exception (ftp-size conn (uri-path uri)))) (in (ftp-retr conn (basename (uri-path uri)) (dirname (uri-path uri))))) (call-with-output-file file (lambda (out) - ;; TODO: Show a progress bar. - (dump-port in out))) + (dump-port in out + #:buffer-size 65536 ; don't flood the log + #:progress (progress-proc (uri->string uri) size)))) (ftp-close conn)) + (newline) file) (define (open-connection-for-uri uri) From e66ca1a5a898c4bfd0c2c3c2ec3284befde28ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 6 Jan 2013 18:36:50 +0100 Subject: [PATCH 61/71] download: Report the progress of HTTP downloads. * guix/build/download.scm (http-fetch): Rename `bv' to `bv-or-port'. Use `http-get*' followed by `dump-port' when the former is available, and pass a progress procedure to `dump-port'. --- guix/build/download.scm | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/guix/build/download.scm b/guix/build/download.scm index 8a715cf50b..7c48d7bff5 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -126,20 +126,34 @@ which is not available during bootstrap." (define (http-fetch uri file) "Fetch data from URI and write it to FILE. Return FILE on success." - ;; FIXME: Use a variant of `http-get' that returns a port instead of - ;; loading everything in memory. (let*-values (((connection) (open-connection-for-uri uri)) - ((resp bv) - (http-get uri #:port connection #:decode-body? #f)) + ((resp bv-or-port) + ;; XXX: `http-get*' was introduced in 2.0.7. We know + ;; we're using it within the chroot, but + ;; `guix-download' might be using a different version. + ;; So keep this compatibility hack for now. + (if (module-defined? (resolve-interface '(web client)) + 'http-get*) + (http-get* uri #:port connection #:decode-body? #f) + (http-get uri #:port connection #:decode-body? #f))) ((code) - (response-code resp))) + (response-code resp)) + ((size) + (response-content-length resp))) (case code ((200) ; OK (begin (call-with-output-file file (lambda (p) - (put-bytevector p bv))) + (if (port? bv-or-port) + (begin + (dump-port bv-or-port p + #:buffer-size 65536 ; don't flood the log + #:progress (progress-proc (uri->string uri) + size)) + (newline)) + (put-bytevector p bv-or-port)))) file)) ((302) ; found (redirection) (let ((uri (response-location resp))) From 2357f85032de5457c28586794fa0fb09488dc6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 6 Jan 2013 18:43:58 +0100 Subject: [PATCH 62/71] Update a few more license headers. * distro/packages/openssl.scm, m4/guix.m4, nix/sync-with-upstream: Update headers. --- distro/packages/openssl.scm | 12 ++++++------ m4/guix.m4 | 12 ++++++------ nix/sync-with-upstream | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/distro/packages/openssl.scm b/distro/packages/openssl.scm index 8f40307d4e..4018e46a49 100644 --- a/distro/packages/openssl.scm +++ b/distro/packages/openssl.scm @@ -1,20 +1,20 @@ -;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Andreas Enge +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2013 Andreas Enge ;;; -;;; This file is part of Guix. +;;; This file is part of GNU Guix. ;;; -;;; Guix is free software; you can redistribute it and/or modify it +;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; -;;; Guix is distributed in the hope that it will be useful, but +;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License -;;; along with Guix. If not, see . +;;; along with GNU Guix. If not, see . (define-module (distro packages openssl) #:use-module (distro) diff --git a/m4/guix.m4 b/m4/guix.m4 index 7d7d7381a0..6c7d5e0127 100644 --- a/m4/guix.m4 +++ b/m4/guix.m4 @@ -1,20 +1,20 @@ -dnl Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -dnl Copyright (C) 2012 Ludovic Courtès +dnl GNU Guix --- Functional package management for GNU +dnl Copyright © 2012 Ludovic Courtès dnl -dnl This file is part of Guix. +dnl This file is part of GNU Guix. dnl -dnl Guix is free software; you can redistribute it and/or modify it +dnl GNU Guix is free software; you can redistribute it and/or modify it dnl under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 3 of the License, or (at dnl your option) any later version. dnl -dnl Guix is distributed in the hope that it will be useful, but +dnl GNU Guix is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License -dnl along with Guix. If not, see . +dnl along with GNU Guix. If not, see . dnl GUIX_ASSERT_LIBGCRYPT_USABLE dnl diff --git a/nix/sync-with-upstream b/nix/sync-with-upstream index 1f11fd7d47..66a315a643 100755 --- a/nix/sync-with-upstream +++ b/nix/sync-with-upstream @@ -1,21 +1,21 @@ #!/bin/sh -# Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -# Copyright (C) 2012 Ludovic Courtès +# GNU Guix --- Functional package management for GNU +# Copyright © 2012 Ludovic Courtès # -# This file is part of Guix. +# This file is part of GNU Guix. # -# Guix is free software; you can redistribute it and/or modify it +# GNU Guix is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # -# Guix is distributed in the hope that it will be useful, but +# GNU Guix is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with Guix. If not, see . +# along with GNU Guix. If not, see . # # Update the local copy of Nix source code needed to build the daemon. From b30e4f3f125d2d23647609f1ff5c1e784e72c196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 6 Jan 2013 18:47:24 +0100 Subject: [PATCH 63/71] distro: bdb: Adjust to lack of /bin/sh. * distro/packages/bdb.scm (bdb): Pass `CONFIG_SHELL' and `SHELL' to the `configure' script. --- distro/packages/bdb.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/distro/packages/bdb.scm b/distro/packages/bdb.scm index 6d6adc000c..93bf290231 100644 --- a/distro/packages/bdb.scm +++ b/distro/packages/bdb.scm @@ -44,7 +44,9 @@ (let ((out (assoc-ref outputs "out"))) (zero? (system* "./dist/configure" - (string-append "--prefix=" out))))) + (string-append "--prefix=" out) + (string-append "CONFIG_SHELL=" (which "bash")) + (string-append "SHELL=" (which "bash")))))) %standard-phases)))) (synopsis "db, the Berkeley database") (description From 9149f1a08731de1db63536e4a29480b769f7e0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 8 Jan 2013 22:57:09 +0100 Subject: [PATCH 64/71] doc: Update porting instructions in `HACKING'. * HACKING (When the platform is supported by Nixpkgs): Update instructions. --- HACKING | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/HACKING b/HACKING index 3ff6040623..79697a141c 100644 --- a/HACKING +++ b/HACKING @@ -2,7 +2,7 @@ #+TITLE: Hacking GNU Guix and its incredible distro -Copyright © 2012 Ludovic Courtès +Copyright © 2012, 2013 Ludovic Courtès Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -106,26 +106,10 @@ GCC, libc, etc. need to be built. To that end, run the following commands: #+BEGIN_SRC sh - ./pre-inst-env guix-build \ - -e '(@@ (distro packages base) %guile-bootstrap-tarball)' \ + ./pre-inst-env guix-build \ + -e '(@ (distro packages make-bootstrap) bootstrap-tarballs)' \ --system=i686-linux - - ./pre-inst-env guix-build \ - -e '(@@ (distro packages base) %bootstrap-binaries-tarball)' \ - --system=i686-linux - - ./pre-inst-env guix-build \ - -e '(@@ (distro packages base) %binutils-bootstrap-tarball)' \ - --system=i686-linux - - ./pre-inst-env guix-build \ - -e '(@@ (distro packages base) %glibc-bootstrap-tarball)' \ - --system=i686-linux - - ./pre-inst-env guix-build \ - -e '(@@ (distro packages base) %gcc-bootstrap-tarball)' \ - --system=i686-linux - + #+END_SRC These should build tarballs containing statically-linked tools usable on @@ -135,12 +119,11 @@ In the source tree, you need to install binaries for ‘mkdir’, ‘bash’, ‘tar’, and ‘xz’ under ‘distro/packages/bootstrap/i686-linux’. These binaries can be extracted from the static-binaries tarball built above. -A rule for -‘distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz’ +A rule for ‘distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz’ needs to be added in ‘Makefile.am’, with the appropriate hexadecimal vrepresentation of its SHA256 hash. -You may then revert your changes to ‘base.scm’. For the variables +You may then revert your changes to ‘bootstrap.scm’. For the variables ‘%bootstrap-coreutils&co’, ‘%bootstrap-binutils’, ‘%bootstrap-glibc’, and ‘%bootstrap-gcc’, the expected SHA256 of the corresponding tarballs for ‘i686-linux’ (built above) must be added. From a06a99ff779c7419c2e47c475b5c0fa8a9fc24c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 10 Jan 2013 00:08:40 +0100 Subject: [PATCH 65/71] build-system/gnu: Improve support for "lib" outputs; support "doc" outputs. * guix/build/gnu-build-system.scm (configure)[package-name]: New procedure. When LIBDIR is true and INCLUDEDIR is false, add --includedir=LIBDIR/include. Add support for --docdir when a "doc" output exists. --- guix/build/gnu-build-system.scm | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index e9421000bf..b7b9fdac95 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012 Ludovic Courtès +;;; Copyright © 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -115,10 +115,20 @@ makefiles." (define* (configure #:key inputs outputs (configure-flags '()) out-of-source? #:allow-other-keys) + (define (package-name) + (let* ((out (assoc-ref outputs "out")) + (base (basename out)) + (dash (string-rindex base #\-))) + ;; XXX: We'd rather use `package-name->name+version' or similar. + (if dash + (substring base 0 dash) + base))) + (let* ((prefix (assoc-ref outputs "out")) (bindir (assoc-ref outputs "bin")) (libdir (assoc-ref outputs "lib")) (includedir (assoc-ref outputs "include")) + (docdir (assoc-ref outputs "doc")) (bash (or (and=> (assoc-ref inputs "bash") (cut string-append <> "/bin/bash")) "/bin/sh")) @@ -133,12 +143,21 @@ makefiles." (list (string-append "--bindir=" bindir "/bin")) '()) ,@(if libdir - (list (string-append "--libdir=" libdir "/lib")) + (cons (string-append "--libdir=" libdir "/lib") + (if includedir + '() + (list + (string-append "--includedir=" + libdir "/include")))) '()) ,@(if includedir (list (string-append "--includedir=" includedir "/include")) '()) + ,@(if docdir + (list (string-append "--docdir=" docdir + "/doc/" (package-name))) + '()) ,@configure-flags)) (abs-srcdir (getcwd)) (srcdir (if out-of-source? From 4873f8ed9f79f8e20c8304f8ea1b4664df36fa3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 10 Jan 2013 00:09:25 +0100 Subject: [PATCH 66/71] distro: binutils: Add a "lib" output. * distro/packages/base.scm (binutils): Add `outputs' field. --- distro/packages/base.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/distro/packages/base.scm b/distro/packages/base.scm index cb0cb0fd79..bc705f16e7 100644 --- a/distro/packages/base.scm +++ b/distro/packages/base.scm @@ -353,6 +353,11 @@ that it is possible to use Make to build and install the program.") "1a9w66v5dwvbnawshjwqcgz7km6kw6ihkzp6sswv9ycc3knzhykc")))) (build-system gnu-build-system) + ;; Split Binutils in several outputs, mostly to avoid collisions in + ;; user profiles with GCC---e.g., libiberty.a. + (outputs '("out" ; ar, ld, binutils.info, etc. + "lib")) ; libbfd.a, bfd.h, etc. + ;; TODO: Add dependency on zlib + those for Gold. (native-inputs `(("patch/new-dtags" ,(search-patch "binutils-ld-new-dtags.patch")))) From 704197f4bf70609ef273bdb73331869142b58aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 10 Jan 2013 00:10:59 +0100 Subject: [PATCH 67/71] distro: gmp: Update to 5.0.1. * distro/packages/multiprecision.scm (gmp): Update to 5.0.1. --- distro/packages/multiprecision.scm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/distro/packages/multiprecision.scm b/distro/packages/multiprecision.scm index 40550ee65d..444c6103eb 100644 --- a/distro/packages/multiprecision.scm +++ b/distro/packages/multiprecision.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012 Ludovic Courtès +;;; Copyright © 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,14 +28,18 @@ (define-public gmp (package (name "gmp") - (version "5.0.5") + (version "5.1.0") (source (origin (method url-fetch) - (uri (string-append "mirror://gnu/gmp/gmp-" version - ".tar.bz2")) + (uri + ;; Note: this version is not available from GNU mirrors + ;; because it was made with an Automake affected by + ;; CVE-2012-3386. + (string-append "ftp://ftp.gmplib.org/pub/gmp-" + version "/gmp-" version ".tar.bz2")) (sha256 (base32 - "1jfymbr90mpn0zw5sg001llqnvf2462y77vgjknrmfs1rjn8ln0z")))) + "15n7xxgasbxdch8ii8z9ic6fxc2ysk3q8iavf55abjp5iylspnfz")))) (build-system gnu-build-system) (native-inputs `(("m4" ,m4))) (arguments `(#:configure-flags From 5fedc65b0fa807bafde46b4071e9e324ef8c0ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 10 Jan 2013 22:18:16 +0100 Subject: [PATCH 68/71] build: Print the Guix system type. * m4/guix.m4 (GUIX_SYSTEM_TYPE): Print the system type. --- m4/guix.m4 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/m4/guix.m4 b/m4/guix.m4 index 6c7d5e0127..6cf1b01c90 100644 --- a/m4/guix.m4 +++ b/m4/guix.m4 @@ -1,5 +1,5 @@ dnl GNU Guix --- Functional package management for GNU -dnl Copyright © 2012 Ludovic Courtès +dnl Copyright © 2012, 2013 Ludovic Courtès dnl dnl This file is part of GNU Guix. dnl @@ -61,5 +61,9 @@ AC_DEFUN([GUIX_SYSTEM_TYPE], [ # `darwin10.2.0', etc. guix_system="$machine_name-`echo $host_os | "$SED" -e's/@<:@0-9.@:>@*$//g'`";; esac]) + + AC_MSG_CHECKING([for the Guix system type]) + AC_MSG_RESULT([$guix_system]) + AC_SUBST([guix_system]) ]) From f03e7115d7b777fa961f306cb8b8c5288a40b89e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 10 Jan 2013 22:33:35 +0100 Subject: [PATCH 69/71] distro: libsigsegv: Use a single output. * distro/packages/libsigsegv.scm (libsigsegv): Use just a single output, otherwise nothing ends up in `out' as a consequence of commit a06a99f. Reported by Andreas Enge . --- distro/packages/libsigsegv.scm | 3 +-- doc/guix.texi | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/distro/packages/libsigsegv.scm b/distro/packages/libsigsegv.scm index 07185186a5..a21e2064c7 100644 --- a/distro/packages/libsigsegv.scm +++ b/distro/packages/libsigsegv.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012 Ludovic Courtès +;;; Copyright © 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -35,7 +35,6 @@ (sha256 (base32 "16hrs8k3nmc7a8jam5j1fpspd6sdpkamskvsdpcw6m29vnis8q44")))) (build-system gnu-build-system) - (outputs '("out" "lib")) ; separate libdir from the rest (home-page "http://www.gnu.org/software/libsigsegv/") (synopsis "GNU libsigsegv, a library to handle page faults in user mode") (description diff --git a/doc/guix.texi b/doc/guix.texi index 2ca1496bac..c7f6683677 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -219,7 +219,7 @@ Install @var{package}. @code{guile}, or a package name followed by a hyphen and version number, such as @code{guile-1.8}. In addition, @var{package} may contain a colon, followed by the name of one of the outputs of the package, as in -@code{gcc:doc} or @code{libsigsegv-2.10:lib}. +@code{gcc:doc} or @code{binutils-2.22:lib}. @item --remove=@var{package} @itemx -r @var{package} From ab6522aeb05b23a2bb32b10457cebd85ccb248fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 10 Jan 2013 22:35:35 +0100 Subject: [PATCH 70/71] distro: gawk: Adjust to the libsigsegv output change. * distro/packages/gawk.scm (gawk): Adjust the libsigsegv with a single output. --- distro/packages/gawk.scm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/distro/packages/gawk.scm b/distro/packages/gawk.scm index 0acdbea3e8..6fed7f8b70 100644 --- a/distro/packages/gawk.scm +++ b/distro/packages/gawk.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012 Ludovic Courtès +;;; Copyright © 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -54,8 +54,7 @@ %standard-phases))) ((system cross-system) '(#:parallel-tests? #f)))) - (inputs `(("libsigsegv" ,libsigsegv) ; headers - ("libsigsegv/lib" ,libsigsegv "lib"))) ; library + (inputs `(("libsigsegv" ,libsigsegv))) (home-page "http://www.gnu.org/software/gawk/") (synopsis "GNU implementation of the Awk programming language") (description From 28e55604212c01884a77a4f5eb66294c4957c48a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 11 Jan 2013 15:41:58 +0100 Subject: [PATCH 71/71] download: Abbreviate URLs when displaying the progress report. * guix/build/download.scm (uri-abbreviation): New procedure. (ftp-fetch, http-fetch): Use it instead of `uri->string' when calling `progress-proc'. Reported by Andreas Enge. --- guix/build/download.scm | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/guix/build/download.scm b/guix/build/download.scm index 7c48d7bff5..09c62541de 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -55,6 +55,25 @@ argument to `dump-port'. The progress report is written to LOG-PORT." (flush-output-port log-port) (cont)))) +(define* (uri-abbreviation uri #:optional (max-length 42)) + "If URI's string representation is larger than MAX-LENGTH, return an +abbreviation of URI showing the scheme, host, and basename of the file." + (define uri-as-string + (uri->string uri)) + + (define (elide-path) + (let ((path (uri-path uri))) + (string-append (symbol->string (uri-scheme uri)) + "://" (uri-host uri) + (string-append "/.../" (basename path))))) + + (if (> (string-length uri-as-string) max-length) + (let ((short (elide-path))) + (if (< (string-length short) (string-length uri-as-string)) + short + uri-as-string)) + uri-as-string)) + (define (ftp-fetch uri file) "Fetch data from URI and write it to FILE. Return FILE on success." (let* ((conn (ftp-open (uri-host uri))) @@ -65,7 +84,7 @@ argument to `dump-port'. The progress report is written to LOG-PORT." (lambda (out) (dump-port in out #:buffer-size 65536 ; don't flood the log - #:progress (progress-proc (uri->string uri) size)))) + #:progress (progress-proc (uri-abbreviation uri) size)))) (ftp-close conn)) (newline) @@ -150,7 +169,7 @@ which is not available during bootstrap." (begin (dump-port bv-or-port p #:buffer-size 65536 ; don't flood the log - #:progress (progress-proc (uri->string uri) + #:progress (progress-proc (uri-abbreviation uri) size)) (newline)) (put-bytevector p bv-or-port))))