summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/acl.scm5
-rw-r--r--gnu/packages/attr.scm5
-rw-r--r--gnu/packages/autotools.scm54
-rw-r--r--gnu/packages/base.scm211
-rw-r--r--gnu/packages/bootstrap.scm50
-rwxr-xr-xgnu/packages/bootstrap/mips64el-linux/bashbin0 -> 1409080 bytes
-rwxr-xr-xgnu/packages/bootstrap/mips64el-linux/mkdirbin0 -> 698500 bytes
-rwxr-xr-xgnu/packages/bootstrap/mips64el-linux/tarbin0 -> 1283708 bytes
-rwxr-xr-xgnu/packages/bootstrap/mips64el-linux/xzbin0 -> 851736 bytes
-rw-r--r--gnu/packages/cdrom.scm4
-rw-r--r--gnu/packages/cross-base.scm9
-rw-r--r--gnu/packages/fdisk.scm5
-rw-r--r--gnu/packages/gcc.scm34
-rw-r--r--gnu/packages/gd.scm5
-rw-r--r--gnu/packages/gdb.scm7
-rw-r--r--gnu/packages/gettext.scm28
-rw-r--r--gnu/packages/gkrellm.scm5
-rw-r--r--gnu/packages/glib.scm7
-rw-r--r--gnu/packages/gnunet.scm5
-rw-r--r--gnu/packages/grub.scm4
-rw-r--r--gnu/packages/libffi.scm4
-rw-r--r--gnu/packages/linux.scm10
-rw-r--r--gnu/packages/lsh.scm3
-rw-r--r--gnu/packages/m4.scm7
-rw-r--r--gnu/packages/make-bootstrap.scm45
-rw-r--r--gnu/packages/maths.scm16
-rw-r--r--gnu/packages/mit-krb5.scm9
-rw-r--r--gnu/packages/mp3.scm3
-rw-r--r--gnu/packages/multiprecision.scm4
-rw-r--r--gnu/packages/nano.scm5
-rw-r--r--gnu/packages/oggvorbis.scm3
-rw-r--r--gnu/packages/parted.scm5
-rw-r--r--gnu/packages/patches/alsa-lib-mips-atomic-fix.patch42
-rw-r--r--gnu/packages/patches/binutils-loongson-madd-fix.patch44
-rw-r--r--gnu/packages/patches/binutils-loongson-workaround.patch34
-rw-r--r--gnu/packages/patches/gd-mips64-deplibs-fix.patch17
-rw-r--r--gnu/packages/patches/gdb-loongson-madd-fix.patch44
-rw-r--r--gnu/packages/patches/glibc-make-4.0.patch12
-rw-r--r--gnu/packages/patches/glibc-no-ld-so-cache.patch53
-rw-r--r--gnu/packages/patches/libffi-mips-n32-fix.patch21
-rw-r--r--gnu/packages/patches/libmad-mips-newgcc.patch16
-rw-r--r--gnu/packages/patches/liboop-mips64-deplibs-fix.patch17
-rw-r--r--gnu/packages/patches/libtheora-config-guess.patch37
-rw-r--r--gnu/packages/patches/libtool-skip-tests-for-mips.patch12
-rw-r--r--gnu/packages/patches/mit-krb5-init-fix.patch18
-rw-r--r--gnu/packages/patches/pspp-tests.patch13
-rw-r--r--gnu/packages/patches/tar-gets-undeclared.patch26
-rw-r--r--gnu/packages/perl.scm5
-rw-r--r--gnu/packages/readline.scm11
-rw-r--r--gnu/packages/system.scm5
-rw-r--r--gnu/packages/version-control.scm7
-rw-r--r--gnu/packages/vpn.scm5
-rw-r--r--gnu/packages/w3m.scm5
-rw-r--r--gnu/packages/wget.scm5
-rw-r--r--gnu/packages/xorg.scm7
55 files changed, 691 insertions, 317 deletions
diff --git a/gnu/packages/acl.scm b/gnu/packages/acl.scm
index dde9ac4f34..37c0b71dc9 100644
--- a/gnu/packages/acl.scm
+++ b/gnu/packages/acl.scm
@@ -20,8 +20,7 @@
   #:use-module (guix licenses)
   #:use-module (gnu packages attr)
   #:use-module (gnu packages perl)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'guix:))
+  #:use-module (gnu packages gettext)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu))
@@ -62,7 +61,7 @@
                     '()
                     `(("perl" ,perl)))))
     (native-inputs
-     `(("gettext" ,guix:gettext)))
+     `(("gettext" ,gnu-gettext)))
 
     (home-page
      "http://savannah.nongnu.org/projects/acl")
diff --git a/gnu/packages/attr.scm b/gnu/packages/attr.scm
index 3108a9072a..f4f6c46642 100644
--- a/gnu/packages/attr.scm
+++ b/gnu/packages/attr.scm
@@ -20,8 +20,7 @@
 (define-module (gnu packages attr)
   #:use-module (guix licenses)
   #:use-module (gnu packages perl)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'guix:))
+  #:use-module (gnu packages gettext)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu))
@@ -75,7 +74,7 @@
          '()
          `(("perl" ,perl))))
     (native-inputs
-     `(("gettext" ,guix:gettext)))
+     `(("gettext" ,gnu-gettext)))
 
     (home-page "http://savannah.nongnu.org/projects/attr/")
     (synopsis "Library and tools for manipulating extended attributes")
diff --git a/gnu/packages/autotools.scm b/gnu/packages/autotools.scm
index ab0c7dcbdf..90f80872ed 100644
--- a/gnu/packages/autotools.scm
+++ b/gnu/packages/autotools.scm
@@ -216,7 +216,10 @@ simplifying the entire process for the developer.")
                                  version ".tar.gz"))
              (sha256
               (base32
-               "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk"))))
+               "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk"))
+             (patches
+              (list (search-patch "libtool-skip-tests.patch")
+                    (search-patch "libtool-skip-tests-for-mips.patch")))))
     (build-system gnu-build-system)
     (native-inputs `(("m4" ,m4)
                      ("perl" ,perl)))
@@ -228,33 +231,30 @@ simplifying the entire process for the developer.")
                "out"))                       ; libltdl.so, ltdl.h, etc.
 
     (arguments
-     `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests"))
-       ,@(if (%current-target-system)
-             '()                        ; no `check' phase when cross-building
-             '(#:phases (alist-cons-before
-                         'check 'pre-check
-                         (lambda* (#:key inputs #:allow-other-keys)
-                           ;; Run the test suite in parallel, if possible.
-                           (let ((ncores
-                                  (cond
-                                   ((getenv "NIX_BUILD_CORES")
-                                    =>
-                                    (lambda (n)
-                                      (if (zero? (string->number n))
-                                          (number->string (current-processor-count))
-                                          n)))
-                                   (else "1"))))
-                             (setenv "TESTSUITEFLAGS"
-                                     (string-append "-j" ncores)))
+     (if (%current-target-system)
+         '()                            ; no `check' phase when cross-building
+         '(#:phases (alist-cons-before
+                     'check 'pre-check
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       ;; Run the test suite in parallel, if possible.
+                       (let ((ncores
+                              (cond
+                               ((getenv "NIX_BUILD_CORES")
+                                =>
+                                (lambda (n)
+                                  (if (zero? (string->number n))
+                                      (number->string (current-processor-count))
+                                      n)))
+                               (else "1"))))
+                         (setenv "TESTSUITEFLAGS"
+                                 (string-append "-j" ncores)))
 
-                           ;; Path references to /bin/sh.
-                           (let ((bash (assoc-ref inputs "bash")))
-                             (substitute* "tests/testsuite"
-                               (("/bin/sh")
-                                (string-append bash "/bin/bash")))))
-                         %standard-phases)))))
-    (inputs `(("patch/skip-tests"
-               ,(search-patch "libtool-skip-tests.patch"))))
+                       ;; Path references to /bin/sh.
+                       (let ((bash (assoc-ref inputs "bash")))
+                         (substitute* "tests/testsuite"
+                           (("/bin/sh")
+                            (string-append bash "/bin/bash")))))
+                     %standard-phases))))
     (synopsis "Generic shared library support tools")
     (description
      "Libtool is a script to help in the creation of shared libraries.  By
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 78798e2b00..e835b418b2 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -68,14 +68,14 @@ command-line arguments, multiple languages, and so on.")
 (define-public grep
   (package
    (name "grep")
-   (version "2.14")
+   (version "2.15")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/grep/grep-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "1qbjb1l7f9blckc5pqy8jlf6482hpx4awn2acmhyf5mv9wfq03p7"))))
+              "052kjsafg2x7n2zpy3iw4pzwf8fdfng5pcvi9v3chx3rb1786nmz"))))
    (build-system gnu-build-system)
    (synopsis "Print lines matching a pattern")
    (description
@@ -125,18 +125,15 @@ is often used for substituting text patterns in a stream.")
 (define-public tar
   (package
    (name "tar")
-   (version "1.26")
+   (version "1.27.1")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/tar/tar-"
                                 version ".tar.bz2"))
             (sha256
              (base32
-              "0hbdkzmchq9ycr2x1pxqdcgdbaxksh8c6ac0jf75jajhcks6jlss"))))
+              "1iip0fk0wqhxb0jcwphz43r4fxkx1y7mznnhmlvr618jhp7b63wv"))))
    (build-system gnu-build-system)
-   (inputs `(("patch/gets" ,(search-patch "tar-gets-undeclared.patch"))))
-   (arguments
-    `(#:patches (list (assoc-ref %build-inputs "patch/gets"))))
    (synopsis "Managing tar archives")
    (description
     "Tar provides the ability to create tar archives, as well as the
@@ -207,19 +204,15 @@ interactive means to merge two files.")
                                 version ".tar.gz"))
             (sha256
              (base32
-              "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3"))))
+              "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3"))
+            (patches (list (search-patch "findutils-absolute-paths.patch")))))
    (build-system gnu-build-system)
-   (native-inputs
-    `(("patch/absolute-paths"
-       ,(search-patch "findutils-absolute-paths.patch"))))
    (arguments
-    `(#:patches (list (assoc-ref %build-inputs "patch/absolute-paths"))
-
-      ;; Work around cross-compilation failure.
-      ;; See <http://savannah.gnu.org/bugs/?27299#comment1>.
-      ,@(if (%current-target-system)
-            '(#:configure-flags '("gl_cv_func_wcwidth_works=yes"))
-            '())))
+    ;; Work around cross-compilation failure.
+    ;; See <http://savannah.gnu.org/bugs/?27299#comment1>.
+    (if (%current-target-system)
+        '(#:configure-flags '("gl_cv_func_wcwidth_works=yes"))
+        '()))
    (synopsis "Operating on files matching given criteria")
    (description
     "Findutils supplies the basic file directory searching utilities of the
@@ -278,21 +271,20 @@ functionality beyond that which is outlined in the POSIX standard.")
 (define-public gnu-make
   (package
    (name "make")
-   (version "3.82")
+   (version "4.0")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/make/make-" version
                                 ".tar.bz2"))
             (sha256
              (base32
-              "0ri98385hsd7li6rh4l5afcq92v8l2lgiaz85wgcfh4w2wzsghg2"))))
+              "1nyvn8mknw0mf7727lprva3lisl1y0n03lvar342rrpdmz3qc1p6"))
+            (patches (list (search-patch "make-impure-dirs.patch")))))
    (build-system gnu-build-system)
-   (native-inputs
-    `(("patch/impure-dirs" ,(search-patch "make-impure-dirs.patch"))))
+   (inputs `(("guile" ,guile-2.0)))
    (outputs '("out" "debug"))
    (arguments
-    '(#:patches (list (assoc-ref %build-inputs "patch/impure-dirs"))
-      #:phases (alist-cons-before
+    '(#:phases (alist-cons-before
                 'build 'set-default-shell
                 (lambda* (#:key inputs #:allow-other-keys)
                   ;; Change the default shell from /bin/sh.
@@ -323,7 +315,10 @@ change.")
                                 version ".tar.bz2"))
             (sha256
              (base32
-              "15qhbkz3r266xaa52slh857qn3abw7rb2x2jnhpfrafpzrb4x4gy"))))
+              "15qhbkz3r266xaa52slh857qn3abw7rb2x2jnhpfrafpzrb4x4gy"))
+            (patches (list (search-patch "binutils-ld-new-dtags.patch")
+                           (search-patch "binutils-loongson-workaround.patch")
+                           (search-patch "binutils-loongson-madd-fix.patch")))))
    (build-system gnu-build-system)
 
    ;; Split Binutils in several outputs, mostly to avoid collisions in
@@ -332,11 +327,8 @@ change.")
               "lib"))                      ; libbfd.a, bfd.h, etc.
 
    ;; TODO: Add dependency on zlib + those for Gold.
-   (native-inputs
-    `(("patch/new-dtags" ,(search-patch "binutils-ld-new-dtags.patch"))))
    (arguments
-    `(#:patches (list (assoc-ref %build-inputs "patch/new-dtags"))
-      #:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
+    `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
                           ;; on GCC when bootstrapping.
                           "LDFLAGS=-static-libgcc"
 
@@ -367,7 +359,19 @@ archives.")
                                 version ".tar.xz"))
             (sha256
              (base32
-              "18spla703zav8dq9fw7rbzkyv9qfisxb26p7amg1x3wjh7iy3d1c"))))
+              "18spla703zav8dq9fw7rbzkyv9qfisxb26p7amg1x3wjh7iy3d1c"))
+            (snippet
+             ;; Disable 'ldconfig' and /etc/ld.so.cache.  The latter is
+             ;; required on LFS distros to avoid loading the distro's libc.so
+             ;; instead of ours.
+             '(substitute* "sysdeps/unix/sysv/linux/configure"
+                (("use_ldconfig=yes")
+                 "use_ldconfig=no")))
+            (modules '((guix build utils)))
+            (imported-modules modules)
+            (patches (map search-patch
+                          '("glibc-ldd-x86_64.patch"
+                            "glibc-make-4.0.patch")))))
    (build-system gnu-build-system)
 
    ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
@@ -382,8 +386,6 @@ archives.")
 
    (arguments
     `(#:out-of-source? #t
-      #:patches (list (assoc-ref %build-inputs "patch/ld.so.cache")
-                      (assoc-ref %build-inputs "patch/ldd"))
       #:configure-flags
       (list "--enable-add-ons"
             "--sysconfdir=/etc"
@@ -467,11 +469,7 @@ archives.")
                    (zero? (system* "make" "localedata/install-locales")))
                  %standard-phases))))
 
-   (inputs `(("patch/ld.so.cache"
-              ,(search-patch "glibc-no-ld-so-cache.patch"))
-             ("patch/ldd"
-              ,(search-patch "glibc-ldd-x86_64.patch"))
-             ("static-bash" ,(static-package bash-light))))
+   (inputs `(("static-bash" ,(static-package bash-light))))
    (synopsis "The GNU C Library")
    (description
     "Any Unix-like operating system needs a C library: the library which
@@ -569,6 +567,10 @@ and daylight-saving rules.")
             ((#:phases phases)
              `(alist-replace
                'build (lambda _
+                        ;; Don't attempt to build 'guile.c' since we don't
+                        ;; have Guile here.
+                        (substitute* "build.sh"
+                          (("guile\\.\\$\\{OBJEXT\\}") ""))
                         (zero? (system* "./build.sh")))
                (alist-replace
                 'install (lambda* (#:key outputs #:allow-other-keys)
@@ -645,7 +647,7 @@ identifier SYSTEM."
 
 (define gcc-boot0
   (package-with-bootstrap-guile
-   (package (inherit gcc-4.7)
+   (package (inherit gcc-4.8)
      (name "gcc-cross-boot0")
      (arguments
       `(#:guile ,%bootstrap-guile
@@ -655,7 +657,7 @@ identifier SYSTEM."
                    (ice-9 regex)
                    (srfi srfi-1)
                    (srfi srfi-26))
-        ,@(substitute-keyword-arguments (package-arguments gcc-4.7)
+        ,@(substitute-keyword-arguments (package-arguments gcc-4.8)
             ((#:configure-flags flags)
              `(append (list ,(string-append "--target=" (boot-triplet))
 
@@ -664,8 +666,18 @@ identifier SYSTEM."
 
                             ;; Disable features not needed at this stage.
                             "--disable-shared"
-                            "--enable-languages=c"
+                            "--enable-languages=c,c++"
+
+                            ;; libstdc++ cannot be built at this stage
+                            ;; ("Link tests are not allowed after
+                            ;; GCC_NO_EXECUTABLES.").
+                            "--disable-libstdc++-v3"
+
+                            "--disable-threads"
                             "--disable-libmudflap"
+                            "--disable-libatomic"
+                            "--disable-libsanitizer"
+                            "--disable-libitm"
                             "--disable-libgomp"
                             "--disable-libssp"
                             "--disable-libquadmath"
@@ -692,24 +704,7 @@ identifier SYSTEM."
                    ,@(map (lambda (lib)
                             `(symlink ,(package-full-name lib)
                                       ,(package-name lib)))
-                          (list gmp mpfr mpc))
-
-                   ;; MPFR headers/lib are found under $(MPFR)/src, but
-                   ;; `configure' wrongfully tells MPC too look under
-                   ;; $(MPFR), so fix that.
-                   (substitute* "configure"
-                     (("extra_mpc_mpfr_configure_flags(.+)--with-mpfr-include=([^/]+)/mpfr(.*)--with-mpfr-lib=([^ ]+)/mpfr"
-                       _ equals include middle lib)
-                      (string-append "extra_mpc_mpfr_configure_flags" equals
-                                     "--with-mpfr-include=" include
-                                     "/mpfr/src" middle
-                                     "--with-mpfr-lib=" lib
-                                     "/mpfr/src"))
-                     (("gmpinc='-I([^ ]+)/mpfr -I([^ ]+)/mpfr" _ a b)
-                      (string-append "gmpinc='-I" a "/mpfr/src "
-                                     "-I" b "/mpfr/src"))
-                     (("gmplibs='-L([^ ]+)/mpfr" _ a)
-                      (string-append "gmplibs='-L" a "/mpfr/src")))))
+                          (list gmp mpfr mpc))))
                (alist-cons-after
                 'install 'symlink-libgcc_eh
                 (lambda* (#:key outputs #:allow-other-keys)
@@ -719,7 +714,7 @@ identifier SYSTEM."
                     (with-directory-excursion
                         (string-append out "/lib/gcc/"
                                        ,(boot-triplet)
-                                       "/" ,(package-version gcc-4.7))
+                                       "/" ,(package-version gcc-4.8))
                       (symlink "libgcc.a" "libgcc_eh.a"))))
                 ,phases))))))
 
@@ -735,7 +730,7 @@ identifier SYSTEM."
 
      ;; No need for Texinfo at this stage.
      (native-inputs (alist-delete "texinfo"
-                                  (package-native-inputs gcc-4.7))))))
+                                  (package-native-inputs gcc-4.8))))))
 
 (define (linux-libre-headers-boot0)
   "Return Linux-Libre header files for the bootstrap environment."
@@ -801,7 +796,7 @@ identifier SYSTEM."
 (define (cross-gcc-wrapper gcc binutils glibc bash)
   "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
 that makes it available under the native tool names."
-  (package (inherit gcc-4.7)
+  (package (inherit gcc-4.8)
     (name (string-append (package-name gcc) "-wrapped"))
     (source #f)
     (build-system trivial-build-system)
@@ -818,27 +813,29 @@ that makes it available under the native tool names."
                           (out      (assoc-ref %outputs "out"))
                           (bindir   (string-append out "/bin"))
                           (triplet  ,(boot-triplet)))
-                     (mkdir-p bindir)
-                     (with-directory-excursion bindir
-                       (for-each (lambda (tool)
-                                   (symlink (string-append binutils "/bin/"
-                                                           triplet "-" tool)
-                                            tool))
-                                 '("ar" "ranlib"))
-
+                     (define (wrap-program program)
                        ;; GCC-BOOT0 is a libc-less cross-compiler, so it
                        ;; needs to be told where to find the crt files and
                        ;; the dynamic linker.
-                       (call-with-output-file "gcc"
+                       (call-with-output-file program
                          (lambda (p)
                            (format p "#!~a/bin/bash
-exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
+exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                                    bash
-                                   gcc triplet
+                                   gcc triplet program
                                    libc libc
                                    ,(glibc-dynamic-linker))))
 
-                       (chmod "gcc" #o555))))))
+                       (chmod program #o555))
+
+                     (mkdir-p bindir)
+                     (with-directory-excursion bindir
+                       (for-each (lambda (tool)
+                                   (symlink (string-append binutils "/bin/"
+                                                           triplet "-" tool)
+                                            tool))
+                                 '("ar" "ranlib"))
+                       (for-each wrap-program '("gcc" "g++")))))))
     (native-inputs
      `(("binutils" ,binutils)
        ("gcc" ,gcc)
@@ -894,6 +891,36 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
         ,@(package-arguments binutils)))
      (inputs %boot2-inputs))))
 
+(define libstdc++
+  ;; Intermediate libstdc++ that will allow us to build the final GCC
+  ;; (remember that GCC-BOOT0 cannot build libstdc++.)
+  (package-with-bootstrap-guile
+   (package (inherit gcc-4.8)
+     (name "libstdc++")
+     (arguments
+      `(#:guile ,%bootstrap-guile
+        #:implicit-inputs? #f
+
+        #:out-of-source? #t
+        #:phases (alist-cons-before
+                  'configure 'chdir
+                  (lambda _
+                    (chdir "libstdc++-v3"))
+                  %standard-phases)
+        #:configure-flags `("--disable-shared"
+                            "--disable-libstdcxx-threads"
+                            "--disable-libstdcxx-pch"
+                            ,(string-append "--with-gxx-include-dir="
+                                            (assoc-ref %outputs "out")
+                                            "/include"
+                                            ;; "/include/c++/"
+                                            ;; ,(package-version gcc-4.8)
+                                            ))))
+     (inputs %boot2-inputs)
+     (native-inputs '())
+     (propagated-inputs '())
+     (synopsis "GNU C++ standard library (intermediate)"))))
+
 (define-public gcc-final
   ;; The final GCC.
   (package (inherit gcc-boot0)
@@ -907,12 +934,25 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
        ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
        ,@(substitute-keyword-arguments (package-arguments gcc-boot0)
            ((#:configure-flags boot-flags)
-            (let loop ((args (package-arguments gcc-4.7)))
+            (let loop ((args (package-arguments gcc-4.8)))
               (match args
                 ((#:configure-flags normal-flags _ ...)
                  normal-flags)
                 ((_ rest ...)
                  (loop rest)))))
+           ((#:make-flags flags)
+            ;; Since $LIBRARY_PATH and $CPATH are not honored, add the
+            ;; relevant flags.
+            `(cons (string-append "CPPFLAGS=-I"
+                                  (assoc-ref %build-inputs "libstdc++")
+                                  "/include")
+                   (map (lambda (flag)
+                          (if (string-prefix? "LDFLAGS=" flag)
+                              (string-append flag " -L"
+                                             (assoc-ref %build-inputs "libstdc++")
+                                             "/lib")
+                              flag))
+                        ,flags)))
            ((#:phases phases)
             `(alist-delete 'symlink-libgcc_eh ,phases)))))
 
@@ -920,6 +960,7 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
               ("mpfr-source" ,(package-source mpfr))
               ("mpc-source" ,(package-source mpc))
               ("binutils" ,binutils-final)
+              ("libstdc++" ,libstdc++)
               ,@%boot2-inputs))))
 
 (define ld-wrapper-boot3
@@ -1000,6 +1041,14 @@ store.")
                                  (current-source-location)
                                  #:guile %bootstrap-guile)))
 
+(define-public gnu-make-final
+  ;; The final GNU Make, which uses the final Guile.
+  (package-with-bootstrap-guile
+   (package-with-explicit-inputs gnu-make
+                                 `(("guile" ,guile-final)
+                                   ,@%boot4-inputs)
+                                 (current-source-location))))
+
 (define-public ld-wrapper
   ;; The final `ld' wrapper, which uses the final Guile.
   (package (inherit ld-wrapper-boot3)
@@ -1010,9 +1059,13 @@ store.")
                       '("guile" "bash"))))))
 
 (define-public %final-inputs
-  ;; Final derivations used as implicit inputs by `gnu-build-system'.
-  (let ((finalize (cut package-with-explicit-inputs <> %boot4-inputs
-                       (current-source-location))))
+  ;; Final derivations used as implicit inputs by 'gnu-build-system'.  We
+  ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
+  ;; used for origins that have patches, thereby avoiding circular
+  ;; dependencies.
+  (let ((finalize (compose package-with-bootstrap-guile
+                           (cut package-with-explicit-inputs <> %boot4-inputs
+                                (current-source-location)))))
     `(,@(map (match-lambda
               ((name package)
                (list name (finalize package))))
@@ -1026,8 +1079,8 @@ store.")
                ("sed" ,sed)
                ("grep" ,grep)
                ("findutils" ,findutils)
-               ("gawk" ,gawk)
-               ("make" ,gnu-make)))
+               ("gawk" ,gawk)))
+      ("make" ,gnu-make-final)
       ("bash" ,bash-final)
       ("ld-wrapper" ,ld-wrapper)
       ("binutils" ,binutils-final)
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 11f54ad051..981cde9f2b 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -64,11 +64,21 @@
              #:guile %bootstrap-guile
              #:system system)))
 
+  (define %bootstrap-patch-inputs
+    ;; Packages used when an <origin> has a non-empty 'patches' field.
+    `(("tar"   ,%bootstrap-coreutils&co)
+      ("xz"    ,%bootstrap-coreutils&co)
+      ("bzip2" ,%bootstrap-coreutils&co)
+      ("gzip"  ,%bootstrap-coreutils&co)
+      ("patch" ,%bootstrap-coreutils&co)))
+
   (let ((orig-method (origin-method source)))
     (origin (inherit source)
       (method (cond ((eq? orig-method url-fetch)
                      (boot url-fetch))
-                    (else orig-method))))))
+                    (else orig-method)))
+      (patch-guile %bootstrap-guile)
+      (patch-inputs %bootstrap-patch-inputs))))
 
 (define (package-from-tarball name source program-to-test description)
   "Return a package that correspond to the extraction of SOURCE.
@@ -170,7 +180,7 @@ check whether everything is alright."
                               (xz    (->store "xz"))
                               (mkdir (->store "mkdir"))
                               (bash  (->store "bash"))
-                              (guile (->store "guile-2.0.7.tar.xz"))
+                              (guile (->store "guile-2.0.9.tar.xz"))
                               (builder
                                (add-text-to-store store
                                                   "build-bootstrap-guile.sh"
@@ -209,16 +219,19 @@ $out/bin/guile --version~%"
                           (origin
                            (method url-fetch)
                            (uri (map (cut string-append <> "/" system
-                                          "/20130105/static-binaries.tar.xz")
+                                          "/20131110/static-binaries.tar.xz")
                                      %bootstrap-base-urls))
                            (sha256
                             (match system
                               ("x86_64-linux"
                                (base32
-                                "0md23alzy6nc5f16pric7mkagczdzr8xbh074sb3rjzrls06j1ls"))
+                                "0c533p9dhczzcsa1117gmfq3pc8w362g4mx84ik36srpr7cx2bg4"))
                               ("i686-linux"
                                (base32
-                                "0nzj1lmm9b94g7k737cr4w1dv282w5nmhb53238ikax9r6pkc0yb"))))))
+                                "0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak"))
+                              ("mips64el-linux"
+                               (base32
+                                "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753"))))))
                         "true"                    ; the program to test
                         "Bootstrap binaries of Coreutils, Awk, etc."))
 
@@ -228,16 +241,19 @@ $out/bin/guile --version~%"
                           (origin
                            (method url-fetch)
                            (uri (map (cut string-append <> "/" system
-                                          "/20130105/binutils-2.22.tar.xz")
+                                          "/20131110/binutils-2.23.2.tar.xz")
                                      %bootstrap-base-urls))
                            (sha256
                             (match system
                               ("x86_64-linux"
                                (base32
-                                "1ffmk2yy2pxvkqgzrkzp3s4jpn4qaaksyk3b5nsc5cjwfm7qkgzh"))
+                                "1j5yivz7zkjqfsfmxzrrrffwyayjqyfxgpi89df0w4qziqs2dg20"))
                               ("i686-linux"
                                (base32
-                                "1rafk6aq4sayvv3r3d2khn93nkyzf002xzh0xadlyci4mznr6b0a"))))))
+                                "14jgwf9gscd7l2pnz610b1zia06dvcm2qyzvni31b8zpgmcai2v9"))
+                              ("mips64el-linux"
+                               (base32
+                                "1x8kkhcxmfyzg1ddpz2pxs6fbdl6412r7x0nzbmi5n7mj8zw2gy7"))))))
                         "ld"                      ; the program to test
                         "Bootstrap binaries of the GNU Binutils"))
 
@@ -279,16 +295,19 @@ $out/bin/guile --version~%"
                     (origin
                      (method url-fetch)
                      (uri (map (cut string-append <> "/" (%current-system)
-                                    "/20130105/glibc-2.17.tar.xz")
+                                    "/20131110/glibc-2.18.tar.xz")
                                %bootstrap-base-urls))
                      (sha256
                       (match (%current-system)
                         ("x86_64-linux"
                          (base32
-                          "18kv1z9d8dr1j3hm9w7663kchqw9p6rsx11n1m143jgba2jz6jy3"))
+                          "0jlqrgavvnplj1b083s20jj9iddr4lzfvwybw5xrcis9spbfzk7v"))
                         ("i686-linux"
                          (base32
-                          "08hv8i0axwnihrcgbz19x0a7s6zyv3yx38x8r29liwl8h82x9g88")))))))))
+                          "1hgrccw1zqdc7lvgivwa54d9l3zsim5pqm0dykxg0z522h6gr05w"))
+                        ("mips64el-linux"
+                         (base32
+                          "0k97a3whzx3apsi9n2cbsrr79ad6lh00klxph9hw4fqyp1abkdsg")))))))))
     (synopsis "Bootstrap binaries and headers of the GNU C Library")
     (description #f)
     (home-page #f)
@@ -347,16 +366,19 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
                     (origin
                      (method url-fetch)
                      (uri (map (cut string-append <> "/" (%current-system)
-                                    "/20130105/gcc-4.7.2.tar.xz")
+                                    "/20131110/gcc-4.8.2.tar.xz")
                                %bootstrap-base-urls))
                      (sha256
                       (match (%current-system)
                         ("x86_64-linux"
                          (base32
-                          "1x1p7han5crnbw906iwdifykr6grzm0w27dy9gz75j0q1b32i4px"))
+                          "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls"))
                         ("i686-linux"
                          (base32
-                          "06wqs0xxnpw3hn0xjb4c9cs0899p1xwkcysa2rvzhvpra0c5vsg2")))))))))
+                          "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
+                        ("mips64el-linux"
+                         (base32
+                          "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
     (native-search-paths
      (list (search-path-specification
             (variable "CPATH")
diff --git a/gnu/packages/bootstrap/mips64el-linux/bash b/gnu/packages/bootstrap/mips64el-linux/bash
new file mode 100755
index 0000000000..403671d2fa
--- /dev/null
+++ b/gnu/packages/bootstrap/mips64el-linux/bash
Binary files differdiff --git a/gnu/packages/bootstrap/mips64el-linux/mkdir b/gnu/packages/bootstrap/mips64el-linux/mkdir
new file mode 100755
index 0000000000..c8d3285b38
--- /dev/null
+++ b/gnu/packages/bootstrap/mips64el-linux/mkdir
Binary files differdiff --git a/gnu/packages/bootstrap/mips64el-linux/tar b/gnu/packages/bootstrap/mips64el-linux/tar
new file mode 100755
index 0000000000..0cdf7cce2c
--- /dev/null
+++ b/gnu/packages/bootstrap/mips64el-linux/tar
Binary files differdiff --git a/gnu/packages/bootstrap/mips64el-linux/xz b/gnu/packages/bootstrap/mips64el-linux/xz
new file mode 100755
index 0000000000..b0622ba946
--- /dev/null
+++ b/gnu/packages/bootstrap/mips64el-linux/xz
Binary files differdiff --git a/gnu/packages/cdrom.scm b/gnu/packages/cdrom.scm
index 49840ad69f..4580af807b 100644
--- a/gnu/packages/cdrom.scm
+++ b/gnu/packages/cdrom.scm
@@ -25,7 +25,7 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages acl)
   #:use-module (gnu packages compression)
-  #:use-module ((gnu packages gettext) #:renamer (symbol-prefix-proc 'gnu:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages help2man)
   #:use-module (gnu packages ncurses)
@@ -179,7 +179,7 @@ reconstruction capability.")
                "0pm039a78h7m9vvjmmjfkl05ii6qdmfhvbypxjbc7j5w82y66is4"))))
     (build-system gnu-build-system)
     (inputs
-     `(("gettext" ,gnu:gettext)
+     `(("gettext" ,gnu-gettext)
        ("gtk+" ,gtk+-2)
        ("pkg-config" ,pkg-config)
        ("which" ,which)))
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 0731103bfa..41128b73cd 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -70,11 +70,11 @@
   "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."
-  (package (inherit gcc-4.7)
+  (package (inherit gcc-4.8)
     (name (string-append "gcc-cross-"
                          (if libc "" "sans-libc-")
                          target))
-    (source (origin (inherit (package-source gcc-4.7))
+    (source (origin (inherit (package-source gcc-4.8))
               (patches
                (list (search-patch "gcc-cross-environment-variables.patch")))))
     (arguments
@@ -85,7 +85,7 @@ GCC that does not target a libc; otherwise, target that libc."
                   (srfi srfi-1)
                   (srfi srfi-26))
 
-       ,@(substitute-keyword-arguments (package-arguments gcc-4.7)
+       ,@(substitute-keyword-arguments (package-arguments gcc-4.8)
            ((#:configure-flags flags)
             `(append (list ,(string-append "--target=" target)
                            ,@(gcc-configure-flags-for-triplet target)
@@ -101,6 +101,7 @@ GCC that does not target a libc; otherwise, target that libc."
                                    "--enable-languages=c"
 
                                    "--disable-threads" ; libgcc, would need libc
+                                   "--disable-libatomic"
                                    "--disable-libmudflap"
                                    "--disable-libgomp"
                                    "--disable-libssp"
@@ -186,7 +187,7 @@ GCC that does not target a libc; otherwise, target that libc."
        ("libc-native" ,@(assoc-ref %final-inputs "libc"))
 
        ;; Remaining inputs.
-       ,@(let ((inputs (append (package-inputs gcc-4.7)
+       ,@(let ((inputs (append (package-inputs gcc-4.8)
                                (alist-delete "libc" %final-inputs))))
            (if libc
                `(("libc" ,libc)
diff --git a/gnu/packages/fdisk.scm b/gnu/packages/fdisk.scm
index dca77c4d6e..8272c45aab 100644
--- a/gnu/packages/fdisk.scm
+++ b/gnu/packages/fdisk.scm
@@ -18,8 +18,7 @@
 
 (define-module (gnu packages fdisk)
   #:use-module ((guix licenses) #:select (gpl3+))
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'guix:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages parted)
@@ -41,7 +40,7 @@
         "04nd7civ561x2lwcmxhsqbprml3178jfc58fy1v7hzqg5k4nbhy3"))))
     (build-system gnu-build-system)
     (inputs
-     `(("gettext" ,guix:gettext)
+     `(("gettext" ,gnu-gettext)
        ("guile" ,guile-1.8)
        ("util-linux" ,util-linux)
        ("parted" ,parted)))
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index bbc0a134d2..aa3b48692e 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -73,6 +73,9 @@ where the OS part is overloaded to denote a specific ABI---into GCC
                      "--enable-languages=c,c++"
                      "--disable-multilib"
 
+                     ;; No pre-compiled libstdc++ headers, to save space.
+                     "--disable-libstdcxx-pch"
+
                      "--with-local-prefix=/no-gcc-local-prefix"
 
                      ,(let ((libc (assoc-ref %build-inputs "libc")))
@@ -115,7 +118,9 @@ where the OS part is overloaded to denote a specific ABI---into GCC
          #:strip-binaries? ,stripped?
          #:configure-flags ,(configure-flags)
          #:make-flags
-         (let ((libc (assoc-ref %build-inputs "libc")))
+         (let* ((libc        (assoc-ref %build-inputs "libc"))
+                (libc-native (or (assoc-ref %build-inputs "libc-native")
+                                 libc)))
            `(,@(if libc
                    (list (string-append "LDFLAGS_FOR_TARGET="
                                         "-B" libc "/lib "
@@ -123,6 +128,12 @@ where the OS part is overloaded to denote a specific ABI---into GCC
                                         "-Wl," libc
                                         ,(glibc-dynamic-linker)))
                    '())
+
+             ;; Native programs like 'genhooks' also need that right.
+             ,(string-append "LDFLAGS="
+                              "-Wl,-rpath=" libc-native "/lib "
+                             "-Wl,-dynamic-linker "
+                             "-Wl," libc-native ,(glibc-dynamic-linker))
              ,(string-append "BOOT_CFLAGS=-O2 "
                              ,(if stripped? "-g0" "-g"))))
 
@@ -148,18 +159,21 @@ where the OS part is overloaded to denote a specific ABI---into GCC
                 ;; 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"
+                                         "^gnu-user.*\\.h$")
+                  (("#define GNU_USER_TARGET_LIB_SPEC (.*)$" _ suffix)
+                   ;; Help libgcc_s.so be found (see also below.)  Always use
+                   ;; '-lgcc_s' so that libgcc_s.so is always found by those
+                   ;; programs that use 'pthread_cancel' (glibc dlopens
+                   ;; libgcc_s.so when pthread_cancel support is needed, but
+                   ;; having it in the application's RUNPATH isn't enough; see
+                   ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.)
+                   (format #f "#define GNU_USER_TARGET_LIB_SPEC \
+\"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib64 -rpath=~a/lib -lgcc_s}} \" ~a"
                            libc libc out out suffix))
-                  (("#define STARTFILE_SPEC.*$" line)
+                  (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line)
                    (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
 #define STANDARD_STARTFILE_PREFIX_2 \"\"
-~a~%"
+~a"
                            libc line))))
 
               ;; Don't retain a dependency on the build-time sed.
diff --git a/gnu/packages/gd.scm b/gnu/packages/gd.scm
index 13bcd45f77..ce3db6709c 100644
--- a/gnu/packages/gd.scm
+++ b/gnu/packages/gd.scm
@@ -20,6 +20,7 @@
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
   #:use-module (guix download)
+  #:use-module (gnu packages)
   #:use-module (gnu packages libpng)
   #:use-module (gnu packages libjpeg)
   #:use-module (gnu packages fontutils)
@@ -40,7 +41,9 @@
              (uri "https://bitbucket.org/libgd/gd-libgd/get/GD_2_0_33.tar.gz")
              (sha256
               (base32
-               "0yrbx8mj9pykyzm0zl1q86xlkdvkajcsf5jmg688vhw9yc5wmbbw"))))
+               "0yrbx8mj9pykyzm0zl1q86xlkdvkajcsf5jmg688vhw9yc5wmbbw"))
+             (patches
+              (list (search-patch "gd-mips64-deplibs-fix.patch")))))
     (build-system gnu-build-system)
     (arguments
      '(#:phases (alist-cons-after
diff --git a/gnu/packages/gdb.scm b/gnu/packages/gdb.scm
index 09e00aaeb1..ddf94f9eaa 100644
--- a/gnu/packages/gdb.scm
+++ b/gnu/packages/gdb.scm
@@ -17,6 +17,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages gdb)
+  #:use-module (gnu packages)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages dejagnu)
@@ -39,13 +40,15 @@
                                  version ".tar.bz2"))
              (sha256
               (base32
-               "1r32s6vqgskw6pz9pmp41b8injd51c4bbxr6ifdpyid52j5a7pz3"))))
+               "1r32s6vqgskw6pz9pmp41b8injd51c4bbxr6ifdpyid52j5a7pz3"))
+             (patches (list (search-patch "gdb-loongson-madd-fix.patch")))))
     (build-system gnu-build-system)
     (arguments
      '(#:phases (alist-cons-after
                  'configure 'post-configure
                  (lambda _
-                   (patch-makefile-SHELL "gdb/gdbserver/Makefile.in"))
+                   (for-each patch-makefile-SHELL
+                             (find-files "." "Makefile\\.in")))
                  %standard-phases)))
     (inputs
      `(("expat" ,expat)
diff --git a/gnu/packages/gettext.scm b/gnu/packages/gettext.scm
index 07d2b0d8cb..6b056055b8 100644
--- a/gnu/packages/gettext.scm
+++ b/gnu/packages/gettext.scm
@@ -17,26 +17,42 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages gettext)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:select (gpl3))
   #:use-module (gnu packages)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages xml))
 
-(define-public gettext
+;; Use that name to avoid clashes with Guile's 'gettext' procedure.
+;;
+;; We used to resort to #:renamer on the user side, but that prevented
+;; circular dependencies involving (gnu packages gettext).  This is because
+;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used
+;; module when there's a #:renamer, and that module may be empty at that point
+;; in case or circular dependencies.
+(define-public gnu-gettext
   (package
     (name "gettext")
-    (version "0.18.3")
+    (version "0.18.3.1")
     (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnu/gettext/gettext-"
                                  version ".tar.gz"))
              (sha256
               (base32
-               "0j7rp56c61j4k1bz1xdc041hzv7186yyzhbp95fmc0zq7l2c3wrn"))))
+               "0p940zmmw1lndvdhck2vrazikjhr02affwy47mmpfxqvacrrm3qd"))))
     (build-system gnu-build-system)
+    (inputs
+     `(("expat" ,expat)))
     (arguments
      `(#:phases (alist-cons-before
+                 'configure 'link-expat
+                 (lambda _
+                   (substitute* "gettext-tools/configure"
+                     (("LIBEXPAT=\"-ldl\"") "LIBEXPAT=\"-ldl -lexpat\"")
+                     (("LTLIBEXPAT=\"-ldl\"") "LTLIBEXPAT=\"-ldl -lexpat\"")))
+                (alist-cons-before
                  'check 'patch-tests
                  (lambda* (#:key inputs #:allow-other-keys)
                    (let ((bash (which "sh")))
@@ -48,7 +64,7 @@
                                               "posix_spawn")
                        (("/bin/sh")
                         bash))))
-                 %standard-phases)))
+                 %standard-phases))))
     (home-page "http://www.gnu.org/software/gettext/")
     (synopsis "Tools and documentation for translation")
     (description
diff --git a/gnu/packages/gkrellm.scm b/gnu/packages/gkrellm.scm
index f53b4fc891..610af418b4 100644
--- a/gnu/packages/gkrellm.scm
+++ b/gnu/packages/gkrellm.scm
@@ -22,8 +22,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'gnu:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xorg))
@@ -42,7 +41,7 @@
         "12rc6zaa7kb60b9744lbrlfkxxfniprm6x0mispv63h4kh75navh"))))
     (build-system gnu-build-system)
     (inputs
-     `(("gettext" ,gnu:gettext)
+     `(("gettext" ,gnu-gettext)
        ("gtk+" ,gtk+-2)
        ("libice" ,libice)
        ("libsm" ,libsm)))
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index 61ba0b944e..fc65f304fc 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -29,8 +29,7 @@
   #:use-module (gnu packages bison)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages flex)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'guix:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages perl)
@@ -124,7 +123,7 @@ shared NFS home directories.")
               "doc"))                      ; 20 MiB of GTK-Doc reference
    (inputs
     `(("coreutils" ,coreutils)
-      ("gettext" ,guix:gettext)
+      ("gettext" ,gnu-gettext)
       ("libffi" ,libffi)
       ("pkg-config" ,pkg-config)
       ("python" ,python-wrapper)
@@ -224,7 +223,7 @@ bindings to call into the C library.")
     (propagated-inputs
      `(;; Propagate gettext because users expect it to be there, and so does
        ;; the `intltool-update' script.
-       ("gettext" ,guix:gettext)
+       ("gettext" ,gnu-gettext)
 
        ;; `file' is used by `intltool-update' too.
        ("file" ,file)
diff --git a/gnu/packages/gnunet.scm b/gnu/packages/gnunet.scm
index 3eb953ca2d..0f5f32b9b4 100644
--- a/gnu/packages/gnunet.scm
+++ b/gnu/packages/gnunet.scm
@@ -20,8 +20,7 @@
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages curl)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'gnu:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages gnutls)
@@ -68,7 +67,7 @@
    ;; * libsmf
    ;; * libtidy
    (inputs
-    `(("gettext" ,gnu:gettext)
+    `(("gettext" ,gnu-gettext)
       ("flac" ,flac)
       ("glib" ,glib)
       ("libjpeg" ,libjpeg)
diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
index ba1fd8fabc..c24dcaefd9 100644
--- a/gnu/packages/grub.scm
+++ b/gnu/packages/grub.scm
@@ -24,7 +24,7 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages bison)
-  #:use-module ((gnu packages gettext) #:renamer (symbol-prefix-proc 'gnu:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages qemu)
@@ -84,7 +84,7 @@
                  %standard-phases)))
     (inputs
      `(;; ("lvm2" ,lvm2)
-       ("gettext" ,gnu:gettext)
+       ("gettext" ,gnu-gettext)
        ("freetype" ,freetype)
        ;; ("libusb" ,libusb)
        ("ncurses" ,ncurses)))
diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index e4a2761273..d1a834d9c5 100644
--- a/gnu/packages/libffi.scm
+++ b/gnu/packages/libffi.scm
@@ -17,6 +17,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages libffi)
+  #:use-module (gnu packages)
   #:use-module (guix licenses)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -46,7 +47,8 @@
                              name "-" version ".tar.gz"))
              (sha256
               (base32
-               "077ibkf84bvcd6rw1m6jb107br63i2pp301rkmsbgg6300adxp8x"))))
+               "077ibkf84bvcd6rw1m6jb107br63i2pp301rkmsbgg6300adxp8x"))
+             (patches (list (search-patch "libffi-mips-n32-fix.patch")))))
     (build-system gnu-build-system)
     (arguments `(#:modules ((guix build utils) (guix build gnu-build-system)
                             (ice-9 ftw) (srfi srfi-26))
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index e712c3cb9d..e1f8b4f46d 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -30,8 +30,7 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages algebra)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'g:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages attr)
   #:use-module (gnu packages xml)
@@ -473,7 +472,8 @@ trace of all the system calls made by a another process/program.")
                    version ".tar.bz2"))
              (sha256
               (base32
-               "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))))
+               "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))
+             (patches (list (search-patch "alsa-lib-mips-atomic-fix.patch")))))
     (build-system gnu-build-system)
     (home-page "http://www.alsa-project.org/")
     (synopsis "The Advanced Linux Sound Architecture libraries")
@@ -513,7 +513,7 @@ MIDI functionality to the Linux-based operating system.")
        ("ncurses" ,ncurses)
        ("alsa-lib" ,alsa-lib)
        ("xmlto" ,xmlto)
-       ("gettext" ,g:gettext)))
+       ("gettext" ,gnu-gettext)))
     (home-page "http://www.alsa-project.org/")
     (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
     (description
@@ -676,7 +676,7 @@ manpages.")
                          (sha256
                           (base32
                            "0p93lsqx23v5fv4hpbrydmfvw1ha2rgqpn2zqbs2jhxkzhjc030p"))))))
-    (native-inputs `(("gettext" ,g:gettext)))
+    (native-inputs `(("gettext" ,gnu-gettext)))
 
     (synopsis "Tools for controlling the network subsystem in Linux")
     (description
diff --git a/gnu/packages/lsh.scm b/gnu/packages/lsh.scm
index 58040839e1..7d9ba78a5e 100644
--- a/gnu/packages/lsh.scm
+++ b/gnu/packages/lsh.scm
@@ -43,7 +43,8 @@
                           version ".tar.gz"))
       (sha256
        (base32
-        "0z6rlalhvfca64jpvksppc9bdhs7jwhiw4y35g5ibvh91xp3rn1l"))))
+        "0z6rlalhvfca64jpvksppc9bdhs7jwhiw4y35g5ibvh91xp3rn1l"))
+      (patches (list (search-patch "liboop-mips64-deplibs-fix.patch")))))
     (build-system gnu-build-system)
     (home-page "http://www.lysator.liu.se/liboop/")
     (synopsis "Event loop library")
diff --git a/gnu/packages/m4.scm b/gnu/packages/m4.scm
index f341b246a2..6bfe564148 100644
--- a/gnu/packages/m4.scm
+++ b/gnu/packages/m4.scm
@@ -33,7 +33,8 @@
                                 version ".tar.bz2"))
             (sha256
              (base32
-              "0w0da1chh12mczxa5lnwzjk9czi3dq6gnnndbpa6w4rj76b1yklf"))))
+              "0w0da1chh12mczxa5lnwzjk9czi3dq6gnnndbpa6w4rj76b1yklf"))
+            (patches (list (search-patch "m4-readlink-EINVAL.patch")))))
    (build-system gnu-build-system)
    (arguments
     ;; XXX: Disable tests on those platforms with know issues.
@@ -41,8 +42,6 @@
                              '("x86_64-darwin"
                                "i686-cygwin"
                                "i686-sunos")))
-      #:patches (list (assoc-ref %build-inputs
-                                 "patch/readlink-EINVAL"))
       #:phases (alist-cons-before
                 'check 'pre-check
                 (lambda* (#:key inputs #:allow-other-keys)
@@ -55,8 +54,6 @@
                       (("/bin/sh")
                        (format #f "~a/bin/bash" bash)))))
                 %standard-phases)))
-   (inputs `(("patch/readlink-EINVAL"
-              ,(search-patch "m4-readlink-EINVAL.patch"))))
    (synopsis "Macro processor")
    (description
     "GNU M4 is an implementation of the M4 macro language, which features
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 8c148f7086..7f7a808542 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -64,7 +64,13 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
         ;; and can use statically-linked NSS modules.
         `(cons* "--disable-nscd" "--disable-build-nscd"
                 "--enable-static-nss"
-                ,flags))))))
+                ,flags))))
+
+    ;; Remove the 'debug' output to allow bit-reproducible builds (when the
+    ;; 'debug' output is used, ELF files end up with a .gnu_debuglink, which
+    ;; includes a CRC of the corresponding debugging symbols; those symbols
+    ;; contain store file names, so the CRC changes at every rebuild.)
+    (outputs (delete "debug" (package-outputs base)))))
 
 (define (package-with-relocatable-glibc p)
   "Return a variant of P that uses the libc as defined by
@@ -94,10 +100,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
             ("cross-binutils" ,(cross-binutils target))
             ,@%final-inputs))
         `(("libc" ,(glibc-for-bootstrap))
-          ("gcc" ,(package (inherit gcc-4.7)
+          ("gcc" ,(package (inherit gcc-4.8)
                     (inputs
                      `(("libc",(glibc-for-bootstrap))
-                       ,@(package-inputs gcc-4.7)))))
+                       ,@(package-inputs gcc-4.8)))))
           ,@(fold alist-delete %final-inputs '("libc" "gcc")))))
 
   (package-with-explicit-inputs p inputs
@@ -127,7 +133,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                                 (#f '())
                                 (x  (list x))))
 
-                      ;; Remove the `debug' output.
+                      ;; Remove the 'debug' output (see above for the reason.)
                       (outputs '("out"))))
         (bzip2 (package (inherit bzip2)
                  (arguments
@@ -363,6 +369,11 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                                (string-append incdir "/asm"))
              (copy-recursively (string-append linux "/include/asm-generic")
                                (string-append incdir "/asm-generic"))
+
+             ;; Remove the '.install' and '..install.cmd' files; the latter
+             ;; contains store paths, which prevents bit reproducibility.
+             (for-each delete-file (find-files incdir "\\.install"))
+
              #t))))
       (inputs `(("libc" ,(let ((target (%current-target-system)))
                            (if target
@@ -378,7 +389,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-4.7)
+   (package (inherit gcc-4.8)
      (name "gcc-static")
      (arguments
       `(#:modules ((guix build utils)
@@ -386,7 +397,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-4.7)
+        ,@(substitute-keyword-arguments (package-arguments gcc-4.8)
             ((#:guile _) #f)
             ((#:implicit-inputs? _) #t)
             ((#:configure-flags flags)
@@ -395,6 +406,9 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                        "--disable-plugin"
                        "--enable-languages=c"
                        "--disable-libmudflap"
+                       "--disable-libatomic"
+                       "--disable-libsanitizer"
+                       "--disable-libitm"
                        "--disable-libgomp"
                        "--disable-libssp"
                        "--disable-libquadmath"
@@ -404,16 +418,11 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
             ((#:make-flags 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)
-               ,@(package-inputs gcc-4.7))))))
+                 `(cons "BOOT_LDFLAGS=-static" ,flags)))))))))
 
 (define %gcc-stripped
   ;; The subset of GCC files needed for bootstrap.
-  (package (inherit gcc-4.7)
+  (package (inherit gcc-4.8)
     (name "gcc-stripped")
     (build-system trivial-build-system)
     (source #f)
@@ -429,6 +438,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
          (let* ((out        (assoc-ref %outputs "out"))
                 (bindir     (string-append out "/bin"))
                 (libdir     (string-append out "/lib"))
+                (includedir (string-append out "/include"))
                 (libexecdir (string-append out "/libexec"))
                 (gcc        (assoc-ref %build-inputs "gcc")))
            (copy-recursively (string-append gcc "/bin") bindir)
@@ -444,6 +454,11 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                              libexecdir)
            (for-each remove-store-references
                      (find-files libexecdir ".*"))
+
+           ;; Starting from GCC 4.8, helper programs built natively
+           ;; (‘genchecksum’, ‘gcc-nm’, etc.) rely on C++ headers.
+           (copy-recursively (string-append gcc "/include/c++")
+                             (string-append includedir "/c++"))
            #t))))
     (inputs `(("gcc" ,%gcc-static)))))
 
@@ -461,6 +476,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                   (name (string-append (package-name guile-2.0) "-static"))
                   (source source)
                   (synopsis "Statically-linked and relocatable Guile")
+
+                  ;; Remove the 'debug' output (see above for the reason.)
+                  (outputs (delete "debug" (package-outputs guile-2.0)))
+
                   (propagated-inputs
                    `(("bdw-gc" ,libgc)
                      ,@(alist-delete "bdw-gc"
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 9b2b052a52..c1c78d5ce3 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -26,9 +26,10 @@
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages compression)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'gnu:))
+  #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
@@ -132,12 +133,16 @@ LP/MIP solver is included in the package.")
                           version ".tar.gz"))
       (sha256
        (base32
-        "0qhxsdbwxd3cn1shc13wxvx2lg32lp4z6sz24kv3jz7p5xfi8j7x"))))
+        "0qhxsdbwxd3cn1shc13wxvx2lg32lp4z6sz24kv3jz7p5xfi8j7x"))
+      (patches (list (search-patch "pspp-tests.patch")))))
     (build-system gnu-build-system)
     (inputs
-     `(("gettext" ,gnu:gettext)
+     `(("cairo" ,cairo)
+       ("fontconfig" ,fontconfig)
+       ("gettext" ,gnu-gettext)
        ("gsl" ,gsl)
        ("libxml2" ,libxml2)
+       ("pango" ,pango)
        ("readline" ,readline)
        ("zlib" ,zlib)))
     (native-inputs
@@ -145,8 +150,7 @@ LP/MIP solver is included in the package.")
        ("pkg-config" ,pkg-config)))
     (arguments
      `(#:configure-flags
-       `("--without-cairo" ; FIXME: tests currently fail for lack of font
-         "--without-gui"))) ; FIXME: package missing dependencies
+       `("--without-gui"))) ; FIXME: package missing dependencies
     (home-page "http://www.gnu.org/software/pspp/")
     (synopsis "Statistical analysis")
     (description
diff --git a/gnu/packages/mit-krb5.scm b/gnu/packages/mit-krb5.scm
index 8222212d95..361cd36f25 100644
--- a/gnu/packages/mit-krb5.scm
+++ b/gnu/packages/mit-krb5.scm
@@ -37,6 +37,8 @@
             (sha256 (base32
                      "1daiaxgkxcryqs37w28v4x1vajqmay4l144d1zd9c2d7jjxr9gcs"))))
    (build-system gnu-build-system)
+   (native-inputs
+    `(("patch/init-fix" ,(search-patch "mit-krb5-init-fix.patch"))))
    (inputs `(("bison" ,bison)
              ("perl" ,perl)))
    (arguments
@@ -51,7 +53,12 @@
            (and (zero? (system* "tar" "xvf" source))
                 (zero? (system* "tar" "xvf" (string-append inner ".tar.gz")))
                 (chdir inner)
-                (chdir "src"))))
+                (chdir "src")
+                ;; XXX The current patch system does not support unusual
+                ;; source unpack methods, so we have to apply this patch in a
+                ;; non-standard way.
+                (zero? (system* "patch" "-p1" "--batch" "-i"
+                                (assoc-ref %build-inputs "patch/init-fix"))))))
        (alist-replace
         'check
         (lambda* (#:key inputs #:allow-other-keys #:rest args)
diff --git a/gnu/packages/mp3.scm b/gnu/packages/mp3.scm
index b604a36291..5f69255d2a 100644
--- a/gnu/packages/mp3.scm
+++ b/gnu/packages/mp3.scm
@@ -44,7 +44,8 @@
                                 version ".tar.gz"))
             (sha256
              (base32
-              "14460zhacxhswnzb36qfpd1f2wbk10qvksvm6wyq5hpvdgnw7ymv"))))
+              "14460zhacxhswnzb36qfpd1f2wbk10qvksvm6wyq5hpvdgnw7ymv"))
+            (patches (list (search-patch "libmad-mips-newgcc.patch")))))
    (build-system gnu-build-system)
    (arguments
     `(#:phases
diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm
index 6692d26b59..c9e691a626 100644
--- a/gnu/packages/multiprecision.scm
+++ b/gnu/packages/multiprecision.scm
@@ -27,7 +27,7 @@
 (define-public gmp
   (package
    (name "gmp")
-   (version "5.1.2")
+   (version "5.1.3")
    (source (origin
             (method url-fetch)
             (uri
@@ -35,7 +35,7 @@
                             version ".tar.xz"))
             (sha256
              (base32
-              "1hnbxz7a6jrli8ph27i8zb6k2f456zn6l5xi78yhskzbxjk47nf7"))))
+              "0wbhn3wih61vjcs94q531fipfvvzqfq2v4qr03rl3xaggyiyvqny"))))
    (build-system gnu-build-system)
    (native-inputs `(("m4" ,m4)))
    (outputs '("out" "debug"))
diff --git a/gnu/packages/nano.scm b/gnu/packages/nano.scm
index c936ca552c..662cf4184f 100644
--- a/gnu/packages/nano.scm
+++ b/gnu/packages/nano.scm
@@ -18,8 +18,7 @@
 
 (define-module (gnu packages nano)
   #:use-module (guix licenses)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'guix:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages ncurses)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -39,7 +38,7 @@
         "1s3b21h5p7r8xafw0gahswj16ai6k2vnjhmd15b491hl0x494c7z"))))
     (build-system gnu-build-system)
     (inputs
-     `(("gettext" ,guix:gettext)
+     `(("gettext" ,gnu-gettext)
        ("ncurses" ,ncurses)))
     (home-page "http://www.nano-editor.org/")
     (synopsis "Small, user-friendly console text editor")
diff --git a/gnu/packages/oggvorbis.scm b/gnu/packages/oggvorbis.scm
index 1b1630e1fb..e2084b06b3 100644
--- a/gnu/packages/oggvorbis.scm
+++ b/gnu/packages/oggvorbis.scm
@@ -100,7 +100,8 @@ polyphonic) audio and music at fixed and variable bitrates from 16 to
                                  version ".tar.xz"))
              (sha256
               (base32
-               "0q8wark9ribij57dciym5vdikg2464p8q2mgqvfb78ksjh4s8vgk"))))
+               "0q8wark9ribij57dciym5vdikg2464p8q2mgqvfb78ksjh4s8vgk"))
+             (patches (list (search-patch "libtheora-config-guess.patch")))))
     (build-system gnu-build-system)
     (inputs `(("libvorbis" ,libvorbis)))
     ;; The .pc files refer to libogg.
diff --git a/gnu/packages/parted.scm b/gnu/packages/parted.scm
index 9d835d6b6c..25f021b6fd 100644
--- a/gnu/packages/parted.scm
+++ b/gnu/packages/parted.scm
@@ -22,8 +22,7 @@
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages check)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'guix:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages readline))
 
@@ -54,7 +53,7 @@
     (inputs
      ;; XXX: add 'lvm2'.
      `(("check" ,check)
-       ("gettext" ,guix:gettext)
+       ("gettext" ,gnu-gettext)
        ("readline" ,readline)
        ("util-linux" ,util-linux)))
     (home-page "http://www.gnu.org/software/parted/")
diff --git a/gnu/packages/patches/alsa-lib-mips-atomic-fix.patch b/gnu/packages/patches/alsa-lib-mips-atomic-fix.patch
new file mode 100644
index 0000000000..8c37bd3ac4
--- /dev/null
+++ b/gnu/packages/patches/alsa-lib-mips-atomic-fix.patch
@@ -0,0 +1,42 @@
+Fix the declarations of inlined atomic ops for mips.
+
+This patch was copied from Debian.
+
+--- alsa-lib/include/iatomic.h.orig	2013-05-21 04:48:28.000000000 -0400
++++ alsa-lib/include/iatomic.h	2013-10-29 13:01:37.055995968 -0400
+@@ -720,7 +720,7 @@
+  * Atomically adds @i to @v.  Note that the guaranteed useful range
+  * of an atomic_t is only 24 bits.
+  */
+-extern __inline__ void atomic_add(int i, atomic_t * v)
++static __inline__ void atomic_add(int i, atomic_t * v)
+ {
+ 	unsigned long temp;
+ 
+@@ -744,7 +744,7 @@
+  * Atomically subtracts @i from @v.  Note that the guaranteed
+  * useful range of an atomic_t is only 24 bits.
+  */
+-extern __inline__ void atomic_sub(int i, atomic_t * v)
++static __inline__ void atomic_sub(int i, atomic_t * v)
+ {
+ 	unsigned long temp;
+ 
+@@ -763,7 +763,7 @@
+ /*
+  * Same as above, but return the result value
+  */
+-extern __inline__ int atomic_add_return(int i, atomic_t * v)
++static __inline__ int atomic_add_return(int i, atomic_t * v)
+ {
+ 	unsigned long temp, result;
+ 
+@@ -784,7 +784,7 @@
+ 	return result;
+ }
+ 
+-extern __inline__ int atomic_sub_return(int i, atomic_t * v)
++static __inline__ int atomic_sub_return(int i, atomic_t * v)
+ {
+ 	unsigned long temp, result;
+ 
diff --git a/gnu/packages/patches/binutils-loongson-madd-fix.patch b/gnu/packages/patches/binutils-loongson-madd-fix.patch
new file mode 100644
index 0000000000..364ccd67e3
--- /dev/null
+++ b/gnu/packages/patches/binutils-loongson-madd-fix.patch
@@ -0,0 +1,44 @@
+Fix the Loongson 2F specific fused multiply-add instructions on paired singles to
+use the encoding recognized by the processor, as opposed to the mistaken english
+Loongson 2F documentation.
+
+Patch by Mark H Weaver <mhw@netris.org>.
+
+--- binutils/opcodes/mips-opc.c.orig	2012-09-04 10:21:10.000000000 -0400
++++ binutils/opcodes/mips-opc.c	2013-10-06 02:23:33.679983766 -0400
+@@ -931,7 +931,7 @@
+ {"madd.s",	"D,S,T",	0x72000018,	0xffe0003f,	RD_S|RD_T|WR_D|FP_S,	0,	IL2F	},
+ {"madd.ps", "D,R,S,T",	0x4c000026, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,    0,		I5_33	},
+ {"madd.ps",	"D,S,T",	0x45600018,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2E	},
+-{"madd.ps",	"D,S,T",	0x71600018,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
++{"madd.ps",	"D,S,T",	0x72c00018,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
+ {"madd",    "s,t",      0x0000001c, 0xfc00ffff, RD_s|RD_t|WR_HILO,           0,		L1	},
+ {"madd",    "s,t",      0x70000000, 0xfc00ffff, RD_s|RD_t|MOD_HILO,          0,		I32|N55	},
+ {"madd",    "s,t",      0x70000000, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M,      0,		G1	},
+@@ -1041,7 +1041,7 @@
+ {"msub.s",	"D,S,T",	0x72000019,	0xffe0003f,	RD_S|RD_T|WR_D|FP_S,	0,	IL2F	},
+ {"msub.ps", "D,R,S,T",	0x4c00002e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0,		I5_33	},
+ {"msub.ps",	"D,S,T",	0x45600019,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2E	},
+-{"msub.ps",	"D,S,T",	0x71600019,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
++{"msub.ps",	"D,S,T",	0x72c00019,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
+ {"msub",    "s,t",      0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO,	0,		L1    	},
+ {"msub",    "s,t",      0x70000004, 0xfc00ffff, RD_s|RD_t|MOD_HILO,     0,		I32|N55 },
+ {"msub",    "7,s,t",	0x70000004, 0xfc00e7ff, MOD_a|RD_s|RD_t,        0,              D32	},
+@@ -1157,7 +1157,7 @@
+ {"nmadd.s",	"D,S,T",	0x7200001a,	0xffe0003f,	RD_S|RD_T|WR_D|FP_S,	0,	IL2F	},
+ {"nmadd.ps","D,R,S,T",	0x4c000036, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0,		I5_33	},
+ {"nmadd.ps",	"D,S,T",	0x4560001a,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2E	},
+-{"nmadd.ps",	"D,S,T",	0x7160001a,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
++{"nmadd.ps",	"D,S,T",	0x72c0001a,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
+ {"nmsub.d", "D,R,S,T",	0x4c000039, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0,		I4_33	},
+ {"nmsub.d",	"D,S,T",	0x4620001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2E	},
+ {"nmsub.d",	"D,S,T",	0x7220001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
+@@ -1166,7 +1166,7 @@
+ {"nmsub.s",	"D,S,T",	0x7200001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_S,	0,	IL2F	},
+ {"nmsub.ps","D,R,S,T",	0x4c00003e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0,		I5_33	},
+ {"nmsub.ps",	"D,S,T",	0x4560001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2E	},
+-{"nmsub.ps",	"D,S,T",	0x7160001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
++{"nmsub.ps",	"D,S,T",	0x72c0001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
+ /* nop is at the start of the table.  */
+ {"nor",     "d,v,t",	0x00000027, 0xfc0007ff,	WR_d|RD_s|RD_t,		0,		I1	},
+ {"nor",     "t,r,I",	0,    (int) M_NOR_I,	INSN_MACRO,		0,		I1	},
diff --git a/gnu/packages/patches/binutils-loongson-workaround.patch b/gnu/packages/patches/binutils-loongson-workaround.patch
new file mode 100644
index 0000000000..f43572a53d
--- /dev/null
+++ b/gnu/packages/patches/binutils-loongson-workaround.patch
@@ -0,0 +1,34 @@
+Enable the workaround for the Loongson 2F bug by default.
+
+Patch by Mark H Weaver <mhw@netris.org>.
+
+--- binutils/gas/config/tc-mips.c.orig	2012-09-04 10:21:03.000000000 -0400
++++ binutils/gas/config/tc-mips.c	2013-10-06 02:23:21.651983768 -0400
+@@ -910,10 +910,10 @@
+ };
+ 
+ /* ...likewise -mfix-loongson2f-jump.  */
+-static bfd_boolean mips_fix_loongson2f_jump;
++static bfd_boolean mips_fix_loongson2f_jump = FALSE;
+ 
+ /* ...likewise -mfix-loongson2f-nop.  */
+-static bfd_boolean mips_fix_loongson2f_nop;
++static bfd_boolean mips_fix_loongson2f_nop = TRUE;
+ 
+ /* True if -mfix-loongson2f-nop or -mfix-loongson2f-jump passed.  */
+ static bfd_boolean mips_fix_loongson2f;
+--- binutils/gas/testsuite/gas/mips/mips.exp.orig	2012-09-04 10:17:13.000000000 -0400
++++ binutils/gas/testsuite/gas/mips/mips.exp	2013-10-06 02:23:21.663983768 -0400
+@@ -91,6 +91,12 @@
+ 
+     # Catch because the variable won't be set the first time through.
+     catch {unset mips_arches}
++
++    # Disable the loongson2f nop fix by default, because most of the
++    # existing test cases for mips will fail otherwise.
++    global ASFLAGS
++    set old_ASFLAGS "$ASFLAGS"
++    set ASFLAGS "$ASFLAGS -mno-fix-loongson2f-nop"
+ }
+ 
+ # mips_arch_create ARCH GPRSIZE EXTENDS PROPS AS_FLAGS OBJDUMP_FLAGS \
diff --git a/gnu/packages/patches/gd-mips64-deplibs-fix.patch b/gnu/packages/patches/gd-mips64-deplibs-fix.patch
new file mode 100644
index 0000000000..6231310cdb
--- /dev/null
+++ b/gnu/packages/patches/gd-mips64-deplibs-fix.patch
@@ -0,0 +1,17 @@
+Patch configure script to choose pass_all deplibs check method for
+linux-gnu* systems on mips64.  This is a temporary hack until libgd
+bootstraps their build system with a newer libtool.
+
+Patch by Mark H Weaver <mhw@netris.org>.
+
+--- libgd-gd/src/configure.orig	2006-04-05 11:56:57.000000000 -0400
++++ libgd-gd/src/configure	2013-11-02 17:56:19.123995838 -0400
+@@ -4457,7 +4457,7 @@
+ # This must be Linux ELF.
+ linux-gnu*)
+   case $host_cpu in
+-  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | s390* | x86_64*)
++  alpha* | hppa* | i*86 | mips | mipsel | mips64 | mips64el | powerpc* | sparc* | ia64* | s390* | x86_64*)
+     lt_cv_deplibs_check_method=pass_all ;;
+   *)
+     # glibc up to 2.1.1 does not perform some relocations on ARM
diff --git a/gnu/packages/patches/gdb-loongson-madd-fix.patch b/gnu/packages/patches/gdb-loongson-madd-fix.patch
new file mode 100644
index 0000000000..0d50dd2dd4
--- /dev/null
+++ b/gnu/packages/patches/gdb-loongson-madd-fix.patch
@@ -0,0 +1,44 @@
+Fix the Loongson 2F specific fused multiply-add instructions on paired singles to
+use the encoding recognized by the processor, as opposed to the mistaken english
+Loongson 2F documentation.
+
+Patch by Mark H Weaver <mhw@netris.org>.
+
+--- gdb/opcodes/mips-opc.c.orig	2013-02-09 05:24:18.000000000 -0500
++++ gdb/opcodes/mips-opc.c	2013-10-27 23:35:20.191997541 -0400
+@@ -956,7 +956,7 @@
+ {"madd.s",  "D,S,T",	0x4600001c, 0xffe0003f, RD_S|RD_T|WR_D|FP_S,	     0,		EE	},
+ {"madd.ps", "D,R,S,T",	0x4c000026, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,    0,		I5_33	},
+ {"madd.ps",	"D,S,T",	0x45600018,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2E	},
+-{"madd.ps",	"D,S,T",	0x71600018,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
++{"madd.ps",	"D,S,T",	0x72c00018,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
+ {"madd",    "s,t",      0x0000001c, 0xfc00ffff, RD_s|RD_t|WR_HILO,           0,		L1	},
+ {"madd",    "s,t",      0x70000000, 0xfc00ffff, RD_s|RD_t|MOD_HILO,          0,		I32|N55	},
+ {"madd",    "s,t",      0x70000000, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M,      0,		G1	},
+@@ -1084,7 +1084,7 @@
+ {"msub.s",  "D,S,T",	0x4600001d, 0xffe0003f,	RD_S|RD_T|WR_D|FP_S,	0,		EE	},
+ {"msub.ps", "D,R,S,T",	0x4c00002e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0,		I5_33	},
+ {"msub.ps",	"D,S,T",	0x45600019,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2E	},
+-{"msub.ps",	"D,S,T",	0x71600019,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
++{"msub.ps",	"D,S,T",	0x72c00019,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
+ {"msub",    "s,t",      0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO,	0,		L1    	},
+ {"msub",    "s,t",      0x70000004, 0xfc00ffff, RD_s|RD_t|MOD_HILO,     0,		I32|N55 },
+ {"msub",    "7,s,t",	0x70000004, 0xfc00e7ff, MOD_a|RD_s|RD_t,        0,              D32	},
+@@ -1218,7 +1218,7 @@
+ {"nmadd.s",	"D,S,T",	0x7200001a,	0xffe0003f,	RD_S|RD_T|WR_D|FP_S,	0,	IL2F	},
+ {"nmadd.ps","D,R,S,T",	0x4c000036, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0,		I5_33	},
+ {"nmadd.ps",	"D,S,T",	0x4560001a,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2E	},
+-{"nmadd.ps",	"D,S,T",	0x7160001a,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
++{"nmadd.ps",	"D,S,T",	0x72c0001a,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
+ {"nmsub.d", "D,R,S,T",	0x4c000039, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0,		I4_33	},
+ {"nmsub.d",	"D,S,T",	0x4620001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2E	},
+ {"nmsub.d",	"D,S,T",	0x7220001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
+@@ -1227,7 +1227,7 @@
+ {"nmsub.s",	"D,S,T",	0x7200001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_S,	0,	IL2F	},
+ {"nmsub.ps","D,R,S,T",	0x4c00003e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0,		I5_33	},
+ {"nmsub.ps",	"D,S,T",	0x4560001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2E	},
+-{"nmsub.ps",	"D,S,T",	0x7160001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
++{"nmsub.ps",	"D,S,T",	0x72c0001b,	0xffe0003f,	RD_S|RD_T|WR_D|FP_D,	0,	IL2F	},
+ /* nop is at the start of the table.  */
+ {"nor",     "d,v,t",	0x00000027, 0xfc0007ff,	WR_d|RD_s|RD_t,		0,		I1	},
+ {"nor",     "t,r,I",	0,    (int) M_NOR_I,	INSN_MACRO,		0,		I1	},
diff --git a/gnu/packages/patches/glibc-make-4.0.patch b/gnu/packages/patches/glibc-make-4.0.patch
new file mode 100644
index 0000000000..d83de1d33d
--- /dev/null
+++ b/gnu/packages/patches/glibc-make-4.0.patch
@@ -0,0 +1,12 @@
+Allow libc to be compiled with GNU Make 4.0.
+
+--- glibc-2.18/configure	2013-08-11 00:52:55.000000000 +0200
++++ glibc-2.18/configure	2013-10-16 16:53:09.000000000 +0200
+@@ -4772,7 +4772,7 @@ $as_echo_n "checking version of $MAKE...
+   ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+   case $ac_prog_version in
+     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+-    3.79* | 3.[89]*)
++    3.79* | 3.[89]* | 4.*)
+        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
diff --git a/gnu/packages/patches/glibc-no-ld-so-cache.patch b/gnu/packages/patches/glibc-no-ld-so-cache.patch
deleted file mode 100644
index 75fff50b47..0000000000
--- a/gnu/packages/patches/glibc-no-ld-so-cache.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-Disable attempts to use the system-wide /etc/ld.so.cache.  This is
-required on LFS distros to avoid loading the distro's libc.so instead
-of ours.
-
-Patch from Nixpkgs.  Idea by Eelco Dolstra, initial patch by Jack
-Cummings, minor fixups by Shea Levy.
-
-diff -Naur glibc-2.13-orig/elf/ldconfig.c glibc-2.13/elf/ldconfig.c
---- glibc-2.13-orig/elf/ldconfig.c	2011-01-17 23:34:07.000000000 -0500
-+++ glibc-2.13/elf/ldconfig.c	2012-04-10 23:28:45.957492340 -0400
-@@ -51,7 +51,7 @@
- #endif
- 
- #ifndef LD_SO_CONF
--# define LD_SO_CONF SYSCONFDIR "/ld.so.conf"
-+# define LD_SO_CONF PREFIX "/etc/ld.so.conf"
- #endif
- 
- /* Get libc version number.  */
-
---- glibc-2.16.0/elf/Makefile	2012-06-30 21:12:34.000000000 +0200
-+++ glibc-2.16.0/elf/Makefile	2012-11-12 23:52:21.000000000 +0100
-@@ -415,12 +415,12 @@ $(objpfx)ldconfig: $(ldconfig-modules:%=
- 
- $(objpfx)pldd: $(pldd-modules:%=$(objpfx)%.o)
- 
--SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
--CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
-+PREFIX-FLAGS := -D'PREFIX="$(sysconfdir)"'
-+CFLAGS-ldconfig.c = $(PREFIX-FLAGS) -D'LIBDIR="$(libdir)"' \
- 		    -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
--CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
--CFLAGS-cache.c = $(SYSCONF-FLAGS)
--CFLAGS-rtld.c = $(SYSCONF-FLAGS)
-+CFLAGS-dl-cache.c = $(PREFIX-FLAGS)
-+CFLAGS-cache.c = $(PREFIX-FLAGS)
-+CFLAGS-rtld.c = $(PREFIX-FLAGS)
- 
- CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
- 		     -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
-
-diff -Naur glibc-2.13-orig/sysdeps/generic/dl-cache.h glibc-2.13/sysdeps/generic/dl-cache.h
---- glibc-2.13-orig/sysdeps/generic/dl-cache.h	2011-01-17 23:34:07.000000000 -0500
-+++ glibc-2.13/sysdeps/generic/dl-cache.h	2012-04-10 23:28:20.077488815 -0400
-@@ -29,7 +29,7 @@
- #endif
- 
- #ifndef LD_SO_CACHE
--# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
-+# define LD_SO_CACHE PREFIX "/etc/ld.so.cache"
- #endif
- 
- #ifndef add_system_dir
diff --git a/gnu/packages/patches/libffi-mips-n32-fix.patch b/gnu/packages/patches/libffi-mips-n32-fix.patch
new file mode 100644
index 0000000000..87ec48f883
--- /dev/null
+++ b/gnu/packages/patches/libffi-mips-n32-fix.patch
@@ -0,0 +1,21 @@
+Fix handling of uint32_t arguments on the MIPS N32 ABI.
+
+Patch by Mark H Weaver <mhw@netris.org>.
+
+--- libffi/src/mips/ffi.c.orig	2013-03-16 07:19:39.000000000 -0400
++++ libffi/src/mips/ffi.c	2013-10-22 01:11:03.111985247 -0400
+@@ -170,7 +170,14 @@
+ 		break;
+ 		  
+ 	      case FFI_TYPE_UINT32:
++#ifdef FFI_MIPS_N32
++		/* The N32 ABI requires that 32-bit integers
++		   be sign-extended to 64-bits, regardless of
++		   whether they are signed or unsigned. */
++		*(ffi_arg *)argp = *(SINT32 *)(* p_argv);
++#else
+ 		*(ffi_arg *)argp = *(UINT32 *)(* p_argv);
++#endif
+ 		break;
+ 
+ 	      /* This can only happen with 64bit slots.  */
diff --git a/gnu/packages/patches/libmad-mips-newgcc.patch b/gnu/packages/patches/libmad-mips-newgcc.patch
new file mode 100644
index 0000000000..d22c51255e
--- /dev/null
+++ b/gnu/packages/patches/libmad-mips-newgcc.patch
@@ -0,0 +1,16 @@
+Fix MIPS assembly code to work with newer GCC, where the "=h"
+constraint is no longer supported.
+
+--- libmad/fixed.h.orig	2004-02-16 21:02:03.000000000 -0500
++++ libmad/fixed.h	2011-10-29 18:47:21.000000000 -0400
+@@ -304,8 +304,8 @@
+  * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+  */
+ #  define MAD_F_MLX(hi, lo, x, y)  \
+-    asm ("mult	%2,%3"  \
+-	 : "=l" (lo), "=h" (hi)  \
++    asm ("mult	%2,%3\n\tmfhi  %1"  \
++	 : "=l" (lo), "=r" (hi)  \
+ 	 : "%r" (x), "r" (y))
+ 
+ # if defined(HAVE_MADD_ASM)
diff --git a/gnu/packages/patches/liboop-mips64-deplibs-fix.patch b/gnu/packages/patches/liboop-mips64-deplibs-fix.patch
new file mode 100644
index 0000000000..b91754a8cc
--- /dev/null
+++ b/gnu/packages/patches/liboop-mips64-deplibs-fix.patch
@@ -0,0 +1,17 @@
+Patch configure script to choose pass_all deplibs check method for
+linux-gnu* systems on mips64.  This is a temporary hack until liboop
+bootstraps their build system with a newer libtool.
+
+Patch by Mark H Weaver <mhw@netris.org>.
+
+--- liboop/configure.orig	2003-10-26 11:41:19.000000000 -0500
++++ liboop/configure	2013-11-02 18:09:11.079995796 -0400
+@@ -3395,7 +3395,7 @@
+ # This must be Linux ELF.
+ linux*)
+   case $host_cpu in
+-  alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh*)
++  alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | mips64 | mips64el | powerpc* | sparc* | s390* | sh*)
+     lt_cv_deplibs_check_method=pass_all ;;
+   *)
+     # glibc up to 2.1.1 does not perform some relocations on ARM
diff --git a/gnu/packages/patches/libtheora-config-guess.patch b/gnu/packages/patches/libtheora-config-guess.patch
new file mode 100644
index 0000000000..9529ea7101
--- /dev/null
+++ b/gnu/packages/patches/libtheora-config-guess.patch
@@ -0,0 +1,37 @@
+Minimally patch libtheora's ancient config.guess to support mips64.
+
+--- libtheora/config.guess.orig	2009-02-23 22:50:50.000000000 -0500
++++ libtheora/config.guess	2013-10-31 23:49:48.155999944 -0400
+@@ -798,25 +798,24 @@
+     m68*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+-    mips:Linux:*:*)
++    mips:Linux:*:* | mips64:Linux:*:*)
+ 	eval $set_cc_for_build
+ 	sed 's/^	//' << EOF >$dummy.c
+ 	#undef CPU
+-	#undef mips
+-	#undef mipsel
++	#undef ${UNAME_MACHINE}
++	#undef ${UNAME_MACHINE}el
+ 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+-	CPU=mipsel
++	CPU=${UNAME_MACHINE}el
+ 	#else
+ 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+-	CPU=mips
++	CPU=${UNAME_MACHINE}
+ 	#else
+ 	CPU=
+ 	#endif
+ 	#endif
+ EOF
+-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+-	rm -f $dummy.c && rmdir $tmpdir
+-	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
++	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit 0; }
+ 	;;
+     ppc:Linux:*:*)
+ 	echo powerpc-unknown-linux-gnu
diff --git a/gnu/packages/patches/libtool-skip-tests-for-mips.patch b/gnu/packages/patches/libtool-skip-tests-for-mips.patch
new file mode 100644
index 0000000000..36587d23c2
--- /dev/null
+++ b/gnu/packages/patches/libtool-skip-tests-for-mips.patch
@@ -0,0 +1,12 @@
+TEMPORARY HACK: Disable a test that fails on MIPS.
+
+--- libtool/Makefile.in.orig	2011-10-17 06:18:55.000000000 -0400
++++ libtool/Makefile.in	2013-10-12 20:41:50.669067382 -0400
+@@ -890,7 +890,6 @@
+ 	tests/demo-pic-make.test \
+ 	tests/demo-pic-exec.test \
+ 	tests/demo-nopic.test \
+-	tests/demo-nopic-make.test \
+ 	tests/demo-nopic-exec.test \
+ 	tests/cdemo-shared.test \
+ 	tests/cdemo-shared-make.test \
diff --git a/gnu/packages/patches/mit-krb5-init-fix.patch b/gnu/packages/patches/mit-krb5-init-fix.patch
new file mode 100644
index 0000000000..13e49c2789
--- /dev/null
+++ b/gnu/packages/patches/mit-krb5-init-fix.patch
@@ -0,0 +1,18 @@
+Fix the early context initialization code to avoid assuming that
+arguments will be evaluated from right to left.
+
+Patch by Mark H Weaver <mhw@netris.org>.
+
+--- src/lib/krb5/krb/t_cc_config.c.orig	2012-12-17 21:47:05.000000000 -0500
++++ src/lib/krb5/krb/t_cc_config.c	2013-10-29 18:19:16.547994590 -0400
+@@ -117,8 +117,8 @@
+     int c;
+     unsigned int i;
+ 
+-    bail_on_err(context, "Error initializing Kerberos library",
+-                krb5_init_context(&context));
++    ret = krb5_init_context(&context);
++    bail_on_err(context, "Error initializing Kerberos library", ret);
+     bail_on_err(context, "Error getting location of default ccache",
+                 krb5_cc_default(context, &ccache));
+     server = NULL;
diff --git a/gnu/packages/patches/pspp-tests.patch b/gnu/packages/patches/pspp-tests.patch
new file mode 100644
index 0000000000..3e61b68804
--- /dev/null
+++ b/gnu/packages/patches/pspp-tests.patch
@@ -0,0 +1,13 @@
+diff --git a/tests/output/render-test.c b/tests/output/render-test.c
+index 5f4c1da..e9df96c 100644
+--- a/tests/output/render-test.c
++++ b/tests/output/render-test.c
+@@ -142,7 +142,7 @@ configure_drivers (int width, int length)
+   string_map_insert (&options, "left-margin", "0");
+   string_map_insert (&options, "right-margin", "0");
+   string_map_insert_nocopy (&options, xstrdup ("paper-size"),
+-                            xasprintf ("%dx%dpt", width * 5, length * 8));
++                            xasprintf ("%dx%dpt", width * 5, length * 16));
+   driver = output_driver_create (&options);
+   if (driver == NULL)
+     exit (EXIT_FAILURE);
diff --git a/gnu/packages/patches/tar-gets-undeclared.patch b/gnu/packages/patches/tar-gets-undeclared.patch
deleted file mode 100644
index 301a09dde1..0000000000
--- a/gnu/packages/patches/tar-gets-undeclared.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-This patch is needed to allow builds with newer versions of
-the GNU libc (2.16+).
-
-This is a backport of this patch:
-
-commit 66712c23388e93e5c518ebc8515140fa0c807348
-Author: Eric Blake <eblake@redhat.com>
-Date:   Thu Mar 29 13:30:41 2012 -0600
-
-    stdio: don't assume gets any more
-    
---- tar-1.26/gnu/stdio.in.h	2012-07-02 14:28:45.000000000 +0200
-+++ tar-1.26/gnu/stdio.in.h	2012-07-02 14:28:50.000000000 +0200
-@@ -160,12 +160,6 @@ _GL_WARN_ON_USE (fflush, "fflush is not
-                  "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/perl.scm b/gnu/packages/perl.scm
index c677a1b7e2..21cdc5cea7 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -34,11 +34,11 @@
                                  version ".tar.gz"))
              (sha256
               (base32
-               "15qxzba3a50c9nik5ydgyfp62x7h9vxxn12yd1jgl93hb1wj96km"))))
+               "15qxzba3a50c9nik5ydgyfp62x7h9vxxn12yd1jgl93hb1wj96km"))
+             (patches (list (search-patch "perl-no-sys-dirs.patch")))))
     (build-system gnu-build-system)
     (arguments
      '(#:tests? #f
-       #:patches (list (assoc-ref %build-inputs "patch/no-sys-dirs"))
        #:phases
        (alist-replace
         'configure
@@ -62,7 +62,6 @@
                       (string-append "-Dlocincpth=" libc "/include")
                       (string-append "-Dloclibpth=" libc "/lib")))))
         %standard-phases)))
-    (inputs `(("patch/no-sys-dirs" ,(search-patch "perl-no-sys-dirs.patch"))))
     (native-search-paths (list (search-path-specification
                                 (variable "PERL5LIB")
                                 (directories '("lib/perl5/site_perl")))))
diff --git a/gnu/packages/readline.scm b/gnu/packages/readline.scm
index 1fbbd69d7e..5e8d7d7003 100644
--- a/gnu/packages/readline.scm
+++ b/gnu/packages/readline.scm
@@ -45,15 +45,12 @@
                                    version ".tar.gz"))
                (sha256
                 (base32
-                 "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr"))))
+                 "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr"))
+               (patches (list (search-patch "readline-link-ncurses.patch")))
+               (patch-flags '("-p0"))))
       (build-system gnu-build-system)
       (propagated-inputs `(("ncurses" ,ncurses)))
-      (inputs `(("patch/link-ncurses"
-                 ,(search-patch "readline-link-ncurses.patch"))))
-      (arguments `(#:patches (list (assoc-ref %build-inputs
-                                              "patch/link-ncurses"))
-                   #:patch-flags '("-p0")
-                   #:configure-flags
+      (arguments `(#:configure-flags
                    (list (string-append "LDFLAGS=-Wl,-rpath -Wl,"
                                         (assoc-ref %build-inputs "ncurses")
                                         "/lib"))
diff --git a/gnu/packages/system.scm b/gnu/packages/system.scm
index 9c06e6b61e..2f1eab3806 100644
--- a/gnu/packages/system.scm
+++ b/gnu/packages/system.scm
@@ -28,8 +28,7 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages guile)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'g:))
+  #:use-module (gnu packages gettext)
   #:use-module ((gnu packages base)
                 #:select (tar))
   #:use-module ((gnu packages compression)
@@ -76,7 +75,7 @@ is based on GNU Guile.")
         "1b4hfqv23l87cb37fxwzfk2sgspkyxpr3ig2hsd23hr6mm982j7z"))))
    (build-system cmake-build-system)
    (arguments '(#:tests? #f)) ; There are no tests.
-   (native-inputs `(("gettext" ,g:gettext)))
+   (native-inputs `(("gettext" ,gnu-gettext)))
    (home-page "http://projects.gw-computing.net/projects/dfc")
    (synopsis "Display file system space usage using graphs and colors")
    (description
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 38e586b853..3d88ff8a4a 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -26,8 +26,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix build utils)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'guix:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages apr)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages ed)
@@ -59,7 +58,7 @@
     (inputs
      ;; Note: 'tools/packaging/lp-upload-release' and 'tools/weavemerge.sh'
      ;; require Zsh.
-     `(("gettext" ,guix:gettext)))
+     `(("gettext" ,gnu-gettext)))
     (arguments
      `(#:tests? #f ; no test target
        #:python ,python-2)) ; Python 3 apparently not yet supported, see
@@ -88,7 +87,7 @@ from a command line or use a GUI application.")
    (inputs
     `(("curl" ,curl)
       ("expat" ,expat)
-      ("gettext" ,guix:gettext)
+      ("gettext" ,gnu-gettext)
       ("openssl" ,openssl)
       ("perl" ,perl)
       ("python" ,python-2) ; CAVEAT: incompatible with python-3 according to INSTALL
diff --git a/gnu/packages/vpn.scm b/gnu/packages/vpn.scm
index 0b733550be..dbdfa227e9 100644
--- a/gnu/packages/vpn.scm
+++ b/gnu/packages/vpn.scm
@@ -24,8 +24,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'gnu:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages openssl)
   #:use-module (gnu packages perl)
@@ -81,7 +80,7 @@ Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
                      "1rd8pap455wzkx19i0sy3cqap524b6fwcjvqynxp6lhm01di4bd6"))))
    (build-system gnu-build-system)
    (inputs
-    `(("gettext" ,gnu:gettext)
+    `(("gettext" ,gnu-gettext)
       ("libxml2" ,libxml2)
       ("openssl" ,openssl)
       ("pkg-config" ,pkg-config)
diff --git a/gnu/packages/w3m.scm b/gnu/packages/w3m.scm
index b5122d4f23..64fa78ab1b 100644
--- a/gnu/packages/w3m.scm
+++ b/gnu/packages/w3m.scm
@@ -18,8 +18,7 @@
 
 (define-module (gnu packages w3m)
   #:use-module ((guix licenses) #:select (x11-style))
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'guix:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages bdw-gc)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages ncurses)
@@ -61,7 +60,7 @@
                                (("@PERL@") (which "perl"))))
                            %standard-phases)))
     (inputs
-     `(("gettext" ,guix:gettext)
+     `(("gettext" ,gnu-gettext)
        ("libgc" ,libgc)
        ("ncurses" ,ncurses)
        ("openssl" ,openssl)
diff --git a/gnu/packages/wget.scm b/gnu/packages/wget.scm
index ab7170a73c..29bb725d3b 100644
--- a/gnu/packages/wget.scm
+++ b/gnu/packages/wget.scm
@@ -18,8 +18,7 @@
 
 (define-module (gnu packages wget)
   #:use-module (guix licenses)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'guix:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages gnutls)
   #:use-module (gnu packages perl)
   #:use-module (guix packages)
@@ -42,7 +41,7 @@
     (inputs
      `(("gnutls" ,gnutls)
        ("perl" ,perl)
-       ("gettext" ,guix:gettext)))
+       ("gettext" ,gnu-gettext)))
     (home-page "http://www.gnu.org/software/wget/")
     (synopsis "Non-interactive command-line utility for downloading files")
     (description
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 8ff1532879..3a53fdf3a6 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -26,8 +26,7 @@
   #:use-module (gnu packages compression)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
-  #:use-module ((gnu packages gettext)
-                #:renamer (symbol-prefix-proc 'gnu:))
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages gperf)
@@ -1303,7 +1302,7 @@ tracking.")
             "0dd737ch4q9gr151wff1m3q2j7wf3pip4y81601xdrsh8wipxnx6"))))
     (build-system gnu-build-system)
     (inputs
-      `(("gettext" ,gnu:gettext)
+      `(("gettext" ,gnu-gettext)
         ("libxt" ,libxt)
         ("xproto" ,xproto)
         ("libxext" ,libxext)
@@ -3236,7 +3235,7 @@ tracking.")
             "1nmb7ma8rqryicc5xqrn2hm5pwp5lkf7nj28bwbf63mz2r0mk892"))))
     (build-system gnu-build-system)
     (inputs
-      `(("gettext" ,gnu:gettext)
+      `(("gettext" ,gnu-gettext)
         ("intltool" ,intltool)
         ("libx11" ,libx11)
         ("pkg-config" ,pkg-config)