summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/autotools.scm54
-rw-r--r--gnu/packages/base.scm90
-rw-r--r--gnu/packages/bootstrap.scm63
-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/cross-base.scm9
-rw-r--r--gnu/packages/gd.scm5
-rw-r--r--gnu/packages/gdb.scm7
-rw-r--r--gnu/packages/libffi.scm4
-rw-r--r--gnu/packages/linux.scm3
-rw-r--r--gnu/packages/lsh.scm3
-rw-r--r--gnu/packages/m4.scm7
-rw-r--r--gnu/packages/make-bootstrap.scm37
-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/oggvorbis.scm3
-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/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/tar-gets-undeclared.patch26
-rw-r--r--gnu/packages/perl.scm5
-rw-r--r--gnu/packages/readline.scm11
34 files changed, 514 insertions, 143 deletions
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 8cee8f850b..41e1a8d049 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -73,14 +73,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
@@ -130,18 +130,15 @@ is often used for substituting text patterns in a stream.")
 (define-public tar
   (package
    (name "tar")
-   (version "1.26")
+   (version "1.27")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/tar/tar-"
                                 version ".tar.bz2"))
             (sha256
              (base32
-              "0hbdkzmchq9ycr2x1pxqdcgdbaxksh8c6ac0jf75jajhcks6jlss"))))
+              "0yrwmx2f721ahpnki4fnzvnmrd3md3bq417icb4wrjky7k3caf12"))))
    (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
@@ -212,19 +209,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
@@ -283,21 +276,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.
@@ -328,7 +320,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
@@ -337,11 +332,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"
 
@@ -372,7 +364,11 @@ archives.")
                                 version ".tar.xz"))
             (sha256
              (base32
-              "18spla703zav8dq9fw7rbzkyv9qfisxb26p7amg1x3wjh7iy3d1c"))))
+              "18spla703zav8dq9fw7rbzkyv9qfisxb26p7amg1x3wjh7iy3d1c"))
+            (patches (map search-patch
+                          '("glibc-no-ld-so-cache.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
@@ -387,8 +383,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"
@@ -472,11 +466,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
@@ -574,6 +564,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)
@@ -1005,6 +999,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)
@@ -1015,9 +1017,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))))
@@ -1031,8 +1037,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..d369edb8b6 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,12 @@ check whether everything is alright."
                               (xz    (->store "xz"))
                               (mkdir (->store "mkdir"))
                               (bash  (->store "bash"))
-                              (guile (->store "guile-2.0.7.tar.xz"))
+                              (guile (->store
+                                      (match (%current-system)
+                                        ("mips64el-linux"
+                                         "guile-2.0.9.tar.xz")
+                                        (_
+                                         "guile-2.0.7.tar.xz"))))
                               (builder
                                (add-text-to-store store
                                                   "build-bootstrap-guile.sh"
@@ -209,7 +224,11 @@ $out/bin/guile --version~%"
                           (origin
                            (method url-fetch)
                            (uri (map (cut string-append <> "/" system
-                                          "/20130105/static-binaries.tar.xz")
+                                          (match system
+                                            ("mips64el-linux"
+                                             "/20131017/static-binaries.tar.xz")
+                                            (_
+                                             "/20130105/static-binaries.tar.xz")))
                                      %bootstrap-base-urls))
                            (sha256
                             (match system
@@ -218,7 +237,10 @@ $out/bin/guile --version~%"
                                 "0md23alzy6nc5f16pric7mkagczdzr8xbh074sb3rjzrls06j1ls"))
                               ("i686-linux"
                                (base32
-                                "0nzj1lmm9b94g7k737cr4w1dv282w5nmhb53238ikax9r6pkc0yb"))))))
+                                "0nzj1lmm9b94g7k737cr4w1dv282w5nmhb53238ikax9r6pkc0yb"))
+                              ("mips64el-linux"
+                               (base32
+                                "17k5f1322b7n1difhlyw4cghxvq8fxj7wlhzghh4y362fshvvw1c"))))))
                         "true"                    ; the program to test
                         "Bootstrap binaries of Coreutils, Awk, etc."))
 
@@ -228,7 +250,11 @@ $out/bin/guile --version~%"
                           (origin
                            (method url-fetch)
                            (uri (map (cut string-append <> "/" system
-                                          "/20130105/binutils-2.22.tar.xz")
+                                          (match system
+                                            ("mips64el-linux"
+                                             "/20131017/binutils-2.23.2.tar.xz")
+                                            (_
+                                             "/20130105/binutils-2.22.tar.xz")))
                                      %bootstrap-base-urls))
                            (sha256
                             (match system
@@ -237,7 +263,10 @@ $out/bin/guile --version~%"
                                 "1ffmk2yy2pxvkqgzrkzp3s4jpn4qaaksyk3b5nsc5cjwfm7qkgzh"))
                               ("i686-linux"
                                (base32
-                                "1rafk6aq4sayvv3r3d2khn93nkyzf002xzh0xadlyci4mznr6b0a"))))))
+                                "1rafk6aq4sayvv3r3d2khn93nkyzf002xzh0xadlyci4mznr6b0a"))
+                              ("mips64el-linux"
+                               (base32
+                                "1dpnmscgg1fxg9xmlbvcm1d8h8brjgqwaal748w3v3qf33is4sl6"))))))
                         "ld"                      ; the program to test
                         "Bootstrap binaries of the GNU Binutils"))
 
@@ -279,7 +308,11 @@ $out/bin/guile --version~%"
                     (origin
                      (method url-fetch)
                      (uri (map (cut string-append <> "/" (%current-system)
-                                    "/20130105/glibc-2.17.tar.xz")
+                                    (match (%current-system)
+                                      ("mips64el-linux"
+                                       "/20131017/glibc-2.18.tar.xz")
+                                      (_
+                                       "/20130105/glibc-2.17.tar.xz")))
                                %bootstrap-base-urls))
                      (sha256
                       (match (%current-system)
@@ -288,7 +321,10 @@ $out/bin/guile --version~%"
                           "18kv1z9d8dr1j3hm9w7663kchqw9p6rsx11n1m143jgba2jz6jy3"))
                         ("i686-linux"
                          (base32
-                          "08hv8i0axwnihrcgbz19x0a7s6zyv3yx38x8r29liwl8h82x9g88")))))))))
+                          "08hv8i0axwnihrcgbz19x0a7s6zyv3yx38x8r29liwl8h82x9g88"))
+                        ("mips64el-linux"
+                         (base32
+                          "1w9x8r2him7qbqlm7ah1aq04kk2ydma44jzgdzsdj3kjx36sqyq1")))))))))
     (synopsis "Bootstrap binaries and headers of the GNU C Library")
     (description #f)
     (home-page #f)
@@ -347,7 +383,11 @@ 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")
+                                    (match (%current-system)
+                                      ("mips64el-linux"
+                                       "/20131017/gcc-4.7.3.tar.xz")
+                                      (_
+                                       "/20130105/gcc-4.7.2.tar.xz")))
                                %bootstrap-base-urls))
                      (sha256
                       (match (%current-system)
@@ -356,7 +396,10 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
                           "1x1p7han5crnbw906iwdifykr6grzm0w27dy9gz75j0q1b32i4px"))
                         ("i686-linux"
                          (base32
-                          "06wqs0xxnpw3hn0xjb4c9cs0899p1xwkcysa2rvzhvpra0c5vsg2")))))))))
+                          "06wqs0xxnpw3hn0xjb4c9cs0899p1xwkcysa2rvzhvpra0c5vsg2"))
+                        ("mips64el-linux"
+                         (base32
+                          "0g9z8cdlnlzbg67607rxxfk5vi4xjsdc7c2agvdnyzlp0shib6rb")))))))))
     (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/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/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/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 cd1c921626..eab4280324 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -473,7 +473,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")
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..defc32bc08 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)
@@ -409,11 +420,11 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                ("mpfr-source" ,(package-source mpfr))
                ("mpc-source" ,(package-source mpc))
                ("binutils" ,binutils)
-               ,@(package-inputs gcc-4.7))))))
+               ,@(package-inputs gcc-4.8))))))
 
 (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 +440,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 +456,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 +478,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/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/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/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/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/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"))