From cfbf7877a673400881db20521a9d6a44261ed62b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 12 Jun 2013 09:39:31 +0200 Subject: [PATCH 01/43] ld-wrapper: Unless in a build env., allow files that symlink to the store. * gnu/packages/ld-wrapper.scm (pure-file-name?): As a last resort, when %BUILD-DIRECTORY is false, check whether FILE is a symlink, and loop over it to check whether its target is in the store. --- gnu/packages/ld-wrapper.scm | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/gnu/packages/ld-wrapper.scm b/gnu/packages/ld-wrapper.scm index fd5a4cbd0c..41ff3df986 100644 --- a/gnu/packages/ld-wrapper.scm +++ b/gnu/packages/ld-wrapper.scm @@ -11,7 +11,7 @@ main="(@ (gnu build-support ld-wrapper) ld-wrapper)" exec @GUILE@ -c "(load-compiled \"$0.go\") (apply $main (cdr (command-line)))" "$@" !# ;;; 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. ;;; @@ -82,13 +82,26 @@ exec @GUILE@ -c "(load-compiled \"$0.go\") (apply $main (cdr (command-line)))" " (getenv "GUIX_LD_WRAPPER_DEBUG")) (define (pure-file-name? file) - ;; Return #t when FILE is the name of a file either within the store or - ;; within the build directory. - (or (not (string-prefix? "/" file)) - (string-prefix? %store-directory file) - (string-prefix? %temporary-directory file) - (and %build-directory - (string-prefix? %build-directory file)))) + ;; Return #t when FILE is the name of a file either within the store + ;; (possibly via a symlink) or within the build directory. + (define %max-symlink-depth 50) + + (let loop ((file file) + (depth 0)) + (or (not (string-prefix? "/" file)) + (string-prefix? %store-directory file) + (string-prefix? %temporary-directory file) + (if %build-directory + (string-prefix? %build-directory file) + + ;; When used from a user environment, FILE may refer to + ;; ~/.guix-profile/lib/libfoo.so, which is itself a symlink to the + ;; store. Check whether this is the case. + (let ((s (false-if-exception (lstat file)))) + (and s + (eq? 'symlink (stat:type s)) + (< depth %max-symlink-depth) + (loop (readlink file) (+ 1 depth)))))))) (define (switch-arguments switch args) ;; Return the arguments passed for the occurrences of SWITCH--e.g., From fba96c4885aa5b95c42120387db0450d9794508a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Jun 2013 23:45:41 +0200 Subject: [PATCH 02/43] gnu: libgc: Switch to 7.2d. * gnu/packages/bdw-gc.scm (libgc): Upgrade to 7.2d. (libgc-7.2): Remove. --- gnu/packages/bdw-gc.scm | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm index e119fc0bb9..ad0577b1ea 100644 --- a/gnu/packages/bdw-gc.scm +++ b/gnu/packages/bdw-gc.scm @@ -25,7 +25,7 @@ (define-public libgc (package (name "libgc") - (version "7.2alpha6") + (version "7.2d") (source (origin (method url-fetch) (uri (string-append @@ -33,7 +33,7 @@ version ".tar.gz")) (sha256 (base32 - "05jwadjbrv8pr7z9cb4miskicxqpxm0pca4h2rg5cgbpajr2bx7b")))) + "0phwa5driahnpn79zqff14w9yc8sn3599cxz91m78hqdcpl0mznr")))) (build-system gnu-build-system) ;; TODO: Build with -DUSE_LIBC_PRIVATES (see make-bootstrap.scm). (synopsis "The Boehm-Demers-Weiser conservative garbage collector @@ -58,17 +58,3 @@ C or C++ programs, though that is not its primary goal.") ;; permissive X11-style license: ;; http://www.hpl.hp.com/personal/Hans_Boehm/gc/license.txt (license x11))) - -(define-public libgc-7.2 - ;; This is the latest final release of the 7.2 series. - ;; TODO: Use it as the default when doing a core-updates. - (package (inherit libgc) - (version "7.2d") - (source (origin - (method url-fetch) - (uri (string-append - "http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-" - version ".tar.gz")) - (sha256 - (base32 - "0phwa5driahnpn79zqff14w9yc8sn3599cxz91m78hqdcpl0mznr")))))) From 4db00e42109b6f8229259859deac35499eec9004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Jun 2013 23:47:22 +0200 Subject: [PATCH 03/43] gnu: libgc: Always build with -DUSE_LIBC_PRIVATES. * gnu/packages/bdw-gc.scm (libgc): Add `arguments' field. * gnu/packages/make-bootstrap.scm (%guile-static): Remove local `libgc'. --- gnu/packages/bdw-gc.scm | 5 ++++- gnu/packages/make-bootstrap.scm | 8 +------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm index ad0577b1ea..bebb0862e3 100644 --- a/gnu/packages/bdw-gc.scm +++ b/gnu/packages/bdw-gc.scm @@ -35,7 +35,10 @@ (base32 "0phwa5driahnpn79zqff14w9yc8sn3599cxz91m78hqdcpl0mznr")))) (build-system gnu-build-system) - ;; TODO: Build with -DUSE_LIBC_PRIVATES (see make-bootstrap.scm). + (arguments + ;; Make it so that we don't rely on /proc. This is especially useful in + ;; an initrd run before /proc is mounted. + '(#:configure-flags '("CPPFLAGS=-DUSE_LIBC_PRIVATES"))) (synopsis "The Boehm-Demers-Weiser conservative garbage collector for C and C++") (description diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index de4e0dcbeb..b927d5db25 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -404,13 +404,7 @@ ;; A statically-linked Guile that is relocatable--i.e., it can search ;; .scm and .go files relative to its installation directory, rather ;; than in hard-coded configure-time paths. - (let* ((libgc (package (inherit libgc) - (arguments - ;; Make it so that we don't rely on /proc. This is - ;; especially useful in an initrd run before /proc is - ;; mounted. - '(#:configure-flags '("CPPFLAGS=-DUSE_LIBC_PRIVATES"))))) - (guile (package (inherit guile-2.0) + (let* ((guile (package (inherit guile-2.0) (name (string-append (package-name guile-2.0) "-static")) (inputs `(("patch/relocatable" From 56c092ce94cee893898f71ce61e443dd121cccdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 21 Jun 2013 00:25:54 +0200 Subject: [PATCH 04/43] build-system/gnu: Unify with (guix build-system gnu-cross-build). * guix/build/gnu-build-system.scm (set-paths): Add `native-inputs' and `native-search-paths' keyword parameters. Honor them. (configure): Add `target' and `native-inputs' keyword parameters. Look for Bash in NATIVE-INPUTS or INPUTS. Pass `--host' when TARGET is true. (strip): Add `strip-command' keyword parameter. Use it. * guix/build/gnu-cross-build.scm: Remove. * Makefile.am (MODULES): Adjust accordingly. * gnu/packages/acl.scm, gnu/packages/attr.scm, gnu/packages/base.scm, gnu/packages/bash.scm, gnu/packages/gawk.scm, gnu/packages/gettext.scm, gnu/packages/guile.scm, gnu/packages/libffi.scm, gnu/packages/libsigsegv.scm, gnu/packages/linux.scm, gnu/packages/ncurses.scm, gnu/packages/readline.scm, guix/build-system/gnu.scm: Replace `%standard-cross-phases' by `%standard-phases'. Remove references to (guix build gnu-cross-build). --- Makefile.am | 1 - gnu/packages/acl.scm | 2 +- gnu/packages/attr.scm | 2 +- gnu/packages/base.scm | 4 +- gnu/packages/bash.scm | 9 +-- gnu/packages/gawk.scm | 4 +- gnu/packages/gettext.scm | 2 +- gnu/packages/guile.scm | 4 +- gnu/packages/libffi.scm | 9 +-- gnu/packages/libsigsegv.scm | 4 +- gnu/packages/linux.scm | 10 +-- gnu/packages/ncurses.scm | 2 +- gnu/packages/readline.scm | 4 +- guix/build-system/gnu.scm | 6 +- guix/build/gnu-build-system.scm | 45 +++++++++-- guix/build/gnu-cross-build.scm | 138 -------------------------------- 16 files changed, 54 insertions(+), 192 deletions(-) delete mode 100644 guix/build/gnu-cross-build.scm diff --git a/Makefile.am b/Makefile.am index 418b63a377..9faa6544ea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -59,7 +59,6 @@ MODULES = \ guix/build/download.scm \ guix/build/cmake-build-system.scm \ guix/build/gnu-build-system.scm \ - guix/build/gnu-cross-build.scm \ guix/build/perl-build-system.scm \ guix/build/python-build-system.scm \ guix/build/utils.scm \ diff --git a/gnu/packages/acl.scm b/gnu/packages/acl.scm index 54c9116baf..b7604dcea6 100644 --- a/gnu/packages/acl.scm +++ b/gnu/packages/acl.scm @@ -46,7 +46,7 @@ (lambda _ (patch-makefile-SHELL "include/buildmacros")) ,(if (%current-target-system) - '%standard-cross-phases + '%standard-phases '(alist-replace 'check (lambda _ (system* "make" "tests" "-C" "test") diff --git a/gnu/packages/attr.scm b/gnu/packages/attr.scm index 3fb15d235f..2ce50296ac 100644 --- a/gnu/packages/attr.scm +++ b/gnu/packages/attr.scm @@ -55,7 +55,7 @@ ;; When building natively, adjust the test cases. ,(if (%current-target-system) - '%standard-cross-phases + '%standard-phases '(alist-replace 'check (lambda _ ;; Use the right shell. diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 85380549ff..95052775c5 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -293,9 +293,7 @@ The tools supplied with this package are: (substitute* (find-files "tests" "\\.sh$") (("#!/bin/sh") (format #f "#!~a/bin/bash" bash))))) - ,(if (%current-target-system) - '%standard-cross-phases - '%standard-phases)))) + %standard-phases))) (synopsis "Core GNU utilities (file, text, shell)") (description "The GNU Core Utilities are the basic file, shell and text manipulation diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm index bf51403f1a..aa3f397a52 100644 --- a/gnu/packages/bash.scm +++ b/gnu/packages/bash.scm @@ -82,9 +82,7 @@ #:phases (alist-cons-after 'install 'post-install ,post-install-phase - ,(if (%current-target-system) - '%standard-cross-phases - '%standard-phases)))) + %standard-phases))) (synopsis "The GNU Bourne-Again SHell") (description "Bash is the shell, or command language interpreter, that will appear in @@ -106,10 +104,7 @@ modification.") (let ((args `(#:modules ((guix build gnu-build-system) (guix build utils) (srfi srfi-1) - (srfi srfi-26) - ,@(if (%current-target-system) - '((guix build gnu-cross-build)) - '())) + (srfi srfi-26)) ,@(package-arguments bash)))) (substitute-keyword-arguments args ((#:configure-flags flags) diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm index 444fa5e556..1b19f7bfd2 100644 --- a/gnu/packages/gawk.scm +++ b/gnu/packages/gawk.scm @@ -50,9 +50,7 @@ (substitute* "io.c" (("/bin/sh") (string-append bash "/bin/bash"))))) - ,(if (%current-target-system) - '%standard-cross-phases - '%standard-phases)))) + %standard-phases))) (inputs `(("libsigsegv" ,libsigsegv) ;; TODO: On next core-updates, make Bash input unconditional. diff --git a/gnu/packages/gettext.scm b/gnu/packages/gettext.scm index e22b1ba6ff..c838f9c0a6 100644 --- a/gnu/packages/gettext.scm +++ b/gnu/packages/gettext.scm @@ -39,7 +39,7 @@ (arguments `(#:patches (list (assoc-ref %build-inputs "patch/gets")) #:phases ,(if (%current-target-system) - '%standard-cross-phases + '%standard-phases '(alist-cons-before 'check 'patch-tests (lambda* (#:key inputs #:allow-other-keys) diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index b53f3eb770..c4eca3e350 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -158,9 +158,7 @@ extensible. It supports many SRFIs.") (substitute* "module/ice-9/popen.scm" (("/bin/sh") (string-append bash "/bin/bash"))))) - ,(if (%current-target-system) - '%standard-cross-phases - '%standard-phases)) + %standard-phases) ,@(if (%current-target-system) '(#:configure-flags '("CC_FOR_BUILD=gcc")) diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm index f7d4a8c908..fdebab7433 100644 --- a/gnu/packages/libffi.scm +++ b/gnu/packages/libffi.scm @@ -49,15 +49,10 @@ "0ln4jbpb6clcsdpb9niqk0frgx4k0xki96wiv067ig0q4cajb7aq")))) (build-system gnu-build-system) (arguments `(#:modules ((guix build utils) (guix build gnu-build-system) - (ice-9 ftw) (srfi srfi-26) - ,@(if (%current-target-system) - '((guix build gnu-cross-build)) - '())) + (ice-9 ftw) (srfi srfi-26)) #:phases (alist-cons-after 'install 'post-install ,post-install-phase - ,(if (%current-target-system) - '%standard-cross-phases - '%standard-phases)))) + %standard-phases))) (synopsis "Foreign function call interface library") (description "The libffi library provides a portable, high level programming interface diff --git a/gnu/packages/libsigsegv.scm b/gnu/packages/libsigsegv.scm index 4689b3d8b5..62fb40737a 100644 --- a/gnu/packages/libsigsegv.scm +++ b/gnu/packages/libsigsegv.scm @@ -49,9 +49,7 @@ (lambda _ (substitute* "src/fault-linux-mips-old.h" (("#include ") ""))) - ,(if (%current-target-system) - '%standard-cross-phases - '%standard-phases))) + %standard-phases)) '())) (description "GNU libsigsegv is a library for handling page faults in user mode. A page diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 0bc9fbcb5e..dde53e9f5d 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -80,18 +80,12 @@ (arguments `(#:modules ((guix build gnu-build-system) (guix build utils) - (srfi srfi-1) - ,@(if (%current-target-system) - '((guix build gnu-cross-build)) - '())) + (srfi srfi-1)) #:phases (alist-replace 'build ,(build-phase (%current-system)) (alist-replace 'install ,install-phase - (alist-delete 'configure - ,(if (%current-target-system) - '%standard-cross-phases - '%standard-phases)))) + (alist-delete 'configure %standard-phases))) #:tests? #f)) (synopsis "GNU Linux-Libre kernel headers") (description "Headers of the Linux-Libre kernel.") diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm index c1badae8a3..e5a9bce0f1 100644 --- a/gnu/packages/ncurses.scm +++ b/gnu/packages/ncurses.scm @@ -116,7 +116,7 @@ ,cross-pre-install-phase (alist-cons-after 'install 'post-install ,post-install-phase - %standard-cross-phases))) + %standard-phases))) `(alist-cons-after ; native build 'install 'post-install ,post-install-phase diff --git a/gnu/packages/readline.scm b/gnu/packages/readline.scm index 1fb4376971..8857666fcc 100644 --- a/gnu/packages/readline.scm +++ b/gnu/packages/readline.scm @@ -61,9 +61,7 @@ #:phases (alist-cons-after 'install 'post-install ,post-install-phase - ,(if (%current-target-system) - '%standard-cross-phases - '%standard-phases)))) + %standard-phases))) (synopsis "Edit command lines while typing, with history support") (description "The GNU Readline library provides a set of functions for use by diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index 35590aa3da..b72239d13e 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -340,14 +340,12 @@ inputs." (strip-flags ''("--strip-debug")) (strip-directories ''("lib" "lib64" "libexec" "bin" "sbin")) - (phases '%standard-cross-phases) + (phases '%standard-phases) (system (%current-system)) - (implicit-inputs? #t) ; useful when bootstrapping + (implicit-inputs? #t) (imported-modules '((guix build gnu-build-system) - (guix build gnu-cross-build) (guix build utils))) (modules '((guix build gnu-build-system) - (guix build gnu-cross-build) (guix build utils)))) "Cross-build NAME for TARGET, where TARGET is a GNU triplet. INPUTS are cross-built inputs, and NATIVE-INPUTS are inputs that run on the build diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 47820aa02e..4245f2aefd 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -48,15 +48,28 @@ #f dir)) -(define* (set-paths #:key inputs (search-paths '()) +(define* (set-paths #:key target inputs native-inputs + (search-paths '()) (native-search-paths '()) #:allow-other-keys) (define input-directories (match inputs (((_ . dir) ...) dir))) + (define native-input-directories + (match native-inputs + (((_ . dir) ...) + dir) + (#f ; not cross compiling + '()))) + + ;; When cross building, $PATH must refer only to native (host) inputs since + ;; target inputs are not executable. (set-path-environment-variable "PATH" '("bin" "sbin") - input-directories) + (append native-input-directories + (if target + '() + input-directories))) (for-each (match-lambda ((env-var (directories ...) separator) @@ -65,6 +78,15 @@ #:separator separator))) search-paths) + (when native-search-paths + ;; Search paths for native inputs, when cross building. + (for-each (match-lambda + ((env-var (directories ...) separator) + (set-path-environment-variable env-var directories + native-input-directories + #:separator separator))) + native-search-paths)) + ;; Dump the environment variables as a shell script, for handy debugging. (system "export > environment-variables")) @@ -102,7 +124,8 @@ makefiles." (append patch-flags (list "--input" p))))) patches)) -(define* (configure #:key inputs outputs (configure-flags '()) out-of-source? +(define* (configure #:key target native-inputs inputs outputs + (configure-flags '()) out-of-source? #:allow-other-keys) (define (package-name) (let* ((out (assoc-ref outputs "out")) @@ -119,7 +142,7 @@ makefiles." (libdir (assoc-ref outputs "lib")) (includedir (assoc-ref outputs "include")) (docdir (assoc-ref outputs "doc")) - (bash (or (and=> (assoc-ref inputs "bash") + (bash (or (and=> (assoc-ref (or native-inputs inputs) "bash") (cut string-append <> "/bin/bash")) "/bin/sh")) (flags `(,(string-append "CONFIG_SHELL=" bash) @@ -148,6 +171,9 @@ makefiles." (list (string-append "--docdir=" docdir "/doc/" (package-name))) '()) + ,@(if target ; cross building + (list (string-append "--host=" target)) + '()) ,@configure-flags)) (abs-srcdir (getcwd)) (srcdir (if out-of-source? @@ -230,17 +256,20 @@ makefiles." bindirs))) #t) -(define* (strip #:key outputs (strip-binaries? #t) +(define* (strip #:key target outputs (strip-binaries? #t) + (strip-command (if target + (string-append target "-strip") + "strip")) (strip-flags '("--strip-debug")) (strip-directories '("lib" "lib64" "libexec" "bin" "sbin")) #:allow-other-keys) (define (strip-dir dir) - (format #t "stripping binaries in ~s with flags ~s~%" - dir strip-flags) + (format #t "stripping binaries in ~s with ~s and flags ~s~%" + dir strip-command strip-flags) (file-system-fold (const #t) (lambda (path stat result) ; leaf - (zero? (apply system* "strip" + (zero? (apply system* strip-command (append strip-flags (list path))))) (const #t) ; down (const #t) ; up diff --git a/guix/build/gnu-cross-build.scm b/guix/build/gnu-cross-build.scm deleted file mode 100644 index dab60684ac..0000000000 --- a/guix/build/gnu-cross-build.scm +++ /dev/null @@ -1,138 +0,0 @@ -;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013 Ludovic Courtès -;;; -;;; This file is part of GNU Guix. -;;; -;;; 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. -;;; -;;; 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 GNU Guix. If not, see . - -(define-module (guix build gnu-cross-build) - #:use-module (guix build utils) - #:use-module ((guix build gnu-build-system) - #:renamer (symbol-prefix-proc 'build:)) - #:use-module (ice-9 ftw) - #:use-module (ice-9 match) - #:use-module (srfi srfi-1) - #:export (%standard-cross-phases - gnu-cross-build)) - -;;; Commentary: -;;; -;;; Extension of `gnu-build-system.scm' to support cross-compilation. -;;; -;;; Code: - -(define* (set-paths #:key inputs native-inputs - (search-paths '()) (native-search-paths '()) - #:allow-other-keys) - (define input-directories - (match inputs - (((_ . dir) ...) - dir))) - - (define native-input-directories - (match native-inputs - (((_ . dir) ...) - dir))) - - ;; $PATH must refer only to native (host) inputs since target inputs are not - ;; executable. - (set-path-environment-variable "PATH" '("bin" "sbin") - native-input-directories) - - ;; Search paths for target inputs. - (for-each (match-lambda - ((env-var (directories ...) separator) - (set-path-environment-variable env-var directories - input-directories - #:separator separator))) - search-paths) - - ;; Search paths for native inputs. - (for-each (match-lambda - ((env-var (directories ...) separator) - (set-path-environment-variable env-var directories - native-input-directories - #:separator separator))) - native-search-paths) - - ;; Dump the environment variables as a shell script, for handy debugging. - (system "export > environment-variables")) - -(define* (configure #:key - inputs outputs (configure-flags '()) out-of-source? - target native-inputs - #:allow-other-keys) - (format #t "configuring for cross-compilation to `~a'~%" target) - (apply (assoc-ref build:%standard-phases 'configure) - #:configure-flags (cons (string-append "--host=" target) - configure-flags) - - ;; XXX: The underlying `configure' phase looks for Bash among - ;; #:inputs, so fool it this way. - #:inputs native-inputs - - #:outputs outputs - #:out-of-source? out-of-source? - '())) - -(define* (strip #:key target outputs (strip-binaries? #t) - (strip-flags '("--strip-debug")) - (strip-directories '("lib" "lib64" "libexec" - "bin" "sbin")) - #:allow-other-keys) - ;; TODO: The only difference with `strip' in gnu-build-system.scm is the - ;; name of the strip command; factorize it. - - (define (strip-dir dir) - (format #t "stripping binaries in ~s with flags ~s~%" - dir strip-flags) - (file-system-fold (const #t) - (lambda (path stat result) ; leaf - (zero? (apply system* - (string-append target "-strip") - (append strip-flags (list path))))) - (const #t) ; down - (const #t) ; up - (const #t) ; skip - (lambda (path stat errno result) - (format (current-error-port) - "strip: failed to access `~a': ~a~%" - path (strerror errno)) - #f) - #t - dir)) - - (or (not strip-binaries?) - (every strip-dir - (append-map (match-lambda - ((_ . dir) - (filter-map (lambda (d) - (let ((sub (string-append dir "/" d))) - (and (directory-exists? sub) sub))) - strip-directories))) - outputs)))) - -(define %standard-cross-phases - ;; The standard phases when cross-building. - (let ((replacements `((set-paths ,set-paths) - (configure ,configure) - (strip ,strip)))) - (fold (lambda (replacement phases) - (match replacement - ((name proc) - (alist-replace name proc phases)))) - (alist-delete 'check build:%standard-phases) - replacements))) - -;;; gnu-cross-build.scm ends here From 4ca968eb954c0a8c166c8cd390024cdafdb9e416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 21 Jun 2013 00:32:07 +0200 Subject: [PATCH 05/43] build-system/gnu: Save `environment-variables' after each phase. * guix/build/gnu-build-system.scm (set-paths): Move `system' call to... (gnu-build): ... here. --- guix/build/gnu-build-system.scm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 4245f2aefd..8ccf27a1b1 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -87,8 +87,7 @@ #:separator separator))) native-search-paths)) - ;; Dump the environment variables as a shell script, for handy debugging. - (system "export > environment-variables")) + #t) (define* (unpack #:key source #:allow-other-keys) (and (zero? (system* "tar" "xvf" source)) @@ -316,10 +315,13 @@ in order. Return #t if all the PHASES succeeded, #f otherwise." (every (match-lambda ((name . proc) (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)))) + (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))) + + ;; Dump the environment variables as a shell script, for handy debugging. + (system "export > $NIX_BUILD_TOP/environment-variables") + result)))) phases)) From 2f41f51c401cc45842218a801891a71a64416ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 22 Jun 2013 16:15:23 +0200 Subject: [PATCH 06/43] build-system/gnu: Set #:tests? to #f when cross-compiling. * guix/build/gnu-build-system.scm (check): Add `target' formal parameter. Change `tests?' to default to (not target). --- 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 8ccf27a1b1..bed498dfef 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -214,8 +214,8 @@ makefiles." '()) ,@make-flags)))) -(define* (check #:key (make-flags '()) (tests? #t) (test-target "check") - (parallel-tests? #t) +(define* (check #:key target (make-flags '()) (tests? (not target)) + (test-target "check") (parallel-tests? #t) #:allow-other-keys) (if tests? (zero? (apply system* "make" test-target From 2a511f7a1a114eeba49273a1c32d80dfff5dee10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 22 Jun 2013 16:27:13 +0200 Subject: [PATCH 07/43] gnu: gzip: Upgrade to 1.6. * gnu/packages/compression.scm (gzip): Upgrade. --- gnu/packages/compression.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index b39119f611..8196d695b3 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -66,14 +66,14 @@ in compression.") (define-public gzip (package (name "gzip") - (version "1.5") + (version "1.6") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gzip/gzip-" version ".tar.gz")) (sha256 (base32 - "18rm80kar7n016g8bsyy1a3zk50i2826xdgs874yh64rzj7nxmdm")))) + "0zlgdm4v3dndrbiz7b67mbbj25dpwqbmbzjiycssvrfrcfvq7swp")))) (build-system gnu-build-system) (synopsis "General file (de)compression (using lzw)") (arguments From d16368cf41f1b685c523de04f86ded11914c218b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 22 Jun 2013 16:29:19 +0200 Subject: [PATCH 08/43] gnu: gawk: Upgrade to 4.1.0. * gnu/packages/gawk.scm (gawk): Update to 4.1.0. Remove wrong-headed comments. --- gnu/packages/gawk.scm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm index 1b19f7bfd2..da570e6617 100644 --- a/gnu/packages/gawk.scm +++ b/gnu/packages/gawk.scm @@ -27,13 +27,13 @@ (define-public gawk (package (name "gawk") - (version "4.0.2") + (version "4.1.0") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gawk/gawk-" version ".tar.xz")) (sha256 - (base32 "04vd0axif762mf781pj3days6ilv2333b9zi9c50y5mma66g5q91")))) + (base32 "0hin2hswbbd6kd6i4zzvgciwpl5fba8d2s524z8y5qagyz3x010q")))) (build-system gnu-build-system) (arguments `(#:parallel-tests? #f ; test suite fails in parallel @@ -45,7 +45,6 @@ 'configure 'set-shell-file-name (lambda* (#:key inputs #:allow-other-keys) ;; Refer to the right shell. - ;; FIXME: Remove `else' arm upon core-updates. (let ((bash (assoc-ref inputs "bash"))) (substitute* "io.c" (("/bin/sh") @@ -53,7 +52,6 @@ %standard-phases))) (inputs `(("libsigsegv" ,libsigsegv) - ;; TODO: On next core-updates, make Bash input unconditional. ,@(if (%current-target-system) `(("bash" ,bash)) '()))) From 8572bf5e0c921dfcd860a220e7646d1b3f4a90da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 22 Jun 2013 16:29:40 +0200 Subject: [PATCH 09/43] gnu: gmp: Upgrade to 5.1.2. * gnu/packages/multiprecision.scm (gmp): Update to 5.1.2. --- gnu/packages/multiprecision.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm index 19c32352b3..46acba3065 100644 --- a/gnu/packages/multiprecision.scm +++ b/gnu/packages/multiprecision.scm @@ -27,7 +27,7 @@ (define-public gmp (package (name "gmp") - (version "5.1.1") + (version "5.1.2") (source (origin (method url-fetch) (uri @@ -35,7 +35,7 @@ version ".tar.xz")) (sha256 (base32 - "1hili06lcf0clg5qfvz7knm6pmj6ab54yhsvskp1mdny5xw4vmjb")))) + "1hnbxz7a6jrli8ph27i8zb6k2f456zn6l5xi78yhskzbxjk47nf7")))) (build-system gnu-build-system) (native-inputs `(("m4" ,m4))) (arguments `(#:configure-flags From ee26820636c2521bb0a15bd960814bafa780635e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 22 Jun 2013 16:32:30 +0200 Subject: [PATCH 10/43] gnu: acl, attr: Make `gettext' a native input. * gnu/packages/acl.scm (acl): Make `gettext' a native input, always. * gnu/packages/attr.scm (attr): Likewise. --- gnu/packages/acl.scm | 9 ++------- gnu/packages/attr.scm | 16 ++++++---------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/gnu/packages/acl.scm b/gnu/packages/acl.scm index b7604dcea6..dde9ac4f34 100644 --- a/gnu/packages/acl.scm +++ b/gnu/packages/acl.scm @@ -60,14 +60,9 @@ ;; Perl is needed to run tests; remove it from cross builds. ,@(if (%current-target-system) '() - `(("gettext" ,guix:gettext) - ("perl" ,perl))))) + `(("perl" ,perl))))) (native-inputs - ;; FIXME: Upon next core-updates, make gettext a native input - ;; unconditionally. - (if (%current-target-system) - `(("gettext" ,guix:gettext)) - '())) + `(("gettext" ,guix:gettext))) (home-page "http://savannah.nongnu.org/projects/acl") diff --git a/gnu/packages/attr.scm b/gnu/packages/attr.scm index 2ce50296ac..3108a9072a 100644 --- a/gnu/packages/attr.scm +++ b/gnu/packages/attr.scm @@ -69,17 +69,13 @@ ;; dependent on the underlying file system. #t) %standard-phases)))))) - (inputs `(;; Perl is needed to run tests; remove it from cross builds. - ,@(if (%current-target-system) - '() - `(("perl" ,perl) - ("gettext" ,guix:gettext))))) - (native-inputs - ;; FIXME: Upon next core-updates, make gettext a native input - ;; unconditionally. + (inputs + ;; Perl is needed to run tests; remove it from cross builds. (if (%current-target-system) - `(("gettext" ,guix:gettext)) - '())) + '() + `(("perl" ,perl)))) + (native-inputs + `(("gettext" ,guix:gettext))) (home-page "http://savannah.nongnu.org/projects/attr/") (synopsis "Library and tools for manipulating extended attributes") From b15669f37daecd9d06e0d4b3c864ecdbb81c9b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 22 Jun 2013 16:42:46 +0200 Subject: [PATCH 11/43] utils: `set-path-environment-variable' calls `unsetenv' for empty values. * guix/build/utils.scm (set-path-environment-variable): When VALUE is the empty string, call `unsetenv' instead of `setenv'. * gnu/packages/guile.scm (guile-2.0)[arguments]: Remove `unsetenv' trick. --- gnu/packages/guile.scm | 11 ----------- guix/build/utils.scm | 14 +++++++++++--- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index c4eca3e350..c78ab57915 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -142,17 +142,6 @@ extensible. It supports many SRFIs.") `(#:phases (alist-cons-before 'configure 'pre-configure (lambda* (#:key inputs #:allow-other-keys) - ;; By default we end up with GUILE_LOAD_PATH="" and - ;; GUILE_LOAD_COMPILED_PATH="". But that is equivalent to - ;; ".", and breaks the build system when cross-compiling. - ;; Thus, make sure they are unset. - ;; TODO: Eventually fix `set-path-environment-variable' - ;; for that case. - ,@(if (%current-target-system) - '((unsetenv "GUILE_LOAD_PATH") - (unsetenv "GUILE_LOAD_COMPILED_PATH")) - '()) - ;; Tell (ice-9 popen) the file name of Bash. (let ((bash (assoc-ref inputs "bash"))) (substitute* "module/ice-9/popen.scm" diff --git a/guix/build/utils.scm b/guix/build/utils.scm index a4a82a5f8c..c0b150e016 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -248,9 +248,17 @@ SEPARATOR-separated path accordingly. Example: " (let* ((path (search-path-as-list sub-directories input-dirs)) (value (list->search-path-as-string path separator))) - (setenv env-var value) - (format #t "environment variable `~a' set to `~a'~%" - env-var value))) + (if (string-null? value) + (begin + ;; Never set ENV-VAR to an empty string because often, the empty + ;; string is equivalent to ".". This is the case for + ;; GUILE_LOAD_PATH in Guile 2.0, for instance. + (unsetenv env-var) + (format #t "environment variable `~a' unset~%" env-var)) + (begin + (setenv env-var value) + (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 From a62b83d52fb154e6d1073ab3620daa48e101f933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 22 Jun 2013 16:47:09 +0200 Subject: [PATCH 12/43] gnu: libffi: Upgrade to 3.0.13. * gnu/packages/libffi.scm (libffi): Upgrade to 3.0.13. --- gnu/packages/libffi.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm index fdebab7433..0707bf8a7e 100644 --- a/gnu/packages/libffi.scm +++ b/gnu/packages/libffi.scm @@ -29,7 +29,7 @@ (define out (assoc-ref outputs "out")) (mkdir (string-append out "/include")) (with-directory-excursion - (string-append out "/lib/libffi-3.0.9/include") + (string-append out "/lib/libffi-3.0.13/include") (for-each (lambda (h) (format #t "moving `~a' to includedir~%" h) (rename-file h (string-append out "/include/" h))) @@ -38,7 +38,7 @@ (not (member x '("." "..")))))))))) (package (name "libffi") - (version "3.0.9") + (version "3.0.13") (source (origin (method url-fetch) (uri @@ -46,7 +46,7 @@ name "-" version ".tar.gz")) (sha256 (base32 - "0ln4jbpb6clcsdpb9niqk0frgx4k0xki96wiv067ig0q4cajb7aq")))) + "077ibkf84bvcd6rw1m6jb107br63i2pp301rkmsbgg6300adxp8x")))) (build-system gnu-build-system) (arguments `(#:modules ((guix build utils) (guix build gnu-build-system) (ice-9 ftw) (srfi srfi-26)) From f7c3429073fb0d32ccd124b7a35828c5e2d52b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 24 Jun 2013 23:26:50 +0200 Subject: [PATCH 13/43] build-system/gnu: Disable test suite when cross building. * guix/build-system/gnu.scm (gnu-cross-build): Change #:tests? to default to #f. --- guix/build-system/gnu.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index b72239d13e..78e8bf0652 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -332,7 +332,7 @@ inputs." (make-flags ''()) (patches ''()) (patch-flags ''("--batch" "-p1")) (out-of-source? #f) - (tests? #t) + (tests? #f) ; nothing can be done (test-target "check") (parallel-build? #t) (parallel-tests? #t) (patch-shebangs? #t) From 1e4310f1f269d26f7129e1bae167c8d8b096ea10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 25 Jun 2013 00:00:09 +0200 Subject: [PATCH 14/43] gnu: gawk: Allow cross-compilation. * gnu/packages/gawk.scm (gawk)[arguments]: Annihilate the `check-for-shared-lib-support' target when cross-compiling. --- gnu/packages/gawk.scm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm index da570e6617..aff856d9f3 100644 --- a/gnu/packages/gawk.scm +++ b/gnu/packages/gawk.scm @@ -38,9 +38,6 @@ (arguments `(#:parallel-tests? #f ; test suite fails in parallel - ;; Work around test failure on Cygwin. - #:tests? ,(not (string=? (%current-system) "i686-cygwin")) - #:phases (alist-cons-before 'configure 'set-shell-file-name (lambda* (#:key inputs #:allow-other-keys) @@ -48,7 +45,16 @@ (let ((bash (assoc-ref inputs "bash"))) (substitute* "io.c" (("/bin/sh") - (string-append bash "/bin/bash"))))) + (string-append bash "/bin/bash"))) + + ;; When cross-compiling, remove dependencies on the + ;; `check-for-shared-lib-support' target, which tries to + ;; run the cross-built `gawk'. + ,@(if (%current-target-system) + '((substitute* "extension/Makefile.in" + (("^.*: check-for-shared-lib-support" match) + (string-append "### " match)))) + '()))) %standard-phases))) (inputs `(("libsigsegv" ,libsigsegv) From ac5c1cec868b3a3a0f7bc4b06f101c9913361130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 25 Jun 2013 00:06:31 +0200 Subject: [PATCH 15/43] build-system/trivial: Don't bind `%target' in the builder. * guix/build-system/trivial.scm (trivial-cross-build): Don't bind `%target' here since this causes problem when BUILDER contains (use-modules ...) clauses, and can be achieved differently anyway. --- guix/build-system/trivial.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guix/build-system/trivial.scm b/guix/build-system/trivial.scm index 85a3c697e3..3c5031c4bd 100644 --- a/guix/build-system/trivial.scm +++ b/guix/build-system/trivial.scm @@ -53,8 +53,7 @@ ignored." outputs guile system builder (modules '()) search-paths native-search-paths) "Like `trivial-build', but in a cross-compilation context." - (build-expression->derivation store name system - `(let ((%target ,target)) ,builder) + (build-expression->derivation store name system builder (append native-inputs inputs) #:outputs outputs #:modules modules From 7e873a6708779481e2c2baa82ddbd8fcf232db5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 25 Jun 2013 20:54:56 +0200 Subject: [PATCH 16/43] build-system/gnu: Augment `package-with-explicit-inputs' for cross builds. * guix/build-system/gnu.scm (package-with-explicit-inputs): Add `native-inputs' keyword parameter. Allow INPUTS and NATIVE-INPUTS to be thunks. --- guix/build-system/gnu.scm | 80 ++++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 31 deletions(-) diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index 78e8bf0652..434a6dd5e0 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -41,42 +41,60 @@ ;; ;; Code: -(define* (package-with-explicit-inputs p boot-inputs +(define* (package-with-explicit-inputs p inputs #:optional (loc (current-source-location)) - #:key guile) - "Rewrite P, which is assumed to use GNU-BUILD-SYSTEM, to take -BOOT-INPUTS as explicit inputs instead of the implicit default, and -return it. Use GUILE to run the builder, or the distro's final Guile -when GUILE is #f." - (define rewritten-input - (match-lambda - ((name (? package? p) sub-drv ...) - (cons* name - (package-with-explicit-inputs p boot-inputs #:guile guile) - sub-drv)) - (x x))) + #:key (native-inputs '()) + guile) + "Rewrite P, which is assumed to use GNU-BUILD-SYSTEM, to take INPUTS and +NATIVE-INPUTS as explicit inputs instead of the implicit default, and return +it. INPUTS and NATIVE-INPUTS can be either input lists or thunks; in the +latter case, they will be called in a context where the `%current-system' and +`%current-target-system' are suitably parametrized. Use GUILE to run the +builder, or the distro's final Guile when GUILE is #f." + (define inputs* inputs) + (define native-inputs* native-inputs) - (define boot-input-names - (map car boot-inputs)) + (define (call inputs) + (if (procedure? inputs) + (inputs) + inputs)) - (define (filtered-inputs inputs) - (fold alist-delete inputs boot-input-names)) + (define (duplicate-filter inputs) + (let ((names (match (call inputs) + (((name _ ...) ...) + name)))) + (lambda (inputs) + (fold alist-delete inputs names)))) - (package (inherit p) - (location (if (pair? loc) (source-properties->location loc) loc)) - (arguments - (let ((args (package-arguments p))) - `(#:guile ,guile - #:implicit-inputs? #f ,@args))) - (native-inputs (map rewritten-input - (filtered-inputs (package-native-inputs p)))) - (propagated-inputs (map rewritten-input - (filtered-inputs - (package-propagated-inputs p)))) - (inputs `(,@boot-inputs - ,@(map rewritten-input - (filtered-inputs (package-inputs p))))))) + (let loop ((p p)) + (define rewritten-input + (memoize + (match-lambda + ((name (? package? p) sub-drv ...) + (cons* name (loop p) sub-drv)) + (x x)))) + + (package (inherit p) + (location (if (pair? loc) (source-properties->location loc) loc)) + (arguments + (let ((args (package-arguments p))) + `(#:guile ,guile + #:implicit-inputs? #f + ,@args))) + (native-inputs + (let ((filtered (duplicate-filter native-inputs*))) + `(,@(call native-inputs*) + ,@(map rewritten-input + (filtered (package-native-inputs p)))))) + (propagated-inputs + (map rewritten-input + (package-propagated-inputs p))) + (inputs + (let ((filtered (duplicate-filter inputs*))) + `(,@(call inputs*) + ,@(map rewritten-input + (filtered (package-inputs p))))))))) (define (package-with-extra-configure-variable p variable value) "Return a version of P with VARIABLE=VALUE specified as an extra `configure' From 0de71c233cb1d4fdea1d41bfe8a39be778502d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 25 Jun 2013 20:57:14 +0200 Subject: [PATCH 17/43] gnu: cross-base: Make the cross tools native inputs. * gnu/packages/cross-base.scm (cross-gcc): Change `inputs' to `native-inputs', and set `inputs' to the empty list. (cross-libc): Likewise. --- gnu/packages/cross-base.scm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 5c46d00b20..4cfbbba234 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -175,7 +175,8 @@ GCC that does not target a libc; otherwise, target that libc." ;; ;; for instance. #f)))) - (inputs + + (native-inputs `(("patch/cross-env-vars" ,(search-patch "gcc-cross-environment-variables.patch")) @@ -193,6 +194,8 @@ GCC that does not target a libc; otherwise, target that libc." ,@inputs) inputs)))) + (inputs '()) + ;; Only search target inputs, not host inputs. (search-paths (list (search-path-specification @@ -225,9 +228,9 @@ XBINUTILS and the cross tool chain." (and (zero? (system* "make" "defconfig")) (zero? (system* "make" "mrproper" "headers_check")))) ,phases)))) - (inputs `(("cross-gcc" ,xgcc) - ("cross-binutils" ,xbinutils) - ,@(package-inputs linux-libre-headers))))) + (native-inputs `(("cross-gcc" ,xgcc) + ("cross-binutils" ,xbinutils) + ,@(package-native-inputs linux-libre-headers))))) (package (inherit glibc) (name (string-append "glibc-cross-" target)) @@ -248,9 +251,9 @@ XBINUTILS and the cross tool chain." #t)) ,phases)))) (propagated-inputs `(("cross-linux-headers" ,xlinux-headers))) - (inputs `(("cross-gcc" ,xgcc) - ("cross-binutils" ,xbinutils) - ,@(package-inputs glibc))))) + (native-inputs `(("cross-gcc" ,xgcc) + ("cross-binutils" ,xbinutils) + ,@(package-native-inputs glibc))))) ;;; From a3cff41dd1fbc1c860d9984c8e5666d02e0f07de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 25 Jun 2013 23:04:32 +0200 Subject: [PATCH 18/43] build-system/gnu: `package-with-explicit-inputs' skips non-GBS packages. * guix/build-system/gnu.scm (package-with-explicit-inputs)[rewritten-input]: Leave P unchanged if its build system is not GNU-BUILD-SYSTEM. --- guix/build-system/gnu.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index 434a6dd5e0..d074294b4c 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -72,7 +72,11 @@ builder, or the distro's final Guile when GUILE is #f." (memoize (match-lambda ((name (? package? p) sub-drv ...) - (cons* name (loop p) sub-drv)) + ;; XXX: Check whether P's build system knows #:implicit-inputs, for + ;; things like `cross-pkg-config'. + (if (eq? (package-build-system p) gnu-build-system) + (cons* name (loop p) sub-drv) + (cons* name p sub-drv))) (x x)))) (package (inherit p) From a410a0105d9517ccc0982b396588835899f6fc3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 25 Jun 2013 23:39:14 +0200 Subject: [PATCH 19/43] gnu: make-bootstrap: Allow cross-compilation of the bootstrap tarballs. * gnu/packages/make-bootstrap.scm (package-with-relocatable-glibc): Turn `inputs' into a thunk. Add `native-inputs', and pass it to `package-with-explicit-inputs'. (%static-inputs): Add %BASH-STATIC as an input to gawk when cross building. (%glibc-stripped): When cross compiling, use (glibc-for-bootstrap (cross-libc)) as the basis. (%gcc-static): Base on GCC-4.7, not GCC-FINAL. (tarball-package): TAR and XZ are native inputs. Choose the tarball file name based on (%current-target-system) too. --- gnu/packages/make-bootstrap.scm | 185 +++++++++++++++++++------------- 1 file changed, 108 insertions(+), 77 deletions(-) diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index c8de969b1a..13f858adc6 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -24,6 +24,7 @@ #:use-module (guix build-system gnu) #:use-module ((gnu packages) #:select (search-patch)) #:use-module (gnu packages base) + #:use-module (gnu packages cross-base) #:use-module (gnu packages bash) #:use-module (gnu packages compression) #:use-module (gnu packages gawk) @@ -49,20 +50,20 @@ ;;; ;;; Code: -(define* (glibc-for-bootstrap #:optional (base glibc-final)) +(define* (glibc-for-bootstrap #:optional (base glibc)) "Return a libc deriving from BASE whose `system' and `popen' functions looks for `sh' in $PATH, and without nscd, and with static NSS modules." (package (inherit base) (arguments (substitute-keyword-arguments (package-arguments base) ((#:patches patches) - `(cons (assoc-ref %build-inputs "patch/system") ,patches)) + `(cons (assoc-ref %build-inputs "patch/system") ,patches)) ((#:configure-flags flags) - ;; Arrange so that getaddrinfo & co. do not contact the nscd, - ;; and can use statically-linked NSS modules. - `(cons* "--disable-nscd" "--disable-build-nscd" - "--enable-static-nss" - ,flags)))) + ;; 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 base))))) @@ -71,17 +72,39 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." "Return a variant of P that uses the libc as defined by `glibc-for-bootstrap'." - (define inputs - `(("libc", (glibc-for-bootstrap)) - ("gcc" ,(package-with-explicit-inputs - gcc-4.7 - `(("libc",(glibc-for-bootstrap)) - ,@(alist-delete "libc" %final-inputs)) - (current-source-location))) - ,@(fold alist-delete %final-inputs '("libc" "gcc")))) + (define (cross-bootstrap-libc) + (let ((target (%current-target-system))) + (glibc-for-bootstrap + ;; `cross-libc' already returns a cross libc, so clear + ;; %CURRENT-TARGET-SYSTEM. + (parameterize ((%current-target-system #f)) + (cross-libc target))))) + + ;; Standard inputs with the above libc and corresponding GCC. + + (define (inputs) + (if (%current-target-system) ; is this package cross built? + `(("cross-libc" ,(cross-bootstrap-libc))) + '())) + + (define (native-inputs) + (if (%current-target-system) + (let ((target (%current-target-system))) + `(("cross-gcc" ,(cross-gcc target + (cross-binutils target) + (cross-bootstrap-libc))) + ("cross-binutils" ,(cross-binutils target)) + ,@%final-inputs)) + `(("libc" ,(glibc-for-bootstrap)) + ("gcc" ,(package (inherit gcc-4.7) + (inputs + `(("libc",(glibc-for-bootstrap)) + ,@(package-inputs gcc-4.7))))) + ,@(fold alist-delete %final-inputs '("libc" "gcc"))))) (package-with-explicit-inputs p inputs - (current-source-location))) + (current-source-location) + #:native-inputs native-inputs)) (define %bash-static (static-package bash-light)) @@ -140,9 +163,12 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (substitute* "configure" (("-export-dynamic") ""))) ,phases))))) - (inputs `(("patch/sh" ,(search-patch "gawk-shell.patch")))))) - (finalize (compose static-package - package-with-relocatable-glibc))) + (inputs `(("patch/sh" ,(search-patch "gawk-shell.patch")) + ,@(if (%current-target-system) + `(("bash" ,%bash-static)) + '()))))) + (finalize (compose static-package + package-with-relocatable-glibc))) `(,@(map (match-lambda ((name package) (list name (finalize package)))) @@ -155,12 +181,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ("sed" ,sed) ("grep" ,grep) ("gawk" ,gawk))) - ("bash" ,%bash-static) - ;; ("ld-wrapper" ,ld-wrapper) - ;; ("binutils" ,binutils-final) - ;; ("gcc" ,gcc-final) - ;; ("libc" ,glibc-final) - ))) + ("bash" ,%bash-static)))) (define %static-binaries (package @@ -330,7 +351,12 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (copy-recursively (string-append linux "/include/asm-generic") (string-append incdir "/asm-generic")) #t)))) - (inputs `(("libc" ,glibc) + (inputs `(("libc" ,(let ((target (%current-target-system))) + (if target + (glibc-for-bootstrap + (parameterize ((%current-target-system #f)) + (cross-libc target))) + glibc))) ("linux-headers" ,linux-libre-headers))) ;; Only one output. @@ -339,7 +365,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (define %gcc-static ;; A statically-linked GCC, with stripped-down functionality. (package-with-relocatable-glibc - (package (inherit gcc-final) + (package (inherit gcc-4.7) (name "gcc-static") (arguments `(#:modules ((guix build utils) @@ -347,7 +373,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (srfi srfi-1) (srfi srfi-26) (ice-9 regex)) - ,@(substitute-keyword-arguments (package-arguments gcc-final) + ,@(substitute-keyword-arguments (package-arguments gcc-4.7) ((#:guile _) #f) ((#:implicit-inputs? _) #t) ((#:configure-flags flags) @@ -365,10 +391,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ((#: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)))))) + ("mpfr-source" ,(package-source mpfr)) + ("mpc-source" ,(package-source mpc)) + ("binutils" ,binutils) + ,@(package-inputs gcc-4.7)))))) (define %gcc-stripped ;; The subset of GCC files needed for bootstrap. @@ -411,51 +437,54 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ;; .scm and .go files relative to its installation directory, rather ;; than in hard-coded configure-time paths. (let* ((guile (package (inherit guile-2.0) - (name (string-append (package-name guile-2.0) "-static")) - (inputs - `(("patch/relocatable" - ,(search-patch "guile-relocatable.patch")) - ("patch/utf8" - ,(search-patch "guile-default-utf8.patch")) - ("patch/syscalls" - ,(search-patch "guile-linux-syscalls.patch")) - ,@(package-inputs guile-2.0))) - (propagated-inputs - `(("bdw-gc" ,libgc) - ,@(alist-delete "bdw-gc" - (package-propagated-inputs guile-2.0)))) - (arguments - `(;; When `configure' checks for ltdl availability, it - ;; doesn't try to link using libtool, and thus fails - ;; because of a missing -ldl. Work around that. - #:configure-flags '("LDFLAGS=-ldl") + (name (string-append (package-name guile-2.0) "-static")) + (inputs + `(("patch/relocatable" + ,(search-patch "guile-relocatable.patch")) + ("patch/utf8" + ,(search-patch "guile-default-utf8.patch")) + ("patch/syscalls" + ,(search-patch "guile-linux-syscalls.patch")) + ,@(package-inputs guile-2.0))) + (propagated-inputs + `(("bdw-gc" ,libgc) + ,@(alist-delete "bdw-gc" + (package-propagated-inputs guile-2.0)))) + (arguments + `(;; When `configure' checks for ltdl availability, it + ;; doesn't try to link using libtool, and thus fails + ;; because of a missing -ldl. Work around that. + #:configure-flags '("LDFLAGS=-ldl" + ,@(if (%current-target-system) + '("CC_FOR_BUILD=gcc") + '())) - #:phases (alist-cons-before - 'configure 'static-guile - (lambda _ - (substitute* "libguile/Makefile.in" - ;; Create a statically-linked `guile' - ;; executable. - (("^guile_LDFLAGS =") - "guile_LDFLAGS = -all-static") + #:phases (alist-cons-before + 'configure 'static-guile + (lambda _ + (substitute* "libguile/Makefile.in" + ;; Create a statically-linked `guile' + ;; executable. + (("^guile_LDFLAGS =") + "guile_LDFLAGS = -all-static") - ;; Add `-ldl' *after* libguile-2.0.la. - (("^guile_LDADD =(.*)$" _ ldadd) - (string-append "guile_LDADD = " - (string-trim-right ldadd) - " -ldl\n")))) - %standard-phases) + ;; Add `-ldl' *after* libguile-2.0.la. + (("^guile_LDADD =(.*)$" _ ldadd) + (string-append "guile_LDADD = " + (string-trim-right ldadd) + " -ldl\n")))) + %standard-phases) - ;; Allow Guile to be relocated, as is needed during - ;; bootstrap. - #:patches - (list (assoc-ref %build-inputs "patch/relocatable") - (assoc-ref %build-inputs "patch/utf8") - (assoc-ref %build-inputs "patch/syscalls")) + ;; Allow Guile to be relocated, as is needed during + ;; bootstrap. + #:patches + (list (assoc-ref %build-inputs "patch/relocatable") + (assoc-ref %build-inputs "patch/utf8") + (assoc-ref %build-inputs "patch/syscalls")) - ;; There are uses of `dynamic-link' in - ;; {foreign,coverage}.test that don't fly here. - #:tests? #f))))) + ;; There are uses of `dynamic-link' in + ;; {foreign,coverage}.test that don't fly here. + #:tests? #f))))) (package-with-relocatable-glibc (static-package guile)))) (define %guile-static-stripped @@ -492,9 +521,9 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (location (source-properties->location (current-source-location))) (name (string-append (package-name pkg) "-tarball")) (build-system trivial-build-system) - (inputs `(("tar" ,tar) - ("xz" ,xz) - ("input" ,pkg))) + (native-inputs `(("tar" ,tar) + ("xz" ,xz))) + (inputs `(("input" ,pkg))) (arguments (let ((name (package-name pkg)) (version (package-version pkg))) @@ -512,7 +541,9 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (zero? (system* "tar" "cJvf" (string-append out "/" ,name "-" ,version - "-" ,(%current-system) + "-" + ,(or (%current-target-system) + (%current-system)) ".tar.xz") ".")))))))))) From 9306d350b2ab911cdebf82cf79c23df2c57b2a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 25 Jun 2013 23:45:34 +0200 Subject: [PATCH 20/43] build: Build the bootstrap tarballs on Hydra. * build-aux/hydra/gnu-system.scm (%packages-to-cross-build): Uncomment the bootstrap tarball packages. --- build-aux/hydra/gnu-system.scm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build-aux/hydra/gnu-system.scm b/build-aux/hydra/gnu-system.scm index f03c201223..2fffe25009 100644 --- a/build-aux/hydra/gnu-system.scm +++ b/build-aux/hydra/gnu-system.scm @@ -79,12 +79,11 @@ SYSTEM." (define %packages-to-cross-build (list gmp mpfr mpc coreutils findutils diffutils patch sed grep gawk gettext hello guile-2.0 - ;; %bootstrap-binaries-tarball - ;; %binutils-bootstrap-tarball - ;; %glibc-bootstrap-tarball - ;; %gcc-bootstrap-tarball - ;; %guile-bootstrap-tarball - )) + %bootstrap-binaries-tarball + %binutils-bootstrap-tarball + %glibc-bootstrap-tarball + %gcc-bootstrap-tarball + %guile-bootstrap-tarball)) (define %cross-targets '("mips64el-linux-gnu")) From c8fa51f2d6dd8ab9157f8c87b909f73b956371d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 26 Jun 2013 14:31:24 +0200 Subject: [PATCH 21/43] gnu: cross-base: Build Binutils with `--with-sysroot=/'. * gnu/packages/cross-base.scm (cross-binutils): Use `--with-sysroot=/'. --- gnu/packages/cross-base.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 4cfbbba234..e6a8a1b550 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -56,8 +56,13 @@ ;; library. This works because as a side effect ;; `genscripts.sh' sets `USE_LIBPATH=yes', which tells ;; elf32.em to use DT_RUNPATH in its search list. - `(cons "--with-sysroot=/no-such-path" - ,flags))))))) + ;; See . + ;; + ;; In theory choosing / as the sysroot could lead ld + ;; to pick up native libs instead of target ones. In + ;; practice the RUNPATH of target libs only refers to + ;; target libs, not native libs, so this is safe. + `(cons "--with-sysroot=/" ,flags))))))) (cross binutils target))) (define* (cross-gcc target From e7133c76802991f8da2afd87eed598f5ca00a082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 26 Jun 2013 16:27:51 +0200 Subject: [PATCH 22/43] gnu: cross-base: Make `glibc-dynamic-linker' do the right thing. * gnu/packages/bootstrap.scm (glibc-dynamic-linker): Determine SYSTEM based on (%current-target-system) when it's true. * gnu/packages/cross-base.scm (cross-gcc): Directly call (package-arguments gcc-4.7) from the body of `arguments'. --- gnu/packages/bootstrap.scm | 5 ++++- gnu/packages/cross-base.scm | 8 +------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index eaad45a741..86723a9591 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -131,7 +131,10 @@ check whether everything is alright." (propagated-inputs (map rewritten-input (package-propagated-inputs p))))))) -(define* (glibc-dynamic-linker #:optional (system (%current-system))) +(define* (glibc-dynamic-linker + #:optional (system (or (and=> (%current-target-system) + gnu-triplet->nix-system) + (%current-system)))) "Return the name of Glibc's dynamic linker for SYSTEM." (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2") ((string=? system "i686-linux") "/lib/ld-linux.so.2") diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index e6a8a1b550..68c321ee89 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -70,12 +70,6 @@ "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a GCC that does not target a libc; otherwise, target that libc." - (define args - ;; Get the arguments as if we were building for TARGET. In particular, we - ;; want `glibc-dynamic-linker' to return the right thing. - (parameterize ((%current-system (gnu-triplet->nix-system target))) - (package-arguments gcc-4.7))) - (package (inherit gcc-4.7) (name (string-append "gcc-cross-" (if libc "" "sans-libc-") @@ -89,7 +83,7 @@ GCC that does not target a libc; otherwise, target that libc." (srfi srfi-26)) #:patches (list (assoc-ref %build-inputs "patch/cross-env-vars")) - ,@(substitute-keyword-arguments args + ,@(substitute-keyword-arguments (package-arguments gcc-4.7) ((#:configure-flags flags) `(append (list ,(string-append "--target=" target) ,@(if libc From de1d41f9807dec9cc8a151af60e4949aa62b25d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 26 Jun 2013 16:51:39 +0200 Subject: [PATCH 23/43] gnu: gcc: Allow cross-compilation of GCC itself. * gnu/packages/gcc.scm (gcc-4.7): Define `CC_FOR_TARGET', `AR_FOR_TARGET', etc. when cross-compiling. --- gnu/packages/gcc.scm | 235 +++++++++++++++++++++++-------------------- 1 file changed, 128 insertions(+), 107 deletions(-) diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index d239b5a9ab..b297ef1fb1 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -32,129 +32,150 @@ "ftp://gcc.gnu.org/pub/gcc/infrastructure/") (define-public gcc-4.7 - (let ((stripped? #t)) ; TODO: make this a parameter + (let* ((stripped? #t) ; TODO: make this a parameter + (maybe-target-tools + (lambda () + ;; Return the `_FOR_TARGET' variables that are needed when + ;; cross-compiling GCC. + (let ((target (%current-target-system))) + (if target + (map (lambda (var tool) + (string-append (string-append var "_FOR_TARGET") + "=" target "-" tool)) + '("CC" "CXX" "LD" "AR" "NM" "RANLIB" "STRIP") + '("gcc" "g++" "ld" "ar" "nm" "ranlib" "strip")) + '())))) + (configure-flags + (lambda () + ;; This is terrible. Since we have two levels of quasiquotation, + ;; we have to do this convoluted thing just so we can insert the + ;; contents of (maybe-target-tools). + (list 'quasiquote + (append + '("--enable-plugin" + "--enable-languages=c,c++" + "--disable-multilib" + + "--with-local-prefix=/no-gcc-local-prefix" + + ,(let ((libc (assoc-ref %build-inputs "libc"))) + (if libc + (string-append "--with-native-system-header-dir=" libc + "/include") + "--without-headers"))) + + (maybe-target-tools)))))) (package - (name "gcc") - (version "4.7.3") - (source (origin - (method url-fetch) - (uri (string-append "mirror://gnu/gcc/gcc-" - version "/gcc-" version ".tar.bz2")) - (sha256 - (base32 - "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g")))) - (build-system gnu-build-system) - (inputs `(("gmp" ,gmp) - ("mpfr" ,mpfr) - ("mpc" ,mpc) - ("isl" ,isl) - ("cloog" ,cloog) - ("libelf" ,libelf) - ("zlib" ,zlib))) - (arguments - `(#:out-of-source? #t - #:strip-binaries? ,stripped? - #:configure-flags - `("--enable-plugin" - "--enable-languages=c,c++" - "--disable-multilib" + (name "gcc") + (version "4.7.3") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/gcc/gcc-" + version "/gcc-" version ".tar.bz2")) + (sha256 + (base32 + "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g")))) + (build-system gnu-build-system) + (inputs `(("gmp" ,gmp) + ("mpfr" ,mpfr) + ("mpc" ,mpc) + ("isl" ,isl) + ("cloog" ,cloog) + ("libelf" ,libelf) + ("zlib" ,zlib))) + (arguments + `(#:out-of-source? #t + #:strip-binaries? ,stripped? + #:configure-flags ,(configure-flags) + #:make-flags + (let ((libc (assoc-ref %build-inputs "libc"))) + `(,@(if libc + (list (string-append "LDFLAGS_FOR_TARGET=" + "-B" libc "/lib " + "-Wl,-dynamic-linker " + "-Wl," libc + ,(glibc-dynamic-linker))) + '()) + ,(string-append "BOOT_CFLAGS=-O2 " + ,(if stripped? "-g0" "-g")))) - "--with-local-prefix=/no-gcc-local-prefix" + #:tests? #f + #:phases + (alist-cons-before + 'configure 'pre-configure + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (libc (assoc-ref inputs "libc"))) + (when libc + ;; The following is not performed for `--without-headers' + ;; cross-compiler builds. - ,(let ((libc (assoc-ref %build-inputs "libc"))) - (if libc - (string-append "--with-native-system-header-dir=" libc - "/include") - "--without-headers"))) - #:make-flags - (let ((libc (assoc-ref %build-inputs "libc"))) - `(,@(if libc - (list (string-append "LDFLAGS_FOR_TARGET=" - "-B" libc "/lib " - "-Wl,-dynamic-linker " - "-Wl," libc - ,(glibc-dynamic-linker))) - '()) - ,(string-append "BOOT_CFLAGS=-O2 " - ,(if stripped? "-g0" "-g")))) + ;; Fix the dynamic linker's file name. + (substitute* (find-files "gcc/config" + "^linux(64|-elf)?\\.h$") + (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix) + (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%" + suffix + (string-append libc ,(glibc-dynamic-linker))))) - #:tests? #f - #:phases - (alist-cons-before - 'configure 'pre-configure - (lambda* (#:key inputs outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out")) - (libc (assoc-ref inputs "libc"))) - (when libc - ;; The following is not performed for `--without-headers' - ;; cross-compiler builds. - - ;; Fix the dynamic linker's file name. - (substitute* (find-files "gcc/config" - "^linux(64|-elf)?\\.h$") - (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix) - (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%" - suffix - (string-append libc ,(glibc-dynamic-linker))))) - - ;; Tell where to find libstdc++, libc, and `?crt*.o', except - ;; `crt{begin,end}.o', which come with GCC. - (substitute* (find-files "gcc/config" - "^(gnu-user(64)?|linux-elf)\\.h$") - (("#define LIB_SPEC (.*)$" _ suffix) - ;; Note that with this "lib" spec, we may still add a - ;; RUNPATH to GCC even when `libgcc_s' is not NEEDED. - ;; There's not much that can be done to avoid it, though. - (format #f "#define LIB_SPEC \"-L~a/lib %{!static:-rpath=~a/lib \ + ;; Tell where to find libstdc++, libc, and `?crt*.o', except + ;; `crt{begin,end}.o', which come with GCC. + (substitute* (find-files "gcc/config" + "^(gnu-user(64)?|linux-elf)\\.h$") + (("#define LIB_SPEC (.*)$" _ suffix) + ;; Note that with this "lib" spec, we may still add a + ;; RUNPATH to GCC even when `libgcc_s' is not NEEDED. + ;; There's not much that can be done to avoid it, though. + (format #f "#define LIB_SPEC \"-L~a/lib %{!static:-rpath=~a/lib \ %{!static-libgcc:-rpath=~a/lib64 -rpath=~a/lib}} \" ~a" - libc libc out out suffix)) - (("#define STARTFILE_SPEC.*$" line) - (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\" + libc libc out out suffix)) + (("#define STARTFILE_SPEC.*$" line) + (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\" #define STANDARD_STARTFILE_PREFIX_2 \"\" ~a~%" - libc line)))) + libc line)))) - ;; Don't retain a dependency on the build-time sed. - (substitute* "fixincludes/fixincl.x" - (("static char const sed_cmd_z\\[\\] =.*;") - "static char const sed_cmd_z[] = \"sed\";")))) + ;; Don't retain a dependency on the build-time sed. + (substitute* "fixincludes/fixincl.x" + (("static char const sed_cmd_z\\[\\] =.*;") + "static char const sed_cmd_z[] = \"sed\";")))) - (alist-cons-after - 'configure 'post-configure - (lambda _ - ;; Don't store configure flags, to avoid retaining references to - ;; build-time dependencies---e.g., `--with-ppl=/nix/store/xxx'. - (substitute* "Makefile" - (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest) - "TOPLEVEL_CONFIGURE_ARGUMENTS=\n"))) - (alist-replace 'install - (lambda* (#:key outputs #:allow-other-keys) - (zero? - (system* "make" - ,(if stripped? - "install-strip" - "install")))) - %standard-phases))))) + (alist-cons-after + 'configure 'post-configure + (lambda _ + ;; Don't store configure flags, to avoid retaining references to + ;; build-time dependencies---e.g., `--with-ppl=/nix/store/xxx'. + (substitute* "Makefile" + (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest) + "TOPLEVEL_CONFIGURE_ARGUMENTS=\n"))) + (alist-replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (zero? + (system* "make" + ,(if stripped? + "install-strip" + "install")))) + %standard-phases))))) - (native-search-paths - (list (search-path-specification - (variable "CPATH") - (directories '("include"))) - (search-path-specification - (variable "LIBRARY_PATH") - (directories '("lib" "lib64"))))) + (native-search-paths + (list (search-path-specification + (variable "CPATH") + (directories '("include"))) + (search-path-specification + (variable "LIBRARY_PATH") + (directories '("lib" "lib64"))))) - (properties `((gcc-libc . ,(assoc-ref inputs "libc")))) - (synopsis "GNU Compiler Collection") - (description - "The GNU Compiler Collection includes compiler front ends for C, C++, + (properties `((gcc-libc . ,(assoc-ref inputs "libc")))) + (synopsis "GNU Compiler Collection") + (description + "The GNU Compiler Collection includes compiler front ends for C, C++, Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well as libraries for these languages (libstdc++, libgcj, libgomp,...). GCC development is a part of the GNU Project, aiming to improve the compiler used in the GNU system including the GNU/Linux variant.") - (license gpl3+) - (home-page "http://gcc.gnu.org/")))) + (license gpl3+) + (home-page "http://gcc.gnu.org/")))) (define-public gcc-4.8 ;; FIXME: Move to gcc.scm when Binutils is updated. From 11acdf1747a18fe11ccbabb78b5b14884164ee39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 26 Jun 2013 17:01:10 +0200 Subject: [PATCH 24/43] gnu: make-bootstrap: Have %gcc-static actually static when cross building. * gnu/packages/make-bootstrap.scm (%gcc-static): Pass `-static' through `LDFLAGS' when cross-compiling. --- gnu/packages/make-bootstrap.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 13f858adc6..853dc8e59d 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -389,7 +389,9 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (remove (cut string-match "--(.*plugin|enable-languages)" <>) ,flags))) ((#:make-flags flags) - `(cons "BOOT_LDFLAGS=-static" ,flags))))) + (if (%current-target-system) + `(cons "LDFLAGS=-static" ,flags) + `(cons "BOOT_LDFLAGS=-static" ,flags)))))) (inputs `(("gmp-source" ,(package-source gmp)) ("mpfr-source" ,(package-source mpfr)) ("mpc-source" ,(package-source mpc)) From 5708485357ef0e55f5148347958c4fe9a860453e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 26 Jun 2013 17:23:56 +0200 Subject: [PATCH 25/43] gnu: make-bootstrap: Fix cross compilation of binutils-static. * gnu/packages/make-bootstrap.scm (%binutils-static): Inherit configure flags from BINUTILS. --- gnu/packages/make-bootstrap.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 853dc8e59d..f4d29bdf96 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -260,7 +260,11 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (package (inherit binutils) (name "binutils-static") (arguments - `(#:configure-flags '("--disable-gold" "--with-lib-path=/no-ld-lib-path") + `(#:configure-flags (cons "--disable-gold" + ,(match (memq #:configure-flags + (package-arguments binutils)) + ((#:configure-flags flags _ ...) + flags))) #:strip-flags '("--strip-all") #:phases (alist-cons-before 'configure 'all-static From beda99e882e6049f4bf426551d0fd8a2cc7127e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 26 Jun 2013 22:37:38 +0200 Subject: [PATCH 26/43] gnu: cross-base: Add support for `mips64el-linux-gnu-gnuabi64' (N64 ABI). * gnu/packages/cross-base.scm (gcc-configure-flags-for-triplet): New procedure. (cross-gcc): Use it. (xgcc-mips64el): Use *-gnuabi64 instead of the N32 ABI. --- gnu/packages/cross-base.scm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 68c321ee89..5edc1b52e3 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -30,6 +30,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 match) + #:use-module (ice-9 regex) #:export (cross-binutils cross-libc cross-gcc)) @@ -65,6 +66,20 @@ `(cons "--with-sysroot=/" ,flags))))))) (cross binutils target))) +(define (gcc-configure-flags-for-triplet target) + "Return a list of additional GCC `configure' flags for TARGET, a GNU triplet. + +The purpose of this procedure is to translate extended GNU triplets---e.g., +where the OS part is overloaded to denote a specific ABI---into GCC +`configure' options. We take extended GNU triplets that glibc recognizes." + (cond ((string-match "^mips64el.*gnuabin?64$" target) + ;; Triplets recognized by glibc as denoting the N64 ABI; see + ;; ports/sysdeps/mips/preconfigure. + '("--with-abi=64")) + (else + ;; TODO: Add `armel.*gnueabi', `hf', etc. + '()))) + (define* (cross-gcc target #:optional (xbinutils (cross-binutils target)) libc) "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use @@ -86,6 +101,7 @@ GCC that does not target a libc; otherwise, target that libc." ,@(substitute-keyword-arguments (package-arguments gcc-4.7) ((#:configure-flags flags) `(append (list ,(string-append "--target=" target) + ,@(gcc-configure-flags-for-triplet target) ,@(if libc '() `( ;; Disable features not needed at this stage. @@ -260,7 +276,7 @@ XBINUTILS and the cross tool chain." ;;; (define-public xgcc-mips64el - (let ((triplet "mips64el-linux-gnu")) + (let ((triplet "mips64el-linux-gnuabi64")) ; N64 ABI (cross-gcc triplet (cross-binutils triplet) (cross-libc triplet)))) From 58ab9f9b8e80f9f0eb1e1e1c2e41e97533b65371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 26 Jun 2013 22:41:09 +0200 Subject: [PATCH 27/43] build: Add "mips64el-linux-gnuabi64" as a cross build target. * build-aux/hydra/gnu-system.scm (%packages-to-cross-build): Add %bootstrap-tarballs. (%cross-targets): Add "mips64el-linux-gnuabi64". --- build-aux/hydra/gnu-system.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build-aux/hydra/gnu-system.scm b/build-aux/hydra/gnu-system.scm index 2fffe25009..de3cd1154b 100644 --- a/build-aux/hydra/gnu-system.scm +++ b/build-aux/hydra/gnu-system.scm @@ -83,10 +83,12 @@ SYSTEM." %binutils-bootstrap-tarball %glibc-bootstrap-tarball %gcc-bootstrap-tarball - %guile-bootstrap-tarball)) + %guile-bootstrap-tarball + %bootstrap-tarballs)) (define %cross-targets - '("mips64el-linux-gnu")) + '("mips64el-linux-gnu" + "mips64el-linux-gnuabi64")) (define (hydra-jobs store arguments) "Return Hydra jobs." From ca16cb96066e29b32df924df9e1446efcc58c87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 26 Jun 2013 23:02:49 +0200 Subject: [PATCH 28/43] gnu: gcc: Use `gcc-configure-flags-for-triplet' when cross-compiling GCC. * gnu/packages/cross-base.scm (gcc-configure-flags-for-triplet): Move to... * gnu/packages/gcc.scm (gcc-configure-flags-for-triplet): ... here. New procedure. (gcc-4.7): Use it when (%current-target-system) is true. --- gnu/packages/cross-base.scm | 15 --------------- gnu/packages/gcc.scm | 23 ++++++++++++++++++++++- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 5edc1b52e3..29a81f1fa7 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -30,7 +30,6 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 match) - #:use-module (ice-9 regex) #:export (cross-binutils cross-libc cross-gcc)) @@ -66,20 +65,6 @@ `(cons "--with-sysroot=/" ,flags))))))) (cross binutils target))) -(define (gcc-configure-flags-for-triplet target) - "Return a list of additional GCC `configure' flags for TARGET, a GNU triplet. - -The purpose of this procedure is to translate extended GNU triplets---e.g., -where the OS part is overloaded to denote a specific ABI---into GCC -`configure' options. We take extended GNU triplets that glibc recognizes." - (cond ((string-match "^mips64el.*gnuabin?64$" target) - ;; Triplets recognized by glibc as denoting the N64 ABI; see - ;; ports/sysdeps/mips/preconfigure. - '("--with-abi=64")) - (else - ;; TODO: Add `armel.*gnueabi', `hf', etc. - '()))) - (define* (cross-gcc target #:optional (xbinutils (cross-binutils target)) libc) "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index b297ef1fb1..bba35901a2 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -25,12 +25,27 @@ #:use-module (gnu packages multiprecision) #:use-module (guix packages) #:use-module (guix download) - #:use-module (guix build-system gnu)) + #:use-module (guix build-system gnu) + #:use-module (ice-9 regex)) (define %gcc-infrastructure ;; Base URL for GCC's infrastructure. "ftp://gcc.gnu.org/pub/gcc/infrastructure/") +(define-public (gcc-configure-flags-for-triplet target) + "Return a list of additional GCC `configure' flags for TARGET, a GNU triplet. + +The purpose of this procedure is to translate extended GNU triplets---e.g., +where the OS part is overloaded to denote a specific ABI---into GCC +`configure' options. We take extended GNU triplets that glibc recognizes." + (cond ((string-match "^mips64el.*gnuabin?64$" target) + ;; Triplets recognized by glibc as denoting the N64 ABI; see + ;; ports/sysdeps/mips/preconfigure. + '("--with-abi=64")) + (else + ;; TODO: Add `armel.*gnueabi', `hf', etc. + '()))) + (define-public gcc-4.7 (let* ((stripped? #t) ; TODO: make this a parameter (maybe-target-tools @@ -64,6 +79,12 @@ "/include") "--without-headers"))) + ;; When cross-compiling GCC, pass the right options for the + ;; target triplet. + (or (and=> (%current-target-system) + gcc-configure-flags-for-triplet) + '()) + (maybe-target-tools)))))) (package (name "gcc") From d475b25953012cacbc8c661884d7f89cd5e93b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 3 Jul 2013 23:08:41 +0200 Subject: [PATCH 29/43] utils: Re-export `alist-cons' and `alist-delete'. * guix/build/utils.scm: Re-export `alist-cons' and `alist-delete'. --- guix/build/utils.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index c0b150e016..06e88b1ff8 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -27,6 +27,8 @@ #:use-module (ice-9 rdelim) #:use-module (rnrs bytevectors) #:use-module (rnrs io ports) + #:re-export (alist-cons + alist-delete) #:export (directory-exists? executable-file? call-with-ascii-input-file From be58d01a7e60601eb7b00a5fd3b724fdafb8dd29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 3 Jul 2013 23:53:31 +0200 Subject: [PATCH 30/43] build-system/gnu: Write debug files to the "debug" sub-derivation, if any. * guix/build/gnu-build-system.scm (strip): Add `objcopy-command' keyword parameter. [debug-output, debug-file-extension]: New variables. [debug-file, make-debug-file, add-debug-link]: New procedures. [strip-dir]: Use them. --- guix/build/gnu-build-system.scm | 53 +++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index bed498dfef..ebcb185e13 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -259,17 +259,66 @@ makefiles." (strip-command (if target (string-append target "-strip") "strip")) + (objcopy-command (if target + (string-append target "-objcopy") + "objcopy")) (strip-flags '("--strip-debug")) (strip-directories '("lib" "lib64" "libexec" "bin" "sbin")) #:allow-other-keys) + (define debug-output + ;; If an output is called "debug", then that's where debugging information + ;; will be stored instead of being discarded. + (assoc-ref outputs "debug")) + + (define debug-file-extension + ;; File name extension for debugging information. + ".debug") + + (define (debug-file file) + ;; Return the name of the debug file for FILE, an absolute file name. + ;; Once installed in the user's profile, it is in $PROFILE/lib/debug/FILE, + ;; which is where GDB looks for it (info "(gdb) Separate Debug Files"). + (string-append debug-output "/lib/debug/" + file debug-file-extension)) + + (define (make-debug-file file) + ;; Create a file in DEBUG-OUTPUT containing the debugging info of FILE. + (let ((debug (debug-file file))) + (mkdir-p (dirname debug)) + (copy-file file debug) + (and (zero? (system* strip-command "--only-keep-debug" debug)) + (begin + (chmod debug #o400) + #t)))) + + (define (add-debug-link file) + ;; Add a debug link in FILE (info "(binutils) strip"). + + ;; `objcopy --add-gnu-debuglink' wants to have the target of the debug + ;; link around so it can compute a CRC of that file (see the + ;; `bfd_fill_in_gnu_debuglink_section' function.) No reference to + ;; DEBUG-OUTPUT is kept because bfd keeps only the basename of the debug + ;; file. + (zero? (system* objcopy-command + (string-append "--add-gnu-debuglink=" + (debug-file file)) + file))) + (define (strip-dir dir) (format #t "stripping binaries in ~s with ~s and flags ~s~%" dir strip-command strip-flags) + (when debug-output + (format #t "debugging output written to ~s using ~s~%" + debug-output objcopy-command)) (file-system-fold (const #t) (lambda (path stat result) ; leaf - (zero? (apply system* strip-command - (append strip-flags (list path))))) + (and (or (not debug-output) + (make-debug-file path)) + (zero? (apply system* strip-command + (append strip-flags (list path)))) + (or (not debug-output) + (add-debug-link path)))) (const #t) ; down (const #t) ; up (const #t) ; skip From 9bf62d9b1d8058b7c428932d40ac91dd48e988dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 3 Jul 2013 23:55:04 +0200 Subject: [PATCH 31/43] gnu: Add a "debug" output for some packages. * gnu/packages/base.scm (coreutils, gnu-make, glibc): Add a "debug" output. * gnu/packages/bdw-gc.scm (libgc): Likewise. * gnu/packages/guile.scm (guile-2.0): Likewise. * gnu/packages/libffi.scm (libffi): Likewise. * gnu/packages/multiprecision.scm (gmp, mpfr, mpc): Likewise. --- gnu/packages/base.scm | 4 +++- gnu/packages/bdw-gc.scm | 1 + gnu/packages/guile.scm | 2 ++ gnu/packages/libffi.scm | 1 + gnu/packages/multiprecision.scm | 3 +++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 95052775c5..7ca7ec74c6 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -279,6 +279,7 @@ The tools supplied with this package are: ,@(if (%current-target-system) '() `(("perl" ,perl))))) + (outputs '("out" "debug")) (arguments `(#:parallel-build? #f ; help2man may be called too early #:phases (alist-cons-before @@ -316,6 +317,7 @@ are expected to exist on every operating system.") (build-system gnu-build-system) (native-inputs `(("patch/impure-dirs" ,(search-patch "make-impure-dirs.patch")))) + (outputs '("out" "debug")) (arguments '(#:patches (list (assoc-ref %build-inputs "patch/impure-dirs")) #:phases (alist-cons-before @@ -403,7 +405,7 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.") ;; reference to them anyway, so there's no space savings here. ;; TODO: Eventually we may want to add a $LOCALE_ARCHIVE search path like ;; Nixpkgs does. - (outputs '("out" "locales")) + (outputs '("out" "locales" "debug")) (arguments `(#:out-of-source? #t diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm index bebb0862e3..7cce9671d1 100644 --- a/gnu/packages/bdw-gc.scm +++ b/gnu/packages/bdw-gc.scm @@ -39,6 +39,7 @@ ;; Make it so that we don't rely on /proc. This is especially useful in ;; an initrd run before /proc is mounted. '(#:configure-flags '("CPPFLAGS=-DUSE_LIBC_PRIVATES"))) + (outputs '("out" "debug")) (synopsis "The Boehm-Demers-Weiser conservative garbage collector for C and C++") (description diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index c78ab57915..772776349e 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -138,6 +138,8 @@ extensible. It supports many SRFIs.") (self-native-input? #t) + (outputs '("out" "debug")) + (arguments `(#:phases (alist-cons-before 'configure 'pre-configure diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm index 0707bf8a7e..e4a2761273 100644 --- a/gnu/packages/libffi.scm +++ b/gnu/packages/libffi.scm @@ -53,6 +53,7 @@ #:phases (alist-cons-after 'install 'post-install ,post-install-phase %standard-phases))) + (outputs '("out" "debug")) (synopsis "Foreign function call interface library") (description "The libffi library provides a portable, high level programming interface diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm index 46acba3065..16383d1ec1 100644 --- a/gnu/packages/multiprecision.scm +++ b/gnu/packages/multiprecision.scm @@ -38,6 +38,7 @@ "1hnbxz7a6jrli8ph27i8zb6k2f456zn6l5xi78yhskzbxjk47nf7")))) (build-system gnu-build-system) (native-inputs `(("m4" ,m4))) + (outputs '("out" "debug")) (arguments `(#:configure-flags '(;; Build a "fat binary", with routines for several ;; sub-architectures. @@ -78,6 +79,7 @@ faster algorithms.") (sha256 (base32 "0fs501qi8l523gs3cpy4jjcnvwxggyfbklcys80wq236xx3hz79r")))) (build-system gnu-build-system) + (outputs '("out" "debug")) (propagated-inputs `(("gmp" ,gmp))) ; refers to (synopsis "C library for arbitrary precision floating-point arithmetic") (description @@ -103,6 +105,7 @@ double-precision floating-point arithmetic (53-bit mantissa).") (sha256 (base32 "1zq0fidp1jii2j5k5n9hmx55a6wwid33gjzhimvxq9d5zrf82npd")))) (build-system gnu-build-system) + (outputs '("out" "debug")) (propagated-inputs `(("gmp" ,gmp) ; refers to both ("mpfr" ,mpfr))) (synopsis "C library for arbitrary precision complex arithmetic") From a4627d498a9d8021141df27a1cac4c61da8a7a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 4 Jul 2013 11:08:28 +0200 Subject: [PATCH 32/43] gnu: cross-libc: Remove the "debug" output. * gnu/packages/cross-base.scm (cross-libc): Remove "debug" from the `outputs' field. --- gnu/packages/cross-base.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 29a81f1fa7..ca8d432d96 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -250,6 +250,10 @@ XBINUTILS and the cross tool chain." (string-append linux "/include")) #t)) ,phases)))) + + ;; Remove the "debug" output since stripping is disabled. + (outputs (delete "debug" (package-outputs glibc))) + (propagated-inputs `(("cross-linux-headers" ,xlinux-headers))) (native-inputs `(("cross-gcc" ,xgcc) ("cross-binutils" ,xbinutils) From 82f9b17687073d9d2d1c9a9a70e338e56fb9a7b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 4 Jul 2013 13:26:35 +0200 Subject: [PATCH 33/43] build-system/gnu: Remove the "debug" output when `strip-binaries?' is #f. * guix/build-system/gnu.scm (gnu-build, gnu-cross-build): Delete "debug" from OUTPUTS when STRIP-BINARIES? is false. * gnu/packages/cross-base.scm (cross-libc): Leave `outputs' unchanged. This reverts commit a4627d4. --- gnu/packages/cross-base.scm | 3 --- guix/build-system/gnu.scm | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index ca8d432d96..28224a1c40 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -251,9 +251,6 @@ XBINUTILS and the cross tool chain." #t)) ,phases)))) - ;; Remove the "debug" output since stripping is disabled. - (outputs (delete "debug" (package-outputs glibc))) - (propagated-inputs `(("cross-linux-headers" ,xlinux-headers))) (native-inputs `(("cross-gcc" ,xgcc) ("cross-binutils" ,xbinutils) diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index d074294b4c..c12a871fd8 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -299,7 +299,9 @@ which could lead to gratuitous input divergence." ,@(if implicit-inputs? implicit-inputs '())) - #:outputs outputs + #:outputs (if strip-binaries? + outputs + (delete "debug" outputs)) #:modules imported-modules #:guile-for-build guile-for-build)) @@ -470,7 +472,9 @@ platform." ,@(if implicit-inputs? implicit-host-inputs '())) - #:outputs outputs + #:outputs (if strip-binaries? + outputs + (delete "debug" outputs)) #:modules imported-modules #:guile-for-build guile-for-build)) From 3a4ebc11240761901de75da3ffebbace5a70cf6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 5 Jul 2013 14:39:47 +0200 Subject: [PATCH 34/43] gnu: make-bootstrap: guile-static-stripped has no "debug" output. * gnu/packages/make-bootstrap.scm (%guile-static-stripped): Add `outputs' field. --- gnu/packages/make-bootstrap.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index f4d29bdf96..97362baff2 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -519,7 +519,8 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (string-append out "/bin/guile")) (remove-store-references (string-append out "/bin/guile")) #t)))) - (inputs `(("guile" ,%guile-static))))) + (inputs `(("guile" ,%guile-static))) + (outputs '("out")))) (define (tarball-package pkg) "Return a package containing a tarball of PKG." From c8ebc82187d83e845a201bbe45d837c97f9c64b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 6 Jul 2013 18:08:29 +0200 Subject: [PATCH 35/43] gnu: gcc: Add Texinfo to the native inputs. * gnu/packages/gcc.scm (gcc-4.7): Add `native-inputs' field. (gcc-4.8): Remove outdated comment. * gnu/packages/base.scm (gcc-boot0): Add `native-inputs' field. --- gnu/packages/base.scm | 6 +++++- gnu/packages/gcc.scm | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 7ca7ec74c6..a5c6a70603 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -756,7 +756,11 @@ identifier SYSTEM." ;; Call it differently so that the builder can check whether ;; the "libc" input is #f. ("libc-native" ,@(assoc-ref %boot0-inputs "libc")) - ,@(alist-delete "libc" %boot0-inputs)))))) + ,@(alist-delete "libc" %boot0-inputs))) + + ;; No need for Texinfo at this stage. + (native-inputs (alist-delete "texinfo" + (package-native-inputs gcc-4.7)))))) (define linux-libre-headers-boot0 (package-with-bootstrap-guile diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index bba35901a2..f8caf4c7f6 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -23,6 +23,7 @@ #:use-module (gnu packages bootstrap) #:use-module (gnu packages compression) #:use-module (gnu packages multiprecision) + #:use-module (gnu packages texinfo) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix build-system gnu) @@ -104,6 +105,10 @@ where the OS part is overloaded to denote a specific ABI---into GCC ("cloog" ,cloog) ("libelf" ,libelf) ("zlib" ,zlib))) + + ;; GCC is one of the few packages that doesn't ship .info files. + (native-inputs `(("texinfo" ,texinfo))) + (arguments `(#:out-of-source? #t #:strip-binaries? ,stripped? @@ -199,7 +204,6 @@ used in the GNU system including the GNU/Linux variant.") (home-page "http://gcc.gnu.org/")))) (define-public gcc-4.8 - ;; FIXME: Move to gcc.scm when Binutils is updated. (package (inherit gcc-4.7) (version "4.8.0") (source (origin From 401c53c46917f7e3e8c8fcf1d316f0c274279165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 7 Jul 2013 00:29:50 +0200 Subject: [PATCH 36/43] doc: Add a "Boostrapping" section. * doc/guix.texi (Package Modules): New node, with material formerly under "GNU Distribution". (Bootstrapping): New node. * Makefile.am (EXTRA_DIST): Add doc/images/bootstrap-graph.dot and doc/images/bootstrap-graph.eps. (infoimagedir, dist_infoimage_DATA, DOT_OPTIONS): New variable. (.dot.png, .dot.eps, doc/guix.pdf, doc/guix.info, doc/guix.ps): New targets. * doc/images/bootstrap-graph.dot: New file. --- .gitignore | 2 + Makefile.am | 26 ++++- doc/guix.texi | 170 ++++++++++++++++++++++++++++++--- doc/images/bootstrap-graph.dot | 83 ++++++++++++++++ 4 files changed, 265 insertions(+), 16 deletions(-) create mode 100644 doc/images/bootstrap-graph.dot diff --git a/.gitignore b/.gitignore index 9ccddce8c2..f97a3b5f3d 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,5 @@ stamp-h[0-9] /doc/guix.vr /doc/guix.vrs /nix/scripts/substitute-binary +/doc/images/bootstrap-graph.png +/doc/images/bootstrap-graph.eps diff --git a/Makefile.am b/Makefile.am index 9faa6544ea..ee6d023988 100644 --- a/Makefile.am +++ b/Makefile.am @@ -169,7 +169,31 @@ $(guix_install_go_files): install-nobase_dist_guilemoduleDATA SUBDIRS = po info_TEXINFOS = doc/guix.texi -EXTRA_DIST += doc/fdl-1.3.texi +EXTRA_DIST += \ + doc/fdl-1.3.texi \ + doc/images/bootstrap-graph.dot \ + doc/images/bootstrap-graph.eps + +infoimagedir = $(infodir)/images +dist_infoimage_DATA = doc/images/bootstrap-graph.png + +# Try hard to obtain an image size and aspect that's reasonable for inclusion +# in an Info or PDF document. +DOT_OPTIONS = \ + -Tpng -Gratio=.9 -Gnodesep=.005 -Granksep=.00005 \ + -Nfontsize=9 -Nheight=.1 -Nwidth=.1 + +.dot.png: + dot -Tpng $(DOT_OPTIONS) < "$<" > "$@.tmp" + mv "$@.tmp" "$@" + +.dot.eps: + dot -Teps $(DOT_OPTIONS) < "$<" > "$@.tmp" + mv "$@.tmp" "$@" + +doc/guix.pdf: doc/images/bootstrap-graph.png +doc/guix.info: doc/images/bootstrap-graph.png +doc/guix.ps: doc/images/bootstrap-graph.eps if BUILD_DAEMON diff --git a/doc/guix.texi b/doc/guix.texi index 23e8351c02..4d674b1b20 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1426,29 +1426,169 @@ guix package}): guix package --list-available @end example -The package definitions of the distribution may are provided by Guile -modules in the @code{(gnu packages ...)} name space---for instance, the -@code{(gnu packages emacs)} module exports a variable named -@code{emacs}, which is bound to a @code{} object -(@pxref{Defining Packages}). The @code{(gnu packages)} module provides -facilities for searching for packages. - -The distribution is fully @dfn{bootstrapped} and @dfn{self-contained}: -each package is built based solely on other packages in the -distribution. The root of this dependency graph is a small set of -@dfn{bootstrap binaries}, provided by the @code{(gnu packages -bootstrap)} module. These are statically-linked binaries of the core -tools without which building anything at all would be impossible. - - Our goal is to build a practical 100% free software distribution of Linux-based and other variants of GNU, with a focus on the promotion and tight integration of GNU components, and an emphasis on programs and tools that help users exert that freedom. +@menu +* Package Modules:: Packages from the programmer's viewpoint. +* Bootstrapping:: GNU/Linux built from scratch. +@end menu + Building this distribution is a cooperative effort, and you are invited to join! @ref{Contributing}, for information about how you can help. +@node Package Modules +@section Package Modules + +From a programming viewpoint, the package definitions of the +distribution are provided by Guile modules in the @code{(gnu packages +...)} name space---for instance, the @code{(gnu packages emacs)} module +exports a variable named @code{emacs}, which is bound to a +@code{} object (@pxref{Defining Packages}). The @code{(gnu +packages)} module provides facilities for searching for packages. + +The distribution is fully @dfn{bootstrapped} and @dfn{self-contained}: +each package is built based solely on other packages in the +distribution. The root of this dependency graph is a small set of +@dfn{bootstrap binaries}, provided by the @code{(gnu packages +bootstrap)} module. More on this in the next section. + + +@node Bootstrapping +@section Bootstrapping + +@c Adapted from the ELS 2013 paper. + +@cindex bootstrapping + +Bootstrapping in our context refers to how the distribution gets built +``from nothing''. Remember that the build environment of a derivation +contains nothing but its declared inputs (@pxref{Introduction}). So +there's an obvious chicken-and-egg problem: how does the first package +get built? How does the first compiler get compiled? Note that this is +a question of interest only to the curious hacker, not to the regular +user, so you can shamelessly skip this section if you consider yourself +a ``regular user''. + +@cindex bootstrap binaries +The GNU system is primarily made of C code, with libc at its core. The +GNU build system itself assumes the availability of a Bourne shell and +command-line tools provided by GNU Coreutils, Awk, Findutils, `sed', and +`grep'. Furthermore, build programs---programs that run +@code{./configure}, @code{make}, etc.---are written in Guile Scheme +(@pxref{Derivations}). Consequently, to be able to build anything at +all, from scratch, Guix relies on pre-built binaries of Guile, GCC, +Binutils, libc, and the other packages mentioned above---the +@dfn{bootstrap binaries}. + +These bootstrap binaries are ``taken for granted'', though we can also +re-create them if needed (more on that later.) + +@unnumberedsubsec Preparing to Use the Bootstrap Binaries + +@c As of Emacs 24.3, Info-mode displays the image, but since it's a +@c large image, it's hard to scroll. Oh well. +@image{images/bootstrap-graph,,,Dependency graph of the early bootstrap derivations} + +The figure above shows the very beginning of the dependency graph of the +distribution, corresponding to the package definitions of the @code{(gnu +packages bootstrap)} module. At this level of detail, things are +slightly complex. First, Guile itself consists of an ELF executable, +along with many source and compiled Scheme files that are dynamically +loaded when it runs. This gets stored in the @file{guile-2.0.7.tar.xz} +tarball shown in this graph. This tarball is part of Guix's ``source'' +distribution, and gets inserted into the store with @code{add-to-store} +(@pxref{The Store}). + +But how do we write a derivation that unpacks this tarball and adds it +to the store? To solve this problem, the @code{guile-bootstrap-2.0.drv} +derivation---the first one that gets built---uses @code{bash} as its +builder, which runs @code{build-bootstrap-guile.sh}, which in turn calls +@code{tar} to unpack the tarball. Thus, @file{bash}, @file{tar}, +@file{xz}, and @file{mkdir} are statically-linked binaries, also part of +the Guix source distribution, whose sole purpose is to allow the Guile +tarball to be unpacked. + +Once @code{guile-bootstrap-2.0.drv} is built, we have a functioning +Guile that can be used to run subsequent build programs. Its first task +is to download tarballs containing the other pre-built binaries---this +is what the @code{.tar.xz.drv} derivations do. Guix modules such as +@code{ftp-client.scm} are used for this purpose. The +@code{module-import.drv} derivations import those modules in a directory +in the store, using the original layout. The +@code{module-import-compiled.drv} derivations compile those modules, and +write them in an output directory with the right layout. This +corresponds to the @code{#:modules} argument of +@code{build-expression->derivation} (@pxref{Derivations}). + +Finally, the various tarballs are unpacked by the +derivations @code{gcc-bootstrap-0.drv}, @code{glibc-bootstrap-0.drv}, +etc., at which point we have a working C tool chain. + + +@unnumberedsubsec Building the Build Tools + +@c TODO: Add a package-level dependency graph generated from (gnu +@c packages base). + +Bootstrapping is complete when we have a full tool chain that does not +depend on the pre-built bootstrap tools discussed above. This +no-dependency requirement is verified by checking whether the files of +the final tool chain contain references to the @file{/nix/store} +directories of the bootstrap inputs. The process that leads to this +``final'' tool chain is described by the package definitions found in +the @code{(gnu packages base)} module. + +@c See . +The first tool that gets built with the bootstrap binaries is +GNU Make, which is a prerequisite for all the following packages. +From there Findutils and Diffutils get built. + +Then come the first-stage Binutils and GCC, built as pseudo cross +tools---i.e., with @code{--target} equal to @code{--host}. They are +used to build libc. Thanks to this cross-build trick, this libc is +guaranteed not to hold any reference to the initial tool chain. + +From there the final Binutils and GCC are built. GCC uses @code{ld} +from the final Binutils, and links programs against the just-built libc. +This tool chain is used to build the other packages used by Guix and by +the GNU Build System: Guile, Bash, Coreutils, etc. + +And voilà! At this point we have the complete set of build tools that +the GNU Build System expects. These are in the @code{%final-inputs} +variables of the @code{(gnu packages base)} module, and are implicitly +used by any package that uses @code{gnu-build-system} (@pxref{Defining +Packages}). + + +@unnumberedsubsec Building the Bootstrap Binaries + +Because the final tool chain does not depend on the bootstrap binaries, +those rarely need to be updated. Nevertheless, it is useful to have an +automated way to produce them, should an update occur, and this is what +the @code{(gnu packages make-bootstrap)} module provides. + +The following command builds the tarballs containing the bootstrap +binaries (Guile, Binutils, GCC, libc, and a tarball containing a mixture +of Coreutils and other basic command-line tools): + +@example +guix build bootstrap-tarballs +@end example + +The generated tarballs are those that should be referred to in the +@code{(gnu packages bootstrap)} module mentioned at the beginning of +this section. + +Still here? Then perhaps by now you've started to wonder: when do we +reach a fixed point? That is an interesting question! The answer is +unknown, but if you would like to investigate further (and have +significant computational and storage resources to do so), then let us +know. + + @c ********************************************************************* @node Contributing @chapter Contributing diff --git a/doc/images/bootstrap-graph.dot b/doc/images/bootstrap-graph.dot new file mode 100644 index 0000000000..06d7f29c7a --- /dev/null +++ b/doc/images/bootstrap-graph.dot @@ -0,0 +1,83 @@ +# Obtained by running "nix-store --graph" on the first GCC derivation. + +digraph G { +"/nix/store/x60397za40lx0n88f51a2csfdq5xvb19-gcc-bootstrap-0.drv" [label = "gcc-bootstrap-0.drv", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/3iawic1z95112yfz5y9xdp66qbxxr8l1-tar" -> "/nix/store/x60397za40lx0n88f51a2csfdq5xvb19-gcc-bootstrap-0.drv" [color = "black"]; +"/nix/store/4sv9xhcjap6byca130fzpzzjalb7iixv-glibc-bootstrap-0.drv" -> "/nix/store/x60397za40lx0n88f51a2csfdq5xvb19-gcc-bootstrap-0.drv" [color = "red"]; +"/nix/store/8cc81w6m04csm52y247xj3gydrbz2niv-xz" -> "/nix/store/x60397za40lx0n88f51a2csfdq5xvb19-gcc-bootstrap-0.drv" [color = "green"]; +"/nix/store/96yx6013dhggr3mpg5ayxv8dm9mv2ghv-module-import.drv" -> "/nix/store/x60397za40lx0n88f51a2csfdq5xvb19-gcc-bootstrap-0.drv" [color = "blue"]; +"/nix/store/fl9cwcczfdv73vq5sr0c4rd5hqzrgvac-gcc-4.7.2.tar.xz.drv" -> "/nix/store/x60397za40lx0n88f51a2csfdq5xvb19-gcc-bootstrap-0.drv" [color = "magenta"]; +"/nix/store/jaaqdl979wjirnbxz1jqsipg22nva5n4-bash" -> "/nix/store/x60397za40lx0n88f51a2csfdq5xvb19-gcc-bootstrap-0.drv" [color = "burlywood"]; +"/nix/store/r3dsy5j2c16sv26raala6kahff7w18hb-gcc-bootstrap-0-guile-builder" -> "/nix/store/x60397za40lx0n88f51a2csfdq5xvb19-gcc-bootstrap-0.drv" [color = "black"]; +"/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" -> "/nix/store/x60397za40lx0n88f51a2csfdq5xvb19-gcc-bootstrap-0.drv" [color = "red"]; +"/nix/store/y4n7rzysx6qz3p0n91dw9qz5w93l6iqv-module-import-compiled.drv" -> "/nix/store/x60397za40lx0n88f51a2csfdq5xvb19-gcc-bootstrap-0.drv" [color = "green"]; +"/nix/store/3iawic1z95112yfz5y9xdp66qbxxr8l1-tar" [label = "tar", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/4sv9xhcjap6byca130fzpzzjalb7iixv-glibc-bootstrap-0.drv" [label = "glibc-bootstrap-0.drv", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/3iawic1z95112yfz5y9xdp66qbxxr8l1-tar" -> "/nix/store/4sv9xhcjap6byca130fzpzzjalb7iixv-glibc-bootstrap-0.drv" [color = "blue"]; +"/nix/store/8cc81w6m04csm52y247xj3gydrbz2niv-xz" -> "/nix/store/4sv9xhcjap6byca130fzpzzjalb7iixv-glibc-bootstrap-0.drv" [color = "magenta"]; +"/nix/store/8iivk9hpnps21yrbq3zzsxgzv9ixbhgh-glibc-bootstrap-0-guile-builder" -> "/nix/store/4sv9xhcjap6byca130fzpzzjalb7iixv-glibc-bootstrap-0.drv" [color = "burlywood"]; +"/nix/store/96yx6013dhggr3mpg5ayxv8dm9mv2ghv-module-import.drv" -> "/nix/store/4sv9xhcjap6byca130fzpzzjalb7iixv-glibc-bootstrap-0.drv" [color = "black"]; +"/nix/store/wdwrkg02gn28bkpbxgdb2nv558v8s3ji-glibc-2.17.tar.xz.drv" -> "/nix/store/4sv9xhcjap6byca130fzpzzjalb7iixv-glibc-bootstrap-0.drv" [color = "red"]; +"/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" -> "/nix/store/4sv9xhcjap6byca130fzpzzjalb7iixv-glibc-bootstrap-0.drv" [color = "green"]; +"/nix/store/y4n7rzysx6qz3p0n91dw9qz5w93l6iqv-module-import-compiled.drv" -> "/nix/store/4sv9xhcjap6byca130fzpzzjalb7iixv-glibc-bootstrap-0.drv" [color = "blue"]; +"/nix/store/8cc81w6m04csm52y247xj3gydrbz2niv-xz" [label = "xz", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/8iivk9hpnps21yrbq3zzsxgzv9ixbhgh-glibc-bootstrap-0-guile-builder" [label = "glibc-bootstrap-0-guile-builder", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/3iawic1z95112yfz5y9xdp66qbxxr8l1-tar" -> "/nix/store/8iivk9hpnps21yrbq3zzsxgzv9ixbhgh-glibc-bootstrap-0-guile-builder" [color = "magenta"]; +"/nix/store/8cc81w6m04csm52y247xj3gydrbz2niv-xz" -> "/nix/store/8iivk9hpnps21yrbq3zzsxgzv9ixbhgh-glibc-bootstrap-0-guile-builder" [color = "burlywood"]; +"/nix/store/96yx6013dhggr3mpg5ayxv8dm9mv2ghv-module-import.drv" [label = "module-import.drv", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/9zrdfvnrpljryr82an2n1mj6bh2przhn-module-import-guile-builder" -> "/nix/store/96yx6013dhggr3mpg5ayxv8dm9mv2ghv-module-import.drv" [color = "black"]; +"/nix/store/mj7amprgvl2rgash1nr0v64apik8vc7f-utils.scm" -> "/nix/store/96yx6013dhggr3mpg5ayxv8dm9mv2ghv-module-import.drv" [color = "red"]; +"/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" -> "/nix/store/96yx6013dhggr3mpg5ayxv8dm9mv2ghv-module-import.drv" [color = "green"]; +"/nix/store/9zrdfvnrpljryr82an2n1mj6bh2przhn-module-import-guile-builder" [label = "module-import-guile-builder", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/mj7amprgvl2rgash1nr0v64apik8vc7f-utils.scm" -> "/nix/store/9zrdfvnrpljryr82an2n1mj6bh2przhn-module-import-guile-builder" [color = "blue"]; +"/nix/store/fl9cwcczfdv73vq5sr0c4rd5hqzrgvac-gcc-4.7.2.tar.xz.drv" [label = "gcc-4.7.2.tar.xz.drv", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/6kslnirvm26fij7wpjqbw617ri4gf5x5-gcc-4.7.2.tar.xz-guile-builder" -> "/nix/store/fl9cwcczfdv73vq5sr0c4rd5hqzrgvac-gcc-4.7.2.tar.xz.drv" [color = "magenta"]; +"/nix/store/kvk5wp8c9rzvvrmq5fv5r58l78q8i6ch-module-import.drv" -> "/nix/store/fl9cwcczfdv73vq5sr0c4rd5hqzrgvac-gcc-4.7.2.tar.xz.drv" [color = "burlywood"]; +"/nix/store/pzv319p3q7raiad7nq7fcdw9rafzp14k-module-import-compiled.drv" -> "/nix/store/fl9cwcczfdv73vq5sr0c4rd5hqzrgvac-gcc-4.7.2.tar.xz.drv" [color = "black"]; +"/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" -> "/nix/store/fl9cwcczfdv73vq5sr0c4rd5hqzrgvac-gcc-4.7.2.tar.xz.drv" [color = "red"]; +"/nix/store/6kslnirvm26fij7wpjqbw617ri4gf5x5-gcc-4.7.2.tar.xz-guile-builder" [label = "gcc-4.7.2.tar.xz-guile-builder", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/jaaqdl979wjirnbxz1jqsipg22nva5n4-bash" [label = "bash", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/kvk5wp8c9rzvvrmq5fv5r58l78q8i6ch-module-import.drv" [label = "module-import.drv", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/abagrdbdndkd0y2dwk0nw1gw0g0rhl2z-ftp-client.scm" -> "/nix/store/kvk5wp8c9rzvvrmq5fv5r58l78q8i6ch-module-import.drv" [color = "green"]; +"/nix/store/dwd2iwd1ban8a8rmx568dpgrbkkidfhw-download.scm" -> "/nix/store/kvk5wp8c9rzvvrmq5fv5r58l78q8i6ch-module-import.drv" [color = "blue"]; +"/nix/store/mj7amprgvl2rgash1nr0v64apik8vc7f-utils.scm" -> "/nix/store/kvk5wp8c9rzvvrmq5fv5r58l78q8i6ch-module-import.drv" [color = "magenta"]; +"/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" -> "/nix/store/kvk5wp8c9rzvvrmq5fv5r58l78q8i6ch-module-import.drv" [color = "burlywood"]; +"/nix/store/yfixjx2gpvsi5dhkpdx5gj6gx0xdk1c8-module-import-guile-builder" -> "/nix/store/kvk5wp8c9rzvvrmq5fv5r58l78q8i6ch-module-import.drv" [color = "black"]; +"/nix/store/abagrdbdndkd0y2dwk0nw1gw0g0rhl2z-ftp-client.scm" [label = "ftp-client.scm", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/dwd2iwd1ban8a8rmx568dpgrbkkidfhw-download.scm" [label = "download.scm", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/mj7amprgvl2rgash1nr0v64apik8vc7f-utils.scm" [label = "utils.scm", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/pzv319p3q7raiad7nq7fcdw9rafzp14k-module-import-compiled.drv" [label = "module-import-compiled.drv", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/98gzqlgpm4gxrpl5bzykpqbwrx8ckx8l-module-import-compiled-guile-builder" -> "/nix/store/pzv319p3q7raiad7nq7fcdw9rafzp14k-module-import-compiled.drv" [color = "red"]; +"/nix/store/kvk5wp8c9rzvvrmq5fv5r58l78q8i6ch-module-import.drv" -> "/nix/store/pzv319p3q7raiad7nq7fcdw9rafzp14k-module-import-compiled.drv" [color = "green"]; +"/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" -> "/nix/store/pzv319p3q7raiad7nq7fcdw9rafzp14k-module-import-compiled.drv" [color = "blue"]; +"/nix/store/98gzqlgpm4gxrpl5bzykpqbwrx8ckx8l-module-import-compiled-guile-builder" [label = "module-import-compiled-guile-builder", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/r3dsy5j2c16sv26raala6kahff7w18hb-gcc-bootstrap-0-guile-builder" [label = "gcc-bootstrap-0-guile-builder", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/3iawic1z95112yfz5y9xdp66qbxxr8l1-tar" -> "/nix/store/r3dsy5j2c16sv26raala6kahff7w18hb-gcc-bootstrap-0-guile-builder" [color = "magenta"]; +"/nix/store/8cc81w6m04csm52y247xj3gydrbz2niv-xz" -> "/nix/store/r3dsy5j2c16sv26raala6kahff7w18hb-gcc-bootstrap-0-guile-builder" [color = "burlywood"]; +"/nix/store/jaaqdl979wjirnbxz1jqsipg22nva5n4-bash" -> "/nix/store/r3dsy5j2c16sv26raala6kahff7w18hb-gcc-bootstrap-0-guile-builder" [color = "black"]; +"/nix/store/wdwrkg02gn28bkpbxgdb2nv558v8s3ji-glibc-2.17.tar.xz.drv" [label = "glibc-2.17.tar.xz.drv", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/kvk5wp8c9rzvvrmq5fv5r58l78q8i6ch-module-import.drv" -> "/nix/store/wdwrkg02gn28bkpbxgdb2nv558v8s3ji-glibc-2.17.tar.xz.drv" [color = "red"]; +"/nix/store/pzv319p3q7raiad7nq7fcdw9rafzp14k-module-import-compiled.drv" -> "/nix/store/wdwrkg02gn28bkpbxgdb2nv558v8s3ji-glibc-2.17.tar.xz.drv" [color = "green"]; +"/nix/store/q7as3jddipj4g6si8lawrdbkjg0zcjvg-glibc-2.17.tar.xz-guile-builder" -> "/nix/store/wdwrkg02gn28bkpbxgdb2nv558v8s3ji-glibc-2.17.tar.xz.drv" [color = "blue"]; +"/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" -> "/nix/store/wdwrkg02gn28bkpbxgdb2nv558v8s3ji-glibc-2.17.tar.xz.drv" [color = "magenta"]; +"/nix/store/q7as3jddipj4g6si8lawrdbkjg0zcjvg-glibc-2.17.tar.xz-guile-builder" [label = "glibc-2.17.tar.xz-guile-builder", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" [label = "guile-bootstrap-2.0.drv", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/bplka3yqdg8prqq3zdxza6wxlkjdhr2g-build-bootstrap-guile.sh" -> "/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" [color = "burlywood"]; +"/nix/store/jaaqdl979wjirnbxz1jqsipg22nva5n4-bash" -> "/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" [color = "black"]; +"/nix/store/bplka3yqdg8prqq3zdxza6wxlkjdhr2g-build-bootstrap-guile.sh" [label = "build-bootstrap-guile.sh", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/3iawic1z95112yfz5y9xdp66qbxxr8l1-tar" -> "/nix/store/bplka3yqdg8prqq3zdxza6wxlkjdhr2g-build-bootstrap-guile.sh" [color = "red"]; +"/nix/store/4xv2y0m6zr2lgi8x8pcb3zxjqxsz69kj-mkdir" -> "/nix/store/bplka3yqdg8prqq3zdxza6wxlkjdhr2g-build-bootstrap-guile.sh" [color = "green"]; +"/nix/store/8cc81w6m04csm52y247xj3gydrbz2niv-xz" -> "/nix/store/bplka3yqdg8prqq3zdxza6wxlkjdhr2g-build-bootstrap-guile.sh" [color = "blue"]; +"/nix/store/c450lqvaaz3ngx9pfiiiw55rqq6ssfda-guile-2.0.7.tar.xz" -> "/nix/store/bplka3yqdg8prqq3zdxza6wxlkjdhr2g-build-bootstrap-guile.sh" [color = "magenta"]; +"/nix/store/4xv2y0m6zr2lgi8x8pcb3zxjqxsz69kj-mkdir" [label = "mkdir", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/c450lqvaaz3ngx9pfiiiw55rqq6ssfda-guile-2.0.7.tar.xz" [label = "guile-2.0.7.tar.xz", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/y4n7rzysx6qz3p0n91dw9qz5w93l6iqv-module-import-compiled.drv" [label = "module-import-compiled.drv", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/8jiqjlb6zxjys16ca7s6jvxcc620c71k-module-import-compiled-guile-builder" -> "/nix/store/y4n7rzysx6qz3p0n91dw9qz5w93l6iqv-module-import-compiled.drv" [color = "burlywood"]; +"/nix/store/96yx6013dhggr3mpg5ayxv8dm9mv2ghv-module-import.drv" -> "/nix/store/y4n7rzysx6qz3p0n91dw9qz5w93l6iqv-module-import-compiled.drv" [color = "black"]; +"/nix/store/x9x1a86flhx15cams7235rfy5gc5cww1-guile-bootstrap-2.0.drv" -> "/nix/store/y4n7rzysx6qz3p0n91dw9qz5w93l6iqv-module-import-compiled.drv" [color = "red"]; +"/nix/store/8jiqjlb6zxjys16ca7s6jvxcc620c71k-module-import-compiled-guile-builder" [label = "module-import-compiled-guile-builder", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/yfixjx2gpvsi5dhkpdx5gj6gx0xdk1c8-module-import-guile-builder" [label = "module-import-guile-builder", fontname = Helvetica, shape = box, style = filled, fillcolor = "#ffffff"]; +"/nix/store/abagrdbdndkd0y2dwk0nw1gw0g0rhl2z-ftp-client.scm" -> "/nix/store/yfixjx2gpvsi5dhkpdx5gj6gx0xdk1c8-module-import-guile-builder" [color = "green"]; +"/nix/store/dwd2iwd1ban8a8rmx568dpgrbkkidfhw-download.scm" -> "/nix/store/yfixjx2gpvsi5dhkpdx5gj6gx0xdk1c8-module-import-guile-builder" [color = "blue"]; +"/nix/store/mj7amprgvl2rgash1nr0v64apik8vc7f-utils.scm" -> "/nix/store/yfixjx2gpvsi5dhkpdx5gj6gx0xdk1c8-module-import-guile-builder" [color = "magenta"]; +} From 8b315a6dd5f1b32d1a8a84c0f525dc4850b1e889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 7 Jul 2013 01:02:48 +0200 Subject: [PATCH 37/43] doc: Add a "Porting" section. * HACKING (Porting the Guix distro on a new platform): Remove. * doc/guix.texi (Porting): New node. Describe cross-compilation as the only approach. --- HACKING | 91 --------------------------------------------------- doc/guix.texi | 30 +++++++++++++++++ 2 files changed, 30 insertions(+), 91 deletions(-) diff --git a/HACKING b/HACKING index dd59a68b11..60851e1f2f 100644 --- a/HACKING +++ b/HACKING @@ -127,94 +127,3 @@ after two weeks, and if you’re confident, it’s OK to commit. That last part is subject to being adjusted, allowing individuals to commit directly on non-controversial changes on parts they’re familiar with. - -* Porting the Guix distro on a new platform - -** Introduction - -Unlike Make or similar build tools, Guix requires absolutely /all/ the -dependencies of a build process to be specified. - -For a user-land software distribution, that means that the process that -builds GCC (then used to build all other programs) must itself be -specified; and the process to build the C library to build that GCC; and -the process to build the GCC to build that library; and... See the -problem? Chicken-and-egg. - -To break that cycle, the distro starts from a set of pre-built -binaries–usually referred to as “bootstrap binaries.” These include -statically-linked versions of Guile, GCC, Coreutils, Grep, sed, -etc., and the GNU C Library. - -This section describes how to build those bootstrap binaries when -porting to a new platform. - -** When the platform is supported by Nixpkgs - -In that case, the easiest thing is to bootstrap the distro using -binaries from Nixpkgs. - -To do that, you need to comment out the definitions of -‘%bootstrap-guile’ and ‘%bootstrap-inputs’ in gnu/packages/bootstrap.scm -to force the use of Nixpkgs derivations. For instance, when porting to -‘i686-linux’, you should redefine these variables along these lines: - -#+BEGIN_SRC scheme - (define %bootstrap-guile - (nixpkgs-derivation "guile" "i686-linux")) - - (define %bootstrap-inputs - (compile-time-value - `(("libc" ,(nixpkgs-derivation "glibc" "i686-linux")) - ,@(map (lambda (name) - (list name (nixpkgs-derivation name "i686-linux"))) - '("gnutar" "gzip" "bzip2" "xz" "patch" - "coreutils" "gnused" "gnugrep" "bash" - "gawk" ; used by `config.status' - "gcc" "binutils"))))) -#+END_SRC - -That should allow the distro to be bootstrapped. - -Then, the tarballs containing the initial binaries of Guile, Coreutils, -GCC, libc, etc. need to be built. To that end, run the following -commands: - -#+BEGIN_SRC sh - ./pre-inst-env guix build -K \ - -e '(@ (gnu packages make-bootstrap) %bootstrap-tarballs)' \ - --system=i686-linux - -#+END_SRC - -These should build tarballs containing statically-linked tools usable on -that system. - -In the source tree, you need to install binaries for ‘mkdir’, ‘bash’, -‘tar’, and ‘xz’ under ‘gnu/packages/bootstrap/i686-linux’. These -binaries can be extracted from the static-binaries tarball built above. - -A rule for ‘gnu/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 ‘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. - -This should be enough to bootstrap the distro without resorting to -Nixpkgs. - -** When the platform is *not* supported by Nixpkgs - -In that case, the bootstrap binaries should be built using whatever -tools are available on the target platform. That is, the tarballs and -binaries show above must first be built manually, using the available -tools. - -They should have the same properties as those built by the Guix recipes -shown above. For example, all the binaries (except for glibc) must be -statically-linked; the bootstrap Guile must be relocatable (see patch in -the Guix distro); the static-binaries tarball must contain the same -programs (Coreutils, Grep, sed, Awk, etc.); and so on. diff --git a/doc/guix.texi b/doc/guix.texi index 4d674b1b20..c217416b0a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1434,6 +1434,7 @@ tools that help users exert that freedom. @menu * Package Modules:: Packages from the programmer's viewpoint. * Bootstrapping:: GNU/Linux built from scratch. +* Porting:: Targeting another platform or kernel. @end menu Building this distribution is a cooperative effort, and you are invited @@ -1588,6 +1589,35 @@ unknown, but if you would like to investigate further (and have significant computational and storage resources to do so), then let us know. +@node Porting +@section Porting to a New Platform + +As discussed above, the GNU distribution is self-contained, and +self-containment is achieved by relying on pre-built ``bootstrap +binaries'' (@pxref{Bootstrapping}). These binaries are specific to an +operating system kernel, CPU architecture, and application binary +interface (ABI). Thus, to port the distribution to a platform that is +not yet supported, one must build those bootstrap binaries, and update +the @code{(gnu packages bootstrap)} module to use them on that platform. + +Fortunately, Guix can @emph{cross compile} those bootstrap binaries. +When everything goes well, and assuming the GNU tool chain supports the +target platform, this can be as simple as running a command like this +one: + +@example +guix build --target=armv5tel-linux-gnueabi bootstrap-tarballs +@end example + +In practice, there may be some complications. First, it may be that the +extended GNU triplet that specifies an ABI (like the @code{eabi} suffix +above) is not recognized by all the GNU tools. Typically, glibc +recognizes some of these, whereas GCC uses an extra @code{--with-abi} +configure flag (see @code{gcc.scm} for examples of how to handle this.) +Second, some of the required packages could fail to build for that +platform. Lastly, the generated binaries could be broken for some +reason. + @c ********************************************************************* @node Contributing From b208a005015e9a243695146c21317b8f0d48809e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 7 Jul 2013 23:26:31 +0200 Subject: [PATCH 38/43] doc: Move the packaging guidelines to the manual. * HACKING (Packaging Guidelines): Remove. * doc/guix.texi (Packaging Guidelines): New node. --- HACKING | 10 ---------- doc/guix.texi | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/HACKING b/HACKING index 60851e1f2f..9d8960c1ab 100644 --- a/HACKING +++ b/HACKING @@ -40,16 +40,6 @@ addition to that, you must not miss [[http://www.emacswiki.org/emacs/ParEdit][Pa directly operate on the syntax tree, such as raising an s-expression or wrapping it, swallowing or rejecting the following s-expression, etc. -* Packaging Guidelines - -The GNU distribution is about respecting the freedom of users. Consequently, -it contains only free software as defined at -http://www.gnu.org/philosophy/free-sw.html . - -In addition, we follow the [[http://www.gnu.org/distros/free-system-distribution-guidelines.html][free software distribution guidelines]]. Among other -things, this means that the distribution tries hard not to steer users towards -obtaining information about non-free software. - * Adding new packages Package recipes in Guix look like this: diff --git a/doc/guix.texi b/doc/guix.texi index c217416b0a..d1c9056b54 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1432,6 +1432,7 @@ tight integration of GNU components, and an emphasis on programs and tools that help users exert that freedom. @menu +* Packaging Guidelines:: What goes into the distribution. * Package Modules:: Packages from the programmer's viewpoint. * Bootstrapping:: GNU/Linux built from scratch. * Porting:: Targeting another platform or kernel. @@ -1440,6 +1441,26 @@ tools that help users exert that freedom. Building this distribution is a cooperative effort, and you are invited to join! @ref{Contributing}, for information about how you can help. +@node Packaging Guidelines +@section Packaging Guidelines + +@c Adapted from http://www.gnu.org/philosophy/philosophy.html. + +The GNU operating system has been developed so that users can have +freedom in their computing. GNU is @dfn{free software}, meaning that +users have the @url{http://www.gnu.org/philosophy/free-sw.html,four +essential freedoms}: to run the program, to study and change the program +in source code form, to redistribute exact copies, and to distribute +modified versions. Packages found in the GNU distribution provide only +software that conveys these four freedoms. + +In addition, the GNU distribution follow the +@url{http://www.gnu.org/distros/free-system-distribution-guidelines.html,free +software distribution guidelines}. Among other things, these guidelines +reject non-free firmware, recommendations of non-free software, and +discuss ways to deal with trademarks and patents. + + @node Package Modules @section Package Modules From acf428dd0bbf590f01c32dd9c63f2dfc3d474eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 7 Jul 2013 23:40:36 +0200 Subject: [PATCH 39/43] gnu: tzdata: Upgrade to 2013d. * gnu/packages/base.scm (tzdata): Upgrade to 2013d. --- gnu/packages/base.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index a5c6a70603..9e453522ec 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -511,7 +511,7 @@ with the Linux kernel.") (define-public tzdata (package (name "tzdata") - (version "2013c") + (version "2013d") (source (origin (method url-fetch) (uri (string-append @@ -519,7 +519,7 @@ with the Linux kernel.") version ".tar.gz")) (sha256 (base32 - "11swq6fg20m2dh520qcr8vb23gqhzbvqhizx8wifnmci4gmsg5z5")))) + "08jzd8y2xkgd89wqrv3835pqr48yjabaczxr2rmg42zaykr11an0")))) (build-system gnu-build-system) (arguments '(#:tests? #f @@ -566,7 +566,7 @@ with the Linux kernel.") version ".tar.gz")) (sha256 (base32 - "1w6nkdwhi6k9llshp4baac1yj43jqf3apdf6n66i0wvjj8qyjvp4")))))) + "13xd30ngwhqmj7w216ghd5knvg047hzpc0xca5l297g5cwb62hza")))))) (home-page "http://www.iana.org/time-zones") (synopsis "Database of current and historical time zones") (description "The Time Zone Database (often called tz or zoneinfo) From 2c9143a1f37ee9fdc2fc03c42f07d4b1eb9eada7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 8 Jul 2013 00:13:15 +0200 Subject: [PATCH 40/43] gnu: gettext: Upgrade to 0.18.3. * gnu/packages/gettext.scm (gettext): Upgrade to 0.18.3. Remove patch. Change `patch-tests' phase to use (which "sh'); keep it regardless of whether we're cross compiling. --- gnu-system.am | 1 - gnu/packages/gettext.scm | 53 ++++++------- .../patches/gettext-gets-undeclared.patch | 77 ------------------- 3 files changed, 22 insertions(+), 109 deletions(-) delete mode 100644 gnu/packages/patches/gettext-gets-undeclared.patch diff --git a/gnu-system.am b/gnu-system.am index 96b87e6a72..3b86b63a6d 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -182,7 +182,6 @@ dist_patch_DATA = \ gnu/packages/patches/flex-bison-tests.patch \ gnu/packages/patches/gawk-shell.patch \ gnu/packages/patches/gcc-cross-environment-variables.patch \ - gnu/packages/patches/gettext-gets-undeclared.patch \ gnu/packages/patches/glib-tests-desktop.patch \ gnu/packages/patches/glib-tests-homedir.patch \ gnu/packages/patches/glib-tests-prlimit.patch \ diff --git a/gnu/packages/gettext.scm b/gnu/packages/gettext.scm index c838f9c0a6..399d96784c 100644 --- a/gnu/packages/gettext.scm +++ b/gnu/packages/gettext.scm @@ -26,39 +26,30 @@ (define-public gettext (package (name "gettext") - (version "0.18.1.1") - (source - (origin - (method url-fetch) - (uri (string-append "mirror://gnu/gettext/gettext-" - version ".tar.gz")) - (sha256 - (base32 - "1sa3ch12qxa4h3ya6hkz119yclcccmincl9j20dhrdx5mykp3b4k")))) + (version "0.18.3") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/gettext/gettext-" + version ".tar.gz")) + (sha256 + (base32 + "0j7rp56c61j4k1bz1xdc041hzv7186yyzhbp95fmc0zq7l2c3wrn")))) (build-system gnu-build-system) (arguments - `(#:patches (list (assoc-ref %build-inputs "patch/gets")) - #:phases ,(if (%current-target-system) - '%standard-phases - '(alist-cons-before - 'check 'patch-tests - (lambda* (#:key inputs #:allow-other-keys) - ;; TODO: Use (which "sh"). - (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")))) - (home-page - "http://www.gnu.org/software/gettext/") + `(#:phases (alist-cons-before + 'check 'patch-tests + (lambda* (#:key inputs #:allow-other-keys) + (let ((bash (which "sh"))) + (substitute* (find-files "gettext-tools/tests" + "^msgexec-[0-9]") + (("#![[:blank:]]/bin/sh") + (format #f "#!~a" bash))) + (substitute* (find-files "gettext-tools/gnulib-tests" + "posix_spawn") + (("/bin/sh") + bash)))) + %standard-phases))) + (home-page "http://www.gnu.org/software/gettext/") (synopsis "Tools and documentation for translation") (description "Usually, programs are written and documented in English, and use diff --git a/gnu/packages/patches/gettext-gets-undeclared.patch b/gnu/packages/patches/gettext-gets-undeclared.patch deleted file mode 100644 index 072a8d94ab..0000000000 --- a/gnu/packages/patches/gettext-gets-undeclared.patch +++ /dev/null @@ -1,77 +0,0 @@ -This patch is needed to allow builds with newer versions of -the GNU libc (2.16+). - -The upstream fix was: - - commit 66712c23388e93e5c518ebc8515140fa0c807348 - Author: Eric Blake - Date: Thu Mar 29 13:30:41 2012 -0600 - - stdio: don't assume gets any more - - Gnulib intentionally does not have a gets module, and now that C11 - and glibc have dropped it, we should be more proactive about warning - any user on a platform that still has a declaration of this dangerous - interface. - - * m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets - support. - * modules/stdio (Makefile.am): Likewise. - * lib/stdio-read.c (gets): Likewise. - * tests/test-stdio-c++.cc: Likewise. - * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment. - * lib/stdio.in.h (gets): Make warning occur in more places. - * doc/posix-functions/gets.texi (gets): Update documentation. - Reported by Christer Solskogen. - - Signed-off-by: Eric Blake - -This patch just gets rid of the offending part. - ---- gettext-0.18.1.1/gettext-tools/libgettextpo/stdio.in.h-orig 2012-11-24 01:13:14.000000000 +0400 -+++ gettext-0.18.1.1/gettext-tools/libgettextpo/stdio.in.h 2012-11-24 01:13:46.000000000 +0400 -@@ -137,12 +137,6 @@ - "use gnulib module fflush for portable POSIX compliance"); - #endif - --/* It is very rare that the developer ever has full control of stdin, -- so any use of gets warrants an unconditional warning. Assume it is -- always declared, since it is required by C89. */ --#undef gets --_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); -- - #if @GNULIB_FOPEN@ - # if @REPLACE_FOPEN@ - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - ---- gettext-0.18.1.1/gettext-runtime/gnulib-lib/stdio.in.h-orig 2012-11-24 00:26:49.000000000 +0400 -+++ gettext-0.18.1.1/gettext-runtime/gnulib-lib/stdio.in.h 2012-11-24 00:45:54.000000000 +0400 -@@ -137,12 +137,6 @@ - "use gnulib module fflush for portable POSIX compliance"); - #endif - --/* It is very rare that the developer ever has full control of stdin, -- so any use of gets warrants an unconditional warning. Assume it is -- always declared, since it is required by C89. */ --#undef gets --_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); -- - #if @GNULIB_FOPEN@ - # if @REPLACE_FOPEN@ - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - ---- gettext-0.18.1.1/gettext-tools/gnulib-lib/stdio.in.h-orig 2012-11-24 01:00:26.000000000 +0400 -+++ gettext-0.18.1.1/gettext-tools/gnulib-lib/stdio.in.h 2012-11-24 01:00:53.000000000 +0400 -@@ -137,12 +137,6 @@ - "use gnulib module fflush for portable POSIX compliance"); - #endif - --/* It is very rare that the developer ever has full control of stdin, -- so any use of gets warrants an unconditional warning. Assume it is -- always declared, since it is required by C89. */ --#undef gets --_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); -- - #if @GNULIB_FOPEN@ - # if @REPLACE_FOPEN@ - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) From 4ca0cefd1bb4dcc0df29a5e6d57d79b421e10951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 8 Jul 2013 22:37:02 +0200 Subject: [PATCH 41/43] build: Set the umask to 0022 before running the daemon for tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test-env.in: Run "umask 0022" before running the daemon. Reported by Matthew Lien - 練喆明 --- test-env.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test-env.in b/test-env.in index 64440fb86a..e6b13c271e 100644 --- a/test-env.in +++ b/test-env.in @@ -56,6 +56,10 @@ then # Do that because store.scm calls `canonicalize-path' on it. mkdir -p "$NIX_STORE_DIR" + # Set the umask to avoid "suspicious ownership or permission" errors. + # See . + umask 0022 + # Launch the daemon without chroot support because is may be # unavailable, for instance if we're not running as root. "@abs_top_builddir@/pre-inst-env" \ From 6e721c4d0228bef1947d50dc1eeed19eeb4d12f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 8 Jul 2013 23:33:45 +0200 Subject: [PATCH 42/43] doc: Add "Packages with Multiple Outputs" section. * doc/guix.texi (Packages with Multiple Outputs): New node. (Invoking guix package): Refer to it. --- doc/guix.texi | 56 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index d1c9056b54..003b157387 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -399,6 +399,7 @@ management tools it provides. @menu * Features:: How Guix will make your life brighter. * Invoking guix package:: Package installation, removal, etc. +* Packages with Multiple Outputs:: Single source package, multiple outputs. * Invoking guix gc:: Running the garbage collector. * Invoking guix pull:: Fetching the latest Guix and distribution. @end menu @@ -507,7 +508,8 @@ Install @var{package}. such as @code{guile-1.8.8}. If no version number is specified, the newest available version will be selected. 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{binutils-2.22:lib}. +package, as in @code{gcc:doc} or @code{binutils-2.22:lib} +(@pxref{Packages with Multiple Outputs}). @cindex propagated inputs Sometimes packages have @dfn{propagated inputs}: these are dependencies @@ -658,12 +660,58 @@ List packages currently available in the software distribution installed packages whose name matches @var{regexp}. For each package, print the following items separated by tabs: its name, -its version string, the parts of the package (@code{out} for the main -files, @code{lib} for libraries and possibly headers, etc.), and the -source location of its definition. +its version string, the parts of the package (@pxref{Packages with +Multiple Outputs}), and the source location of its definition. @end table +@node Packages with Multiple Outputs +@section Packages with Multiple Outputs + +@cindex multiple-output packages +@cindex package outputs + +Often, packages defined in Guix have a single @dfn{output}---i.e., the +source package leads exactly one directory in the store. When running +@command{guix package -i glibc}, one installs the default output of the +GNU libc package; the default output is called @code{out}, but its name +can be omitted as shown in this command. In this particular case, the +default output of @code{glibc} contains all the C header files, shared +libraries, static libraries, Info documentation, and other supporting +files. + +Sometimes it is more appropriate to separate the various types of files +produced from a single source package into separate outputs. For +instance, the GLib C library (used by GTK+ and related packages) +installs more than 20 MiB of reference documentation as HTML pages. +To save space for users who do not need it, the documentation goes to a +separate output, called @code{doc}. To install the main GLib output, +which contains everything but the documentation, one would run: + +@example +guix package -i glib +@end example + +The command to install its documentation is: + +@example +guix package -i glib:doc +@end example + +Some packages install programs with different ``dependency footprints''. +For instance, the WordNet package install both command-line tools and +graphical user interfaces (GUIs). The former depend solely on the C +library, whereas the latter depend on Tcl/Tk and the underlying X +libraries. In this case, we leave the command-line tools in the default +output, whereas the GUIs are in a separate output. This allows users +who do not need the GUIs to save space. + +There are several such multiple-output packages in the GNU distribution. +Other conventional output names are @code{lib} for libraries and +possibly header files, and @code{bin} for stand-alone programs. The +outputs of a packages are listed in the third column of the output of +@command{guix package --list-available} (@pxref{Invoking guix package}). + @node Invoking guix gc @section Invoking @command{guix gc} From 91ef73d4642658829facee25ffdc91a48d6ccf73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 9 Jul 2013 00:24:54 +0200 Subject: [PATCH 43/43] doc: Add "Installing Debugging Files". * doc/guix.texi (Installing Debugging Files): New node. (Packages with Multiple Outputs): Add cross-reference. --- doc/guix.texi | 69 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 003b157387..0eac8ea277 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -707,10 +707,12 @@ output, whereas the GUIs are in a separate output. This allows users who do not need the GUIs to save space. There are several such multiple-output packages in the GNU distribution. -Other conventional output names are @code{lib} for libraries and -possibly header files, and @code{bin} for stand-alone programs. The -outputs of a packages are listed in the third column of the output of -@command{guix package --list-available} (@pxref{Invoking guix package}). +Other conventional output names include @code{lib} for libraries and +possibly header files, @code{bin} for stand-alone programs, and +@code{debug} for debugging information (@pxref{Installing Debugging +Files}). The outputs of a packages are listed in the third column of +the output of @command{guix package --list-available} (@pxref{Invoking +guix package}). @node Invoking guix gc @@ -1481,6 +1483,7 @@ tools that help users exert that freedom. @menu * Packaging Guidelines:: What goes into the distribution. +* Installing Debugging Files:: Feeding the debugger. * Package Modules:: Packages from the programmer's viewpoint. * Bootstrapping:: GNU/Linux built from scratch. * Porting:: Targeting another platform or kernel. @@ -1509,6 +1512,64 @@ reject non-free firmware, recommendations of non-free software, and discuss ways to deal with trademarks and patents. +@node Installing Debugging Files +@section Installing Debugging Files + +Program binaries, as produced by the GCC compilers for instance, are +typically written in the ELF format, with a section containing +@dfn{debugging information}. Debugging information is what allows the +debugger, GDB, to map binary code to source code; it is required to +debug a compiled program in good conditions. + +The problem with debugging information is that is takes up a fair amount +of disk space. For example, debugging information for the GNU C Library +weighs in at more than 60 MiB. Thus, as a user, keeping all the +debugging info of all the installed programs is usually not an option. +Yet, space savings should not come at the cost of an impediment to +debugging---especially in the GNU system, which should make it easier +for users to exert their computing freedom (@pxref{GNU Distribution}). + +Thankfully, the GNU Binary Utilities (Binutils) and GDB provide a +mechanism that allows users to get the best of both worlds: debugging +information can be stripped from the binaries and stored in separate +files. GDB is then able to load debugging information from those files, +when they are available (@pxref{Separate Debug Files,,, gdb, Debugging +with GDB}). + +The GNU distribution takes advantage of this by storing debugging +information in the @code{lib/debug} sub-directory of a separate package +output unimaginatively called @code{debug} (@pxref{Packages with +Multiple Outputs}). Users can choose to install the @code{debug} output +of a package when they need it. For instance, the following command +installs the debugging information for the GNU C Library and for GNU +Guile: + +@example +guix package -i glibc:debug -i guile:debug +@end example + +GDB must then be told to look for debug files in the user's profile, by +setting the @code{debug-file-directory} variable (consider setting it +from the @file{~/.gdbinit} file, @pxref{Startup,,, gdb, Debugging with +GDB}): + +@example +(gdb) set debug-file-directory ~/.guix-profile/lib/debug +@end example + +From there on, GDB will pick up debugging information from the +@code{.debug} files under @file{~/.guix-profile/lib/debug}. + +@c XXX: keep me up-to-date +The @code{debug} output mechanism in Guix is implemented by the +@code{gnu-build-system} (@pxref{Defining Packages}). Currently, it is +opt-in---debugging information is available only for those packages +whose definition explicitly declares a @code{debug} output. This may be +changed to opt-out in the future, if our build farm servers can handle +the load. To check whether a package has a @code{debug} output, use +@command{guix package --list-available} (@pxref{Invoking guix package}). + + @node Package Modules @section Package Modules