summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--build-aux/build-self.scm59
-rw-r--r--doc/contributing.texi6
-rw-r--r--doc/guix.texi48
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/admin.scm15
-rw-r--r--gnu/packages/audacity.scm5
-rw-r--r--gnu/packages/audio.scm44
-rw-r--r--gnu/packages/bioinformatics.scm11
-rw-r--r--gnu/packages/boost.scm2
-rw-r--r--gnu/packages/cdrom.scm4
-rw-r--r--gnu/packages/certs.scm22
-rw-r--r--gnu/packages/code.scm4
-rw-r--r--gnu/packages/compression.scm3
-rw-r--r--gnu/packages/cups.scm4
-rw-r--r--gnu/packages/djvu.scm4
-rw-r--r--gnu/packages/docbook.scm7
-rw-r--r--gnu/packages/documentation.scm8
-rw-r--r--gnu/packages/enlightenment.scm4
-rw-r--r--gnu/packages/flashing-tools.scm4
-rw-r--r--gnu/packages/fonts.scm7
-rw-r--r--gnu/packages/fontutils.scm4
-rw-r--r--gnu/packages/game-development.scm53
-rw-r--r--gnu/packages/games.scm8
-rw-r--r--gnu/packages/ghostscript.scm4
-rw-r--r--gnu/packages/gl.scm10
-rw-r--r--gnu/packages/gnome.scm2
-rw-r--r--gnu/packages/gnucash.scm4
-rw-r--r--gnu/packages/graphviz.scm4
-rw-r--r--gnu/packages/hexedit.scm46
-rw-r--r--gnu/packages/image.scm26
-rw-r--r--gnu/packages/java.scm479
-rw-r--r--gnu/packages/libreoffice.scm23
-rw-r--r--gnu/packages/libusb.scm4
-rw-r--r--gnu/packages/linux.scm21
-rw-r--r--gnu/packages/lirc.scm4
-rw-r--r--gnu/packages/lxde.scm14
-rw-r--r--gnu/packages/mail.scm15
-rw-r--r--gnu/packages/maths.scm344
-rw-r--r--gnu/packages/mcrypt.scm13
-rw-r--r--gnu/packages/mp3.scm6
-rw-r--r--gnu/packages/mpi.scm21
-rw-r--r--gnu/packages/music.scm4
-rw-r--r--gnu/packages/networking.scm7
-rw-r--r--gnu/packages/ocr.scm34
-rw-r--r--gnu/packages/onc-rpc.scm2
-rw-r--r--gnu/packages/password-utils.scm4
-rw-r--r--gnu/packages/pdf.scm12
-rw-r--r--gnu/packages/perl.scm4
-rw-r--r--gnu/packages/photo.scm12
-rw-r--r--gnu/packages/popt.scm3
-rw-r--r--gnu/packages/protobuf.scm34
-rw-r--r--gnu/packages/python.scm53
-rw-r--r--gnu/packages/rdesktop.scm4
-rw-r--r--gnu/packages/scheme.scm137
-rw-r--r--gnu/packages/screen.scm4
-rw-r--r--gnu/packages/slim.scm2
-rw-r--r--gnu/packages/swig.scm5
-rw-r--r--gnu/packages/tcl.scm8
-rw-r--r--gnu/packages/tex.scm20
-rw-r--r--gnu/packages/textutils.scm2
-rw-r--r--gnu/packages/version-control.scm202
-rw-r--r--gnu/packages/video.scm11
-rw-r--r--gnu/packages/w3m.scm5
-rw-r--r--gnu/packages/web.scm9
-rw-r--r--gnu/packages/wm.scm2
-rw-r--r--gnu/packages/wxwidgets.scm4
-rw-r--r--gnu/packages/xdisorg.scm7
-rw-r--r--gnu/packages/xiph.scm4
-rw-r--r--gnu/packages/xml.scm3
-rw-r--r--gnu/services/avahi.scm3
-rw-r--r--gnu/services/base.scm6
-rw-r--r--gnu/services/databases.scm10
-rw-r--r--gnu/services/dbus.scm4
-rw-r--r--gnu/services/desktop.scm31
-rw-r--r--gnu/services/dict.scm1
-rw-r--r--gnu/services/lirc.scm7
-rw-r--r--gnu/services/mail.scm1
-rw-r--r--gnu/services/networking.scm15
-rw-r--r--gnu/services/ssh.scm5
-rw-r--r--gnu/services/web.scm7
-rw-r--r--gnu/services/xorg.scm2
-rw-r--r--guix/build/download.scm2
-rw-r--r--guix/build/pull.scm39
-rw-r--r--guix/config.scm.in33
-rw-r--r--guix/derivations.scm21
-rw-r--r--guix/download.scm6
-rw-r--r--guix/scripts/publish.scm59
-rw-r--r--tests/guix-system.sh4
-rw-r--r--tests/publish.scm34
89 files changed, 1437 insertions, 818 deletions
diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index b78f3cb437..59028305e7 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2016 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,7 +19,9 @@
 (define-module (build-self)
   #:use-module (gnu)
   #:use-module (guix)
+  #:use-module (guix config)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-19)
   #:export (build))
 
 ;;; Commentary:
@@ -44,6 +46,18 @@
 (define libgcrypt
   (first (find-best-packages-by-name "libgcrypt" #f)))
 
+(define zlib
+  (first (find-best-packages-by-name "zlib" #f)))
+
+(define gzip
+  (first (find-best-packages-by-name "gzip" #f)))
+
+(define bzip2
+  (first (find-best-packages-by-name "bzip2" #f)))
+
+(define xz
+  (first (find-best-packages-by-name "xz" #f)))
+
 (define guile-json
   (first (find-best-packages-by-name "guile-json" #f)))
 
@@ -57,12 +71,33 @@
          (lambda (file)
            (string-append (dirname file) "/.."))))
 
+
+(define (date-version-string)
+  "Return the current date and hour in UTC timezone, for use as a poor
+person's version identifier."
+  ;; XXX: Replace with a Git commit id.
+  (date->string (current-date 0) "~Y~m~d.~H"))
+
 ;; The procedure below is our return value.
-(define* (build source #:key verbose?
+(define* (build source
+                #:key verbose? (version (date-version-string))
                 #:allow-other-keys
                 #:rest rest)
   "Return a derivation that unpacks SOURCE into STORE and compiles Scheme
 files."
+  ;; The '%xxxdir' variables were added to (guix config) in July 2016 so we
+  ;; cannot assume that they are defined.  Try to guess their value when
+  ;; they're undefined (XXX: we get an incorrect guess when environment
+  ;; variables such as 'NIX_STATE_DIR' are defined!).
+  (define storedir
+    (if (defined? '%storedir) %storedir %store-directory))
+  (define localstatedir
+    (if (defined? '%localstatedir) %localstatedir (dirname %state-directory)))
+  (define sysconfdir
+    (if (defined? '%sysconfdir) %sysconfdir (dirname %config-directory)))
+  (define sbindir
+    (if (defined? '%sbindir) %sbindir (dirname %guix-register-program)))
+
   (define builder
     #~(begin
         (use-modules (guix build pull))
@@ -73,12 +108,28 @@ files."
 
         (build-guix #$output #$source
 
+                    #:system #$%system
+                    #:storedir #$storedir
+                    #:localstatedir #$localstatedir
+                    #:sysconfdir #$sysconfdir
+                    #:sbindir #$sbindir
+
+                    #:package-name #$%guix-package-name
+                    #:package-version #$version
+                    #:bug-report-address #$%guix-bug-report-address
+                    #:home-page-url #$%guix-home-page-url
+
+                    #:libgcrypt #$libgcrypt
+                    #:zlib #$zlib
+                    #:gzip #$gzip
+                    #:bzip2 #$bzip2
+                    #:xz #$xz
+
                     ;; XXX: This is not perfect, enabling VERBOSE? means
                     ;; building a different derivation.
                     #:debug-port (if #$verbose?
                                      (current-error-port)
-                                     (%make-void-port "w"))
-                    #:gcrypt #$libgcrypt)))
+                                     (%make-void-port "w")))))
 
   (gexp->derivation "guix-latest" builder
                     #:modules '((guix build pull)
diff --git a/doc/contributing.texi b/doc/contributing.texi
index 208c6af5e8..dc554d2c76 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -323,6 +323,12 @@ related to the hardware---e.g., use of different instruction set
 extensions---or to the operating system kernel---e.g., reliance on
 @code{uname} or @file{/proc} files.
 
+@item
+When writing documentation, please use gender-neutral wording when
+referring to people, such as
+@uref{https://en.wikipedia.org/wiki/Singular_they, singular
+``they''@comma{} ``their''@comma{} ``them''}, and so forth.
+
 @end enumerate
 
 When posting a patch to the mailing list, use @samp{[PATCH] @dots{}} as
diff --git a/doc/guix.texi b/doc/guix.texi
index 318e6cb5d9..0d6739adc3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2387,7 +2387,7 @@ package looks like this:
                (base32
                 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
     (build-system gnu-build-system)
-    (arguments `(#:configure-flags '("--enable-silent-rules")))
+    (arguments '(#:configure-flags '("--enable-silent-rules")))
     (inputs `(("gawk" ,gawk)))
     (synopsis "Hello, GNU world: An example GNU package")
     (description "Guess what GNU Hello prints!")
@@ -2452,12 +2452,44 @@ The @code{arguments} field specifies options for the build system
 @var{gnu-build-system} as a request run @file{configure} with the
 @code{--enable-silent-rules} flag.
 
+@cindex quote
+@cindex quoting
+@findex '
+@findex quote
+What about these quote (@code{'}) characters?  They are Scheme syntax to
+introduce a literal list; @code{'} is synonymous with @code{quote}.
+@xref{Expression Syntax, quoting,, guile, GNU Guile Reference Manual},
+for details.  Here the value of the @code{arguments} field is a list of
+arguments passed to the build system down the road, as with @code{apply}
+(@pxref{Fly Evaluation, @code{apply},, guile, GNU Guile Reference
+Manual}).
+
+The hash-colon (@code{#:}) sequence defines a Scheme @dfn{keyword}
+(@pxref{Keywords,,, guile, GNU Guile Reference Manual}), and
+@code{#:configure-flags} is a keyword used to pass a keyword argument
+to the build system (@pxref{Coding With Keywords,,, guile, GNU Guile
+Reference Manual}).
+
 @item
 The @code{inputs} field specifies inputs to the build process---i.e.,
 build-time or run-time dependencies of the package.  Here, we define an
 input called @code{"gawk"} whose value is that of the @var{gawk}
 variable; @var{gawk} is itself bound to a @code{<package>} object.
 
+@cindex backquote (quasiquote)
+@findex `
+@findex quasiquote
+@cindex comma (unquote)
+@findex ,
+@findex unquote
+@findex ,@@
+@findex unquote-splicing
+Again, @code{`} (a backquote, synonymous with @code{quasiquote}) allows
+us to introduce a literal list in the @code{inputs} field, while
+@code{,} (a comma, synonymous with @code{unquote}) allows us to insert a
+value in that list (@pxref{Expression Syntax, unquote,, guile, GNU Guile
+Reference Manual}).
+
 Note that GCC, Coreutils, Bash, and other essential tools do not need to
 be specified as inputs here.  Instead, @var{gnu-build-system} takes care
 of ensuring that they are present (@pxref{Build Systems}).
@@ -5633,6 +5665,20 @@ archive}), the daemon may download substitutes from it:
 guix-daemon --substitute-urls=http://example.org:8080
 @end example
 
+As a bonus, @command{guix publish} also serves as a content-addressed
+mirror for source files referenced in @code{origin} records
+(@pxref{origin Reference}).  For instance, assuming @command{guix
+publish} is running on @code{example.org}, the following URL returns the
+raw @file{hello-2.10.tar.gz} file with the given SHA256 hash
+(represented in @code{nix-base32} format, @pxref{Invoking guix hash}):
+
+@example
+http://example.org/file/hello-2.10.tar.gz/sha256/0ssi1@dots{}ndq1i
+@end example
+
+Obviously, these URLs only work for files that are in the store; in
+other cases, they return 404 (``Not Found'').
+
 The following options are available:
 
 @table @code
diff --git a/gnu/local.mk b/gnu/local.mk
index 29e1e84ae0..65834897dc 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -166,6 +166,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/gv.scm				\
   %D%/packages/gxmessage.scm			\
   %D%/packages/haskell.scm			\
+  %D%/packages/hexedit.scm			\
   %D%/packages/hugs.scm				\
   %D%/packages/hurd.scm				\
   %D%/packages/ibus.scm				\
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 1d08be9e13..a7c4892b6b 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -346,8 +346,8 @@ login, passwd, su, groupadd, and useradd.")
     (version "1.08")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/mingetty/mingetty-"
-                                 version ".tar.gz"))
+             (uri (string-append "mirror://sourceforge/mingetty/mingetty/"
+                                 version "/mingetty-" version ".tar.gz"))
              (sha256
               (base32
                "05yxrp44ky2kg6qknk1ih0kvwkgbn9fbz77r3vci7agslh5wjm8g"))))
@@ -440,8 +440,8 @@ ONC RPC numbers.")
     (version "0.7.1")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/netcat/netcat-"
-                                 version ".tar.bz2"))
+             (uri (string-append "mirror://sourceforge/netcat/netcat/" version
+                                 "/netcat-" version ".tar.bz2"))
              (sha256
               (base32
                "1frjcdkhkpzk0f84hx6hmw5l0ynpmji8vcbaxg8h5k2svyxz0nmm"))))
@@ -705,7 +705,8 @@ by bandwidth they use.")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/clusterssh/"
-                                  "clusterssh-" version ".tar.gz"))
+                                  "1.%20ClusterSSH%20Series%203/" version
+                                  "/clusterssh-" version ".tar.gz"))
               (sha256
                (base32
                 "1bwggpvaj2al5blg1ynapviv2kpydffpzq2zkhi81najnvzc1rr7"))))
@@ -1112,8 +1113,8 @@ system is under heavy load.")
     (version "1.2.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/detox/detox-"
-                                  version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/detox/detox/" version
+                                  "/detox-" version ".tar.bz2"))
               (sha256
                (base32
                 "1y6vvjqsg54kl49cry73jbfhr04s7wjs779vrr9zrq6kww7dkymb"))))
diff --git a/gnu/packages/audacity.scm b/gnu/packages/audacity.scm
index 9eae6aa1aa..0f9554deba 100644
--- a/gnu/packages/audacity.scm
+++ b/gnu/packages/audacity.scm
@@ -42,9 +42,8 @@
     (source
      (origin
        (method url-fetch)
-       (uri
-        (string-append
-         "mirror://sourceforge/audacity/audacity-minsrc-" version ".tar.xz"))
+       (uri (string-append "mirror://sourceforge/audacity/audacity/" version
+                           "/audacity-minsrc-" version ".tar.xz"))
        (sha256
         (base32 "1cs2w3fwqylpqmfwkvlgdx5lhclpckfil7pqibl37qlbnf4qvndh"))
        (patches (search-patches "audacity-fix-ffmpeg-binding.patch"))))
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 144d7321b6..27565479a0 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -75,8 +75,8 @@
     (version "2.1.2")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/alsamodular/ams-"
-                                  version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/alsamodular/alsamodular"
+                                  "/" version "/ams-" version ".tar.bz2"))
               (sha256
                (base32
                 "1azbrhpfk4nnybr7kgmc7w6al6xnzppg853vas8gmkh185kk11l0"))))
@@ -766,8 +766,8 @@ also play midifiles using a Soundfont.")
     (version "2.7")
     (source (origin
               (method url-fetch)
-              (uri (string-append
-                    "mirror://sourceforge/faac/faad2-" version ".zip"))
+              (uri (string-append "mirror://sourceforge/faac/faad2-src/faad2-"
+                                  version "/faad2-" version ".zip"))
               (sha256
                (base32
                 "16f3l16c00sg0wkrkm3vzv0gy3g97x309vw788igs0cap2x1ak3z"))))
@@ -868,7 +868,7 @@ patches that can be used with softsynths such as Timidity and WildMidi.")
     (source (origin
              (method url-fetch)
              (uri (string-append
-                   "mirror://sourceforge/guitarix/guitarix2-"
+                   "mirror://sourceforge/guitarix/guitarix/guitarix2-"
                    version ".tar.xz"))
              (sha256
               (base32
@@ -1230,8 +1230,8 @@ connections between them.")
     (version "3.1.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append
-                    "mirror://sourceforge/bs2b/libbs2b-" version ".tar.lzma"))
+              (uri (string-append "mirror://sourceforge/bs2b/libbs2b/" version
+                                  "/libbs2b-" version ".tar.lzma"))
               (sha256
                (base32
                 "1mcc4gjkmphczjybnsrip3gq1f974knzys7x49bv197xk3fn8wdr"))))
@@ -1253,10 +1253,8 @@ essential distortions.")
     (version "0.28")
     (source (origin
              (method url-fetch)
-             (uri (string-append
-                   "mirror://sourceforge/liblo/liblo-"
-                   version
-                   ".tar.gz"))
+             (uri (string-append "mirror://sourceforge/liblo/liblo/" version
+                                 "/liblo-" version ".tar.gz"))
              (sha256
               (base32
                "02drgnpirvl2ihvzgsmn02agr5sj3vipzzw9vma56qlkgfvak56s"))))
@@ -1709,9 +1707,9 @@ Suil currently supports every combination of Gtk 2, Qt 4, and X11.")
     (version "2.14.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append
-                    "mirror://sourceforge/timidity/TiMidity++-"
-                    version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/timidity/TiMidity++"
+                                  "/TiMidity++-" version
+                                  "/TiMidity++-" version ".tar.bz2"))
               (sha256
                (base32
                 "0xk41w4qbk23z1fvqdyfblbz10mmxsllw0svxzjw5sa9y11vczzr"))))
@@ -1871,7 +1869,7 @@ encode and decode wavpack files.")
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/project/modplug-xmms/"
+                    "mirror://sourceforge/modplug-xmms/"
                     name "/" version "/" name "-" version ".tar.gz"))
               (sha256
                (base32
@@ -1892,7 +1890,7 @@ surround and reverb.")
     (version "4.3.10")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/xmp/libxmp/"
+              (uri (string-append "mirror://sourceforge/xmp/libxmp/" version "/"
                                   name "-" version ".tar.gz"))
               (sha256
                (base32
@@ -1912,7 +1910,7 @@ Scream Tracker 3 (S3M), Fast Tracker II (XM), and Impulse Tracker (IT).")
     (version "4.0.10")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/xmp/xmp/"
+              (uri (string-append "mirror://sourceforge/xmp/xmp/" version "/"
                                   name "-" version ".tar.gz"))
               (sha256
                (base32
@@ -1972,8 +1970,8 @@ control functionality, or just for playing around with the sound effects.")
     (version "14.4.2")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/sox/sox-"
-                                  version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/sox/sox/" version "/"
+                                  name "-" version ".tar.bz2"))
               (sha256
                (base32
                 "170lx90r1nlnb2j6lg00524iwvqy72p48vii4xc5prrh8dnrb9l1"))))
@@ -2035,8 +2033,8 @@ conversion.  It may be used, for example, to resample PCM-encoded audio.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append
-             "mirror://sourceforge/twolame/twolame-" version ".tar.gz"))
+       (uri (string-append "mirror://sourceforge/twolame/twolame/" version
+                           "/twolame-" version ".tar.gz"))
        (sha256
         (base32 "0ahiqqng5pidwhj1wzph4vxxgxxgcfa3gl0gywipzx2ii7s35wwq"))))
     (build-system gnu-build-system)
@@ -2102,8 +2100,8 @@ interface.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append
-             "mirror://sourceforge/qsynth/qsynth-" version ".tar.gz"))
+       (uri (string-append "mirror://sourceforge/qsynth/qsynth/" version
+                           "/qsynth-" version ".tar.gz"))
        (sha256
         (base32 "034p6mbwrjnxd9b6h20cidxi4ilkk3cgpjp154j0jzjs1ipf7x2h"))))
     (build-system gnu-build-system)
diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 1cbf85ff6c..5cd92b8150 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -3124,7 +3124,7 @@ BAM and Wiggle files in both transcript-coordinate and genomic-coordinate.")
        (method url-fetch)
        (uri
         (string-append "mirror://sourceforge/rseqc/"
-                       version "/RSeQC-" version ".tar.gz"))
+                       "RSeQC-" version ".tar.gz"))
        (sha256
         (base32 "15ly0254yi032qzkdplg00q144qfdsd986gh62829rl5bkxhj330"))
        (modules '((guix build utils)))
@@ -3235,7 +3235,7 @@ to the user's query of interest.")
      (origin
        (method url-fetch)
        (uri
-        (string-append "mirror://sourceforge/samtools/"
+        (string-append "mirror://sourceforge/samtools/samtools/"
                        version "/samtools-" version ".tar.bz2"))
        (sha256
         (base32
@@ -3295,7 +3295,7 @@ viewer.")
      (origin
        (method url-fetch)
        (uri
-        (string-append "mirror://sourceforge/samtools/"
+        (string-append "mirror://sourceforge/samtools/samtools/"
                        version "/samtools-" version ".tar.bz2"))
        (sha256
         (base32 "1m33xsfwz0s8qi45lylagfllqg7fphf4dr0780rsvw75av9wk06h"))))
@@ -4022,9 +4022,8 @@ sequences.")
     (version "1.4.6-p2")
     (source (origin
               (method url-fetch)
-              (uri (string-append
-                    "mirror://sourceforge/subread/subread-"
-                    version "-source.tar.gz"))
+              (uri (string-append "mirror://sourceforge/subread/subread-"
+                                  version "/subread-" version "-source.tar.gz"))
               (sha256
                (base32
                 "06sv9mpcsdj6p68y15d6gi70lca3lxmzk0dn61hg0kfsa7rxmsr3"))))
diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm
index 882f9cc7c0..fd8f4e80e3 100644
--- a/gnu/packages/boost.scm
+++ b/gnu/packages/boost.scm
@@ -38,7 +38,7 @@
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/boost/boost_"
+                    "mirror://sourceforge/boost/boost/" version "/boost_"
                     (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
                     ".tar.bz2"))
               (sha256
diff --git a/gnu/packages/cdrom.scm b/gnu/packages/cdrom.scm
index 2dd84a2a17..4263cdebb7 100644
--- a/gnu/packages/cdrom.scm
+++ b/gnu/packages/cdrom.scm
@@ -51,8 +51,8 @@
     (version "1.3.2")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/libcddb/libcddb-"
-                                 version ".tar.bz2"))
+             (uri (string-append "mirror://sourceforge/libcddb/libcddb/" version
+                                 "/libcddb-" version ".tar.bz2"))
              (sha256
               (base32
                "0fr21a7vprdyy1bq6s99m0x420c9jm5fipsd63pqv8qyfkhhxkim"))))
diff --git a/gnu/packages/certs.scm b/gnu/packages/certs.scm
index dd7d339794..f5a4372d5c 100644
--- a/gnu/packages/certs.scm
+++ b/gnu/packages/certs.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,7 +25,6 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
-  #:use-module (gnu packages gnuzilla)
   #:use-module (gnu packages python)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages tls))
@@ -71,8 +71,20 @@
    (home-page "http://pkgs.fedoraproject.org/cgit/ca-certificates.git/")))
 
 (define-public nss-certs
-  (package (inherit nss) ; to reuse the source, version and some metadata
+  (package
     (name "nss-certs")
+    (version "3.23")
+    (source (origin
+              (method url-fetch)
+              (uri (let ((version-with-underscores
+                          (string-join (string-split version #\.) "_")))
+                     (string-append
+                      "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
+                      "releases/NSS_" version-with-underscores "_RTM/src/"
+                      "nss-" version ".tar.gz")))
+              (sha256
+               (base32
+                "1kqidv91icq96m9m8zx50n7px08km2l88458rkgyjwcn3kiq7cwl"))))
     (build-system gnu-build-system)
     (outputs '("out"))
     (native-inputs
@@ -123,5 +135,7 @@
                 '(set-paths install-locale unpack)))))
     (synopsis "CA certificates from Mozilla")
     (description
-      "This package provides certificates for Certification Authorities (CA)
-taken from the NSS package and thus ultimately from the Mozilla project.")))
+     "This package provides certificates for Certification Authorities (CA)
+taken from the NSS package and thus ultimately from the Mozilla project.")
+    (home-page "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
+    (license license:mpl2.0)))
diff --git a/gnu/packages/code.scm b/gnu/packages/code.scm
index c3efd15e44..233e803431 100644
--- a/gnu/packages/code.scm
+++ b/gnu/packages/code.scm
@@ -287,8 +287,8 @@ stack traces.")
     (version "1.12")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/ltp/lcov-"
-                                  version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/ltp/Coverage%20Analysis"
+                                  "/LCOV-" version "/lcov-" version ".tar.gz"))
               (sha256
                (base32
                 "19wfifdpxxivhq9adbphanjfga9bg9spms9v7c3589wndjff8x5l"))))
diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index af3bba1f61..01b32a2ac3 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -634,7 +634,8 @@ time for compression ratio.")
     (version "4.3")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/squashfs/"
+              (uri (string-append "mirror://sourceforge/squashfs/squashfs/"
+                                  "squashfs" version "/"
                                   "squashfs" version ".tar.gz"))
               (sha256
                (base32
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index c055315321..2865ff1494 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -306,8 +306,8 @@ device-specific programs to convert and print many types of files.")
     (version "3.16.3")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/hplip/"
-                                  "hplip-" version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/hplip/hplip/" version
+                                  "/hplip-" version ".tar.gz"))
               (sha256
                (base32
                 "1501qdnkjp1ybgagy5188fmf6cgmj5555ygjl3543nlbwcp31lj2"))))
diff --git a/gnu/packages/djvu.scm b/gnu/packages/djvu.scm
index 47a76169f6..e739df3772 100644
--- a/gnu/packages/djvu.scm
+++ b/gnu/packages/djvu.scm
@@ -28,8 +28,8 @@
     (version "3.5.27")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/djvu/djvulibre-"
-                                  version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/djvu/DjVuLibre/"
+                                  version "/djvulibre-" version ".tar.gz"))
               (sha256
                (base32
                 "0psh3zl9dj4n4r3lx25390nx34xz0bg0ql48zdskhq354ljni5p6"))))
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index b8a8ba69dc..3d18d459bd 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -135,8 +135,8 @@ by no means limited to these applications.)  This package provides XML DTDs.")
     (version "1.78.1")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/docbook/docbook-xsl-"
-                                  version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/docbook/docbook-xsl/"
+                                  version "/docbook-xsl-" version ".tar.bz2"))
               (sha256
                (base32
                 "0rxl013ncmz1n6ymk2idvx3hix9pdabk8xn01cpcv32wmfb753y9"))))
@@ -176,7 +176,8 @@ by no means limited to these applications.)  This package provides XML DTDs.")
     (version "0.3.5")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/dblatex/dblatex-"
+              (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
+                                  "dblatex-" version "/dblatex-"
                                   version ".tar.bz2"))
               (sha256
                (base32
diff --git a/gnu/packages/documentation.scm b/gnu/packages/documentation.scm
index 8302cc49cc..72af708dbd 100644
--- a/gnu/packages/documentation.scm
+++ b/gnu/packages/documentation.scm
@@ -43,8 +43,8 @@
     (version "8.6.9")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/asciidoc/asciidoc-"
-                                  version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/asciidoc/asciidoc/"
+                                  version "/asciidoc-" version ".tar.gz"))
               (sha256
                (base32
                 "1w71nk527lq504njmaf0vzr93pgahkgzzxzglrq6bay8cw2rvnvq"))))
@@ -126,8 +126,8 @@ or Java class files.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/scrollkeeper/scrollkeeper-"
-                           version ".tar.gz"))
+       (uri (string-append "mirror://sourceforge/scrollkeeper/scrollkeeper/"
+                           version "/scrollkeeper-" version ".tar.gz"))
        (sha256
         (base32 "1bfxwxc1ngh11v36z899sz9qam366r050fhkyb5adv65lb1x62sa"))))
     (build-system gnu-build-system)
diff --git a/gnu/packages/enlightenment.scm b/gnu/packages/enlightenment.scm
index a8187f8f85..6289bea7af 100644
--- a/gnu/packages/enlightenment.scm
+++ b/gnu/packages/enlightenment.scm
@@ -270,7 +270,7 @@ Libraries with some extra bells and whistles.")
 (define-public enlightenment
   (package
     (name "enlightenment")
-    (version "0.21.0")
+    (version "0.21.1")
     (source (origin
               (method url-fetch)
               (uri
@@ -278,7 +278,7 @@ Libraries with some extra bells and whistles.")
                               name "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "0p85dmk9ysbf9y7vlc92z7495mh9l860xj3s8pspy9mscv3dnwg9"))))
+                "119sxrgrz163c01yx0q9n2jpmmbv0a58akmz0c2z4xy37f1m02rx"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags '("--enable-mount-eeze")))
diff --git a/gnu/packages/flashing-tools.scm b/gnu/packages/flashing-tools.scm
index e3f8d80c02..d0c164eff4 100644
--- a/gnu/packages/flashing-tools.scm
+++ b/gnu/packages/flashing-tools.scm
@@ -114,8 +114,8 @@ technique (ISP).")
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer-"
-                          version ".tar.gz"))
+      (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
+                          version "/dfu-programmer-" version ".tar.gz"))
       (sha256
        (base32
         "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 3faeb2ebd8..9b2281ad20 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -129,7 +129,7 @@ TrueType (TTF) files.")
     (version "2.35")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/dejavu/"
+             (uri (string-append "mirror://sourceforge/dejavu/dejavu/"
                                  version "/dejavu-fonts-ttf-"
                                  version ".tar.bz2"))
              (sha256
@@ -386,7 +386,7 @@ The Liberation Fonts are sponsored by Red Hat.")
       (origin
         (method url-fetch)
         (uri (string-append
-               "mirror://sourceforge/project/terminus-font/terminus-font-"
+               "mirror://sourceforge/terminus-font/terminus-font-"
                version
                "/terminus-font-"
                version
@@ -476,7 +476,8 @@ text in Simplified Chinese, Traditional Chinese, Japanese, and Korean.")
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/wqy/wqy-zenhei-"
+                    "mirror://sourceforge/wqy/wqy-zenhei/" version
+                    "%20%28Fighting-state%20RC1%29/wqy-zenhei-"
                     version ".tar.gz"))
               (file-name (string-append "wqy-zenhei-" version ".tar.gz"))
               (sha256
diff --git a/gnu/packages/fontutils.scm b/gnu/packages/fontutils.scm
index 38068008ca..9ddbaec2f2 100644
--- a/gnu/packages/fontutils.scm
+++ b/gnu/packages/fontutils.scm
@@ -397,8 +397,8 @@ and returns a sequence of positioned glyphids from the font.")
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/potrace/potrace-"
-                          version ".tar.gz"))
+      (uri (string-append "mirror://sourceforge/potrace/" version
+                          "/potrace-" version ".tar.gz"))
       (sha256
        (base32
         "115p2vgyq7p2mf4nidk2x3aa341nvv2v8ml056vbji36df5l6lk2"))))
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index b11285ab54..7067a714e7 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
+;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -342,6 +343,58 @@ etc.")
     (home-page "http://liballeg.org")
     (license license:giftware)))
 
+(define-public allegro
+  (package
+    (name "allegro")
+    (version "5.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://download.gna.org/allegro/allegro/"
+                                  version "/allegro-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1mwzgzc4nb5k5zkbq7yrc6hg63yxq3wk69lmjag1h19x8b6njnmg"))))
+    (build-system cmake-build-system)
+    (arguments `(#:tests? #f)) ; there are no tests
+    (inputs
+     ;; FIXME: Add the following optional inputs: xinput2, opensl, dumb
+     `(("flac" ,flac)
+       ("freetype" ,freetype)
+       ("glu" ,glu)
+       ("gtk" ,gtk+-2)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libtheora" ,libtheora)
+       ("libvorbis" ,libvorbis)
+       ("libxcursor" ,libxcursor)
+       ("libxinerama" ,libxinerama)
+       ("libxrandr" ,libxrandr)
+       ("mesa" ,mesa)
+       ("openal" ,openal)
+       ("physfs" ,physfs)
+       ("zlib" ,zlib)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (synopsis "Game programming library")
+    (description "Allegro is a library mainly aimed at video game and
+multimedia programming.  It handles common, low-level tasks such as creating
+windows, accepting user input, loading data, drawing images, playing sounds,
+etc.")
+    (home-page "http://liballeg.org")
+    (license license:bsd-3)))
+
+(define-public allegro-5.0
+  (package (inherit allegro)
+    (name "allegro")
+    (version "5.0.11")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://download.gna.org/allegro/allegro/"
+                                  version "/allegro-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0cd51qrh97jrr0xdmnivqgwljpmizg8pixsgvc4blqqlaz4i9zj9"))))))
+
 (define-public aseprite
   (package
     (name "aseprite")
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 731e243f46..3b193eb21c 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -1024,14 +1024,16 @@ falling, themeable graphics and sounds, and replays.")
 (define-public wesnoth
   (package
     (name "wesnoth")
-    (version "1.12.5")
+    (version "1.12.6")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/wesnoth/"
+              (uri (string-append "mirror://sourceforge/wesnoth/wesnoth-"
+                                  (version-major+minor version) "/wesnoth-"
+                                  version "/"
                                   name "-" version ".tar.bz2"))
               (sha256
                (base32
-                "07d8ms9ayswg2g530p0zwmz3d77zv68l6nmc718iq9sbv90av6jr"))))
+                "0kifp6g1dsr16m6ngjq2hx19h851fqg326ps3krnhpyix963h3x5"))))
     (build-system cmake-build-system)
     (arguments
      '(#:tests? #f ; no check target
diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index ae00eea1dc..417f47e79a 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -41,8 +41,8 @@
    (version "2.6")
    (source (origin
             (method url-fetch)
-            (uri (string-append
-                  "mirror://sourceforge/lcms/lcms2-" version ".tar.gz"))
+            (uri (string-append "mirror://sourceforge/lcms/lcms/" version
+                                "/lcms2-" version ".tar.gz"))
             (sha256 (base32
                      "1c8lgq8gfs3nyplvbx9k8wzfj6r2bqi3f611vb1m8z3476454wji"))))
    (build-system gnu-build-system)
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 7fa79bbde3..f36d15a9b9 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -80,7 +80,7 @@ as ASCII text.")
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/project/freeglut/freeglut/"
+                    "mirror://sourceforge/freeglut/freeglut/"
                     version "/freeglut-" version ".tar.gz"))
               (sha256
                (base32
@@ -121,7 +121,7 @@ the X-Consortium license.")
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/project/ftgl/FTGL%20Source/2.1.3~rc5/"
+                    "mirror://sourceforge/ftgl/FTGL%20Source/2.1.3~rc5/"
                     "ftgl-" version ".tar.gz"))
               (sha256
                (base32
@@ -358,10 +358,8 @@ glxgears, glxheads, and glxinfo.")
     (version "1.11.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append
-                    "mirror://sourceforge/glew/glew-"
-                    version
-                    ".tgz"))
+              (uri (string-append "mirror://sourceforge/glew/glew/" version
+                                  "/glew-" version ".tgz"))
               (sha256
                (base32
                 "1mhkllxz49l1x680dmzrv2i82qjrq017sykah3xc90f2d8qcxfv9"))
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 9335005150..318a04d403 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -788,7 +788,7 @@ the API.")
     (version "1.2.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/project/gtkglext/gtkglext/"
+              (uri (string-append "mirror://sourceforge/gtkglext/gtkglext/"
                                   version "/gtkglext-" version ".tar.gz"))
               (sha256
                (base32 "1ya4d2j2aacr9ii5zj4ac95fjpdvlm2rg79mgnk7yvl1dcy3y1z5"))
diff --git a/gnu/packages/gnucash.scm b/gnu/packages/gnucash.scm
index eaa84ccc32..bdef0b163b 100644
--- a/gnu/packages/gnucash.scm
+++ b/gnu/packages/gnucash.scm
@@ -46,8 +46,8 @@
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/gnucash/gnucash-"
-                          version ".tar.bz2"))
+      (uri (string-append "mirror://sourceforge/gnucash/gnucash%20%28stable%29/"
+                          version "/gnucash-" version ".tar.bz2"))
       (sha256
        (base32
         "0x84f07p30pwhriamv8ifljgw755cj87rc12jy1xddf47spyj7rp"))
diff --git a/gnu/packages/graphviz.scm b/gnu/packages/graphviz.scm
index e4b9094632..610bd16beb 100644
--- a/gnu/packages/graphviz.scm
+++ b/gnu/packages/graphviz.scm
@@ -119,8 +119,8 @@ interfaces for other technical domains.")
     (version "0.7.6")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/gts/gts-"
-                                 version ".tar.gz"))
+             (uri (string-append "mirror://sourceforge/gts/gts/" version
+                                 "/gts-" version ".tar.gz"))
              (sha256
               (base32
                "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
diff --git a/gnu/packages/hexedit.scm b/gnu/packages/hexedit.scm
new file mode 100644
index 0000000000..d2aaec306b
--- /dev/null
+++ b/gnu/packages/hexedit.scm
@@ -0,0 +1,46 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages hexedit)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages ncurses)
+  #:use-module (guix download)
+  #:use-module (guix build-system gnu))
+
+(define-public hexedit
+  (package
+    (name "hexedit")
+    (version "1.2.13")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://rigaux.org/"
+                                  name "-" version ".src.tgz"))
+              (sha256
+               (base32
+                "1mwdp1ikk64cqmagnrrps5jkn3li3n47maiqh2qc1xbp1ains4ka"))))
+    (build-system gnu-build-system)
+    (arguments '(#:tests? #f)) ; no check target
+    (inputs `(("ncurses" ,ncurses)))
+    (synopsis "View and edit files or devices in hexadecimal or ASCII")
+    (description "hexedit shows a file both in ASCII and in hexadecimal.  The
+file can be a device as the file is read a piece at a time.  You can modify
+the file and search through it.")
+    (home-page "http://rigaux.org/hexedit.html")
+    (license license:gpl2+)))
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 0ab3f60c5e..188d142710 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -332,8 +332,8 @@ work.")
       (origin
         (method url-fetch)
         (uri
-         (string-append "mirror://sourceforge/openjpeg.mirror/" name "-"
-                        version ".tar.gz"))
+         (string-append "mirror://sourceforge/openjpeg.mirror/" version "/"
+                        name "-" version ".tar.gz"))
         (sha256
          (base32 "00zzm303zvv4ijzancrsb1cqbph3pgz0nky92k9qx3fq9y0vnchj"))
         (patches (search-patches "openjpeg-use-after-free-fix.patch"
@@ -369,8 +369,8 @@ error-resilience, a Java-viewer for j2k-images, ...")
      (origin
        (method url-fetch)
        (uri
-        (string-append "mirror://sourceforge/openjpeg.mirror/" name "-"
-                       version ".tar.gz"))
+        (string-append "mirror://sourceforge/openjpeg.mirror/" version "/"
+                       name "-" version ".tar.gz"))
        (sha256
         (base32 "1c2xc3nl2mg511b63rk7hrckmy14681p1m44mzw3n1fyqnjm0b0z"))
        (patches (search-patches "openjpeg-use-after-free-fix.patch"
@@ -384,8 +384,8 @@ error-resilience, a Java-viewer for j2k-images, ...")
      (origin
        (method url-fetch)
        (uri
-        (string-append "mirror://sourceforge/openjpeg.mirror/" name "-"
-                       version ".tar.gz"))
+        (string-append "mirror://sourceforge/openjpeg.mirror/" version "/"
+                       name "-" version ".tar.gz"))
        (sha256
         (base32 "11waq9w215zvzxrpv40afyd18qf79mxc28fda80bm3ax98cpppqm"))))))
 
@@ -396,8 +396,7 @@ error-resilience, a Java-viewer for j2k-images, ...")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/giflib/giflib-"
-                                  (first (string-split version #\.))
-                                  ".x/giflib-" version ".tar.bz2"))
+                                  version ".tar.bz2"))
               (sha256
                (base32
                 "1md83dip8rf29y40cm5r7nn19705f54iraz6545zhwa6y8zyq9yz"))))
@@ -443,7 +442,8 @@ compose, and analyze GIF images.")
     (version "4.1.4")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/giflib/libungif-"
+              (uri (string-append "mirror://sourceforge/giflib/libungif-4.x/"
+                                  "libungif-" version "/libungif-"
                                   version ".tar.bz2"))
               (sha256
                (base32
@@ -463,8 +463,8 @@ compose, and analyze GIF images.")
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/enlightenment/imlib2-"
-                    version ".tar.bz2"))
+                    "mirror://sourceforge/enlightenment/imlib2-src/" version
+                    "/imlib2-" version ".tar.bz2"))
               (sha256
                (base32
                 "08809xxk2555yj6glixzw9a0x3x8cx55imd89kj3r0h152bn8a3x"))))
@@ -663,8 +663,8 @@ channels.")
     (version "2.0.3")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/libmng/"
-                                  name "-" version ".tar.xz"))
+              (uri (string-append "mirror://sourceforge/libmng/libmng-devel/"
+                                  version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
                 "1lvxnpds0vcf0lil6ia2036ghqlbl740c4d2sz0q5g6l93fjyija"))))
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 753fb7726c..2d50ad84fa 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -30,6 +30,7 @@
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages certs)
   #:use-module (gnu packages cpio)
   #:use-module (gnu packages cups)
   #:use-module (gnu packages compression)
@@ -262,7 +263,8 @@ build process and its dependencies, whereas Make uses Makefile format.")
        #:modules ((guix build utils)
                   (guix build gnu-build-system)
                   (ice-9 popen)
-                  (ice-9 rdelim))
+                  (ice-9 rdelim)
+                  (srfi srfi-19))
 
        #:configure-flags
        (let* ((gcjdir (assoc-ref %build-inputs "gcj"))
@@ -281,111 +283,108 @@ build process and its dependencies, whereas Make uses Makefile format.")
            ,(string-append "--with-jdk-home=" jdk)
            ,(string-append "--with-java=" jdk "/bin/java")))
        #:phases
-       (alist-replace
-        'unpack
-        (lambda* (#:key source inputs #:allow-other-keys)
-          (and (zero? (system* "tar" "xvf" source))
-               (begin
-                 (chdir (string-append "icedtea6-" ,version))
-                 (mkdir "openjdk.src")
-                 (with-directory-excursion "openjdk.src"
-                   (copy-file (assoc-ref inputs "openjdk6-src")
-                              "openjdk6-src.tar.xz")
-                   (zero? (system* "tar" "xvf" "openjdk6-src.tar.xz"))))))
-        (alist-cons-after
-         'unpack 'patch-patches
-         (lambda _
-           ;; shebang in patches so that they apply cleanly
-           (substitute* '("patches/jtreg-jrunscript.patch"
-                          "patches/hotspot/hs23/drop_unlicensed_test.patch")
-             (("#!/bin/sh") (string-append "#!" (which "sh"))))
+       (modify-phases %standard-phases
+         (replace 'unpack
+           (lambda* (#:key source inputs #:allow-other-keys)
+             (and (zero? (system* "tar" "xvf" source))
+                  (begin
+                    (chdir (string-append "icedtea6-" ,version))
+                    (mkdir "openjdk.src")
+                    (with-directory-excursion "openjdk.src"
+                      (copy-file (assoc-ref inputs "openjdk6-src")
+                                 "openjdk6-src.tar.xz")
+                      (zero? (system* "tar" "xvf" "openjdk6-src.tar.xz")))))))
+         (add-after 'unpack 'patch-patches
+           (lambda _
+             ;; shebang in patches so that they apply cleanly
+             (substitute* '("patches/jtreg-jrunscript.patch"
+                            "patches/hotspot/hs23/drop_unlicensed_test.patch")
+               (("#!/bin/sh") (string-append "#!" (which "sh"))))
 
-           ;; fix path to alsa header in patch
-           (substitute* "patches/openjdk/6799141-split_out_versions.patch"
-             (("ALSA_INCLUDE=/usr/include/alsa/version.h")
-              (string-append "ALSA_INCLUDE="
-                             (assoc-ref %build-inputs "alsa-lib")
-                             "/include/alsa/version.h"))))
-         (alist-cons-after
-          'unpack 'patch-paths
-          (lambda _
-            ;; buildtree.make generates shell scripts, so we need to replace
-            ;; the generated shebang
-            (substitute* '("openjdk.src/hotspot/make/linux/makefiles/buildtree.make")
-              (("/bin/sh") (which "bash")))
+             ;; fix path to alsa header in patch
+             (substitute* "patches/openjdk/6799141-split_out_versions.patch"
+               (("ALSA_INCLUDE=/usr/include/alsa/version.h")
+                (string-append "ALSA_INCLUDE="
+                               (assoc-ref %build-inputs "alsa-lib")
+                               "/include/alsa/version.h")))))
+         (add-after 'unpack 'patch-paths
+           (lambda _
+             ;; buildtree.make generates shell scripts, so we need to replace
+             ;; the generated shebang
+             (substitute* '("openjdk.src/hotspot/make/linux/makefiles/buildtree.make")
+               (("/bin/sh") (which "bash")))
 
-            (let ((corebin (string-append
-                            (assoc-ref %build-inputs "coreutils") "/bin/"))
-                  (binbin  (string-append
-                            (assoc-ref %build-inputs "binutils") "/bin/"))
-                  (grepbin (string-append
-                            (assoc-ref %build-inputs "grep") "/bin/")))
-              (substitute* '("openjdk.src/jdk/make/common/shared/Defs-linux.gmk"
-                             "openjdk.src/corba/make/common/shared/Defs-linux.gmk")
-                (("UNIXCOMMAND_PATH  = /bin/")
-                 (string-append "UNIXCOMMAND_PATH = " corebin))
-                (("USRBIN_PATH  = /usr/bin/")
-                 (string-append "USRBIN_PATH = " corebin))
-                (("DEVTOOLS_PATH *= */usr/bin/")
-                 (string-append "DEVTOOLS_PATH = " corebin))
-                (("COMPILER_PATH *= */usr/bin/")
-                 (string-append "COMPILER_PATH = "
-                                (assoc-ref %build-inputs "gcc") "/bin/"))
-                (("DEF_OBJCOPY *=.*objcopy")
-                 (string-append "DEF_OBJCOPY = " (which "objcopy"))))
+             (let ((corebin (string-append
+                             (assoc-ref %build-inputs "coreutils") "/bin/"))
+                   (binbin  (string-append
+                             (assoc-ref %build-inputs "binutils") "/bin/"))
+                   (grepbin (string-append
+                             (assoc-ref %build-inputs "grep") "/bin/")))
+               (substitute* '("openjdk.src/jdk/make/common/shared/Defs-linux.gmk"
+                              "openjdk.src/corba/make/common/shared/Defs-linux.gmk")
+                 (("UNIXCOMMAND_PATH  = /bin/")
+                  (string-append "UNIXCOMMAND_PATH = " corebin))
+                 (("USRBIN_PATH  = /usr/bin/")
+                  (string-append "USRBIN_PATH = " corebin))
+                 (("DEVTOOLS_PATH *= */usr/bin/")
+                  (string-append "DEVTOOLS_PATH = " corebin))
+                 (("COMPILER_PATH *= */usr/bin/")
+                  (string-append "COMPILER_PATH = "
+                                 (assoc-ref %build-inputs "gcc") "/bin/"))
+                 (("DEF_OBJCOPY *=.*objcopy")
+                  (string-append "DEF_OBJCOPY = " (which "objcopy"))))
 
-              ;; fix hard-coded utility paths
-              (substitute* '("openjdk.src/jdk/make/common/shared/Defs-utils.gmk"
-                             "openjdk.src/corba/make/common/shared/Defs-utils.gmk")
-                (("ECHO *=.*echo")
-                 (string-append "ECHO = " (which "echo")))
-                (("^GREP *=.*grep")
-                 (string-append "GREP = " (which "grep")))
-                (("EGREP *=.*egrep")
-                 (string-append "EGREP = " (which "egrep")))
-                (("CPIO *=.*cpio")
-                 (string-append "CPIO = " (which "cpio")))
-                (("READELF *=.*readelf")
-                 (string-append "READELF = " (which "readelf")))
-                (("^ *AR *=.*ar")
-                 (string-append "AR = " (which "ar")))
-                (("^ *TAR *=.*tar")
-                 (string-append "TAR = " (which "tar")))
-                (("AS *=.*as")
-                 (string-append "AS = " (which "as")))
-                (("LD *=.*ld")
-                 (string-append "LD = " (which "ld")))
-                (("STRIP *=.*strip")
-                 (string-append "STRIP = " (which "strip")))
-                (("NM *=.*nm")
-                 (string-append "NM = " (which "nm")))
-                (("^SH *=.*sh")
-                 (string-append "SH = " (which "bash")))
-                (("^FIND *=.*find")
-                 (string-append "FIND = " (which "find")))
-                (("LDD *=.*ldd")
-                 (string-append "LDD = " (which "ldd")))
-                (("NAWK *=.*(n|g)awk")
-                 (string-append "NAWK = " (which "gawk")))
-                (("XARGS *=.*xargs")
-                 (string-append "XARGS = " (which "xargs")))
-                (("UNZIP *=.*unzip")
-                 (string-append "UNZIP = " (which "unzip")))
-                (("ZIPEXE *=.*zip")
-                 (string-append "ZIPEXE = " (which "zip")))
-                (("SED *=.*sed")
-                 (string-append "SED = " (which "sed"))))
+               ;; fix hard-coded utility paths
+               (substitute* '("openjdk.src/jdk/make/common/shared/Defs-utils.gmk"
+                              "openjdk.src/corba/make/common/shared/Defs-utils.gmk")
+                 (("ECHO *=.*echo")
+                  (string-append "ECHO = " (which "echo")))
+                 (("^GREP *=.*grep")
+                  (string-append "GREP = " (which "grep")))
+                 (("EGREP *=.*egrep")
+                  (string-append "EGREP = " (which "egrep")))
+                 (("CPIO *=.*cpio")
+                  (string-append "CPIO = " (which "cpio")))
+                 (("READELF *=.*readelf")
+                  (string-append "READELF = " (which "readelf")))
+                 (("^ *AR *=.*ar")
+                  (string-append "AR = " (which "ar")))
+                 (("^ *TAR *=.*tar")
+                  (string-append "TAR = " (which "tar")))
+                 (("AS *=.*as")
+                  (string-append "AS = " (which "as")))
+                 (("LD *=.*ld")
+                  (string-append "LD = " (which "ld")))
+                 (("STRIP *=.*strip")
+                  (string-append "STRIP = " (which "strip")))
+                 (("NM *=.*nm")
+                  (string-append "NM = " (which "nm")))
+                 (("^SH *=.*sh")
+                  (string-append "SH = " (which "bash")))
+                 (("^FIND *=.*find")
+                  (string-append "FIND = " (which "find")))
+                 (("LDD *=.*ldd")
+                  (string-append "LDD = " (which "ldd")))
+                 (("NAWK *=.*(n|g)awk")
+                  (string-append "NAWK = " (which "gawk")))
+                 (("XARGS *=.*xargs")
+                  (string-append "XARGS = " (which "xargs")))
+                 (("UNZIP *=.*unzip")
+                  (string-append "UNZIP = " (which "unzip")))
+                 (("ZIPEXE *=.*zip")
+                  (string-append "ZIPEXE = " (which "zip")))
+                 (("SED *=.*sed")
+                  (string-append "SED = " (which "sed"))))
 
-              ;; Some of these timestamps cause problems as they are more than
-              ;; 10 years ago, failing the build process.
-              (substitute*
-                  "openjdk.src/jdk/src/share/classes/java/util/CurrencyData.properties"
-                (("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN")
-                (("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN")
-                (("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON")
-                (("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY"))))
-          (alist-cons-before
-           'configure 'set-additional-paths
+               ;; Some of these timestamps cause problems as they are more than
+               ;; 10 years ago, failing the build process.
+               (substitute*
+                   "openjdk.src/jdk/src/share/classes/java/util/CurrencyData.properties"
+                 (("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN")
+                 (("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN")
+                 (("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON")
+                 (("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY")))))
+         (add-before 'configure 'set-additional-paths
            (lambda* (#:key inputs #:allow-other-keys)
              (let* ((gcjdir  (assoc-ref %build-inputs "gcj"))
                     (gcjlib  (string-append gcjdir "/lib"))
@@ -412,125 +411,159 @@ build process and its dependencies, whereas Make uses Makefile format.")
                                       "/include"))
                (setenv "ALT_FREETYPE_LIB_PATH"
                        (string-append (assoc-ref %build-inputs "freetype")
-                                      "/lib"))))
-           (alist-cons-before
-            'check 'fix-test-framework
-            (lambda _
-              ;; Fix PATH in test environment
-              (substitute* "src/jtreg/com/sun/javatest/regtest/Main.java"
-                (("PATH=/bin:/usr/bin")
-                 (string-append "PATH=" (getenv "PATH"))))
-              (substitute* "src/jtreg/com/sun/javatest/util/SysEnv.java"
-                (("/usr/bin/env") (which "env")))
-              #t)
-            (alist-cons-before
-             'check 'fix-hotspot-tests
-             (lambda _
-               (with-directory-excursion "openjdk.src/hotspot/test/"
-                 (substitute* "jprt.config"
-                   (("PATH=\"\\$\\{path4sdk\\}\"")
-                    (string-append "PATH=" (getenv "PATH")))
-                   (("make=/usr/bin/make")
-                    (string-append "make=" (which "make"))))
-                 (substitute* '("runtime/6626217/Test6626217.sh"
-                                "runtime/7110720/Test7110720.sh")
-                   (("/bin/rm") (which "rm"))
-                   (("/bin/cp") (which "cp"))
-                   (("/bin/mv") (which "mv"))))
-               #t)
-             (alist-cons-before
-              'check 'fix-jdk-tests
-              (lambda _
-                (with-directory-excursion "openjdk.src/jdk/test/"
-                  (substitute* "com/sun/jdi/JdbReadTwiceTest.sh"
-                    (("/bin/pwd") (which "pwd")))
-                  (substitute* "com/sun/jdi/ShellScaffold.sh"
-                    (("/bin/kill") (which "kill")))
-                  (substitute* "start-Xvfb.sh"
-                    ;;(("/usr/bin/X11/Xvfb") (which "Xvfb"))
-                    (("/usr/bin/nohup")    (which "nohup")))
-                  (substitute* "javax/security/auth/Subject/doAs/Test.sh"
-                    (("/bin/rm") (which "rm")))
-                  (substitute* "tools/launcher/MultipleJRE.sh"
-                    (("echo \"#!/bin/sh\"")
-                     (string-append "echo \"#!" (which "rm") "\""))
-                    (("/usr/bin/zip") (which "zip")))
-                  (substitute* "com/sun/jdi/OnThrowTest.java"
-                    (("#!/bin/sh") (string-append "#!" (which "sh"))))
-                  (substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java"
-                    (("/usr/bin/uptime") (which "uptime")))
-                  (substitute* "java/lang/ProcessBuilder/Basic.java"
-                    (("/usr/bin/env") (which "env"))
-                    (("/bin/false") (which "false"))
-                    (("/bin/true") (which "true"))
-                    (("/bin/cp") (which "cp"))
-                    (("/bin/sh") (which "sh")))
-                  (substitute* "java/lang/ProcessBuilder/FeelingLucky.java"
-                    (("/bin/sh") (which "sh")))
-                  (substitute* "java/lang/ProcessBuilder/Zombies.java"
-                    (("/usr/bin/perl") (which "perl"))
-                    (("/bin/ps") (which "ps"))
-                    (("/bin/true") (which "true")))
-                  (substitute* "java/lang/Runtime/exec/ConcurrentRead.java"
-                    (("/usr/bin/tee") (which "tee")))
-                  (substitute* "java/lang/Runtime/exec/ExecWithDir.java"
-                    (("/bin/true") (which "true")))
-                  (substitute* "java/lang/Runtime/exec/ExecWithInput.java"
-                    (("/bin/cat") (which "cat")))
-                  (substitute* "java/lang/Runtime/exec/ExitValue.java"
-                    (("/bin/sh") (which "sh"))
-                    (("/bin/true") (which "true"))
-                    (("/bin/kill") (which "kill")))
-                  (substitute* "java/lang/Runtime/exec/LotsOfDestroys.java"
-                    (("/usr/bin/echo") (which "echo")))
-                  (substitute* "java/lang/Runtime/exec/LotsOfOutput.java"
-                    (("/usr/bin/cat") (which "cat")))
-                  (substitute* "java/lang/Runtime/exec/SleepyCat.java"
-                    (("/bin/cat") (which "cat"))
-                    (("/bin/sleep") (which "sleep"))
-                    (("/bin/sh") (which "sh")))
-                  (substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java"
-                    (("/bin/cat") (which "cat")))
-                  (substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java"
-                    (("/bin/chmod") (which "chmod")))
-                  (substitute* "java/util/zip/ZipFile/Assortment.java"
-                    (("/bin/sh") (which "sh"))))
-                #t)
-              (alist-replace
-               'check
-               (lambda _
-                 ;; The "make check-*" targets always return zero, so we need to
-                 ;; check for errors in the associated log files to determine
-                 ;; whether any tests have failed.
-                 (use-modules (ice-9 rdelim))
-                 (let* ((error-pattern (make-regexp "^(Error|FAILED):.*"))
-                        (checker (lambda (port)
-                                   (let loop ()
-                                     (let ((line (read-line port)))
-                                       (cond
-                                        ((eof-object? line) #t)
-                                        ((regexp-exec error-pattern line) #f)
-                                        (else (loop)))))))
-                        (run-test (lambda (test)
-                                    (system* "make" test)
-                                    (call-with-input-file
-                                        (string-append "test/" test ".log")
-                                      checker))))
-                   (or #t ; skip tests
-                       (and (run-test "check-hotspot")
-                            (run-test "check-langtools")
-                            (run-test "check-jdk")))))
-               (alist-replace
-                'install
-                (lambda* (#:key outputs #:allow-other-keys)
-                  (let ((doc (string-append (assoc-ref outputs "doc")
-                                            "/share/doc/icedtea"))
-                        (jre (assoc-ref outputs "out"))
-                        (jdk (assoc-ref outputs "jdk")))
-                    (copy-recursively "openjdk.build/docs" doc)
-                    (copy-recursively "openjdk.build/j2re-image" jre)
-                    (copy-recursively "openjdk.build/j2sdk-image" jdk)))
-                %standard-phases)))))))))))
+                                      "/lib")))))
+         (add-before 'check 'fix-test-framework
+           (lambda _
+             ;; Fix PATH in test environment
+             (substitute* "src/jtreg/com/sun/javatest/regtest/Main.java"
+               (("PATH=/bin:/usr/bin")
+                (string-append "PATH=" (getenv "PATH"))))
+             (substitute* "src/jtreg/com/sun/javatest/util/SysEnv.java"
+               (("/usr/bin/env") (which "env")))
+             #t))
+         (add-before 'check 'fix-hotspot-tests
+           (lambda _
+             (with-directory-excursion "openjdk.src/hotspot/test/"
+               (substitute* "jprt.config"
+                 (("PATH=\"\\$\\{path4sdk\\}\"")
+                  (string-append "PATH=" (getenv "PATH")))
+                 (("make=/usr/bin/make")
+                  (string-append "make=" (which "make"))))
+               (substitute* '("runtime/6626217/Test6626217.sh"
+                              "runtime/7110720/Test7110720.sh")
+                 (("/bin/rm") (which "rm"))
+                 (("/bin/cp") (which "cp"))
+                 (("/bin/mv") (which "mv"))))
+             #t))
+         (add-before 'check 'fix-jdk-tests
+           (lambda _
+             (with-directory-excursion "openjdk.src/jdk/test/"
+               (substitute* "com/sun/jdi/JdbReadTwiceTest.sh"
+                 (("/bin/pwd") (which "pwd")))
+               (substitute* "com/sun/jdi/ShellScaffold.sh"
+                 (("/bin/kill") (which "kill")))
+               (substitute* "start-Xvfb.sh"
+                 ;;(("/usr/bin/X11/Xvfb") (which "Xvfb"))
+                 (("/usr/bin/nohup")    (which "nohup")))
+               (substitute* "javax/security/auth/Subject/doAs/Test.sh"
+                 (("/bin/rm") (which "rm")))
+               (substitute* "tools/launcher/MultipleJRE.sh"
+                 (("echo \"#!/bin/sh\"")
+                  (string-append "echo \"#!" (which "rm") "\""))
+                 (("/usr/bin/zip") (which "zip")))
+               (substitute* "com/sun/jdi/OnThrowTest.java"
+                 (("#!/bin/sh") (string-append "#!" (which "sh"))))
+               (substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java"
+                 (("/usr/bin/uptime") (which "uptime")))
+               (substitute* "java/lang/ProcessBuilder/Basic.java"
+                 (("/usr/bin/env") (which "env"))
+                 (("/bin/false") (which "false"))
+                 (("/bin/true") (which "true"))
+                 (("/bin/cp") (which "cp"))
+                 (("/bin/sh") (which "sh")))
+               (substitute* "java/lang/ProcessBuilder/FeelingLucky.java"
+                 (("/bin/sh") (which "sh")))
+               (substitute* "java/lang/ProcessBuilder/Zombies.java"
+                 (("/usr/bin/perl") (which "perl"))
+                 (("/bin/ps") (which "ps"))
+                 (("/bin/true") (which "true")))
+               (substitute* "java/lang/Runtime/exec/ConcurrentRead.java"
+                 (("/usr/bin/tee") (which "tee")))
+               (substitute* "java/lang/Runtime/exec/ExecWithDir.java"
+                 (("/bin/true") (which "true")))
+               (substitute* "java/lang/Runtime/exec/ExecWithInput.java"
+                 (("/bin/cat") (which "cat")))
+               (substitute* "java/lang/Runtime/exec/ExitValue.java"
+                 (("/bin/sh") (which "sh"))
+                 (("/bin/true") (which "true"))
+                 (("/bin/kill") (which "kill")))
+               (substitute* "java/lang/Runtime/exec/LotsOfDestroys.java"
+                 (("/usr/bin/echo") (which "echo")))
+               (substitute* "java/lang/Runtime/exec/LotsOfOutput.java"
+                 (("/usr/bin/cat") (which "cat")))
+               (substitute* "java/lang/Runtime/exec/SleepyCat.java"
+                 (("/bin/cat") (which "cat"))
+                 (("/bin/sleep") (which "sleep"))
+                 (("/bin/sh") (which "sh")))
+               (substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java"
+                 (("/bin/cat") (which "cat")))
+               (substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java"
+                 (("/bin/chmod") (which "chmod")))
+               (substitute* "java/util/zip/ZipFile/Assortment.java"
+                 (("/bin/sh") (which "sh"))))
+             #t))
+         (replace 'check
+           (lambda _
+             ;; The "make check-*" targets always return zero, so we need to
+             ;; check for errors in the associated log files to determine
+             ;; whether any tests have failed.
+             (use-modules (ice-9 rdelim))
+             (let* ((error-pattern (make-regexp "^(Error|FAILED):.*"))
+                    (checker (lambda (port)
+                               (let loop ()
+                                 (let ((line (read-line port)))
+                                   (cond
+                                    ((eof-object? line) #t)
+                                    ((regexp-exec error-pattern line) #f)
+                                    (else (loop)))))))
+                    (run-test (lambda (test)
+                                (system* "make" test)
+                                (call-with-input-file
+                                    (string-append "test/" test ".log")
+                                  checker))))
+               (or #t ; skip tests
+                   (and (run-test "check-hotspot")
+                        (run-test "check-langtools")
+                        (run-test "check-jdk"))))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((doc (string-append (assoc-ref outputs "doc")
+                                       "/share/doc/icedtea"))
+                   (jre (assoc-ref outputs "out"))
+                   (jdk (assoc-ref outputs "jdk")))
+               (copy-recursively "openjdk.build/docs" doc)
+               (copy-recursively "openjdk.build/j2re-image" jre)
+               (copy-recursively "openjdk.build/j2sdk-image" jdk))))
+         ;; By default IcedTea only generates an empty keystore.  In order to
+         ;; be able to use certificates in Java programs we need to generate a
+         ;; keystore from a set of certificates.  For convenience we use the
+         ;; certificates from the nss-certs package.
+         (add-after 'install 'install-keystore
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((keystore  "cacerts")
+                    (certs-dir (string-append (assoc-ref inputs "nss-certs")
+                                              "/etc/ssl/certs"))
+                    (keytool   (string-append (assoc-ref outputs "jdk")
+                                              "/bin/keytool")))
+               (define (import-cert cert)
+                 (format #t "Importing certificate ~a\n" (basename cert))
+                 (let* ((port (open-pipe* OPEN_WRITE keytool
+                                          "-import"
+                                          "-alias" (basename cert)
+                                          "-keystore" keystore
+                                          "-storepass" "changeit"
+                                          "-file" cert)))
+                   (display "yes\n" port)
+                   (when (not (zero? (status:exit-val (close-pipe port))))
+                     (error "failed to import" cert))))
+
+               ;; This is necessary because the certificate directory contains
+               ;; files with non-ASCII characters in their names.
+               (setlocale LC_ALL "en_US.utf8")
+               (setenv "LC_ALL" "en_US.utf8")
+
+               (for-each import-cert (find-files certs-dir "\\.pem$"))
+               (mkdir-p (string-append (assoc-ref outputs "out")
+                                       "/lib/security"))
+               (mkdir-p (string-append (assoc-ref outputs "jdk")
+                                       "/jre/lib/security"))
+               (install-file keystore
+                             (string-append (assoc-ref outputs "out")
+                                            "/lib/security"))
+               (install-file keystore
+                             (string-append (assoc-ref outputs "jdk")
+                                            "/jre/lib/security"))
+               #t))))))
     (native-inputs
      `(("ant" ,ant)
        ("alsa-lib" ,alsa-lib)
@@ -553,6 +586,7 @@ build process and its dependencies, whereas Make uses Makefile format.")
        ("libxslt" ,libxslt) ;for xsltproc
        ("mit-krb5" ,mit-krb5)
        ("nss" ,nss)
+       ("nss-certs" ,nss-certs)
        ("libx11" ,libx11)
        ("libxcomposite" ,libxcomposite)
        ("libxt" ,libxt)
@@ -798,6 +832,9 @@ build process and its dependencies, whereas Make uses Makefile format.")
              (delete 'patch-paths)
              (delete 'set-additional-paths)
              (delete 'patch-patches)
+             ;; FIXME: This phase is needed but fails with this version of
+             ;; IcedTea.
+             (delete 'install-keystore)
              (replace 'install
                (lambda* (#:key outputs #:allow-other-keys)
                  (let ((doc (string-append (assoc-ref outputs "doc")
diff --git a/gnu/packages/libreoffice.scm b/gnu/packages/libreoffice.scm
index 18606f96a1..8f4a6c9f61 100644
--- a/gnu/packages/libreoffice.scm
+++ b/gnu/packages/libreoffice.scm
@@ -127,7 +127,7 @@ CSV, CSS and XML.")
      (origin
       (method url-fetch)
       (uri (string-append "mirror://sourceforge/libwpd/" name "/" name "-"
-                          version ".tar.xz"))
+                          version "/" name "-" version ".tar.xz"))
       (sha256 (base32
                "03ygxyb0vfjv8raif5q62sl33b54wkr5rzgadb8slijm6k281wpn"))))
     (build-system gnu-build-system)
@@ -158,8 +158,8 @@ spreadsheets and presentations.")
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/libwpd/" name "/" name "-"
-                          version ".tar.xz"))
+      (uri (string-append "mirror://sourceforge/" name "/" name "/"
+                          name "-" version "/" name "-" version ".tar.xz"))
       (sha256 (base32
                "0b6krzr6kxzm89g6bapn805kdayq70hn16n5b5wfs2lwrf0ag2wx"))))
     (build-system gnu-build-system)
@@ -220,8 +220,8 @@ ZVR (simple compressed text format).")
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/libwpg/" name "/" name "-"
-                          version ".tar.xz"))
+      (uri (string-append "mirror://sourceforge/" name "/" name "/"
+                          name "-" version "/" name "-" version ".tar.xz"))
       (sha256 (base32
                "097jx8a638fwwfrzf6v29r1yhc34rq9526py7wf0ck2z4fcr2w3g"))))
     (build-system gnu-build-system)
@@ -576,8 +576,8 @@ text documents, vector drawings, presentations and spreadsheets.")
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/" name "/" name "/"
-                          name "-" version ".tar.xz"))
+      (uri (string-append "mirror://sourceforge/" name "/" name "/" name "-"
+                          version "/" name "-" version ".tar.xz"))
       (sha256 (base32
                "1vx9h419fcfcs0yj071hsg9d2qvkacgca6052m8hv3h743cdmzil"))))
     (build-system gnu-build-system)
@@ -607,7 +607,7 @@ spreadsheet documents.")
      (origin
       (method url-fetch)
       (uri (string-append "mirror://sourceforge/" name "/" name "/"
-                          name "-" version ".tar.xz"))
+                          name "-" version "/" name "-" version ".tar.xz"))
       (sha256 (base32
                "0nlrdk7di015l0sk0ivjdqs86zdcvf73p9z9s9ry5glyhrknzxjk"))))
     (build-system gnu-build-system)
@@ -635,7 +635,7 @@ Works word processor file format.")
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/" name "/"
+      (uri (string-append "mirror://sourceforge/" name "/Hunspell/" version "/"
                           name "-" version ".tar.gz"))
       (sha256 (base32
                "0v14ff9s37vkh45diaddndcrj0hmn67arh8xh8k79q9c1vgc1cm7"))))
@@ -655,7 +655,8 @@ word compounding or character encoding.")
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/hunspell/"
+      (uri (string-append "mirror://sourceforge/hunspell/Hyphen/"
+                          (version-major+minor version) "/"
                           name "-" version ".tar.gz"))
       (sha256 (base32
                "01ap9pr6zzzbp4ky0vy7i1983fwyqy27pl0ld55s30fdxka3ciih"))))
@@ -676,7 +677,7 @@ patterns, which are pre-processed by a perl script.")
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/hunspell/"
+      (uri (string-append "mirror://sourceforge/hunspell/MyThes/" version "/"
                           name "-" version ".tar.gz"))
       (sha256 (base32
                "0prh19wy1c74kmzkkavm9qslk99gz8h8wmjvwzjc6lf8v2az708y"))))
diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 1f659c7594..0071f4f119 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -138,7 +138,7 @@ version of libusb to run with newer libusb.")
     (version "1.1.11")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/libmtp/" version
+             (uri (string-append "mirror://sourceforge/libmtp/libmtp/" version
                                  "/libmtp-" version ".tar.gz"))
              (sha256
               (base32
@@ -174,7 +174,7 @@ proposed for standardization.")
     (version "1.3.10")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/gmtp/" version
+              (uri (string-append "mirror://sourceforge/gmtp/gMTP-" version
                                   "/gmtp-" version ".tar.gz"))
               (sha256
                (base32
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 5ce6007b40..7c5a9ef976 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -723,7 +723,8 @@ from the e2fsprogs package.  It is meant to be used in initrds.")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/extundelete/"
-                                  version "/extundelete-" version ".tar.bz2"))
+                                  "extundelete/" version "/extundelete-"
+                                  version ".tar.bz2"))
               (sha256
                (base32
                 "1x0r7ylxlp9lbj3d7sqf6j2a222dwy2nfpff05jd6mkh4ihxvyd1"))))
@@ -777,8 +778,8 @@ images more compressible.")
     (version "4.7")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/strace/strace-"
-                                 version ".tar.xz"))
+             (uri (string-append "mirror://sourceforge/strace/strace/" version
+                                 "/strace-" version ".tar.xz"))
              (sha256
               (base32
                "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
@@ -1114,8 +1115,8 @@ Linux-based operating systems.")
     (version "1.5")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/bridge/bridge-utils-"
-                                 version ".tar.gz"))
+             (uri (string-append "mirror://sourceforge/bridge/bridge/"
+                                 "bridge-utils-" version ".tar.gz"))
              (sha256
               (base32
                "12367cwqmi0yqphi6j8rkx97q8hw52yq2fx4k0xfclkcizxybya2"))))
@@ -2096,7 +2097,7 @@ thanks to the use of namespaces.")
     (version "9.45")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/" name "/"
+              (uri (string-append "mirror://sourceforge/" name "/" name "/"
                                   name "-" version ".tar.gz"))
               (sha256
                (base32
@@ -2149,8 +2150,8 @@ WLAN, Bluetooth and mobile broadband.")
     (version "1.7")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/acpiclient/"
-                                  name "-" version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/acpiclient/acpiclient/" 
+                                  version "/" name "-" version ".tar.gz"))
               (sha256
                (base32
                 "01ahldvf0gc29dmbd5zi4rrnrw2i1ajnf30sx2vyaski3jv099fp"))))
@@ -2290,7 +2291,7 @@ protocol in question.")
     (version "0.5.4")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/libavc1394/"
+              (uri (string-append "mirror://sourceforge/libavc1394/libavc1394/"
                                   name "-" version ".tar.gz"))
               (sha256
                (base32
@@ -2676,7 +2677,7 @@ feature, and a laptop with an accelerometer.  It has no effect on SSDs.")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/thinkfan/"
-                                  version "/thinkfan-" version ".tar.gz"))
+                                  "/thinkfan-" version ".tar.gz"))
               (sha256
                (base32
                 "0nz4c48f0i0dljpk5y33c188dnnwg8gz82s4grfl8l64jr4n675n"))
diff --git a/gnu/packages/lirc.scm b/gnu/packages/lirc.scm
index 6b1eee3ef2..e3f60e33e2 100644
--- a/gnu/packages/lirc.scm
+++ b/gnu/packages/lirc.scm
@@ -35,8 +35,8 @@
     (version "0.9.4")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/lirc/lirc-"
-                                  version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/lirc/LIRC/" version
+                                  "/lirc-" version ".tar.bz2"))
               (sha256
                (base32
                 "1l2xzhnm4hrla51ik09hcafki0y8wnww7svfm7j63zbl2rssc66x"))
diff --git a/gnu/packages/lxde.scm b/gnu/packages/lxde.scm
index c00400ca70..dedaaee27b 100644
--- a/gnu/packages/lxde.scm
+++ b/gnu/packages/lxde.scm
@@ -36,7 +36,7 @@
     (version "1.2.4")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/project/pcmanfm/"
+              (uri (string-append "mirror://sourceforge/pcmanfm/"
                                   "PCManFM%20%2B%20Libfm%20%28tarball%20release"
                                   "%29/LibFM/" name "-" version ".tar.xz"))
               (sha256
@@ -75,7 +75,7 @@ libFM file management library.")))
     (version "0.6.2")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/project/lxde/"
+              (uri (string-append "mirror://sourceforge/lxde/"
                                   "LXAppearance/" name "-" version ".tar.xz"))
               (sha256
                (base32
@@ -96,7 +96,7 @@ able to change themes, icons, and fonts used by GTK+ applications.")
     (version "0.3.1")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/project/lxde/LXRandR"
+              (uri (string-append "mirror://sourceforge/lxde/LXRandR"
                                   "%20%28monitor%20config%20tool%29/LXRandR%20"
                                   (version-major+minor version) ".x/"
                                   name "-" version ".tar.xz"))
@@ -122,7 +122,7 @@ or external monitor.")
     (version "0.1.7")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/project/lxde/LXTask"
+              (uri (string-append "mirror://sourceforge/lxde/LXTask"
                                   "%20%28task%20manager%29/LXTask%20"
                                   (version-major+minor version) ".x/"
                                   name "-" version ".tar.xz"))
@@ -146,7 +146,7 @@ toolkit.  It allows users to monitor and control of running processes.")
     (version "0.2.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/project/lxde/LXTerminal"
+              (uri (string-append "mirror://sourceforge/lxde/LXTerminal"
                                   "%20%28terminal%20emulator%29/LXTerminal%20"
                                   version "/" name "-" version ".tar.gz"))
               (sha256
@@ -171,7 +171,7 @@ performance, all instances of the terminal are sharing a single process.")
     (version "1.0.1")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/project/lxde/" name "/"
+              (uri (string-append "mirror://sourceforge/lxde/" name "/"
                                   (version-major+minor version) "/"
                                   name "-" version ".tar.xz"))
               (sha256
@@ -193,7 +193,7 @@ speed up the access to freedesktop.org defined application menus.")
     (version "1.2.4")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/project/" name "/"
+              (uri (string-append "mirror://sourceforge/" name "/"
                                   "PCManFM%20%2B%20Libfm%20%28tarball%20release"
                                   "%29/PCManFM/" name "-" version ".tar.xz"))
               (sha256
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index a36fd5ff70..f99c16b405 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -678,14 +678,15 @@ which can add many functionalities to the base client.")
 (define-public msmtp
   (package
     (name "msmtp")
-    (version "1.6.4")
+    (version "1.6.5")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append
-             "mirror://sourceforge/msmtp/msmtp-" version ".tar.xz"))
-       (sha256 (base32
-                "1kfihblm769s4hv8iah5mqynqd6hfwlyz5rcg2v423a4llic0jcv"))))
+       (uri (string-append "mirror://sourceforge/msmtp/msmtp/" version
+                           "/msmtp-" version ".tar.xz"))
+       (sha256
+        (base32
+         "01jh9ba49bih8zsh40myw6qq1ll210q1vw0jg865vrn7jc3dd83n"))))
     (build-system gnu-build-system)
     (inputs
      `(("libidn" ,libidn)
@@ -811,7 +812,7 @@ facilities for checking incoming mail.")
 (define-public dovecot
   (package
     (name "dovecot")
-    (version "2.2.19")
+    (version "2.2.25")
     (source
      (origin
        (method url-fetch)
@@ -819,7 +820,7 @@ facilities for checking incoming mail.")
                            (version-major+minor version) "/"
                            name "-" version ".tar.gz"))
        (sha256 (base32
-                "17sf5aancad4pg1vx1606k99389wg76blpqzmnmxlz4hklzix7km"))))
+                "0rwn5wc5b8j9fzqcjggdgpzmb77myrf4ra294z1gg5v3hhng7nfq"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)))
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index b8ec213d8b..ad7d0e22ee 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
 ;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -35,7 +36,6 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix svn-download)
   #:use-module (guix utils)
   #:use-module (guix build utils)
   #:use-module (guix build-system cmake)
@@ -380,35 +380,40 @@ singular value problems.")
                                 "See LICENSE in the distribution."))))
 
 (define-public gnuplot
-  (package
-    (name "gnuplot")
-    (version "5.0.2")
-    (source
-     (origin
-      (method url-fetch)
-      (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
-                          version "/gnuplot-" version ".tar.gz"))
-      (sha256
-       (base32
-        "146qn414z96c7cc42a1kb9a4kpjc2q2hfdwk44kjjvgmfp9k2ass"))))
-    (build-system gnu-build-system)
-    (inputs `(("readline" ,readline)
-              ("cairo" ,cairo)
-              ("pango" ,pango)
-              ("gd" ,gd)))
-    (native-inputs `(("pkg-config" ,pkg-config)
-                     ("texlive" ,texlive-minimal)))
-    (home-page "http://www.gnuplot.info")
-    (synopsis "Command-line driven graphing utility")
-    (description "Gnuplot is a portable command-line driven graphing
+  ;; Gnuplot version 5.0.4 was updated in-place, resulting in a hash mismatch.
+  ;; This can be removed at the next version update.
+  (let ((upstream-version "5.0.4")
+        (guix-revision "1"))
+    (package
+      (name "gnuplot")
+      (version (string-append upstream-version "-" guix-revision))
+      (source
+       (origin
+        (method url-fetch)
+        (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
+                            upstream-version "/gnuplot-"
+                            upstream-version ".tar.gz"))
+        (sha256
+         (base32
+          "07n3w12dkcxjnhsvsliaqnkhajhi818v6q8mkpmpbplbf92vh70m"))))
+      (build-system gnu-build-system)
+      (inputs `(("readline" ,readline)
+                ("cairo" ,cairo)
+                ("pango" ,pango)
+                ("gd" ,gd)))
+      (native-inputs `(("pkg-config" ,pkg-config)
+                       ("texlive" ,texlive-minimal)))
+      (home-page "http://www.gnuplot.info")
+      (synopsis "Command-line driven graphing utility")
+      (description "Gnuplot is a portable command-line driven graphing
 utility.  It was originally created to allow scientists and students to
 visualize mathematical functions and data interactively, but has grown to
 support many non-interactive uses such as web scripting.  It is also used as a
 plotting engine by third-party applications like Octave.")
-    ;;  X11 Style with the additional restriction that derived works may only be
-    ;;  distributed as patches to the original.
-    (license (license:fsf-free
-              "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
+      ;;  X11 Style with the additional restriction that derived works may only be
+      ;;  distributed as patches to the original.
+      (license (license:fsf-free
+                "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright")))))
 
 (define-public hdf5
   (package
@@ -797,7 +802,7 @@ ASCII text files using Gmsh's own scripting language.")
 (define-public petsc
   (package
     (name "petsc")
-    (version "3.6.2")
+    (version "3.7.2")
     (source
      (origin
       (method url-fetch)
@@ -805,7 +810,7 @@ ASCII text files using Gmsh's own scripting language.")
       (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
                           "petsc-lite-" version ".tar.gz"))
       (sha256
-       (base32 "13h0m5f9xsdpps4lsp59iz2m7zkapwavq2zfkfvs3ab6sndla0l9"))))
+       (base32 "0jfrq6rd4zagw1iimz05m2w91k0jvz3qbik1lk8pqcxw3rvdqk5d"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("python" ,python-2)
@@ -829,33 +834,34 @@ ASCII text files using Gmsh's own scripting language.")
          ,(string-append "--with-superlu-lib="
                          (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
        #:phases
-       (alist-replace
-        'configure
-        ;; PETSc's configure script is actually a python script, so we can't
-        ;; run it with bash.
-        (lambda* (#:key outputs (configure-flags '())
-                  #:allow-other-keys)
-          (let* ((prefix (assoc-ref outputs "out"))
-                 (flags `(,(string-append "--prefix=" prefix)
-                          ,@configure-flags)))
-            (format #t "build directory: ~s~%" (getcwd))
-            (format #t "configure flags: ~s~%" flags)
-            (zero? (apply system* "./configure" flags))))
-        (alist-cons-after
-         'configure 'clean-local-references
-         ;; Try to keep build directory names from leaking into compiled code
-         (lambda* (#:key inputs outputs #:allow-other-keys)
-           (let ((out (assoc-ref outputs "out")))
-             (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
-               (((getcwd)) out))))
-         (alist-cons-after
-          'install 'clean-install
+       (modify-phases %standard-phases
+        (replace 'configure
+          ;; PETSc's configure script is actually a python script, so we can't
+          ;; run it with bash.
+          (lambda* (#:key outputs (configure-flags '())
+                          #:allow-other-keys)
+            (let* ((prefix (assoc-ref outputs "out"))
+                   (flags `(,(string-append "--prefix=" prefix)
+                            ,@configure-flags)))
+              (format #t "build directory: ~s~%" (getcwd))
+              (format #t "configure flags: ~s~%" flags)
+              (zero? (apply system* "./configure" flags)))))
+        (add-after 'configure 'clean-local-references
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (let ((out (assoc-ref outputs "out")))
+              (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
+                ;; Prevent build directory from leaking into compiled code
+                (((getcwd)) out)
+                ;; Scrub timestamp for reproducibility
+                ((".*Libraries compiled on.*") ""))
+              #t)))
+        (add-after 'install 'clean-install
           ;; Try to keep installed files from leaking build directory names.
           (lambda* (#:key inputs outputs #:allow-other-keys)
-            (let ((out     (assoc-ref outputs "out")))
+            (let ((out (assoc-ref outputs "out")))
               (substitute* (map (lambda (file)
                                   (string-append out "/lib/petsc/conf/" file))
-                                '("petscvariables" "PETScConfig.cmake"))
+                                '("petscvariables"))
                 (((getcwd)) out))
               ;; Make compiler references point to the store
               (substitute* (string-append out "/lib/petsc/conf/petscvariables")
@@ -868,9 +874,10 @@ ASCII text files using Gmsh's own scripting language.")
                               (delete-file f))))
                         '("configure.log" "make.log" "gmake.log"
                           "test.log" "error.log" "RDict.db"
+                          "PETScBuildInternal.cmake"
                           ;; Once installed, should uninstall with Guix
-                          "uninstall.py"))))
-          %standard-phases)))))
+                          "uninstall.py"))
+              #t))))))
     (home-page "http://www.mcs.anl.gov/petsc")
     (synopsis "Library to solve PDEs")
     (description "PETSc, pronounced PET-see (the S is silent), is a suite of
@@ -921,7 +928,7 @@ scientific applications modeled by partial differential equations.")
 (define-public slepc
   (package
     (name "slepc")
-    (version "3.6.2")
+    (version "3.7.1")
     (source
      (origin
        (method url-fetch)
@@ -930,7 +937,7 @@ scientific applications modeled by partial differential equations.")
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
-         "1pv5iqz2kc8sj49zsabyz4arnfpana8mjrhq31vzgk16xldk3d1a"))))
+         "1hijlmrvxvfqslnx8yydzw5xqbsn1yy02g32w0hln1z3cgr1c0k7"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("python" ,python-2)))
@@ -946,8 +953,7 @@ scientific applications modeled by partial differential equations.")
                          (assoc-ref %build-inputs "arpack") "/lib"))
        #:phases
        (modify-phases %standard-phases
-         (replace
-          'configure
+         (replace 'configure
           ;; configure is a python script, so we can't run it with bash.
           (lambda* (#:key inputs outputs (configure-flags '())
                     #:allow-other-keys)
@@ -959,8 +965,7 @@ scientific applications modeled by partial differential equations.")
               (setenv "SLEPC_DIR" (getcwd))
               (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
               (zero? (apply system* "./configure" flags)))))
-         (add-after
-          'install 'delete-doc
+         (add-after 'install 'delete-doc
           ;; TODO: SLEPc installs HTML documentation alongside headers in
           ;; $out/include.  We'd like to move them to share/doc, but delete
           ;; them for now, as they are incomplete and installing the complete
@@ -968,8 +973,7 @@ scientific applications modeled by partial differential equations.")
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out")))
               (for-each delete-file (find-files out "\\.html$")))))
-         (add-after
-          'install 'clean-install
+         (add-after 'install 'clean-install
           ;; Clean up unnecessary build logs from installation.
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
@@ -1208,74 +1212,56 @@ porting.")
 (define-public superlu
   (package
     (name "superlu")
-    (version "4.3")
+    (version "5.2.1")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
                            "superlu_" version ".tar.gz"))
        (sha256
-        (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
-    (build-system gnu-build-system)
+        (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; Replace the non-free implementation of MC64 with a stub adapted
+        ;; from Debian
+        '(begin
+           (use-modules (ice-9 regex)
+                        (ice-9 rdelim))
+           (call-with-output-file "SRC/mc64ad.c"
+             (lambda (port)
+               (display "
+#include <stdio.h>
+#include <stdlib.h>
+void mc64id_(int *a) {
+  fprintf (stderr, \"SuperLU: non-free MC64 not available.  Aborting.\\n\");
+  abort ();
+}
+void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
+              int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
+  fprintf (stderr, \"SuperLU: non-free MC64 not available.  Aborting.\\n\");
+  abort ();
+}\n" port)))
+           ;; Remove the corresponding license verbiage.  MC64 license follows
+           ;; a "------" line separator.
+           (with-atomic-file-replacement "License.txt"
+             (let ((rx (make-regexp "-{8}")))
+               (lambda (in out)
+                 (let loop ()
+                   (let ((line (read-line in 'concat)))
+                    (unless (regexp-exec rx line)
+                      (display line out)
+                      (loop)))))))))))
+    (build-system cmake-build-system)
     (native-inputs
      `(("tcsh" ,tcsh)))
     (inputs
-     `(("lapack" ,lapack)
+     `(("blas" ,openblas)
        ("gfortran" ,gfortran)))
     (arguments
-     `(#:parallel-build? #f
-       #:tests? #f                      ;tests are run as part of `make all`
-       #:phases
-       (alist-replace
-        'configure
-        (lambda* (#:key inputs outputs #:allow-other-keys)
-          (call-with-output-file "make.inc"
-            (lambda (port)
-              (format port "
-PLAT        =
-SuperLUroot = ~a
-SUPERLULIB  = ~a/lib/libsuperlu.a
-TMGLIB      = libtmglib.a
-BLASDEF     = -DUSE_VENDOR_BLAS
-BLASLIB     = -L~a/lib -lblas
-LIBS        = $(SUPERLULIB) $(BLASLIB)
-ARCH        = ar
-ARCHFLAGS   = cr
-RANLIB      = ranlib
-CC          = gcc
-PIC         = -fPIC
-CFLAGS      = -O3 -DPRNTlevel=0 $(PIC)
-NOOPTS      = -O0 $(PIC)
-FORTRAN     = gfortran
-FFLAGS      = -O2 $(PIC)
-LOADER      = $(CC)
-CDEFS       = -DAdd_"
-                      (getcwd)
-                      (assoc-ref outputs "out")
-                      (assoc-ref inputs "lapack")))))
-        (alist-cons-before
-         'build 'create-install-directories
-         (lambda* (#:key outputs #:allow-other-keys)
-           (for-each
-            (lambda (dir)
-              (mkdir-p (string-append (assoc-ref outputs "out")
-                                      "/" dir)))
-            '("lib" "include")))
-         (alist-replace
-          'install
-          (lambda* (#:key outputs #:allow-other-keys)
-            ;; Library is placed in lib during the build phase.  Copy over
-            ;; headers to include.
-            (let* ((out    (assoc-ref outputs "out"))
-                   (incdir (string-append out "/include")))
-              (for-each (lambda (file)
-                          (let ((base (basename file)))
-                            (format #t "installing `~a' to `~a'~%"
-                                    base incdir)
-                            (copy-file file
-                                       (string-append incdir "/" base))))
-                        (find-files "SRC" ".*\\.h$"))))
-          %standard-phases)))))
+     `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
+                           "-DTPL_BLAS_LIBRARIES=openblas"
+                           "-DBUILD_SHARED_LIBS:BOOL=YES"
+                           "-DCMAKE_INSTALL_LIBDIR=lib")))
     (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
     (synopsis "Supernodal direct solver for sparse linear systems")
     (description
@@ -1285,7 +1271,9 @@ The library is written in C and is callable from either C or Fortran.  The
 library routines perform an LU decomposition with partial pivoting and
 triangular system solves through forward and back substitution.  The library
 also provides threshold-based ILU factorization preconditioners.")
-    (license license:bsd-3)))
+    (license (list license:bsd-3
+                   license:gpl2+        ;EXAMPLE/*fgmr.c
+                   (license:fsf-free "file://SRC/colamd.h")))))
 
 (define-public superlu-dist
   (package
@@ -1298,6 +1286,30 @@ also provides threshold-based ILU factorization preconditioners.")
                            "superlu_dist_" version ".tar.gz"))
        (sha256
         (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
+              (modules '((guix build utils)))
+       (snippet
+        ;; Replace the non-free implementation of MC64 with a stub
+        '(begin
+           (use-modules (ice-9 regex)
+                        (ice-9 rdelim))
+           (call-with-output-file "SRC/mc64ad.c"
+             (lambda (port)
+               (display "
+#include <stdio.h>
+#include <stdlib.h>
+void mc64id_(int *a) {
+  fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available.  Aborting.\\n\");
+  abort ();
+}
+void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
+              int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
+  fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available.  Aborting.\\n\");
+  abort ();
+}\n" port)))
+           (delete-file "SRC/mc64ad.f.bak")
+           (substitute* "SRC/util.c"    ;adjust default algorithm
+             (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag")
+              "RowPerm = NOROWPERM"))))
        (patches (search-patches "superlu-dist-scotchmetis.patch"))))
     (build-system gnu-build-system)
     (native-inputs
@@ -1791,29 +1803,36 @@ associated functions (eg. contiguous and non-contiguous submatrix views).")
                 "1cdpjxb0fz5f28y5qrqgpw53s7qi8s2v3al9lfdldqxngb21vpx8"))))))
 
 (define-public muparser
-  (package
-    (name "muparser")
-    (version "2.2.5")
-    (source
-     (origin
-       (method svn-fetch)
-       (uri (svn-reference
-             (url "http://muparser.googlecode.com/svn/trunk/")
-             (revision 34)))
-       (sha256
-        (base32
-         "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:configure-flags '("--enable-samples=no")
-       #:tests? #f)) ;no "check" target
-    (home-page "http://muparser.beltoforion.de/")
-    (synopsis "Fast parser library for mathematical expressions")
-    (description
-     "muParser is an extensible high performance math parser library.  It is
-based on transforming an expression into a bytecode and precalculating
-constant parts of it.")
-    (license license:expat)))
+  ;; When switching download sites, muparser re-issued a 2.2.5 release with a
+  ;; different hash. In order to make `guix package --upgrade` work correctly,
+  ;; we set a Guix packaging revision.
+  ;; When the next version of muparser is released, we can remove
+  ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
+  (let ((upstream-version "2.2.5")
+        (revision "2"))
+    (package
+      (name "muparser")
+      (version (string-append upstream-version "-" revision))
+      (source
+       (origin
+         (method url-fetch)
+         (uri (string-append "https://github.com/beltoforion/muparser/archive/v"
+                             upstream-version ".tar.gz"))
+         (file-name (string-append name "-" version ".tar.gz"))
+         (sha256
+          (base32
+           "0277qsi5l23jsck1vhn383bmvc2n9l4a1dl5r9bf7hvjv9ayyrh6"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:configure-flags '("--enable-samples=no")
+         #:tests? #f)) ;no "check" target
+      (home-page "http://muparser.beltoforion.de/")
+      (synopsis "Fast parser library for mathematical expressions")
+      (description
+       "muParser is an extensible high performance math parser library.  It is
+based on transforming an expression into a bytecode and precalculating constant
+parts of it.")
+      (license license:expat))))
 
 (define-public openblas
   (package
@@ -2006,8 +2025,8 @@ packages.")
     (version "3.10.2")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/math-atlas/atlas"
-                                  version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
+                                  version "/atlas" version ".tar.bz2"))
               (sha256
                (base32
                 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
@@ -2136,8 +2155,8 @@ Failure to do so will result in a library with poor performance.")
     (source
      (origin
        (method url-fetch)
-      (uri (string-append "mirror://sourceforge/ogl-math/glm-"
-                          version ".zip"))
+       (uri (string-append "mirror://sourceforge/ogl-math/glm-" version
+                           "/glm-" version ".zip"))
        (sha256
         (base32
          "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
@@ -2355,9 +2374,8 @@ FLANN is written in C++ and contains bindings for C, Octave and Python.")
     (source
       (origin
         (method url-fetch)
-        (uri
-          (string-append
-            "mirror://sourceforge/w-calc/wcalc-" version ".tar.bz2"))
+        (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
+                            "wcalc-" version ".tar.bz2"))
         (sha256
           (base32
             "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
@@ -2381,8 +2399,8 @@ evaluates expressions using the standard order of operations.")
     (version "3.6")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/xaos/xaos-"
-                                  version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
+                                  "/xaos-" version ".tar.gz"))
               (sha256
                (base32
                 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
@@ -2524,7 +2542,7 @@ structured and unstructured grid problems.")))
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/matio/" version "/"
+       (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
                            "matio-" version ".tar.gz"))
        (sha256
         (base32
@@ -2538,3 +2556,25 @@ structured and unstructured grid problems.")))
     (description "Matio is a library for reading and writing MAT files.  It
 supports compressed MAT files, as well as newer (version 7.3) MAT files.")
     (license license:bsd-2)))
+
+(define-public libhilbert
+  (package
+    (name "libhilbert")
+    (version "0.2-1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://web.cs.dal.ca/~chamilto/hilbert/"
+                           "libhilbert-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0v48x8405dj95gjn2saja4bzhw86d6zl6d3dg8h7dzac2qr97s34"))))
+    (build-system gnu-build-system)
+    (home-page "http://web.cs.dal.ca/~chamilto/hilbert")
+    (synopsis "Hilbert indices for multidimensional data")
+    (description "The libhilbert library can efficiently calculate Hilbert
+curves and order-preserving representations of Hilbert curve indices that use
+the same amount of space as the original point representation.  This is useful
+when using the Gilbert curve as a space filling curve through a
+high-dimensional space where not all demensions have the same cardinality.")
+    (license license:lgpl2.1+)))
diff --git a/gnu/packages/mcrypt.scm b/gnu/packages/mcrypt.scm
index 7ac0b92d81..fb5529382e 100644
--- a/gnu/packages/mcrypt.scm
+++ b/gnu/packages/mcrypt.scm
@@ -33,8 +33,8 @@
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/mcrypt/mcrypt-"
-                          version ".tar.gz"))
+      (uri (string-append "mirror://sourceforge/mcrypt/MCrypt/"
+                          version "/" name "-" version ".tar.gz"))
       (sha256
        (base32
         "161031n1w9pb4yzz9i47szc12a4mwpcpvyxnvafsik2l9s2aliai"))
@@ -66,8 +66,8 @@ them.")
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "mirror://sourceforge/mcrypt/libmcrypt-"
-                          version ".tar.gz"))
+      (uri (string-append "mirror://sourceforge/mcrypt/Libmcrypt/" version
+                          "/libmcrypt-" version ".tar.gz"))
       (sha256
        (base32
         "0gipgb939vy9m66d3k8il98rvvwczyaw2ixr8yn6icds9c3nrsz4"))))
@@ -89,9 +89,8 @@ XTEA, 3WAY, TWOFISH, BLOWFISH, ARCFOUR, WAKE and more.")
     (source
      (origin
       (method url-fetch)
-
-      (uri (string-append "mirror://sourceforge/mhash/mhash-"
-                          version ".tar.bz2"))
+      (uri (string-append "mirror://sourceforge/mhash/mhash/" version
+                          "/mhash-" version ".tar.bz2"))
       (sha256
        (base32
         "1w7yiljan8gf1ibiypi6hm3r363imm3sxl1j8hapjdq3m591qljn"))
diff --git a/gnu/packages/mp3.scm b/gnu/packages/mp3.scm
index 8451f0ac9f..37407cdc17 100644
--- a/gnu/packages/mp3.scm
+++ b/gnu/packages/mp3.scm
@@ -290,8 +290,8 @@ This package contains the binary.")
     (version "1.22.4")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/mpg123/mpg123-"
-                                  version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/mpg123/mpg123/" version
+                                  "/mpg123-" version ".tar.bz2"))
               (sha256
                (base32
                 "1lj0xv0b6sgqsbhx10dg60cnzgz98i76gxy51kqh11hka0pf0sah"))))
@@ -314,7 +314,7 @@ command-line tool as well as a C library, libmpg123.")
     (version "0.3.1")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/mpg321/"
+             (uri (string-append "mirror://sourceforge/mpg321/mpg321/"
                                  version "/mpg321-" version ".tar.gz"))
              (sha256
               (base32
diff --git a/gnu/packages/mpi.scm b/gnu/packages/mpi.scm
index 262330ecd7..68937a26f5 100644
--- a/gnu/packages/mpi.scm
+++ b/gnu/packages/mpi.scm
@@ -98,16 +98,16 @@ bind processes, and much more.")
 (define-public openmpi
   (package
     (name "openmpi")
-    (version "1.10.1")
+    (version "1.10.3")
     (source
      (origin
       (method url-fetch)
-      (uri (string-append "http://www.open-mpi.org/software/ompi/v"
+      (uri (string-append "https://www.open-mpi.org/software/ompi/v"
                           (version-major+minor version)
                           "/downloads/openmpi-" version ".tar.bz2"))
       (sha256
        (base32
-        "14p4px9a3qzjc22lnl6braxrcrmd9rgmy7fh4qpanawn2pgfq6br"))))
+        "0k95ri9f8kzx5vhzrdbzn59rn2324fs4a96w5v8jy20j8dkbp13l"))))
     (build-system gnu-build-system)
     (inputs
      `(("hwloc" ,hwloc)
@@ -128,7 +128,20 @@ bind processes, and much more.")
                            ,(string-append "--with-valgrind="
                                            (assoc-ref %build-inputs "valgrind"))
                            ,(string-append "--with-hwloc="
-                                           (assoc-ref %build-inputs "hwloc")))))
+                                           (assoc-ref %build-inputs "hwloc")))
+       #:phases (modify-phases %standard-phases
+                  (add-before 'build 'scrub-timestamps ;reproducibility
+                    (lambda _
+                      (substitute* '("ompi/tools/ompi_info/param.c"
+                                     "orte/tools/orte-info/param.c"
+                                     "oshmem/tools/oshmem_info/param.c")
+                        ((".*(Built|Configured) on.*") ""))
+                      #t))
+                  (add-after 'install 'remove-logs ;reproducibility
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out")))
+                        (for-each delete-file (find-files out "config.log"))
+                        #t))))))
     (home-page "http://www.open-mpi.org")
     (synopsis "MPI-2 implementation")
     (description
diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 91ba4be97b..5d73790e51 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -694,8 +694,8 @@ Editor.  It is compatible with Power Tab Editor 1.7 and Guitar Pro.")
     (source (origin
               (method url-fetch)
               (uri
-               (string-append "mirror://sourceforge/synthv1/synthv1-"
-                              version ".tar.gz"))
+               (string-append "mirror://sourceforge/synthv1/synthv1/" version
+                              "/synthv1-" version ".tar.gz"))
               (sha256
                (base32
                 "0h5zja78phf9705i9g54zh61iczb24iv7rxhljyms30sjgajig1y"))))
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 9e4f7bb010..b92ad0a36a 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -232,7 +232,8 @@ Ethernet devices.")
     (version "1.1.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/ifstatus/ifstatus-v"
+              (uri (string-append "mirror://sourceforge/ifstatus/ifstatus/"
+                                  "ifstatus%20v" version "/ifstatus-v"
                                   version ".tar.gz"))
               (sha256
                (base32
@@ -271,8 +272,8 @@ intended as a substitute for the PPPStatus and EthStatus projects.")
     (version "0.7.4")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/nload/nload-"
-                                  version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/nload/nload/" version
+                                  "/nload-" version ".tar.gz"))
               (sha256
                (base32
                 "1rb9skch2kgqzigf19x8bzk211jdfjfdkrcvaqyj89jy2pkm3h61"))))
diff --git a/gnu/packages/ocr.scm b/gnu/packages/ocr.scm
index 0d5fbcdc29..2e205ddd34 100644
--- a/gnu/packages/ocr.scm
+++ b/gnu/packages/ocr.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,10 +22,8 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
-  #:use-module (gnu packages autotools)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages image)
-  #:use-module (gnu packages pkg-config))
+  #:use-module (gnu packages image))
 
 (define-public ocrad
   (package
@@ -50,39 +49,24 @@ it produces text in 8-bit or UTF-8 formats.")
 (define-public tesseract-ocr
   (package
     (name "tesseract-ocr")
-    (version "3.02.02")
+    (version "3.04.01")
     (source
      (origin
        (method url-fetch)
        (uri (string-append
-             "https://tesseract-ocr.googlecode.com/files/tesseract-ocr-"
+             "https://github.com/tesseract-ocr/tesseract/archive/"
              version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
-        (base32 "0g81m9y4iydp7kgr56mlkvjdwpp3mb01q385yhdnyvra7z5kkk96"))
-       (modules '((guix build utils)))
-       ;; Leptonica added a pkg-config file in the meanwhile.
-       (snippet
-        '(substitute* "tesseract.pc.in"
-           (("^# Requires: lept  ## .*")
-            "Requires: lept\n")))))
+        (base32 "0snwd8as5i8vx7zkimpd2yg898jl96zf90r65a9w615f2hdkxxjp"))))
     (build-system gnu-build-system)
-    (native-inputs
-     `(("autoconf" ,autoconf)
-       ("automake" ,automake)
-       ("libtool" ,libtool)))
-    (propagated-inputs
+    (inputs
      `(("leptonica" ,leptonica)))
     (arguments
-     '(#:phases
-       (modify-phases %standard-phases
-         (add-after
-          'unpack 'autogen
-          (lambda _
-            (zero? (system* "sh" "autogen.sh")))))
-       #:configure-flags
+     '(#:configure-flags
        (let ((leptonica (assoc-ref %build-inputs "leptonica")))
          (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
-    (home-page "https://code.google.com/p/tesseract-ocr/")
+    (home-page "https://github.com/tesseract-ocr")
     (synopsis "Optical character recognition engine")
     (description
      "Tesseract is an optical character recognition (OCR) engine with very
diff --git a/gnu/packages/onc-rpc.scm b/gnu/packages/onc-rpc.scm
index 8861b0e8db..d9b2f9dda0 100644
--- a/gnu/packages/onc-rpc.scm
+++ b/gnu/packages/onc-rpc.scm
@@ -28,7 +28,7 @@
     (version "0.2.4")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/libtirpc/"
+              (uri (string-append "mirror://sourceforge/libtirpc/libtirpc/"
                                   version "/libtirpc-"
                                   version ".tar.bz2"))
               (sha256
diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 1579821385..a03214ae6d 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -53,8 +53,8 @@
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/pwgen/pwgen-"
-                           version ".tar.gz"))
+       (uri (string-append "mirror://sourceforge/pwgen/pwgen/" version
+                           "/pwgen-" version ".tar.gz"))
        (sha256
         (base32 "0mhmw700kkh238fzivcwnwi94bj9f3h36yfh3k3j2v19b0zmjx7b"))))
     (build-system gnu-build-system)
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 36c538c165..dd7a0b0af5 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -418,8 +418,8 @@ interaction.")
     (version "0.9.3")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/podofo/podofo-"
-                                  version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/podofo/podofo/" version
+                                  "/podofo-" version ".tar.gz"))
               (sha256
                (base32
                 "1n12lbq9x15vqn7dc0hsccp56l5jdff1xrhvlfqlbklxx0qiw9pc"))))
@@ -509,8 +509,8 @@ and examining the file structure (pdfshow).")
    (version "5.1.3")
    (source (origin
             (method url-fetch)
-            (uri (string-append "mirror://sourceforge/qpdf/qpdf-"
-                                version ".tar.gz"))
+            (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
+                                "/qpdf-" version ".tar.gz"))
             (sha256 (base32
                      "1lq1v7xghvl6p4hgrwbps3a13ad6lh4ib3myimb83hxgsgd4n5nm"))
             (modules '((guix build utils)))
@@ -561,8 +561,8 @@ program capable of converting PDF into other formats.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/xournal/xournal-"
-                           version ".tar.gz"))
+       (uri (string-append "mirror://sourceforge/xournal/xournal/" version
+                           "/xournal-" version ".tar.gz"))
        (sha256
         (base32
          "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index 9f298ac960..959513f988 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -6094,8 +6094,8 @@ as exceptions to standard program flow.")
     (version "20160302")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/perltidy/Perl-Tidy-"
-                                  version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/perltidy/" version
+                                  "/Perl-Tidy-" version ".tar.gz"))
               (sha256
                (base32
                 "19yw63yh5s3pq7k3nkw6nsamg5b8vvwyhgbizslgxg0mqgc4xl3d"))))
diff --git a/gnu/packages/photo.scm b/gnu/packages/photo.scm
index 38bd9c3ed9..8eb5337b6a 100644
--- a/gnu/packages/photo.scm
+++ b/gnu/packages/photo.scm
@@ -73,8 +73,8 @@ cameras (CRW/CR2, NEF, RAF, DNG, and others).")
     (version "0.6.21")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/libexif/libexif-"
-                                  version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/libexif/libexif/"
+                                  version "/libexif-" version ".tar.bz2"))
               (sha256
                (base32
                 "06nlsibr3ylfwp28w8f5466l6drgrnydgxrm4jmxzrmk5svaxk8n"))))
@@ -92,8 +92,8 @@ data as produced by digital cameras.")
     (version "2.5.2")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/gphoto/libgphoto2-"
-                                  version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/gphoto/libgphoto/"
+                                  version "/libgphoto2-" version ".tar.bz2"))
               (sha256
                (base32
                 "0f1818l1vs5fbmrihzyv3qasddbqi3r01jik5crrxddwalsi2bd3"))))
@@ -122,8 +122,8 @@ from digital cameras.")
     (version "2.5.2")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/gphoto/gphoto2-"
-                                  version ".tar.bz2"))
+              (uri (string-append "mirror://sourceforge/gphoto/gphoto/" version
+                                  "/gphoto2-" version ".tar.bz2"))
               (sha256
                (base32
                 "16c8k1cxfypg7v5h8xi87grclw7a5ayaamn548ys3zkj727r5fcf"))))
diff --git a/gnu/packages/popt.scm b/gnu/packages/popt.scm
index e940df1590..3200873d58 100644
--- a/gnu/packages/popt.scm
+++ b/gnu/packages/popt.scm
@@ -32,7 +32,8 @@
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/argtable/argtable"
+                    "mirror://sourceforge/argtable/argtable/"
+                    "argtable-" version "/argtable"
                     (string-join (string-split version #\.) "-")
                     ".tar.gz"))
              (sha256
diff --git a/gnu/packages/protobuf.scm b/gnu/packages/protobuf.scm
index 03d1edcee7..86c418bb05 100644
--- a/gnu/packages/protobuf.scm
+++ b/gnu/packages/protobuf.scm
@@ -1,5 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016 Daniel Pimentel <d4n1@d4n1.org>
+;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,9 +22,12 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module ((guix licenses)
                 #:select (bsd-3))
-  #:use-module (gnu packages compression))
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages python))
 
 (define-public protobuf
   (package
@@ -44,3 +49,30 @@
 yet extensible format.  Google uses Protocol Buffers for almost all of its
 internal RPC protocols and file formats.")
     (license bsd-3)))
+
+(define-public python-protobuf
+  (package
+    (name "python-protobuf")
+    (version "3.0.0b4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "protobuf" version))
+       (sha256
+        (base32
+         "18zvvn8cgbcwi85ws2ny0k4qp33wd525spsb8sxvrj325mbx9cpk"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-six" ,python-six)))
+    (home-page "https://github.com/google/protobuf")
+    (synopsis "Protocol buffers is a data interchange format")
+    (description
+     "Protocol buffers are a language-neutral, platform-neutral extensible
+mechanism for serializing structured data.")
+    (license bsd-3)
+    (properties `((python2-variant . ,(delay python2-protobuf))))))
+
+(define-public python2-protobuf
+  (package (inherit (package-with-python2
+                     (strip-python2-variant python-protobuf)))
+           (native-inputs `(("python2-setuptools" ,python2-setuptools)))))
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 717a81e59f..00f7803897 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -1394,8 +1394,8 @@ syntax.")
     (version "2.3.4")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/scons/scons-"
-                                 version ".tar.gz"))
+             (uri (string-append "mirror://sourceforge/scons/scons/" version
+                                 "/scons-" version ".tar.gz"))
              (sha256
               (base32
                "0hdlci43wjz8maryj83mz04ir6rwcdrrzpd7cpzvdlzycqhdfmsb"))))
@@ -3039,7 +3039,7 @@ writing C extensions for Python as easy as Python itself.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/numpy"
+       (uri (string-append "mirror://sourceforge/numpy/NumPy/" version
                            "/numpy-" version ".tar.gz"))
        (sha256
         (base32
@@ -3202,7 +3202,8 @@ association studies (GWAS) on extremely large data sets.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/pyparsing"
+       (uri (string-append "mirror://sourceforge/pyparsing/pyparsing"
+                           "/pyparsing-" version
                            "/pyparsing-" version ".tar.gz"))
        (sha256
         (base32
@@ -3323,7 +3324,8 @@ transcendental functions).")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/matplotlib"
+       (uri (string-append "mirror://sourceforge/matplotlib/matplotlib"
+                           "/matplotlib-" version
                            "/matplotlib-" version ".tar.gz"))
        (sha256
         (base32
@@ -3533,7 +3535,8 @@ functions.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/scipy"
+; http://downloads.sourceforge.net/project/scipy/scipy/0.16.1/scipy-0.16.1.tar.gz
+       (uri (string-append "mirror://sourceforge/scipy/scipy/" version
                            "/scipy-" version ".tar.xz"))
        (sha256
         (base32
@@ -4912,7 +4915,8 @@ as possible in order to be comprehensible and easily extensible.")
     (version "0.14")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/python-xlib/"
+              (uri (string-append "mirror://sourceforge/python-xlib/python-xlib"
+                                  "/" version "/"
                                   "python-xlib-" version ".tar.gz"))
               (sha256
                (base32
@@ -8738,7 +8742,7 @@ the same purpose: to provide Python bindings for libmagic.")
     (source
       (origin
         (method url-fetch)
-        (uri (string-append "mirror://sourceforge/s3tools/"
+        (uri (string-append "mirror://sourceforge/s3tools/s3cmd/" version "/"
                             "s3cmd-" version ".tar.gz"))
         (sha256
           (base32
@@ -9763,3 +9767,36 @@ characters, mouse support, and auto suggestions.")
       (native-inputs
        `(("python2-setuptools" ,python2-setuptools)
          ,@(package-native-inputs base))))))
+
+(define-public ptpython
+  (package
+    (name "ptpython")
+    (version "0.34")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "ptpython" version))
+              (sha256
+               (base32
+                "1mmbiyzf0n8hm7z2a562x7w5cbl6jc0zsk6vp40q1z4cyblv1k13"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-docopt" ,python-docopt)
+       ("python-jedi" ,python-jedi)
+       ("python-prompt-toolkit" ,python-prompt-toolkit)
+       ("python-pygments" ,python-pygments)
+       ("python-setuptools" ,python-setuptools)))
+    (home-page "https://github.com/jonathanslenders/ptpython")
+    (synopsis "Python Read-Eval-Print-Loop with nice IDE-like features")
+    (description
+     "ptpython is a Python read-eval-print loop with IDE-like features.
+It supports syntax highlighting, multiline editing, autocompletion, mouse,
+color schemes, bracketed paste, Vi and Emacs keybindings, Chinese characters
+etc.")
+    (license bsd-3)
+    (properties `((python2-variant . ,(delay ptpython-2))))))
+
+(define-public ptpython-2
+  (let ((base (package-with-python2 (strip-python2-variant ptpython))))
+    (package
+      (inherit base)
+      (name "ptpython2"))))
diff --git a/gnu/packages/rdesktop.scm b/gnu/packages/rdesktop.scm
index 39a45c5878..e40852b4ec 100644
--- a/gnu/packages/rdesktop.scm
+++ b/gnu/packages/rdesktop.scm
@@ -31,8 +31,8 @@
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/rdesktop/rdesktop-"
-                    version ".tar.gz"))
+                    "mirror://sourceforge/" name "/" name "/" version "/"
+                    name "-" version ".tar.gz"))
               (sha256
                (base32
                 "1r7c1rjmw2xzq8fw0scyb453gy9z19774z1z8ldmzzsfndb03cl8"))))
diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 1e00e6bb9d..373b6f37b3 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -54,6 +54,8 @@
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages image)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages tls)
+  #:use-module (gnu packages gl)
   #:use-module (ice-9 match))
 
 (define (mit-scheme-source-directory system version)
@@ -414,57 +416,94 @@ implementation techniques and as an expository tool.")
     (build-system gnu-build-system)
     (arguments
      '(#:phases
-       (let* ((gui-libs
-               (lambda (inputs)
-                 (define (lib input)
-                   (string-append (assoc-ref inputs input) "/lib"))
-
-                 (list (lib "glib")
-                       (lib "cairo")
-                       (lib "pango")
-                       (lib "libjpeg")
-                       (lib "gtk")
-                       (lib "gdk-pixbuf")
-                       (lib "fontconfig")
-                       (lib "sqlite")))))         ;to build the doc
-         (alist-cons-before
-          'configure 'pre-configure
-          (lambda* (#:key inputs #:allow-other-keys)
-            (chdir "src")
-
-            ;; The GUI libs are dynamically opened through the FFI, so they
-            ;; must be in the loader's search path.
-            (setenv "LD_LIBRARY_PATH" (string-join (gui-libs inputs) ":")))
-          (alist-cons-after
-           'unpack 'patch-/bin/sh
-           (lambda _
-             (substitute* "collects/racket/system.rkt"
-               (("/bin/sh") (which "sh"))))
-           (alist-cons-after
-            'install 'wrap-programs
-            (lambda* (#:key inputs outputs #:allow-other-keys)
-              (let ((out (assoc-ref outputs "out")))
-                (define (wrap prog)
-                  (wrap-program prog
-                                `("LD_LIBRARY_PATH" ":" prefix
-                                  ,(gui-libs inputs))))
-
-                (with-directory-excursion (string-append out "/bin")
-                  (for-each wrap
-                            (list "gracket" "drracket" "slideshow" "mred"))
-                  #t)))
-            %standard-phases))))
+       (alist-cons-before
+        'configure 'pre-configure
+        (lambda* (#:key inputs #:allow-other-keys)
+          ;; Patch dynamically loaded libraries with their absolute paths.
+          (let* ((library-path   (search-path-as-string->list
+                                  (getenv "LIBRARY_PATH")))
+                 (find-so        (lambda (soname)
+                                   (search-path
+                                    library-path
+                                    (format #f "~a.so" soname))))
+                 (patch-ffi-libs (lambda (file libs)
+                                   (for-each
+                                    (lambda (lib)
+                                      (substitute* file
+                                        (((format #f "\"~a\"" lib))
+                                         (format #f "\"~a\"" (find-so lib)))))
+                                    libs))))
+            (substitute* "collects/db/private/sqlite3/ffi.rkt"
+              (("ffi-lib sqlite-so")
+               (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
+            (substitute* "collects/openssl/libssl.rkt"
+              (("ffi-lib libssl-so")
+               (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
+            (substitute* "collects/openssl/libcrypto.rkt"
+              (("ffi-lib libcrypto-so")
+               (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
+            (substitute* "share/pkgs/math-lib/math/private/bigfloat/gmp.rkt"
+              (("ffi-lib libgmp-so")
+               (format #f "ffi-lib \"~a\"" (find-so "libgmp"))))
+            (substitute* "share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
+              (("ffi-lib libmpfr-so")
+               (format #f "ffi-lib \"~a\"" (find-so "libmpfr"))))
+            (for-each
+             (lambda (x) (apply patch-ffi-libs x))
+             '(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
+                ("libfontconfig" "libcairo"))
+               ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
+                ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
+               ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
+                ("libjpeg"))
+               ("share/pkgs/draw-lib/racket/draw/unsafe/pango.rkt"
+                ("libpango-1.0" "libpangocairo-1.0"))
+               ("share/pkgs/draw-lib/racket/draw/unsafe/png.rkt"
+                ("libpng"))
+               ("share/pkgs/db-lib/db/private/odbc/ffi.rkt"
+                ("libodbc"))
+               ("share/pkgs/gui-lib/mred/private/wx/gtk/x11.rkt"
+                ("libX11"))
+               ("share/pkgs/gui-lib/mred/private/wx/gtk/gsettings.rkt"
+                ("libgio-2.0"))
+               ("share/pkgs/gui-lib/mred/private/wx/gtk/gtk3.rkt"
+                ("libgdk-3" "libgtk-3"))
+               ("share/pkgs/gui-lib/mred/private/wx/gtk/unique.rkt"
+                ("libunique-1.0"))
+               ("share/pkgs/gui-lib/mred/private/wx/gtk/utils.rkt"
+                ("libgdk-x11-2.0" "libgdk_pixbuf-2.0" "libgtk-x11-2.0"))
+               ("share/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt"
+                ("libGL"))
+               ("share/pkgs/sgl/gl.rkt"
+                ("libGL" "libGLU")))))
+          (chdir "src"))
+        (alist-cons-after
+         'unpack 'patch-/bin/sh
+         (lambda _
+           (substitute* "collects/racket/system.rkt"
+             (("/bin/sh") (which "sh"))))
+         %standard-phases))
        #:tests? #f                                ; XXX: how to run them?
        ))
-    (inputs `(("libffi" ,libffi)
-              ("glib" ,glib)                      ; for DrRacket
-              ("cairo" ,cairo)
-              ("pango" ,pango)
-              ("libjpeg" ,libjpeg-8)
-              ("fontconfig" ,fontconfig)
-              ("gdk-pixbuf" ,gdk-pixbuf)
-              ("gtk" ,gtk+-2)
-              ("sqlite" ,sqlite)))                ;needed to build the doc
+    (inputs
+     `(("libffi" ,libffi)
+       ;; Hardcode dynamically loaded libraries for better functionality.
+       ;; sqlite and libraries for `racket/draw' are needed to build the doc.
+       ("cairo" ,cairo)
+       ("fontconfig" ,fontconfig)
+       ("glib" ,glib)
+       ("glu" ,glu)
+       ("gmp" ,gmp)
+       ("gtk+" ,gtk+)  ; propagates gdk-pixbuf+svg
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libx11" ,libx11)
+       ("mesa" ,mesa)
+       ("mpfr" ,mpfr)
+       ("openssl" ,openssl)
+       ("pango" ,pango)
+       ("sqlite" ,sqlite)
+       ("unixodbc" ,unixodbc)))
     (home-page "http://racket-lang.org")
     (synopsis "Implementation of Scheme and related languages")
     (description
diff --git a/gnu/packages/screen.scm b/gnu/packages/screen.scm
index e3f97f4b68..8c900821be 100644
--- a/gnu/packages/screen.scm
+++ b/gnu/packages/screen.scm
@@ -70,8 +70,8 @@ view to show two terminals at once.")
     (version "0.9")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/dtach/dtach-"
-                                  version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/" name "/" name "/"
+                                  version "/" name "-" version ".tar.gz"))
               (sha256
                (base32
                 "1wwj2hlngi8qn2pisvhyfxxs8gyqjlgrrv5lz91w8ly54dlzvs9j"))))
diff --git a/gnu/packages/slim.scm b/gnu/packages/slim.scm
index dfb37a94bc..2328a1aacf 100644
--- a/gnu/packages/slim.scm
+++ b/gnu/packages/slim.scm
@@ -40,7 +40,7 @@
 	     (method url-fetch)
              ;; Used to be available from download.berlios.de.
 	     (uri (string-append
-                   "mirror://sourceforge/project/slim.berlios/slim-"
+                   "mirror://sourceforge/slim.berlios/slim-"
                    version ".tar.gz"))
 	     (sha256
 	      (base32 "1pqhk22jb4aja4hkrm7rjgbgzjyh7i4zswdgf5nw862l2znzxpi1"))
diff --git a/gnu/packages/swig.scm b/gnu/packages/swig.scm
index 6a66a71f1b..1e4de427b9 100644
--- a/gnu/packages/swig.scm
+++ b/gnu/packages/swig.scm
@@ -35,8 +35,9 @@
     (version "3.0.5")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/swig/swig-"
-                                 version ".tar.gz"))
+             (uri (string-append "mirror://sourceforge/" name "/" name "/"
+                                 name "-" version "/"
+                                 name "-" version ".tar.gz"))
              (sha256
               (base32
                "0g1a69vrqxgsnr1wkx851ljn73a2x3jqzxa66s2l3w0kyblbjk4z"))))
diff --git a/gnu/packages/tcl.scm b/gnu/packages/tcl.scm
index 993842339b..4cd94299df 100644
--- a/gnu/packages/tcl.scm
+++ b/gnu/packages/tcl.scm
@@ -227,8 +227,8 @@ interfaces (GUIs) in the Tcl language.")
     (version "1.18")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/" name "/"
-                                  name "-" version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/" name "/" name "/"
+                                  version "/" name "-" version ".tar.gz"))
               (sha256
                (base32
                 "05dmrk9qsryah2n17z6z85dj9l9lfyvnsd7faw0p9bs1pp5pwrkj"))))
@@ -252,8 +252,8 @@ utility functions and modules all written in high-level Tcl.")
     (version "3.2")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/" name "/"
-                                  name "-" version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/" name "/TclXML/"
+                                  version "/" name "-" version ".tar.gz"))
               (sha256
                (base32
                 "0ffb4aw63inig3aql33g4pk0kjk14dv238anp1scwjdjh1k6n4gl"))
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 2600b6f20d..bbbaf43c82 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -64,9 +64,9 @@
 (define texlive-texmf-src
   (origin
     (method url-fetch)
-    (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523-texmf.tar.xz")
+    (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-texmf.tar.xz")
     (sha256 (base32
-              "0mfp6kq1p2ys5ni9czx9xl0xh264axri25vqw37yzk8jn3py9l08"))))
+              "1dv8vgfzpczqw82hv9g7a8djhhyzywljmrarlcyy6g2qi5q51glr"))))
 
 (define texlive-bin
   (package
@@ -75,9 +75,9 @@
    (source
     (origin
      (method url-fetch)
-      (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523-source.tar.xz")
+      (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-source.tar.xz")
       (sha256 (base32
-               "07kb8rsw8d42wy3fj1qgqj26y92spx1lbhx6z73wwdb3msnvh4i9"))))
+               "1v91vahxlxkdra0qz3f132vvx5d9cx2jy84yl1hkch0agyj2rcx8"))))
    (build-system gnu-build-system)
    (inputs
     `(("texlive-extra-src" ,texlive-extra-src)
@@ -167,8 +167,8 @@ that are free software, including support for many languages around the
 world.
 
 This package contains the binaries.")
-   (license (license:fsf-free "http://tug.org/texlive/copying.html"))
-   (home-page "http://www.tug.org/texlive/")))
+   (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
+   (home-page "https://www.tug.org/texlive/")))
 
 (define texlive-texmf
   (package
@@ -234,8 +234,8 @@ that are free software, including support for many languages around the
 world.
 
 This package contains the complete tree of texmf-dist data.")
-   (license (license:fsf-free "http://tug.org/texlive/copying.html"))
-   (home-page "http://www.tug.org/texlive/")))
+   (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
+   (home-page "https://www.tug.org/texlive/")))
 
 (define-public texlive
   (package
@@ -296,8 +296,8 @@ that are free software, including support for many languages around the
 world.
 
 This package contains the complete TeX Live distribution.")
-   (license (license:fsf-free "http://tug.org/texlive/copying.html"))
-   (home-page "http://www.tug.org/texlive/")))
+   (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
+   (home-page "https://www.tug.org/texlive/")))
 
 
 ;; texlive-texmf-minimal is a pruned, small version of the texlive tree,
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index ebcf4b9a1f..c4479fbde9 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -343,7 +343,7 @@ runs Word\".")
               (method url-fetch)
               (uri
                (string-append
-                "mirror://sourceforge/project/utfcpp/utf8cpp_2x/Release%20"
+                "mirror://sourceforge/utfcpp/utf8cpp_2x/Release%20"
                 version "/utf8_v"
                 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
                 ".zip"))
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index ec7f9e8a3c..705275242b 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -94,12 +94,13 @@
      `(#:tests? #f ; no test target
        #:python ,python-2   ; Python 3 apparently not yet supported, see
                             ; https://answers.launchpad.net/bzr/+question/229048
-       #:phases (alist-cons-after
-                 'unpack 'fix-mandir
-                 (lambda _
-                   (substitute* "setup.py"
-                     (("man/man1") "share/man/man1")))
-                 %standard-phases)))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-mandir
+           (lambda _
+             (substitute* "setup.py"
+                          (("man/man1") "share/man/man1"))
+             #t)))))
     (home-page "https://gnu.org/software/bazaar")
     (synopsis "Version control system supporting both distributed and centralized workflows")
     (description
@@ -491,19 +492,19 @@ will work.")
      '(#:tests? #f                    ; no tests
        #:make-flags (list (string-append "prefix="
                                          (assoc-ref %outputs "out")))
-       #:phases (alist-cons-after
-                 'unpack 'reset-shFlags-link
-                 (lambda* (#:key inputs #:allow-other-keys)
-                   ;; The link points to a file in the shFlags submodule.
-                   ;; Redirect it to point to our system shFlags.
-                   (let ((shflags (assoc-ref inputs "shflags")))
-                     (begin
-                       (delete-file "gitflow-shFlags")
-                       (symlink (string-append shflags "/src/shflags")
-                                "gitflow-shFlags"))))
-                 (alist-delete
-                  'configure
-                  (alist-delete 'build %standard-phases)))))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'reset-shFlags-link
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; The link points to a file in the shFlags submodule.
+             ;; Redirect it to point to our system shFlags.
+             (let ((shflags (assoc-ref inputs "shflags")))
+               (begin
+                 (delete-file "gitflow-shFlags")
+                 (symlink (string-append shflags "/src/shflags")
+                          "gitflow-shFlags")))))
+         (delete 'configure)
+         (delete 'build))))
     (home-page "http://nvie.com/posts/a-successful-git-branching-model/")
     (synopsis "Git extensions for Vincent Driessen's branching model")
     (description
@@ -686,48 +687,45 @@ property manipulation.")
     (version "1.8.16")
     (source (origin
              (method url-fetch)
-             (uri (string-append "http://archive.apache.org/dist/subversion/"
+             (uri (string-append "https://archive.apache.org/dist/subversion/"
                                  "subversion-" version ".tar.bz2"))
              (sha256
               (base32
                "0imkxn25n6sbcgfldrx4z29npjprb1lxjm5fb89q4297161nx3zi"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:phases (alist-cons-after
-                 'configure 'patch-libtool-wrapper-ls
-                 (lambda* (#:key inputs #:allow-other-keys)
-                   ;; This substitution allows tests svnauthz_tests and
-                   ;; svnlook_tests to pass.  These tests execute svnauthz and
-                   ;; svnlook through their libtool wrapper scripts from svn
-                   ;; hooks, whose empty environments cause "ls: command not
-                   ;; found" errors.  It would be nice if this fix ultimately
-                   ;; made its way into libtool.
-                   (let ((coreutils (assoc-ref inputs "coreutils")))
-                     (substitute* "libtool"
-                       (("\\\\`ls") (string-append "\\`" coreutils "/bin/ls")))))
-                 (alist-cons-after
-                  'install 'install-perl-bindings
-                  (lambda* (#:key outputs #:allow-other-keys)
-                    ;; Follow the instructions from
-                    ;; 'subversion/bindings/swig/INSTALL'.
-                    (let ((out (assoc-ref outputs "out")))
-                      (and (zero? (system* "make" "swig-pl-lib"))
-                           ;; FIXME: Test failures.
-                           ;; (zero? (system* "make" "check-swig-pl"))
-                           (zero? (system* "make" "install-swig-pl-lib"))
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'configure 'patch-libtool-wrapper-ls
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; This substitution allows tests svnauthz_tests and svnlook_tests
+             ;; to pass.  These tests execute svnauthz and svnlook through
+             ;; their libtool wrapper scripts from svn hooks, whose empty
+             ;; environments cause "ls: command not found" errors.  It would be
+             ;; nice if this fix ultimately made its way into libtool.
+             (let ((coreutils (assoc-ref inputs "coreutils")))
+               (substitute* "libtool"
+                 (("\\\\`ls") (string-append "\\`" coreutils "/bin/ls"))))))
+         (add-after 'install 'install-perl-bindings
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Follow the instructions from 'subversion/bindings/swig/INSTALL'.
+             (let ((out (assoc-ref outputs "out")))
+               (and (zero? (system* "make" "swig-pl-lib"))
+                    ;; FIXME: Test failures.
+                    ;; (zero? (system* "make" "check-swig-pl"))
+                    (zero? (system* "make" "install-swig-pl-lib"))
 
-                           ;; Set the right installation prefix.
-                           (with-directory-excursion
-                               "subversion/bindings/swig/perl/native"
-                             (and (zero?
-                                   (system* "perl" "Makefile.PL"
-                                            (string-append "PREFIX=" out)))
-                                  (zero?
-                                   (system* "make" "install"
-                                            (string-append "OTHERLDFLAGS="
-                                                           "-Wl,-rpath="
-                                                           out "/lib"))))))))
-                  %standard-phases))))
+                    ;; Set the right installation prefix.
+                    (with-directory-excursion
+                        "subversion/bindings/swig/perl/native"
+                      (and (zero?
+                            (system* "perl" "Makefile.PL"
+                                     (string-append "PREFIX=" out)))
+                           (zero?
+                            (system* "make" "install"
+                                     (string-append "OTHERLDFLAGS="
+                                                    "-Wl,-rpath="
+                                                    out "/lib"))))))))))))
     (native-inputs
       `(("pkg-config" ,pkg-config)
         ;; For the Perl bindings.
@@ -740,7 +738,7 @@ property manipulation.")
         ("python" ,python-2) ; incompatible with Python 3 (print syntax)
         ("sqlite" ,sqlite)
         ("zlib" ,zlib)))
-    (home-page "http://subversion.apache.org/")
+    (home-page "https://subversion.apache.org/")
     (synopsis "Revision control system")
     (description
      "Subversion exists to be universally recognized and adopted as a
@@ -902,23 +900,23 @@ large, complex patch files.")
                                        "cssc-missing-include.patch"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:phases (alist-cons-before
-                 'check 'precheck
-                 (lambda _
-                   (begin
-                     (substitute* "tests/common/test-common"
-                       (("/bin/pwd") (which "pwd")))
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'precheck
+           (lambda _
+             (begin
+               (substitute* "tests/common/test-common"
+                 (("/bin/pwd") (which "pwd")))
 
-                     (substitute* "tests/prt/all-512.sh"
-                       (("/bin/sh") (which "sh")))
+               (substitute* "tests/prt/all-512.sh"
+                 (("/bin/sh") (which "sh")))
 
-                     ;; XXX: This test has no hope of passing until there is a "nogroup"
-                     ;; entry (or at least some group to which the guix builder does
-                     ;; not belong) in the /etc/group file of the build environment.
-                     ;; Currently we do not have such a group.  Disable this test for now.
-                     (substitute* "tests/Makefile"
-                       (("test-delta ") ""))))
-                 %standard-phases)))
+               ;; XXX: This test has no hope of passing until there is a "nogroup"
+               ;; entry (or at least some group to which the guix builder does
+               ;; not belong) in the /etc/group file of the build environment.
+               ;; Currently we do not have such a group.  Disable this test for now.
+               (substitute* "tests/Makefile"
+                 (("test-delta ") ""))))))))
     ;; These are needed for the tests
     (native-inputs `(("git" ,git)
                      ("cvs" ,cvs)))
@@ -937,8 +935,8 @@ accessed and migrated on modern systems.")
     (version "4.24")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/aegis/aegis-"
-                                  version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/aegis/aegis/" version
+                                  "/aegis-" version ".tar.gz"))
               (sha256
                (base32
                 "18s86ssarfmc4l17gbpzybca29m5wa37cbaimdji8czlcry3mcjl"))
@@ -971,39 +969,37 @@ accessed and migrated on modern systems.")
                                "--sharedstatedir=/var/com/aegis")
        #:parallel-build? #f ; There are some nasty racy rules in the Makefile.
        #:phases
-        (alist-cons-before
-         'configure 'pre-conf
-         (lambda _
-             (substitute* (append '("configure"
-                                    "etc/check-tar-gz.sh"
-                                    "etc/patches.sh"
-                                    "etc/test.sh"
-                                    "script/aexver.in"
-                                    "script/aebisect.in"
-                                    "script/aeintegratq.in"
-                                    "script/tkaegis.in"
-                                    "script/test_funcs.in"
-                                    "web/eg_oss_templ.sh"
-                                    "web/webiface.html"
-                                    "libaegis/getpw_cache.cc")
-                                  (find-files "test" "\\.sh"))
-               (("/bin/sh") (which "sh")))
-             (setenv "SH" (which "sh")))
-         (alist-replace
-          'check
-          (lambda _
-            (let ((home (string-append (getcwd) "/my-new-home")))
-              ;; Some tests need to write to $HOME.
-              (mkdir home)
-              (setenv "HOME" home)
+       (modify-phases %standard-phases
+         (add-before 'configure 'pre-conf
+           (lambda _
+              (substitute* (append '("configure"
+                                     "etc/check-tar-gz.sh"
+                                     "etc/patches.sh"
+                                     "etc/test.sh"
+                                     "script/aexver.in"
+                                     "script/aebisect.in"
+                                     "script/aeintegratq.in"
+                                     "script/tkaegis.in"
+                                     "script/test_funcs.in"
+                                     "web/eg_oss_templ.sh"
+                                     "web/webiface.html"
+                                     "libaegis/getpw_cache.cc")
+                                   (find-files "test" "\\.sh"))
+                           (("/bin/sh") (which "sh")))
+              (setenv "SH" (which "sh"))))
+         (replace 'check
+           (lambda _
+             (let ((home (string-append (getcwd) "/my-new-home")))
+               ;; Some tests need to write to $HOME.
+               (mkdir home)
+               (setenv "HOME" home)
 
-              ;; This test assumes that  flex has been symlinked to "lex".
-              (substitute* "test/00/t0011a.sh"
-                (("type lex")  "type flex"))
+               ;; This test assumes that  flex has been symlinked to "lex".
+               (substitute* "test/00/t0011a.sh"
+                 (("type lex")  "type flex"))
 
-              ;; The author decided to call the check rule "sure".
-              (zero? (system* "make" "sure"))))
-         %standard-phases))))
+               ;; The author decided to call the check rule "sure".
+               (zero? (system* "make" "sure"))))))))
     (home-page "http://aegis.sourceforge.net")
     (synopsis "Project change supervisor")
     (description "Aegis is a project change supervisor, and performs some of
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index dfce444d9e..948ab5ac8a 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -90,8 +90,8 @@
     (version "1.4rc5")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/aa-project/"
-                                  name "-" version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/aa-project/aa-lib/"
+                                  version "/" name "-" version ".tar.gz"))
               (sha256
                (base32
                 "1vkh19gb76agvh4h87ysbrgy82hrw88lnsvhynjf4vng629dmpgv"))))
@@ -308,7 +308,8 @@ streams.")
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/libdv/libdv-" version ".tar.gz"))
+                    "mirror://sourceforge/" name "/" name "/"
+                    version "/" name "-" version ".tar.gz"))
               (sha256
                (base32
                 "1fl96f2xh2slkv1i1ix7kqk576a0ak1d33cylm0mbhm96d0761d3"))))
@@ -1094,8 +1095,8 @@ for use with HTML5 video.")
     (source (origin
              (method url-fetch)
              (uri (string-append
-                   "mirror://sourceforge/avidemux/avidemux_"
-                   version ".tar.gz"))
+                   "mirror://sourceforge/" name "/" name "/" version "/"
+                   name "_" version ".tar.gz"))
              (sha256
               (base32
                "0nz52yih8sff53inndkh2dba759xjzsh4b8xjww419lcpk0qp6kn"))
diff --git a/gnu/packages/w3m.scm b/gnu/packages/w3m.scm
index 42141fb04d..e7dd583c11 100644
--- a/gnu/packages/w3m.scm
+++ b/gnu/packages/w3m.scm
@@ -37,8 +37,9 @@
     (version "0.5.3")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/w3m/w3m-"
-                                 version ".tar.gz"))
+             (uri (string-append "mirror://sourceforge/" name "/" name "/"
+                                 name "-" version "/"
+                                 name "-" version ".tar.gz"))
              (sha256
               (base32
                "1qx9f0kprf92r1wxl3sacykla0g04qsi0idypzz24b7xy9ix5579"))
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index ea1a30ad26..bbe33db32b 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -636,7 +636,8 @@ of people.")
      (origin
        (method url-fetch)
        (uri (string-append
-             "mirror://sourceforge/quvi/libquvi-scripts-" version ".tar.xz"))
+             "mirror://sourceforge/quvi/" (version-major+minor version) "/"
+             name "/" name "-" version ".tar.xz"))
        (sha256
         (base32 "0d0giry6bb57pnidymvdl7i5x9bq3ljk3g4bs294hcr5mj3cq0kw"))))
     (build-system gnu-build-system)
@@ -654,7 +655,8 @@ parse media stream properties.")
      (origin
        (method url-fetch)
        (uri (string-append
-             "mirror://sourceforge/quvi/libquvi-" version ".tar.xz"))
+             "mirror://sourceforge/quvi/" (version-major+minor version) "/" name "/"
+             name "-" version ".tar.xz"))
        (sha256
         (base32 "00x9gbmzc5cns0gnfag0hsphcr3cb33vbbb9s7ppvvd6bxz2z1mm"))))
     (build-system gnu-build-system)
@@ -687,7 +689,8 @@ URLs and extracting their actual media files.")
      (origin
        (method url-fetch)
        (uri (string-append
-             "mirror://sourceforge/quvi/quvi-" version ".tar.xz"))
+             "mirror://sourceforge/" name "/"  (version-major+minor version)
+             "/" name "/" name "-" version ".tar.xz"))
        (sha256
         (base32 "09lhl6dv5zpryasx7yjslfrcdcqlsbwapvd5lg7w6sm5x5n3k8ci"))))
     (build-system gnu-build-system)
diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index 790c74bbfd..2cc9f44cdc 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -336,7 +336,7 @@ drags, snap-to-border support, and virtual desktops.")
     (synopsis "Small and fast window manager")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/fluxbox/"
+              (uri (string-append "mirror://sourceforge/fluxbox/fluxbox/"
                                   version "/fluxbox-" version ".tar.xz"))
               (sha256
                (base32
diff --git a/gnu/packages/wxwidgets.scm b/gnu/packages/wxwidgets.scm
index 3231e3d48d..c9eb1780d6 100644
--- a/gnu/packages/wxwidgets.scm
+++ b/gnu/packages/wxwidgets.scm
@@ -88,8 +88,8 @@ and many other languages.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append
-             "mirror://sourceforge/wxwindows/wxGTK-" version ".tar.gz"))
+       (uri (string-append "mirror://sourceforge/wxwindows/" version
+                           "/wxWidgets-" version ".tar.bz2"))
        (sha256
         (base32 "1gjs9vfga60mk4j4ngiwsk9h6c7j22pw26m3asxr1jwvqbr8kkqk"))))
     (inputs
diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 44d82dac60..f611518e86 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -108,7 +108,8 @@ program.")
       (origin
         (method url-fetch)
         (uri (string-append
-              "mirror://sourceforge/" name "/" name "-" version ".tar.gz"))
+              "mirror://sourceforge/" name "/" name "/" version "/"
+              name "-" version ".tar.gz"))
         (sha256
           (base32
            "0ibcf46rldnv0r424qcnai1fa5iq3lm5q5rdd7snsi5sb78gmixp"))))
@@ -584,8 +585,8 @@ X Window System.")
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/libxosd/xosd-"
-                    version ".tar.gz"))
+                    "mirror://sourceforge/libxosd/libxosd/xosd-" version "/"
+                    name "-" version ".tar.gz"))
               (sha256
                (base32
                 "025m7ha89q29swkc7s38knnbn8ysl24g2h5s7imfxflm91psj7sg"))))
diff --git a/gnu/packages/xiph.scm b/gnu/packages/xiph.scm
index d1597e96ea..81e0934889 100644
--- a/gnu/packages/xiph.scm
+++ b/gnu/packages/xiph.scm
@@ -300,7 +300,7 @@ ogginfo, to obtain information (tags, bitrate, length, etc.) about
 (define opus
   (package
     (name "opus")
-    (version "1.1.2")
+    (version "1.1.3")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -308,7 +308,7 @@ ogginfo, to obtain information (tags, bitrate, length, etc.) about
                     ".tar.gz"))
               (sha256
                (base32
-                "1z87x5c5x951lhnm70iqr2gqn15wns5cqsw8nnkvl48jwdw00a8f"))))
+                "0cxnd7pjxbgh6l3cbzsw29phpr5cq28fikfhjlp1hc3y5s0gxdjq"))))
     (build-system gnu-build-system)
     (synopsis "Versatile audio codec")
     (description
diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index fb0d07d8cf..6a8fff54cd 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -656,7 +656,8 @@ UTF-8 and UTF-16 encoding.")
     (version "2.6.2")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/tinyxml/tinyxml_"
+              (uri (string-append "mirror://sourceforge/tinyxml/tinyxml/"
+                                  version "/tinyxml_"
                                   (string-join (string-split version #\.) "_")
                                   ".tar.gz"))
               (sha256
diff --git a/gnu/services/avahi.scm b/gnu/services/avahi.scm
index 562005c22c..807cc05a22 100644
--- a/gnu/services/avahi.scm
+++ b/gnu/services/avahi.scm
@@ -26,7 +26,8 @@
   #:use-module (gnu packages admin)
   #:use-module (guix records)
   #:use-module (guix gexp)
-  #:export (avahi-service
+  #:export (avahi-configuration
+            avahi-service
             avahi-service-type))
 
 ;;; Commentary:
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 805ba7d12c..4474ce7996 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -94,11 +94,17 @@
             guix-publish-configuration?
             guix-publish-service
             guix-publish-service-type
+
+            gpm-configuration
+            gpm-configuration?
             gpm-service-type
             gpm-service
 
             urandom-seed-service-type
             urandom-seed-service
+
+            rngd-configuration
+            rngd-configuration?
             rngd-service-type
             rngd-service
             pam-limits-service-type
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index e136d1e00b..86847f8c50 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -27,9 +27,15 @@
   #:use-module (guix records)
   #:use-module (guix gexp)
   #:use-module (ice-9 match)
-  #:export (postgresql-service
+  #:export (postgresql-configuration
+            postgresql-configuration?
+            postgresql-service
+            postgresql-service-type
+
             mysql-service
-            mysql-configuration))
+            mysql-service-type
+            mysql-configuration
+            mysql-configuration?))
 
 ;;; Commentary:
 ;;;
diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm
index 6ef13568ef..690561cccd 100644
--- a/gnu/services/dbus.scm
+++ b/gnu/services/dbus.scm
@@ -27,7 +27,9 @@
   #:use-module (guix records)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
-  #:export (dbus-root-service-type
+  #:export (dbus-configuration
+            dbus-configuration?
+            dbus-root-service-type
             dbus-service))
 
 ;;;
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 86214a73bf..bf21707bfe 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -45,18 +45,47 @@
   #:use-module (guix gexp)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
-  #:export (upower-service
+  #:export (upower-configuration
+            upower-configuration?
+            upower-service
+            upower-service-type
+
+            udisks-configuration
+            udisks-configuration?
             udisks-service
+            udisks-service-type
+
             colord-service
+
             geoclue-application
+            geoclue-configuration
+            geoclue-configuration?
             %standard-geoclue-applications
             geoclue-service
+            geoclue-service-type
+
             bluetooth-service
+
+            polkit-configuration
+            polkit-configuration?
             polkit-service
+            polkit-service-type
+
             elogind-configuration
+            elogind-configuration?
             elogind-service
+            elogind-service-type
+
+            gnome-desktop-configuration
+            gnome-desktop-configuration?
             gnome-desktop-service
+            gnome-desktop-service-type
+
+            xfce-desktop-configuration
+            xfce-desktop-configuration?
             xfce-desktop-service
+            xfce-desktop-service-type
+
             %desktop-services))
 
 ;;; Commentary:
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index 9c06d5713a..b06922c911 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -30,6 +30,7 @@
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match)
   #:export (dicod-service
+            dicod-service-type
             dicod-configuration
             dicod-database
             %dicod-database:gcide))
diff --git a/gnu/services/lirc.scm b/gnu/services/lirc.scm
index 069084abf6..e95f54280d 100644
--- a/gnu/services/lirc.scm
+++ b/gnu/services/lirc.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
-;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,7 +24,10 @@
   #:use-module (guix gexp)
   #:use-module (guix records)
   #:use-module (ice-9 match)
-  #:export (lirc-service))
+  #:export (lirc-configuration
+            lirc-configuation?
+            lirc-service
+            lirc-service-type))
 
 ;;; Commentary:
 ;;;
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 4bd1b96b56..c252d669de 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -37,6 +37,7 @@
             dovecot-configuration-error?
 
             dovecot-service
+            dovecot-service-type
             dovecot-configuration
             opaque-dovecot-configuration
 
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index a77ed3bb80..71f49a03a5 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -39,13 +39,28 @@
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match)
   #:export (%facebook-host-aliases
+            static-networking
             static-networking-service
+            static-networking-service-type
             dhcp-client-service
             %ntp-servers
+
+            ntp-configuration
+            ntp-configuration?
             ntp-service
+            ntp-service-type
+
+            tor-configuration
+            tor-configuration?
             tor-hidden-service
             tor-service
+            tor-service-type
+
+            bitlbee-configuration
+            bitlbee-configuration?
             bitlbee-service
+            bitlbee-service-type
+
             wicd-service
             network-manager-service
             connman-service))
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index 743b5e3805..9a7ea0fb46 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -25,7 +25,10 @@
   #:use-module (guix gexp)
   #:use-module (guix records)
   #:use-module (srfi srfi-26)
-  #:export (lsh-service
+  #:export (lsh-configuration
+            lsh-configuration?
+            lsh-service
+            lsh-service-type
 
             dropbear-configuration
             dropbear-configuration?
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 72ef7d4050..d86aab50b5 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
-;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -27,7 +27,10 @@
   #:use-module (guix records)
   #:use-module (guix gexp)
   #:use-module (ice-9 match)
-  #:export (nginx-service))
+  #:export (nginx-configuration
+            nginx-configuration?
+            nginx-service
+            nginx-service-type))
 
 ;;; Commentary:
 ;;;
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 44d12a7e77..905c88ff66 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -48,6 +48,8 @@
             slim-service-type
             slim-service
 
+            screen-locker
+            screen-locker?
             screen-locker-service-type
             screen-locker-service))
 
diff --git a/guix/build/download.scm b/guix/build/download.scm
index 103e784bb1..307258be92 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -737,7 +737,7 @@ or #f."
     (append-map (lambda (make-url)
                   (filter-map (match-lambda
                                 ((hash-algo . hash)
-                                 (string->uri (make-url hash-algo hash))))
+                                 (string->uri (make-url file hash-algo hash))))
                               hashes))
                 content-addressed-mirrors))
 
diff --git a/guix/build/pull.scm b/guix/build/pull.scm
index 4ddb12ac04..ccf1868516 100644
--- a/guix/build/pull.scm
+++ b/guix/build/pull.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2016 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -36,7 +36,17 @@
 ;;; Code:
 
 (define* (build-guix out source
-                     #:key gcrypt
+                     #:key
+                     system
+                     storedir localstatedir sysconfdir sbindir
+
+                     (package-name "GNU Guix")
+                     (package-version "0")
+                     (bug-report-address "bug-guix@gnu.org")
+                     (home-page-url "https://gnu.org/s/guix")
+
+                     libgcrypt zlib gzip bzip2 xz
+
                      (debug-port (%make-void-port "w"))
                      (log-port (current-error-port)))
   "Build and install Guix in directory OUT using SOURCE, a directory
@@ -55,13 +65,26 @@ containing the source code.  Write any debugging output to DEBUG-PORT."
     (copy-file "guix.scm" (string-append out "/guix.scm"))
     (copy-file "gnu.scm" (string-append out "/gnu.scm"))
 
-    ;; Add a fake (guix config) module to allow the other modules to be
-    ;; compiled.  The user's (guix config) is the one that will be used.
+    ;; Instantiate a (guix config) module that preserves the original
+    ;; settings.
     (copy-file "guix/config.scm.in"
                (string-append out "/guix/config.scm"))
     (substitute* (string-append out "/guix/config.scm")
-      (("@LIBGCRYPT@")
-       (string-append gcrypt "/lib/libgcrypt")))
+      (("@PACKAGE_NAME@") package-name)
+      (("@PACKAGE_VERSION@") package-version)
+      (("@PACKAGE_BUGREPORT@") bug-report-address)
+      (("@PACKAGE_URL@") home-page-url)
+      (("@storedir@") storedir)
+      (("@guix_localstatedir@") localstatedir)
+      (("@guix_sysconfdir@") sysconfdir)
+      (("@guix_sbindir@") sbindir)
+      (("@guix_system@") system)
+      (("@LIBGCRYPT@") (string-append libgcrypt "/lib/libgcrypt"))
+      (("@LIBZ@") (string-append zlib "/lib/libz"))
+      (("@GZIP@") (string-append gzip "/bin/gzip"))
+      (("@BZIP2@") (string-append bzip2 "/bin/bzip2"))
+      (("@XZ@") (string-append xz "/bin/xz"))
+      (("@NIX_INSTANTIATE@") ""))                 ;remnants from the past
 
     ;; Augment the search path so Scheme code can be compiled.
     (set! %load-path (cons out %load-path))
@@ -119,10 +142,6 @@ containing the source code.  Write any debugging output to DEBUG-PORT."
              (set! completed (+ 1 completed))))
          files))))
 
-  ;; Remove the "fake" (guix config).
-  (delete-file (string-append out "/guix/config.scm"))
-  (delete-file (string-append out "/guix/config.go"))
-
   (newline)
   #t)
 
diff --git a/guix/config.scm.in b/guix/config.scm.in
index 6d42cf233c..8f2c4abd8e 100644
--- a/guix/config.scm.in
+++ b/guix/config.scm.in
@@ -21,10 +21,17 @@
             %guix-version
             %guix-bug-report-address
             %guix-home-page-url
+
+            %storedir
+            %localstatedir
+            %sysconfdir
+            %sbindir
+
             %store-directory
             %state-directory
             %config-directory
             %guix-register-program
+
             %system
             %libgcrypt
             %libz
@@ -35,7 +42,8 @@
 
 ;;; Commentary:
 ;;;
-;;; Compile-time configuration of Guix.
+;;; Compile-time configuration of Guix.  When adding a substitution variable
+;;; here, make sure to equip (guix scripts pull) to substitute it.
 ;;;
 ;;; Code:
 
@@ -51,21 +59,36 @@
 (define %guix-home-page-url
   "@PACKAGE_URL@")
 
+(define %storedir
+  "@storedir@")
+
+(define %localstatedir
+  "@guix_localstatedir@")
+
+(define %sysconfdir
+  "@guix_sysconfdir@")
+
+(define %sbindir
+  "@guix_sbindir@")
+
 (define %store-directory
   (or (and=> (getenv "NIX_STORE_DIR") canonicalize-path)
-      "@storedir@"))
+      %storedir))
 
 (define %state-directory
   ;; This must match `NIX_STATE_DIR' as defined in `nix/local.mk'.
-  (or (getenv "NIX_STATE_DIR") "@guix_localstatedir@/guix"))
+  (or (getenv "NIX_STATE_DIR")
+      (string-append %localstatedir "/guix")))
 
 (define %config-directory
   ;; This must match `GUIX_CONFIGURATION_DIRECTORY' as defined in `nix/local.mk'.
-  (or (getenv "GUIX_CONFIGURATION_DIRECTORY") "@guix_sysconfdir@/guix"))
+  (or (getenv "GUIX_CONFIGURATION_DIRECTORY")
+      (string-append %sysconfdir "/guix")))
 
 (define %guix-register-program
   ;; The 'guix-register' program.
-  (or (getenv "GUIX_REGISTER") "@guix_sbindir@/guix-register"))
+  (or (getenv "GUIX_REGISTER")
+      (string-append %sbindir "/guix-register")))
 
 (define %system
   "@guix_system@")
diff --git a/guix/derivations.scm b/guix/derivations.scm
index 76593f373b..7f74ed6c77 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -73,6 +73,7 @@
             derivation-name
             derivation-output-names
             fixed-output-derivation?
+            fixed-output-path
             offloadable-derivation?
             substitutable-derivation?
             substitution-oracle
@@ -676,7 +677,11 @@ the derivation called NAME with hash HASH."
                   name
                   (string-append name "-" output))))
 
-(define (fixed-output-path output hash-algo hash recursive? name)
+(define* (fixed-output-path name hash
+                            #:key
+                            (output "out")
+                            (hash-algo 'sha256)
+                            (recursive? #t))
   "Return an output path for the fixed output OUTPUT defined by HASH of type
 HASH-ALGO, of the derivation NAME.  RECURSIVE? has the same meaning as for
 'add-to-store'."
@@ -736,12 +741,14 @@ output should not be used."
               (outputs  (map (match-lambda
                               ((output-name . ($ <derivation-output>
                                                  _ algo hash rec?))
-                               (let ((path (if hash
-                                               (fixed-output-path output-name
-                                                                  algo hash
-                                                                  rec? name)
-                                               (output-path output-name
-                                                            drv-hash name))))
+                               (let ((path
+                                      (if hash
+                                          (fixed-output-path name hash
+                                                             #:hash-algo algo
+                                                             #:output output-name
+                                                             #:recursive? rec?)
+                                          (output-path output-name
+                                                       drv-hash name))))
                                  (cons output-name
                                        (make-derivation-output path algo
                                                                hash rec?)))))
diff --git a/guix/download.scm b/guix/download.scm
index bcb043ba80..8f38a4f552 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -232,10 +232,10 @@
 
 (define %content-addressed-mirrors
   ;; List of content-addressed mirrors.  Each mirror is represented as a
-  ;; procedure that takes an algorithm (symbol) and a hash (bytevector), and
-  ;; returns a URL or #f.
+  ;; procedure that takes a file name, an algorithm (symbol) and a hash
+  ;; (bytevector), and returns a URL or #f.
   ;; TODO: Add more.
-  '(list (lambda (algo hash)
+  '(list (lambda (file algo hash)
            ;; 'tarballs.nixos.org' supports several algorithms.
            (string-append "http://tarballs.nixos.org/"
                           (symbol->string algo) "/"
diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm
index 3baceaf645..2ca2aeebe3 100644
--- a/guix/scripts/publish.scm
+++ b/guix/scripts/publish.scm
@@ -31,6 +31,7 @@
   #:use-module (srfi srfi-9 gnu)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-37)
   #:use-module (web http)
   #:use-module (web request)
@@ -49,6 +50,7 @@
   #:use-module (guix zlib)
   #:use-module (guix ui)
   #:use-module (guix scripts)
+  #:use-module ((guix build utils) #:select (dump-port))
   #:export (guix-publish))
 
 (define (show-help)
@@ -308,6 +310,25 @@ appropriate duration."
                 store-path)
         (not-found request))))
 
+(define (render-content-addressed-file store request
+                                       name algo hash)
+  "Return the content of the result of the fixed-output derivation NAME that
+has the given HASH of type ALGO."
+  ;; TODO: Support other hash algorithms.
+  (if (and (eq? algo 'sha256) (= 32 (bytevector-length hash)))
+      (let ((item (fixed-output-path name hash
+                                     #:hash-algo algo
+                                     #:recursive? #f)))
+        (if (valid-path? store item)
+            (values `((content-type . (application/octet-stream
+                                       (charset . "ISO-8859-1"))))
+                    ;; XXX: We're not returning the actual contents, deferring
+                    ;; instead to 'http-write'.  This is a hack to work around
+                    ;; <http://bugs.gnu.org/21093>.
+                    item)
+            (not-found request)))
+      (not-found request)))
+
 (define extract-narinfo-hash
   (let ((regexp (make-regexp "^([a-df-np-sv-z0-9]{32}).narinfo$")))
     (lambda (str)
@@ -398,6 +419,34 @@ blocking."
           (swallow-zlib-error
            (close-port port))
           (values)))))
+    (('application/octet-stream . _)
+     ;; Send a raw file in a separate thread.
+     (call-with-new-thread
+      (lambda ()
+        (catch 'system-error
+          (lambda ()
+            (call-with-input-file (utf8->string body)
+              (lambda (input)
+                (let* ((size     (stat:size (stat input)))
+                       (headers  (alist-cons 'content-length size
+                                             (alist-delete 'content-length
+                                                           (response-headers response)
+                                                           eq?)))
+                       (response (write-response (set-field response
+                                                            (response-headers)
+                                                            headers)
+                                                 client))
+                       (output   (response-port response)))
+                  (dump-port input output)
+                  (close-port output)
+                  (values)))))
+          (lambda args
+            ;; If the file was GC'd behind our back, that's fine.  Likewise if
+            ;; the client closes the connection.
+            (unless (memv (system-error-errno args)
+                          (list ENOENT EPIPE ECONNRESET))
+              (apply throw args))
+            (values))))))
     (_
      ;; Handle other responses sequentially.
      (%http-write server client response body))))
@@ -418,7 +467,7 @@ blocking."
     (format #t "~a ~a~%"
             (request-method request)
             (uri-path (request-uri request)))
-    (if (get-request? request) ; reject POST, PUT, etc.
+    (if (get-request? request)                    ;reject POST, PUT, etc.
         (match (request-path-components request)
           ;; /nix-cache-info
           (("nix-cache-info")
@@ -450,6 +499,14 @@ blocking."
                              (_
                               %default-gzip-compression)))
                (not-found request)))
+
+          ;; /nar/file/NAME/sha256/HASH
+          (("file" name "sha256" hash)
+           (guard (c ((invalid-base32-character? c)
+                      (not-found request)))
+             (let ((hash (nix-base32-string->bytevector hash)))
+               (render-content-addressed-file store request
+                                              name 'sha256 hash))))
           (_ (not-found request)))
         (not-found request))))
 
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index d9e1679ae7..77d4e28999 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -1,5 +1,5 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
 #
 # This file is part of GNU Guix.
 #
@@ -139,7 +139,7 @@ if guix system build "$tmpfile" 2> "$errorfile"
 then
     exit 1
 else
-    grep "service 'buggy!'.*'does-not-exist'.*undefined" "$errorfile"
+    grep "service 'buggy!'.*'does-not-exist'.*not provided" "$errorfile"
 fi
 
 # Reporting inconsistent user accounts.
diff --git a/tests/publish.scm b/tests/publish.scm
index 9bf181f1fc..0ba33487bd 100644
--- a/tests/publish.scm
+++ b/tests/publish.scm
@@ -26,6 +26,8 @@
   #:use-module (guix utils)
   #:use-module (guix hash)
   #:use-module (guix store)
+  #:use-module (guix derivations)
+  #:use-module (guix gexp)
   #:use-module (guix base32)
   #:use-module (guix base64)
   #:use-module ((guix records) #:select (recutils->alist))
@@ -210,4 +212,36 @@ References: ~%"
         (display "This file is not a valid store item." port)))
     (response-code (http-get (publish-uri (string-append "/nar/invalid"))))))
 
+(test-equal "/file/NAME/sha256/HASH"
+  "Hello, Guix world!"
+  (let* ((data "Hello, Guix world!")
+         (hash (call-with-input-string data port-sha256))
+         (drv  (run-with-store %store
+                 (gexp->derivation "the-file.txt"
+                                   #~(call-with-output-file #$output
+                                       (lambda (port)
+                                         (display #$data port)))
+                                   #:hash-algo 'sha256
+                                   #:hash hash)))
+         (out  (build-derivations %store (list drv))))
+    (utf8->string
+     (http-get-body
+      (publish-uri
+       (string-append "/file/the-file.txt/sha256/"
+                      (bytevector->nix-base32-string hash)))))))
+
+(test-equal "/file/NAME/sha256/INVALID-NIX-BASE32-STRING"
+  404
+  (let ((uri (publish-uri
+              "/file/the-file.txt/sha256/not-a-nix-base32-string")))
+    (response-code (http-get uri))))
+
+(test-equal "/file/NAME/sha256/INVALID-HASH"
+  404
+  (let ((uri (publish-uri
+              (string-append "/file/the-file.txt/sha256/"
+                             (bytevector->nix-base32-string
+                              (call-with-input-string "" port-sha256))))))
+    (response-code (http-get uri))))
+
 (test-end "publish")