summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/acl.scm11
-rw-r--r--gnu/packages/attr.scm18
-rw-r--r--gnu/packages/base.scm20
-rw-r--r--gnu/packages/bash.scm9
-rw-r--r--gnu/packages/bdw-gc.scm24
-rw-r--r--gnu/packages/bootstrap.scm5
-rw-r--r--gnu/packages/compression.scm4
-rw-r--r--gnu/packages/cross-base.scm38
-rw-r--r--gnu/packages/gawk.scm24
-rw-r--r--gnu/packages/gcc.scm259
-rw-r--r--gnu/packages/gettext.scm53
-rw-r--r--gnu/packages/guile.scm17
-rw-r--r--gnu/packages/ld-wrapper.scm29
-rw-r--r--gnu/packages/libffi.scm16
-rw-r--r--gnu/packages/libsigsegv.scm4
-rw-r--r--gnu/packages/linux.scm10
-rw-r--r--gnu/packages/make-bootstrap.scm214
-rw-r--r--gnu/packages/multiprecision.scm7
-rw-r--r--gnu/packages/ncurses.scm2
-rw-r--r--gnu/packages/patches/gettext-gets-undeclared.patch77
-rw-r--r--gnu/packages/readline.scm4
21 files changed, 409 insertions, 436 deletions
diff --git a/gnu/packages/acl.scm b/gnu/packages/acl.scm
index 54c9116baf..dde9ac4f34 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")
@@ -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 3fb15d235f..3108a9072a 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.
@@ -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")
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 85380549ff..9e453522ec 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
@@ -293,9 +294,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
@@ -318,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
@@ -405,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
@@ -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)
@@ -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/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/bdw-gc.scm b/gnu/packages/bdw-gc.scm
index e119fc0bb9..7cce9671d1 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,9 +33,13 @@
                   version ".tar.gz"))
             (sha256
              (base32
-              "05jwadjbrv8pr7z9cb4miskicxqpxm0pca4h2rg5cgbpajr2bx7b"))))
+              "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")))
+   (outputs '("out" "debug"))
    (synopsis "The Boehm-Demers-Weiser conservative garbage collector
 for C and C++")
    (description
@@ -58,17 +62,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"))))))
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/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
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 5c46d00b20..28224a1c40 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 <http://sourceware.org/ml/binutils/2013-05/msg00312.html>.
+                        ;;
+                        ;; 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
@@ -65,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-")
@@ -84,9 +83,10 @@ 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)
+                           ,@(gcc-configure-flags-for-triplet target)
                            ,@(if libc
                                  '()
                                  `( ;; Disable features not needed at this stage.
@@ -175,7 +175,8 @@ GCC that does not target a libc; otherwise, target that libc."
             ;; <http://lists.fedoraproject.org/pipermail/arm/2010-August/000663.html>
             ;; 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))
@@ -247,10 +250,11 @@ XBINUTILS and the cross tool chain."
                       (string-append linux "/include"))
               #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)))))
 
 
 ;;;
@@ -258,7 +262,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))))
diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 444fa5e556..aff856d9f3 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -27,35 +27,37 @@
 (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
 
-      ;; Work around test failure on Cygwin.
-      #:tests? ,(not (string=? (%current-system) "i686-cygwin"))
-
       #:phases (alist-cons-before
                 'configure 'set-shell-file-name
                 (lambda* (#:key inputs #:allow-other-keys)
                   ;; Refer to the right shell.
-                  ;; FIXME: Remove `else' arm upon core-updates.
                   (let ((bash (assoc-ref inputs "bash")))
                     (substitute* "io.c"
                       (("/bin/sh")
-                       (string-append bash "/bin/bash")))))
-                ,(if (%current-target-system)
-                     '%standard-cross-phases
-                     '%standard-phases))))
+                       (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)
 
-             ;; TODO: On next core-updates, make Bash input unconditional.
              ,@(if (%current-target-system)
                    `(("bash" ,bash))
                    '())))
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index b754b4b7fb..571526ebdf 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -23,138 +23,185 @@
   #: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))
+  #: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
+  (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")))
+
+                   ;; 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")
-     (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)))
 
-          "--with-local-prefix=/no-gcc-local-prefix"
+      ;; GCC is one of the few packages that doesn't ship .info files.
+      (native-inputs `(("texinfo" ,texinfo)))
 
-          ,(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"))))
+      (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"))))
 
-        #: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.
+         #: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)))))
+                ;; 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
   (package (inherit gcc-4.7)
diff --git a/gnu/packages/gettext.scm b/gnu/packages/gettext.scm
index e22b1ba6ff..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-cross-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/guile.scm b/gnu/packages/guile.scm
index b53f3eb770..772776349e 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -138,29 +138,18 @@ extensible.  It supports many SRFIs.")
 
    (self-native-input? #t)
 
+   (outputs '("out" "debug"))
+
    (arguments
     `(#: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"
                       (("/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/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 <ludo@gnu.org>
+;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; 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.,
diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index f7d4a8c908..e4a2761273 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,18 +46,14 @@
                              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)
-                            ,@(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)))
+    (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/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 <asm/sigcontext\\.h>") "")))
-                    ,(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/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 9b16f37031..97362baff2 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
@@ -239,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
@@ -330,7 +355,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 +369,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 +377,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)
@@ -363,12 +393,14 @@ 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))
-	       ("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.
@@ -410,58 +442,55 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
   ;; 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)
-		  (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")
-
-		     #: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)
-
-		     ;; 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)))))
+  (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"
+                                         ,@(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")
+
+                                   ;; 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"))
+
+                     ;; 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
@@ -490,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."
@@ -498,9 +528,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)))
@@ -518,7 +548,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")
                                "."))))))))))
 
diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm
index 19c32352b3..16383d1ec1 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,9 +35,10 @@
                             version ".tar.xz"))
             (sha256
              (base32
-              "1hili06lcf0clg5qfvz7knm6pmj6ab54yhsvskp1mdny5xw4vmjb"))))
+              "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)))            ; <mpfr.h> refers to <gmp.h>
    (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)              ; <mpc.h> refers to both
                         ("mpfr" ,mpfr)))
    (synopsis "C library for arbitrary precision complex arithmetic")
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/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 <eblake@redhat.com>
-  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 <eblake@redhat.com>
-
-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)
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