summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--config-daemon.ac4
-rw-r--r--doc/contributing.texi3
-rw-r--r--doc/guix.texi81
-rw-r--r--gnu/bootloader/extlinux.scm6
-rw-r--r--gnu/bootloader/grub.scm104
-rw-r--r--gnu/bootloader/u-boot.scm5
-rw-r--r--gnu/build/activation.scm17
-rw-r--r--gnu/local.mk6
-rw-r--r--gnu/packages/algebra.scm36
-rw-r--r--gnu/packages/antivirus.scm156
-rw-r--r--gnu/packages/audio.scm122
-rw-r--r--gnu/packages/bioinformatics.scm111
-rw-r--r--gnu/packages/bootloaders.scm6
-rw-r--r--gnu/packages/cran.scm24
-rw-r--r--gnu/packages/emacs.scm6
-rw-r--r--gnu/packages/game-development.scm4
-rw-r--r--gnu/packages/games.scm4
-rw-r--r--gnu/packages/gl.scm3
-rw-r--r--gnu/packages/guile.scm6
-rw-r--r--gnu/packages/image.scm4
-rw-r--r--gnu/packages/java.scm145
-rw-r--r--gnu/packages/linux.scm16
-rw-r--r--gnu/packages/lisp.scm276
-rw-r--r--gnu/packages/llvm.scm35
-rw-r--r--gnu/packages/machine-learning.scm5
-rw-r--r--gnu/packages/man.scm14
-rw-r--r--gnu/packages/maths.scm127
-rw-r--r--gnu/packages/mpi.scm42
-rw-r--r--gnu/packages/multiprecision.scm66
-rw-r--r--gnu/packages/ocaml.scm2328
-rw-r--r--gnu/packages/package-management.scm7
-rw-r--r--gnu/packages/patches/clamav-config-llvm-libs.patch14
-rw-r--r--gnu/packages/patches/clamav-system-tomsfastmath.patch102
-rw-r--r--gnu/packages/patches/emacs-realgud-fix-configure-ac.patch27
-rw-r--r--gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch246
-rw-r--r--gnu/packages/patches/tomsfastmath-constness.patch76
-rw-r--r--gnu/packages/python.scm73
-rw-r--r--gnu/packages/simulation.scm490
-rw-r--r--gnu/packages/statistics.scm8
-rw-r--r--gnu/packages/version-control.scm52
-rw-r--r--gnu/packages/web.scm4
-rw-r--r--gnu/system.scm166
-rw-r--r--gnu/system/linux-initrd.scm13
-rw-r--r--gnu/system/vm.scm210
-rw-r--r--gnu/tests/base.scm11
-rw-r--r--guix/build-system/clojure.scm195
-rw-r--r--guix/build-system/ocaml.scm24
-rw-r--r--guix/build/clojure-build-system.scm110
-rw-r--r--guix/build/clojure-utils.scm265
-rw-r--r--guix/build/ocaml-build-system.scm45
-rw-r--r--guix/download.scm35
-rw-r--r--guix/progress.scm28
-rw-r--r--guix/scripts/system.scm115
-rw-r--r--nix/libstore/local-store.cc17
-rw-r--r--nix/local.mk7
-rw-r--r--nix/nix-daemon/guix-daemon.cc12
-rw-r--r--nix/scripts/authenticate.in (renamed from nix/scripts/guix-authenticate.in)0
58 files changed, 4688 insertions, 1428 deletions
diff --git a/Makefile.am b/Makefile.am
index c63b65ba56..a2144d4b8e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,6 +12,7 @@
 # Copyright © 2018 Nils Gillmann <ng0@n0.is>
 # Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
 # Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
+# Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
 #
 # This file is part of GNU Guix.
 #
@@ -172,6 +173,7 @@ MODULES =					\
   guix/build/syscalls.scm                       \
   guix/build/gremlin.scm			\
   guix/build/debug-link.scm			\
+  guix/build/clojure-utils.scm			\
   guix/build/emacs-utils.scm			\
   guix/build/java-utils.scm			\
   guix/build/lisp-utils.scm			\
diff --git a/config-daemon.ac b/config-daemon.ac
index 04f0fde3b2..aac46817f5 100644
--- a/config-daemon.ac
+++ b/config-daemon.ac
@@ -163,8 +163,8 @@ if test "x$guix_build_daemon" = "xyes"; then
     [chmod +x nix/scripts/download])
   AC_CONFIG_FILES([nix/scripts/substitute],
     [chmod +x nix/scripts/substitute])
-  AC_CONFIG_FILES([nix/scripts/guix-authenticate],
-    [chmod +x nix/scripts/guix-authenticate])
+  AC_CONFIG_FILES([nix/scripts/authenticate],
+    [chmod +x nix/scripts/authenticate])
   AC_CONFIG_FILES([nix/scripts/offload],
     [chmod +x nix/scripts/offload])
 fi
diff --git a/doc/contributing.texi b/doc/contributing.texi
index 91a87ef2dd..7417f28d14 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -112,7 +112,8 @@ run @code{make install}.  To do that, you first need to have an environment
 with all the dependencies available (@pxref{Building from Git}), and then
 simply prefix each command with
 @command{./pre-inst-env} (the @file{pre-inst-env} script lives in the
-top build tree of Guix), as in@footnote{The @option{-E} flag to
+top build tree of Guix; it is generated by @command{./configure}),
+as in@footnote{The @option{-E} flag to
 @command{sudo} guarantees that @code{GUILE_LOAD_PATH} is correctly set
 such that @command{guix-daemon} and the tools it uses can find the Guile
 modules they need.}:
diff --git a/doc/guix.texi b/doc/guix.texi
index 0ba034e822..c2c778a28c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -11,6 +11,7 @@
 
 @c Identifier of the OpenPGP key used to sign tarballs and such.
 @set OPENPGP-SIGNING-KEY-ID 3CE464558A84FDC69DB40CFB090B11993D9AEBB5
+@set KEY-SERVER pool.sks-keyservers.net
 
 @copying
 Copyright @copyright{} 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès@*
@@ -52,6 +53,7 @@ Copyright @copyright{} 2018 Pierre-Antoine Rouby@*
 Copyright @copyright{} 2018 Gábor Boskovits@*
 Copyright @copyright{} 2018 Florian Pelz@*
 Copyright @copyright{} 2018 Laura Lazzati@*
+Copyright @copyright{} 2018 Alex Vong@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -460,7 +462,8 @@ If that command fails because you do not have the required public key,
 then run this command to import it:
 
 @example
-$ gpg --keyserver pgp.mit.edu --recv-keys @value{OPENPGP-SIGNING-KEY-ID}
+$ gpg --keyserver @value{KEY-SERVER} \
+      --recv-keys @value{OPENPGP-SIGNING-KEY-ID}
 @end example
 
 @noindent
@@ -4393,6 +4396,63 @@ The @code{install} phase installs the binaries, and it also installs the
 source code and @file{Cargo.toml} file.
 @end defvr
 
+@cindex Clojure (programming language)
+@cindex simple Clojure build system
+@defvr {Scheme Variable} clojure-build-system
+This variable is exported by @code{(guix build-system clojure)}.  It implements
+a simple build procedure for @uref{https://clojure.org/, Clojure} packages
+using plain old @code{compile} in Clojure.  Cross-compilation is not supported
+yet.
+
+It adds @code{clojure}, @code{icedtea} and @code{zip} to the set of inputs.
+Different packages can be specified with the @code{#:clojure}, @code{#:jdk} and
+@code{#:zip} parameters, respectively.
+
+A list of source directories, test directories and jar names can be specified
+with the @code{#:source-dirs}, @code{#:test-dirs} and @code{#:jar-names}
+parameters, respectively.  Compile directory and main class can be specified
+with the @code{#:compile-dir} and @code{#:main-class} parameters, respectively.
+Other parameters are documented below.
+
+This build system is an extension of @var{ant-build-system}, but with the
+following phases changed:
+
+@table @code
+
+@item build
+This phase calls @code{compile} in Clojure to compile source files and runs
+@command{jar} to create jars from both source files and compiled files
+according to the include list and exclude list specified in
+@code{#:aot-include} and @code{#:aot-exclude}, respectively.  The exclude list
+has priority over the include list.  These lists consist of symbols
+representing Clojure libraries or the special keyword @code{#:all} representing
+all Clojure libraries found under the source directories.  The parameter
+@code{#:omit-source?} decides if source should be included into the jars.
+
+@item check
+This phase runs tests according to the include list and exclude list specified
+in @code{#:test-include} and @code{#:test-exclude}, respectively.  Their
+meanings are analogous to that of @code{#:aot-include} and
+@code{#:aot-exclude}, except that the special keyword @code{#:all} now
+stands for all Clojure libraries found under the test directories.  The
+parameter @code{#:tests?} decides if tests should be run.
+
+@item install
+This phase installs all jars built previously.
+@end table
+
+Apart from the above, this build system also contains an additional phase:
+
+@table @code
+
+@item install-doc
+This phase installs all top-level files with base name matching
+@var{%doc-regex}.  A different regex can be specified with the
+@code{#:doc-regex} parameter.  All files (recursively) inside the documentation
+directories specified in @code{#:doc-dirs} are installed as well.
+@end table
+@end defvr
+
 @defvr {Scheme Variable} cmake-build-system
 This variable is exported by @code{(guix build-system cmake)}.  It
 implements the build procedure for packages using the
@@ -9045,7 +9105,8 @@ If that command fails because you do not have the required public key,
 then run this command to import it:
 
 @example
-$ gpg --keyserver pgp.mit.edu --recv-keys @value{OPENPGP-SIGNING-KEY-ID}
+$ gpg --keyserver @value{KEY-SERVER} \
+      --recv-keys @value{OPENPGP-SIGNING-KEY-ID}
 @end example
 
 @noindent
@@ -9857,7 +9918,7 @@ The list of Linux kernel modules that need to be available in the
 initial RAM disk.  @xref{Initial RAM Disk}.
 
 @item @code{initrd} (default: @code{base-initrd})
-A monadic procedure that returns an initial RAM disk for the Linux
+A procedure that returns an initial RAM disk for the Linux
 kernel.  This field is provided to support low-level customization and
 should rarely be needed for casual use.  @xref{Initial RAM Disk}.
 
@@ -11832,7 +11893,7 @@ Data Type representing the configuration of connman.
 The connman package to use.
 
 @item @code{disable-vpn?} (default: @code{#f})
-When true, enable connman's vpn plugin.
+When true, disable connman's vpn plugin.
 @end table
 @end deftp
 
@@ -21914,10 +21975,10 @@ here is how to use it and customize it further.
 
 @cindex initrd
 @cindex initial RAM disk
-@deffn {Monadic Procedure} raw-initrd @var{file-systems} @
+@deffn {Scheme Procedure} raw-initrd @var{file-systems} @
        [#:linux-modules '()] [#:mapped-devices '()] @
        [#:helper-packages '()] [#:qemu-networking? #f] [#:volatile-root? #f]
-Return a monadic derivation that builds a raw initrd.  @var{file-systems} is
+Return a derivation that builds a raw initrd.  @var{file-systems} is
 a list of file systems to be mounted by the initrd, possibly in addition to
 the root file system specified on the kernel command line via @code{--root}.
 @var{linux-modules} is a list of kernel modules to be loaded at boot time.
@@ -21935,10 +21996,10 @@ When @var{volatile-root?} is true, the root file system is writable but any chan
 to it are lost.
 @end deffn
 
-@deffn {Monadic Procedure} base-initrd @var{file-systems} @
+@deffn {Scheme Procedure} base-initrd @var{file-systems} @
        [#:mapped-devices '()] [#:qemu-networking? #f] [#:volatile-root? #f]@
        [#:linux-modules '()]
-Return a monadic derivation that builds a generic initrd, with kernel
+Return as a file-like object a generic initrd, with kernel
 modules taken from @var{linux}.  @var{file-systems} is a list of file-systems to be
 mounted by the initrd, possibly in addition to the root file system specified
 on the kernel command line via @code{--root}.  @var{mapped-devices} is a list of device
@@ -21958,9 +22019,9 @@ program.  That gives a lot of flexibility.  The
 @code{expression->initrd} procedure builds such an initrd, given the
 program to run in that initrd.
 
-@deffn {Monadic Procedure} expression->initrd @var{exp} @
+@deffn {Scheme Procedure} expression->initrd @var{exp} @
        [#:guile %guile-static-stripped] [#:name "guile-initrd"]
-Return a derivation that builds a Linux initrd (a gzipped cpio archive)
+Return as a file-like object a Linux initrd (a gzipped cpio archive)
 containing @var{guile} and that evaluates @var{exp}, a G-expression,
 upon booting.  All the derivations referenced by @var{exp} are
 automatically copied to the initrd.
diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm
index 8b7a95a6fc..b48596c496 100644
--- a/gnu/bootloader/extlinux.scm
+++ b/gnu/bootloader/extlinux.scm
@@ -19,12 +19,8 @@
 
 (define-module (gnu bootloader extlinux)
   #:use-module (gnu bootloader)
-  #:use-module (gnu system)
-  #:use-module (gnu build bootloader)
   #:use-module (gnu packages bootloaders)
   #:use-module (guix gexp)
-  #:use-module (guix monads)
-  #:use-module (guix records)
   #:use-module (guix utils)
   #:export (extlinux-bootloader
             extlinux-bootloader-gpt))
@@ -78,7 +74,7 @@ TIMEOUT ~a~%"
                       (format port "~%"))
                    #~())))))
 
-  (gexp->derivation "extlinux.conf" builder))
+  (computed-file "extlinux.conf" builder))
 
 
 
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 06856dd58c..161e8b3d02 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -20,26 +20,18 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu bootloader grub)
-  #:use-module (guix store)
-  #:use-module (guix packages)
-  #:use-module (guix derivations)
   #:use-module (guix records)
-  #:use-module (guix monads)
+  #:use-module ((guix utils) #:select (%current-system))
   #:use-module (guix gexp)
-  #:use-module (guix download)
   #:use-module (gnu artwork)
-  #:use-module (gnu system)
   #:use-module (gnu bootloader)
   #:use-module (gnu system uuid)
   #:use-module (gnu system file-systems)
   #:autoload   (gnu packages bootloaders) (grub)
-  #:autoload   (gnu packages compression) (gzip)
   #:autoload   (gnu packages gtk) (guile-cairo guile-rsvg)
-  #:autoload   (gnu packages guile) (guile-2.2)
   #:use-module (ice-9 match)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1)
-  #:use-module (rnrs bytevectors)
   #:export (grub-image
             grub-image?
             grub-image-aspect-ratio
@@ -121,14 +113,14 @@ otherwise."
 
 (define* (svg->png svg #:key width height)
   "Build a PNG of HEIGHT x WIDTH from SVG."
-  (gexp->derivation "grub-image.png"
-                    (with-imported-modules '((gnu build svg))
-                      (with-extensions (list guile-rsvg guile-cairo)
-                        #~(begin
-                            (use-modules (gnu build svg))
-                            (svg->png #+svg #$output
-                                      #:width #$width
-                                      #:height #$height))))))
+  (computed-file "grub-image.png"
+                 (with-imported-modules '((gnu build svg))
+                   (with-extensions (list guile-rsvg guile-cairo)
+                     #~(begin
+                         (use-modules (gnu build svg))
+                         (svg->png #+svg #$output
+                                   #:width #$width
+                                   #:height #$height))))))
 
 (define* (grub-background-image config #:key (width 1024) (height 768))
   "Return the GRUB background image defined in CONFIG with a ratio of
@@ -138,15 +130,13 @@ WIDTH/HEIGHT, or #f if none was found."
                         (= (grub-image-aspect-ratio image) ratio))
                       (grub-theme-images
                        (bootloader-theme config)))))
-    (if image
-        (svg->png (grub-image-file image)
-                  #:width width #:height height)
-        (with-monad %store-monad
-          (return #f)))))
+    (and image
+         (svg->png (grub-image-file image)
+                   #:width width #:height height))))
 
 (define* (eye-candy config store-device store-mount-point
                     #:key system port)
-  "Return in %STORE-MONAD a gexp that writes to PORT (a port-valued gexp) the
+  "Return a gexp that writes to PORT (a port-valued gexp) the
 'grub.cfg' part concerned with graphics mode, background images, colors, and
 all that.  STORE-DEVICE designates the device holding the store, and
 STORE-MOUNT-POINT is its mount point; these are used to determine where the
@@ -194,9 +184,11 @@ fi~%" #$font-file)
     (strip-mount-point store-mount-point
                        (file-append grub "/share/grub/unicode.pf2")))
 
-  (mlet* %store-monad ((image (grub-background-image config)))
-    (return (and image
-                 #~(format #$port "
+  (define image
+    (grub-background-image config))
+
+  (and image
+       #~(format #$port "
 function setup_gfxterm {~a}
 
 # Set 'root' to the partition that contains /gnu/store.
@@ -213,14 +205,14 @@ else
   set menu_color_normal=cyan/blue
   set menu_color_highlight=white/blue
 fi~%"
-                           #$setup-gfxterm-body
-                           #$(grub-root-search store-device font-file)
-                           #$(setup-gfxterm config font-file)
-                           #$(grub-setup-io config)
+                 #$setup-gfxterm-body
+                 #$(grub-root-search store-device font-file)
+                 #$(setup-gfxterm config font-file)
+                 #$(grub-setup-io config)
 
-                           #$(strip-mount-point store-mount-point image)
-                           #$(theme-colors grub-theme-color-normal)
-                           #$(theme-colors grub-theme-color-highlight))))))
+                 #$(strip-mount-point store-mount-point image)
+                 #$(theme-colors grub-theme-color-normal)
+                 #$(theme-colors grub-theme-color-highlight))))
 
 
 ;;;
@@ -331,36 +323,36 @@ entries corresponding to old generations of the system."
                   #$(grub-root-search device kernel)
                   #$kernel (string-join (list #$@arguments))
                   #$initrd))))
-  (mlet %store-monad ((sugar (eye-candy config
-                                        (menu-entry-device
-                                         (first all-entries))
-                                        (menu-entry-device-mount-point
-                                         (first all-entries))
-                                        #:system system
-                                        #:port #~port)))
-    (define builder
-      #~(call-with-output-file #$output
-          (lambda (port)
-            (format port
-                    "# This file was generated from your GuixSD configuration.  Any changes
+  (define sugar
+    (eye-candy config
+               (menu-entry-device (first all-entries))
+               (menu-entry-device-mount-point (first all-entries))
+               #:system system
+               #:port #~port))
+
+  (define builder
+    #~(call-with-output-file #$output
+        (lambda (port)
+          (format port
+                  "# This file was generated from your GuixSD configuration.  Any changes
 # will be lost upon reconfiguration.
 ")
-            #$sugar
-            (format port "
+          #$sugar
+          (format port "
 set default=~a
 set timeout=~a~%"
-                    #$(bootloader-configuration-default-entry config)
-                    #$(bootloader-configuration-timeout config))
-            #$@(map menu-entry->gexp all-entries)
+                  #$(bootloader-configuration-default-entry config)
+                  #$(bootloader-configuration-timeout config))
+          #$@(map menu-entry->gexp all-entries)
 
-            #$@(if (pair? old-entries)
-                   #~((format port "
+          #$@(if (pair? old-entries)
+                 #~((format port "
 submenu \"GNU system, old configurations...\" {~%")
-                      #$@(map menu-entry->gexp old-entries)
-                      (format port "}~%"))
-                   #~()))))
+                    #$@(map menu-entry->gexp old-entries)
+                    (format port "}~%"))
+                 #~()))))
 
-    (gexp->derivation "grub.cfg" builder)))
+  (computed-file "grub.cfg" builder))
 
 
 
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 0157fde3da..b5fab14e14 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -20,13 +20,8 @@
 (define-module (gnu bootloader u-boot)
   #:use-module (gnu bootloader extlinux)
   #:use-module (gnu bootloader)
-  #:use-module (gnu system)
-  #:use-module (gnu build bootloader)
   #:use-module (gnu packages bootloaders)
   #:use-module (guix gexp)
-  #:use-module (guix monads)
-  #:use-module (guix records)
-  #:use-module (guix utils)
   #:export (u-boot-bootloader
             u-boot-a20-olinuxino-lime-bootloader
             u-boot-a20-olinuxino-lime2-bootloader
diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index 68ecd6bc71..0e77677de1 100644
--- a/gnu/build/activation.scm
+++ b/gnu/build/activation.scm
@@ -148,11 +148,15 @@ properties.  Return #t on success."
                           `("-G" ,(string-join supplementary-groups ","))
                           '())
                     ,@(if comment `("-c" ,comment) '())
-                    ,@(if (and home create-home?)
-                          (if (file-exists? home)
-                              `("-d" ,home)     ; avoid warning from 'useradd'
-                              `("-d" ,home "--create-home"))
+                    ,@(if home `("-d" ,home) '())
+
+                    ;; Home directories of non-system accounts are created by
+                    ;; 'activate-user-home'.
+                    ,@(if (and home create-home? system?
+                               (not (file-exists? home)))
+                          '("--create-home")
                           '())
+
                     ,@(if shell `("-s" ,shell) '())
                     ,@(if password `("-p" ,password) '())
                     ,@(if system? '("--system") '())
@@ -229,10 +233,7 @@ numeric gid or #f."
                      #:supplementary-groups supplementary-groups
                      #:comment comment
                      #:home home
-
-                     ;; Home directories of non-system accounts are created by
-                     ;; 'activate-user-home'.
-                     #:create-home? (and create-home? system?)
+                     #:create-home? create-home?
 
                      #:shell shell
                      #:password password)
diff --git a/gnu/local.mk b/gnu/local.mk
index 447f08d201..358222729a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -19,6 +19,7 @@
 # Copyright © 2018 Amirouche Boubekki <amirouche@hypermove.net>
 # Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
 # Copyright © 2018 Stefan Stefanović <stefanx2ovic@gmail.com>
+# Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 #
 # This file is part of GNU Guix.
 #
@@ -60,6 +61,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/android.scm			\
   %D%/packages/animation.scm			\
   %D%/packages/anthy.scm			\
+  %D%/packages/antivirus.scm			\
   %D%/packages/apl.scm				\
   %D%/packages/apr.scm				\
   %D%/packages/aspell.scm			\
@@ -614,6 +616,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/ceph-skip-unittest_blockdev.patch	\
   %D%/packages/patches/ceph-volume-respect-PATH.patch		\
   %D%/packages/patches/chmlib-inttypes.patch			\
+  %D%/packages/patches/clamav-config-llvm-libs.patch		\
+  %D%/packages/patches/clamav-system-tomsfastmath.patch		\
   %D%/packages/patches/clang-3.5-libc-search-path.patch		\
   %D%/packages/patches/clang-3.5-libsanitizer-ustat-fix.patch	\
   %D%/packages/patches/clang-3.8-libc-search-path.patch		\
@@ -664,6 +668,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/emacs-highlight-stages-add-gexp.patch	\
   %D%/packages/patches/emacs-scheme-complete-scheme-r5rs-info.patch	\
   %D%/packages/patches/emacs-source-date-epoch.patch		\
+  %D%/packages/patches/emacs-realgud-fix-configure-ac.patch	\
   %D%/packages/patches/enlightenment-fix-setuid-path.patch	\
   %D%/packages/patches/erlang-man-path.patch			\
   %D%/packages/patches/eudev-rules-directory.patch		\
@@ -1179,6 +1184,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/tk-find-library.patch			\
   %D%/packages/patches/ttf2eot-cstddef.patch			\
   %D%/packages/patches/ttfautohint-source-date-epoch.patch	\
+  %D%/packages/patches/tomsfastmath-constness.patch		\
   %D%/packages/patches/totem-meson-easy-codec.patch		\
   %D%/packages/patches/tuxpaint-stamps-path.patch		\
   %D%/packages/patches/twinkle-include-qregexpvalidator.patch	\
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index 45a3da1713..eea23bd621 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016, 2017, 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2014, 2018 Mark H Weaver <mhw@netris.org>
@@ -179,7 +179,7 @@ PARI is also available as a C library to allow for faster computations.")
 (define-public gp2c
   (package
    (name "gp2c")
-   (version "0.0.11")
+   (version "0.0.11pl1")
    (source (origin
             (method url-fetch)
             (uri (string-append
@@ -187,7 +187,7 @@ PARI is also available as a C library to allow for faster computations.")
                   version ".tar.gz"))
             (sha256
               (base32
-                "1z69xj2dpd8yyi8108rz26c50xpv0k2j8qnk0bzy1c5lw3pd1adm"))))
+                "1c6f6vmncw032kfzrfyr8bynw6yd3faxpy2285r009fmr0zxfs5s"))))
    (build-system gnu-build-system)
    (native-inputs `(("perl" ,perl)))
    (inputs `(("pari-gp" ,pari-gp)))
@@ -210,6 +210,36 @@ GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
    (license license:gpl2)
    (home-page "https://pari.math.u-bordeaux.fr/")))
 
+(define-public cmh
+  (package
+   (name "cmh")
+   (version "1.0")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append
+                  "https://gforge.inria.fr/frs/download.php/33497/cmh-"
+                  version ".tar.gz"))
+            (sha256
+             (base32
+              "1a28xr9bs0igms0ik99x0w8lnb0jyfcmvyi26pbyh9ggcdivd33p"))))
+   (build-system gnu-build-system)
+   (inputs
+     `(("gmp" ,gmp)
+       ("mpfr" ,mpfr)
+       ("mpc" ,mpc)
+       ("mpfrcx" ,mpfrcx)
+       ("fplll" ,fplll)
+       ("pari-gp"  ,pari-gp)))
+   (synopsis "Igusa class polynomial computations")
+   (description
+    "The CMH software computes Igusa (genus 2) class polynomials, which
+parameterize the CM points in the moduli space of 2-dimensional abelian
+varieties, i.e. Jacobians of hyperelliptic curves.
+It can also be used to compute theta constants at arbitrary
+precision.")
+   (license license:gpl3+)
+   (home-page "http://cmh.gforge.inria.fr/")))
+
 (define-public giac-xcas
   (package
     (name "giac-xcas")
diff --git a/gnu/packages/antivirus.scm b/gnu/packages/antivirus.scm
new file mode 100644
index 0000000000..95749761bd
--- /dev/null
+++ b/gnu/packages/antivirus.scm
@@ -0,0 +1,156 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016, 2017, 2018 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2018 Christopher Baines <mail@cbaines.net>
+;;;
+;;; 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 antivirus)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix utils)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages bison)
+  #:use-module (gnu packages check)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages curl)
+  #:use-module (gnu packages cyrus-sasl)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages pcre)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages tls)
+  #:use-module (gnu packages web)
+  #:use-module (gnu packages xml))
+
+(define-public clamav
+  (package
+    (name "clamav")
+    (version "0.100.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://www.clamav.net/downloads/production/"
+                                  "clamav-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1mkd41sxbjkfjinpx5b9kb85q529gj2s3d0klysssqhysh64ybja"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (for-each delete-file-recursively
+                            '("win32"              ;unnecessary
+                              "libclamav/c++/llvm" ;use system llvm
+                              "libclamunrar"))))   ;non-free license
+              (patches
+               (search-patches "clamav-system-tomsfastmath.patch"
+                               "clamav-config-llvm-libs.patch"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("bison" ,bison)
+       ("check" ,check)                 ;for tests
+       ("flex" ,flex)
+       ("pkg-config" ,pkg-config)
+       ;; The tomsfastmath patch touches configure.ac and Makefile.am
+       ("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)))
+    (inputs
+     `(("bzip2" ,bzip2)
+       ("libcurl" ,curl)
+       ("libjson" ,json-c)
+       ("libltdl" ,libltdl)
+       ("libmspack" ,libmspack)
+       ("llvm" ,llvm-3.6)               ;requires <3.7, for JIT/verifier
+       ("ncurses" ,ncurses)
+       ("openssl" ,libressl)
+       ("pcre" ,pcre "bin")             ;for pcre-config
+       ("sasl" ,cyrus-sasl)             ;for linking curl with libtool
+       ("tomsfastmath" ,tomsfastmath)
+       ("xml" ,libxml2)
+       ("zlib" ,zlib)))
+    (arguments
+     `(#:configure-flags
+       (let-syntax ((with (syntax-rules ()
+                            ((_ name)
+                             (string-append "--with-" name "="
+                                            (assoc-ref %build-inputs name))))))
+         (list "--disable-unrar"
+               "--enable-llvm"
+               "--with-system-llvm"
+               "--with-system-libmspack"
+               "--without-included-ltdl"
+               (with "xml")
+               (with "openssl")
+               (with "libjson")
+               (with "pcre")
+               (with "zlib")
+               (with "libcurl")
+               ;; For sanity, specifying --enable-* flags turns
+               ;; "support unavailable" warnings into errors.
+               "--enable-bzip2"
+               "--enable-check"
+               "--sysconfdir=/etc/clamav"
+               ;; Default database directory needs to be writeable
+               "--with-dbdir=/var/db/clamav"))
+       ;; install sample .conf files to %output/etc rather than /etc/clamav
+       #:make-flags (list (string-append "sysconfdir=" %output "/etc"))
+       #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'reconf
+                    (lambda _ (zero? (system* "autoreconf" "-vfi"))))
+                  (add-before 'configure 'patch-llvm-config
+                    (lambda _
+                      (substitute* '("libclamav/c++/detect.cpp"
+                                     "libclamav/c++/ClamBCRTChecks.cpp"
+                                     "libclamav/c++/bytecode2llvm.cpp")
+                        (("llvm/Config/config.h") "llvm/Config/llvm-config.h"))
+                      ;; `llvm-config --libfiles` inappropriately lists lib*.a
+                      ;; libraries, rather than the lib*.so's that our llvm
+                      ;; contains.  They're used only for listing extra build
+                      ;; dependencies, so ignore them until that's fixed.
+                      (substitute* "libclamav/c++/Makefile.in"
+                        (("@LLVMCONFIG_LIBFILES@") ""))
+                      #t))
+                  (add-before 'check 'skip-clamd-tests
+                    ;; XXX: The check?_clamd tests fail inside the build
+                    ;; chroot, but pass outside.
+                    (lambda _
+                      (substitute* "unit_tests/Makefile"
+                        (("check2_clamd.sh.*check4_clamd.sh") ""))
+                      #t)))))
+    (home-page "https://www.clamav.net")
+    (synopsis "Antivirus engine")
+    (description
+     "Clam AntiVirus is an anti-virus toolkit, designed especially for e-mail
+scanning on mail gateways.  It provides a number of utilities including a
+flexible and scalable multi-threaded daemon, a command line scanner, and
+advanced tool for automatic database updates.  The core of the package is an
+anti-virus engine available in the form of a shared library.")
+    (license (list license:gpl2+        ;ClamAV itself
+                   license:lgpl2.1      ;libclamav/mspack.[ch]
+                   license:public-domain ;libclamav/7z/*, libclamav/rijndael.[ch], etc...
+                   (package-license bzip2) ;modified bzip2 source in libclamav/nsis
+                   license:bsd-2        ;several files in libclamav
+                   license:bsd-3        ;libclamav/{regex,qsort.c,swf.[ch]
+                   license:ncsa         ;libclamav/c++/PointerTracking.cpp
+                   license:zlib         ;libclamav/inf*.h
+                   license:x11          ;libclamav/lzw
+                   (license:non-copyleft "libclamav/strlcat.c") ;"OpenBSD" license
+                   license:asl2.0       ;libclamav/yara*
+                   license:expat))))    ;shared/getopt.[ch]
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 2e1b0467c3..7883834d18 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2018 Brett Gilio <brettg@posteo.net>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018 Thorsten Wilms <t_w_@freenet.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -427,6 +428,46 @@ and editing digital audio.  It features digital effects and spectrum analysis
 tools.")
     (license license:gpl2+)))
 
+(define-public autotalent
+  (package
+    (name "autotalent")
+    (version "0.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://tombaran.info/autotalent-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1n04qm66f14195ly6gsy3ra7v2j7zad5n19d8dwfmh0qs6h9hphh"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; no check target
+       #:phases
+       (modify-phases %standard-phases
+         ;; no configure script
+         (delete 'configure)
+         (add-before 'install 'prepare-target-directory
+           (lambda* (#:key outputs #:allow-other-keys)
+             (mkdir-p (string-append (assoc-ref outputs "out") "/lib/ladspa"))
+             #t))
+         (add-after 'unpack 'override-target-directory
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* "Makefile"
+               (("/usr/lib64/ladspa")
+                (string-append (assoc-ref outputs "out") "/lib/ladspa")))
+             #t)))))
+    (inputs
+     `(("ladspa" ,ladspa)))
+    (home-page "http://tombaran.info/autotalent.html")
+    (synopsis "Pitch-correction LADSPA audio plugin")
+    (description
+     "Autotalent is a LADSPA plugin for real-time pitch-correction.  Among its
+controls are allowable notes, strength of correction, LFO for vibrato and
+formant warp.")
+    ;; All code except the FFT routine is licensed under GPLv2+.
+    ;; The FFT routine is under BSD-3.
+    (license (list license:gpl2+))))
+
 (define-public azr3
   (package
     (name "azr3")
@@ -514,6 +555,47 @@ tools (analyzer, mono/stereo tools, crossovers).")
     ;; The plugins are released under LGPLv2.1+
     (license (list license:lgpl2.1+ license:gpl2+))))
 
+(define-public caps-plugins-lv2
+  (package
+    (name "caps-plugins-lv2")
+    (version "0.9.24") ; version that has been ported.
+    (source
+     (origin
+       ;; The Github project hasn't tagged a release.
+       (method git-fetch)
+       (uri (git-reference
+             ;; Actually https://github.com/moddevices/caps-lv2.git, but it's
+             ;; missing fixes for newer glibc, so using the origin of a pull
+             ;; request regarding this issue:
+             (url "https://github.com/jujudusud/caps-lv2.git")
+             (commit "9c9478b7fbd8f9714f552ebe2a6866398b0babfb")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1idfnazin3cca41zw1a8vwgnxjnkrap7bxxjamjqvgpmvydgcam1"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; no check target
+       #:phases
+       (modify-phases %standard-phases
+         ;; no configure script
+         (delete 'configure)
+         (add-after 'unpack 'override-target-directory
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* (find-files "plugins" "Makefile")
+               (("/usr/local")(assoc-ref outputs "out")))
+             #t)))))
+    (inputs
+     `(("lv2" ,lv2)))
+    ;; home-page of the original LADSPA version: http://quitte.de/dsp/caps.html
+    (home-page "https://github.com/moddevices/caps-lv2")
+    (synopsis "LV2 port of the CAPS audio plugin colection")
+    (description
+     "LV2 port of CAPS, a collection of audio plugins comprising basic virtual
+guitar amplification and a small range of classic effects, signal processors and
+generators of mostly elementary and occasionally exotic nature.")
+    (license license:gpl3+)))
+
 (define-public espeak
   (package
     (name "espeak")
@@ -1045,7 +1127,7 @@ follower.")
 (define-public fluidsynth
   (package
     (name "fluidsynth")
-    (version "2.0.1")
+    (version "2.0.2")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -1054,7 +1136,7 @@ follower.")
               (file-name (string-append name "-" version "-checkout"))
               (sha256
                (base32
-                "1mqyym5qkh8xd1rqj3yhfxbw5dxjcrljb6nkfqzvcarlv4h6rjn7"))))
+                "02vs5sfsyh1dl7wlcvgs4w3x0qcmsl7vi000qgp99ynwh3wjb274"))))
     (build-system cmake-build-system)
     (arguments
      '(#:tests? #f                      ; no check target
@@ -1193,7 +1275,7 @@ PS, and DAB+.")
         `(list (string-append "prefix=" (assoc-ref %outputs "out"))
                "world"))))
     (native-inputs
-     `(("llvm" ,llvm-3.8-with-rtti)
+     `(("llvm" ,llvm-3.8)
        ("which" ,which)
        ("xxd" ,xxd)
        ("ctags" ,emacs-minimal)  ; for ctags
@@ -3522,3 +3604,37 @@ using ALSA, MPD, PulseAudio, or a FIFO buffer as its input.")
       (synopsis "Pro-quality GM soundfont")
       (description "Fluid-3 is Frank Wen's pro-quality GM soundfont.")
       (license license:expat))))
+
+(define-public libfdk
+  (let ((commit "2326faaf8f2cdf2c3a9108ccdaf1d7551aec543e")
+        (revision "0"))
+    (package
+      (name "libfdk")
+      ;; The latest upstream revision, with many bug fixes.
+      (version (git-version "0.1.6" revision commit))
+      (source
+        (origin
+          (method git-fetch)
+          (uri (git-reference
+                 (url "https://github.com/mstorsjo/fdk-aac")
+                 (commit commit)))
+          (file-name (git-file-name name version))
+          (sha256
+           (base32
+            "0yy6ndd9d61bwl283vl1r5kva2a4acc0f4r9g0sza156f2abr9ws"))))
+      (build-system gnu-build-system)
+      (native-inputs
+       `(("autoconf" ,autoconf)
+         ("automake" ,automake)
+         ("libtool" ,libtool)))
+      (home-page "https://github.com/mstorsjo/fdk-aac")
+      (synopsis "Fraunhofer FDK AAC library")
+      (description "FDK is a library for encoding and decoding Advanced Audio
+Coding (AAC) format audio, developed by Fraunhofer IIS, and included as part of
+Android.  It supports several Audio Object Types including MPEG-2 and MPEG-4 AAC
+LC, HE-AAC (AAC LC + SBR), HE-AACv2 (LC + SBR + PS) as well AAC-LD (low delay)
+and AAC-ELD (enhanced low delay) for real-time communication.  The encoding
+library supports sample rates up to 96 kHz and up to eight channels (7.1
+surround).")
+      (license (license:fsf-free "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE"
+                                 "https://www.gnu.org/licenses/license-list.html#fdk")))))
diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 28b6cd318b..b913d5647d 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -7380,13 +7380,13 @@ ID and species.  It is used by functions in the GenomeInfoDb package.")
 (define-public r-genomeinfodb
   (package
     (name "r-genomeinfodb")
-    (version "1.18.0")
+    (version "1.18.1")
     (source (origin
               (method url-fetch)
               (uri (bioconductor-uri "GenomeInfoDb" version))
               (sha256
                (base32
-                "1xqpgngd8by0yn627v9kz26a03v5a1lhcfwlnx2i0ivplk9bd40s"))))
+                "049pyzr8iszv3g7wdqf3pz7vg7bzd450c20ln6fgw4g5xnkkr10s"))))
     (properties
      `((upstream-name . "GenomeInfoDb")))
     (build-system r-build-system)
@@ -9748,14 +9748,14 @@ structure (pcaRes) to provide a common interface to the PCA results.")
 (define-public r-msnbase
   (package
     (name "r-msnbase")
-    (version "2.8.0")
+    (version "2.8.1")
     (source
      (origin
        (method url-fetch)
        (uri (bioconductor-uri "MSnbase" version))
        (sha256
         (base32
-         "0nnlydpklmv9kwlk3gkjgabx7l6y4gav3imq98w8wskb1fhm50c0"))))
+         "0y658anh06vnvbkfs7r8q40gqgyqr2r8kj7jlpnp33fy1lvp1nv7"))))
     (properties `((upstream-name . "MSnbase")))
     (build-system r-build-system)
     (propagated-inputs
@@ -10223,14 +10223,14 @@ originally made available by Holmes, Harris, and Quince, 2012, PLoS ONE 7(2):
 (define-public r-ensembldb
   (package
     (name "r-ensembldb")
-    (version "2.6.1")
+    (version "2.6.2")
     (source
      (origin
        (method url-fetch)
        (uri (bioconductor-uri "ensembldb" version))
        (sha256
         (base32
-         "1js05dcv1dj4g2vj7lzlg0rgjcjlk2irdr9rxqpwxmivm8nbvf36"))))
+         "0hdz1f34v7sas2v4225icwl3wd4sf17ykpd5dkbx1hc7wcy4w3np"))))
     (build-system r-build-system)
     (propagated-inputs
      `(("r-annotationdbi" ,r-annotationdbi)
@@ -11166,7 +11166,7 @@ droplet sequencing.  It has been particularly tailored for Drop-seq.")
 (define-public sambamba
   (package
     (name "sambamba")
-    (version "0.6.7-10-g223fa20")
+    (version "0.6.8")
     (source
      (origin
        (method git-fetch)
@@ -11176,7 +11176,7 @@ droplet sequencing.  It has been particularly tailored for Drop-seq.")
        (file-name (string-append name "-" version "-checkout"))
        (sha256
         (base32
-         "1zb9hrxglxqh13ava9wwri30cvf85hjnbn8ccnr8l60a3k5avczn"))))
+         "0k0cz3qcv98p6cq09zlbgnjsggxcqbcmzxg5zikgcgbr2nfq4lry"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f                      ; there is no test target
@@ -11187,9 +11187,10 @@ droplet sequencing.  It has been particularly tailored for Drop-seq.")
          (add-after 'unpack 'fix-ldc-version
            (lambda _
              (substitute* "gen_ldc_version_info.py"
-               (("/usr/bin/env.*") (which "python")))
+               (("/usr/bin/env.*") (which "python3")))
              (substitute* "Makefile"
-               (("\\$\\(shell which ldmd2\\)") (which "ldmd2")))
+               ;; We use ldc2 instead of ldmd2 to compile sambamba.
+               (("\\$\\(shell which ldmd2\\)") (which "ldc2")))
              #t))
          (add-after 'unpack 'place-biod-and-undead
            (lambda* (#:key inputs #:allow-other-keys)
@@ -11201,21 +11202,21 @@ droplet sequencing.  It has been particularly tailored for Drop-seq.")
              (substitute* "Makefile"
                (("htslib/libhts.a lz4/lib/liblz4.a")
                 "-L-lhts -L-llz4")
-               ((" htslib-static lz4-static") ""))
+               ((" lz4-static htslib-static") ""))
              #t))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out   (assoc-ref outputs "out"))
                     (bin   (string-append out "/bin")))
                (mkdir-p bin)
-               (install-file "build/sambamba" bin)
+               (install-file "bin/sambamba" bin)
                #t))))))
     (native-inputs
      `(("ldc" ,ldc)
        ("rdmd" ,rdmd)
-       ("python" ,python2-minimal)
+       ("python" ,python-minimal)
        ("biod"
-        ,(let ((commit "c778e4f2d8bacea7499283ce39f5577b232732c6"))
+        ,(let ((commit "4f1a7d2fb7ef3dfe962aa357d672f354ebfbe42e"))
            (origin
              (method git-fetch)
              (uri (git-reference
@@ -11226,20 +11227,20 @@ droplet sequencing.  It has been particularly tailored for Drop-seq.")
                                        "-checkout"))
              (sha256
               (base32
-               "1z90562hg47i63gx042wb3ak2vqjg5z7hwgn9bp2pdxfg3nxrw37")))))
+               "1k5pdjv1qvi0a3rwd1sfq6zbj37l86i7bf710m4c0y6737lxj426")))))
        ("undead"
-        ,(let ((commit "92803d25c88657e945511f0976a0c79d8da46e89"))
+        ,(let ((commit "9be93876982b5f14fcca60832563b3cd767dd84d"))
            (origin
              (method git-fetch)
              (uri (git-reference
-                   (url "https://github.com/dlang/undeaD.git")
+                   (url "https://github.com/biod/undeaD.git")
                    (commit commit)))
              (file-name (string-append "undead-"
                                        (string-take commit 9)
                                        "-checkout"))
              (sha256
               (base32
-               "0vq6n81vzqvgphjw54lz2isc1j8lcxwjdbrhqz1h5gwrvw9w5138")))))))
+               "1xfarj0nqlmi5jd1vmcmm7pabzaf9hxyvk6hp0d6jslb5k9r8r3d")))))))
     (inputs
      `(("lz4" ,lz4)
        ("htslib" ,htslib-for-sambamba)))
@@ -14376,3 +14377,77 @@ both read length (longer is better) and read identity (higher is better) when
 choosing which reads pass the filter.")
       (license (list license:gpl3       ;filtlong
                      license:asl2.0))))) ;histogram.py
+
+(define-public nanopolish
+  ;; The recommended way to install is to clone the git repository
+  ;; <https://github.com/jts/nanopolish#installing-a-particular-release>.
+  ;; Also, the differences between release and current version seem to be
+  ;; significant.
+  (let ((commit "50e8b5cc62f9b46f5445f5c5e8c5ab7263ea6d9d")
+        (revision "1"))
+    (package
+      (name "nanopolish")
+      (version (git-version "0.10.2" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/jts/nanopolish.git")
+               (commit commit)
+               (recursive? #t)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "09j5gz57yr9i34a27vbl72i4g8syv2zzgmsfyjq02yshmnrvkjs6"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:make-flags
+         `("HDF5=noinstall" "EIGEN=noinstall" "HTS=noinstall" "CC=gcc")
+         #:tests? #f                    ; no check target
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'find-eigen
+             (lambda* (#:key inputs #:allow-other-keys)
+               (setenv "CPATH"
+                       (string-append (assoc-ref inputs "eigen")
+                                      "/include/eigen3"))
+               #t))
+           (delete 'configure)
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (bin (string-append out "/bin"))
+                      (scripts (string-append out "/share/nanopolish/scripts")))
+
+                 (install-file "nanopolish" bin)
+                 (for-each (lambda (file) (install-file file scripts))
+                           (find-files "scripts" ".*"))
+                 #t)))
+           (add-after 'install 'wrap-programs
+             (lambda* (#:key outputs #:allow-other-keys)
+               (for-each (lambda (file)
+                           (wrap-program file `("PYTHONPATH" ":" prefix (,path))))
+                         (find-files "/share/nanopolish/scripts" "\\.py"))
+               (for-each (lambda (file)
+                           (wrap-program file `("PERL5LIB" ":" prefix (,path))))
+                         (find-files  "/share/nanopolish/scripts" "\\.pl"))
+               #t)))))
+      (inputs
+       `(("eigen" ,eigen)
+         ("hdf5" ,hdf5)
+         ("htslib" ,htslib)
+         ("perl" ,perl)
+         ("python" ,python)
+         ("python-biopython" ,python-biopython)
+         ("python-numpy" ,python-numpy)
+         ("python-pysam" ,python-pysam)
+         ("python-scikit-learn" , python-scikit-learn)
+         ("python-scipy" ,python-scipy)
+         ("zlib" ,zlib)))
+      (home-page "https://github.com/jts/nanopolish")
+      (synopsis "Signal-level analysis of Oxford Nanopore sequencing data")
+      (description
+       "This package analyses the Oxford Nanopore sequencing data at signal-level.
+Nanopolish can calculate an improved consensus sequence for a draft genome
+assembly, detect base modifications, call SNPs (Single nucleotide
+polymorphisms) and indels with respect to a reference genome and more.")
+      (license license:expat))))
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 8038c18326..d6e38bb0b8 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -34,6 +34,7 @@
   #:use-module (gnu packages bison)
   #:use-module (gnu packages cdrom)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages disk)
   #:use-module (gnu packages firmware)
@@ -361,7 +362,7 @@ tree binary files.  These are board description files used by Linux and BSD.")
 (define u-boot
   (package
     (name "u-boot")
-    (version "2018.09")
+    (version "2018.11")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -369,12 +370,13 @@ tree binary files.  These are board description files used by Linux and BSD.")
                     "u-boot-" version ".tar.bz2"))
               (sha256
                (base32
-                "0s122kyz1svvs2yjzj4j9qravl3ra4vn0fjqgski7rlczqyg56w3"))))
+                "0znkwljfwwn4y7j20pzz4ilqw8znphrfxns0x1lwdzh3xbr96z3k"))))
     (native-inputs
      `(("bc" ,bc)
        ("bison" ,bison)
        ("dtc" ,dtc)
        ("flex" ,flex)
+       ("lz4" ,lz4)
        ("openssl" ,openssl)
        ("python-2" ,python-2)
        ("python2-coverage" ,python2-coverage)
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index 6ce9bdd16f..f08a204fb8 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -1593,14 +1593,14 @@ the Kaplan-Meier and Aalen-Johansen methods.")
 (define-public r-dimred
   (package
     (name "r-dimred")
-    (version "0.1.0")
+    (version "0.2.2")
     (source
      (origin
        (method url-fetch)
        (uri (cran-uri "dimRed" version))
        (sha256
         (base32
-         "0fasca5fsbrxdwv30hch7vb9snb844l7l8p5fjf239dq45xfy37v"))))
+         "0ssy2qriiy6zdawriqcbl67qiq68ipml3frq7aqlq70r2fqyyw48"))))
     (properties `((upstream-name . "dimRed")))
     (build-system r-build-system)
     (propagated-inputs `(("r-drr" ,r-drr)))
@@ -1864,14 +1864,14 @@ provides a one-row summary of model-level statistics.")
 (define-public r-recipes
   (package
     (name "r-recipes")
-    (version "0.1.3")
+    (version "0.1.4")
     (source
      (origin
        (method url-fetch)
        (uri (cran-uri "recipes" version))
        (sha256
         (base32
-         "1vqh3pxs4n1azhnd1lzg91vasya6g323kllhbrw177j7kdxqyimy"))))
+         "0bwijw4427v2k5z3qci2kyr5dyzql8b3lvf88rwy16p741jckjsn"))))
     (build-system r-build-system)
     (propagated-inputs
      `(("r-broom" ,r-broom)
@@ -4450,14 +4450,14 @@ and adds the annotation to the plot.")
 (define-public r-ggpubr
   (package
     (name "r-ggpubr")
-    (version "0.1.9")
+    (version "0.2")
     (source
      (origin
        (method url-fetch)
        (uri (cran-uri "ggpubr" version))
        (sha256
         (base32
-         "0rvfgii2gxarra7d33n6c63ky0mivxxyx35acsrn94xkbd8mbcsj"))))
+         "0rkpcjb1x7lvhj68aam5airbi534jqyiq12x5xk40a25iifhghq6"))))
     (build-system r-build-system)
     (propagated-inputs
      `(("r-cowplot" ,r-cowplot)
@@ -6725,14 +6725,14 @@ detection, parallelism through BLAS and parallel user templates.")
 (define-public r-sjstats
   (package
     (name "r-sjstats")
-    (version "0.17.1")
+    (version "0.17.2")
     (source
      (origin
        (method url-fetch)
        (uri (cran-uri "sjstats" version))
        (sha256
         (base32
-         "0s9b0xr8gmcm0kh48jkwk8ns0lqknd8kpys4f7czf0xwzmcx2n1z"))))
+         "0c7g35vn7r9rylhp0gj1yfslg7jybwrhpqpp7vdcd90xfccih24r"))))
     (build-system r-build-system)
     (propagated-inputs
      `(("r-bayesplot" ,r-bayesplot)
@@ -6803,14 +6803,14 @@ differentiation.")
 (define-public r-ggeffects
   (package
     (name "r-ggeffects")
-    (version "0.6.0")
+    (version "0.7.0")
     (source
      (origin
        (method url-fetch)
        (uri (cran-uri "ggeffects" version))
        (sha256
         (base32
-         "00l02g7yssqxmcmbrzk2wsj3i9ywd0xsy0rmbfh57q1qi76a1wq1"))))
+         "070c3fxmzajq2fy816s5pfqdyjlnzkabj97z7fcsva4h5rnqi9d6"))))
     (build-system r-build-system)
     (propagated-inputs
      `(("r-crayon" ,r-crayon)
@@ -7499,14 +7499,14 @@ netCDF files.")
 (define-public r-biocmanager
   (package
     (name "r-biocmanager")
-    (version "1.30.3")
+    (version "1.30.4")
     (source
      (origin
        (method url-fetch)
        (uri (cran-uri "BiocManager" version))
        (sha256
         (base32
-         "0mfvx1xzsgiag9p42kdyqg8fvajyakrdy3z2smhdlaawzbi0qmax"))))
+         "0kxs76pixk1d2lpvkyrq6nnvv1rqf55ph5f7igkadyyqirf3y2ah"))))
     (properties `((upstream-name . "BiocManager")))
     (build-system r-build-system)
     (home-page "https://cran.r-project.org/web/packages/BiocManager/")
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 3e32998a9f..ce1add3915 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -3659,7 +3659,11 @@ after buffer changes.")
                            version ".tar"))
        (sha256
         (base32
-         "108wgxg7fb4byaiasgvbxv2hq7b00biq9f0mh9hy6vw4160y5w24"))))
+         "108wgxg7fb4byaiasgvbxv2hq7b00biq9f0mh9hy6vw4160y5w24"))
+       (patches
+        ;; Patch awaiting inclusion upstream (see:
+        ;; https://github.com/realgud/realgud/pull/226).
+        (search-patches "emacs-realgud-fix-configure-ac.patch"))))
     (build-system emacs-build-system)
     (arguments
      `(#:tests? #t
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 1f73025db7..34a015bdf7 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -397,7 +397,7 @@ support.")
 (define-public tiled
   (package
     (name "tiled")
-    (version "1.2.0")
+    (version "1.2.1")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -406,7 +406,7 @@ support.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1rra48hlkcgqxwxi802fb182p1q0723c9hhfvkd5inz9467idd4c"))))
+                "1dl06k2p0r7l20ghxcq5sn7j0jl2l8q4m27vmfs2qfgvldjll2h3"))))
     (build-system gnu-build-system)
     (inputs
      `(("qtbase" ,qtbase)
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 3679aa09c6..bc5d3d581b 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -5606,8 +5606,8 @@ quotation from a collection of quotes.")
            (lambda* (#:key outputs inputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (data (assoc-ref inputs "xonotic-data")))
-               (copy-recursively (string-append data "/share/xonotic")
-                                 (string-append out "/share/xonotic"))
+               (symlink (string-append data "/share/xonotic")
+                        (string-append out "/share/xonotic"))
                #t)))
          (add-after 'install-binaries 'wrap-binaries
            (lambda* (#:key outputs inputs #:allow-other-keys)
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 03c8b497b8..851a31447b 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -259,7 +259,8 @@ also known as DXTn or DXTC) for Mesa.")
         ("libxvmc" ,libxvmc)
         ,@(match (%current-system)
             ((or "x86_64-linux" "i686-linux")
-             `(("llvm" ,llvm)))
+             ;; FIXME: Change to 'llvm' in the next rebuild cycle.
+             `(("llvm" ,llvm-without-rtti)))
             (_
              `()))
         ("makedepend" ,makedepend)
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index f3eb2dcd36..022ac5ee24 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -2286,8 +2286,8 @@ Guile.")
 
 ;; There has not been any release yet.
 (define-public guile-newt
-  (let ((commit "4eaa3cf84b9b426cc0ff7bec48b76cca6ca3ec83")
-        (revision "1"))
+  (let ((commit "a73889c57b0572347f7641facdb1bcf08922feff")
+        (revision "2"))
     (package
       (name "guile-newt")
       (version (string-append "0-" revision "." (string-take commit 9)))
@@ -2299,7 +2299,7 @@ Guile.")
                 (file-name (string-append name "-" version "-checkout"))
                 (sha256
                  (base32
-                  "0ww7jbdsmjlsxm60ym6cb5s5kc4ljz8bn4y2lvcqnap0aihqfk10"))))
+                  "0k37vir22r2sq121lyy74grfai4643s7kr55z01k4j0bh27i06c3"))))
       (build-system gnu-build-system)
       (arguments
        '(#:make-flags
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 11e1b1539b..5503e5dd19 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -900,7 +900,7 @@ language bindings to VIGRA.")
 (define-public libwebp
   (package
     (name "libwebp")
-    (version "1.0.0")
+    (version "1.0.1")
     (source
      (origin
        ;; No tarballs are provided for >0.6.1.
@@ -911,7 +911,7 @@ language bindings to VIGRA.")
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "1w8jzdbr1s4238ygyrlxryycss3f2z6d9amxdq8m82nl3l6skar4"))))
+         "09l4pq4k2acglkmwr96arn79rssl54sv7vrdrgsxqlg7v8c882zh"))))
     (build-system gnu-build-system)
     (inputs
      `(("freeglut" ,freeglut)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 51baade8fd..97d36c72d3 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1988,151 +1988,6 @@ new Date();"))
      `(("java-junit" ,java-junit)
        ,@(package-inputs ant/java8)))))
 
-(define-public clojure
-  (let* ((remove-archives '(begin
-                             (for-each delete-file
-                                       (find-files "." ".*\\.(jar|zip)"))
-                             #t))
-         (submodule (lambda (prefix version hash)
-                      (origin
-                        (method url-fetch)
-                        (uri (string-append "https://github.com/clojure/"
-                                            prefix version ".tar.gz"))
-                        (sha256 (base32 hash))
-                        (modules '((guix build utils)))
-                        (snippet remove-archives)))))
-    (package
-      (name "clojure")
-      (version "1.9.0")
-      (source
-       (origin
-         (method url-fetch)
-         (uri
-          (string-append "https://github.com/clojure/clojure/archive/clojure-"
-                         version ".tar.gz"))
-         (sha256
-          (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"))
-         (modules '((guix build utils)))
-         (snippet remove-archives)))
-      (build-system ant-build-system)
-      (arguments
-       `(#:modules ((guix build ant-build-system)
-                    (guix build utils)
-                    (ice-9 ftw)
-                    (ice-9 regex)
-                    (srfi srfi-1)
-                    (srfi srfi-26))
-         #:test-target "test"
-         #:phases
-         (modify-phases %standard-phases
-           (add-after 'unpack 'unpack-submodule-sources
-             (lambda* (#:key inputs #:allow-other-keys)
-               (for-each
-                (lambda (name)
-                  (mkdir-p name)
-                  (with-directory-excursion name
-                    (invoke "tar"
-                            ;; Use xz for repacked tarball.
-                            "--xz"
-                            "--extract"
-                            "--verbose"
-                            "--file" (assoc-ref inputs name)
-                            "--strip-components=1"))
-                  (copy-recursively (string-append name "/src/main/clojure/")
-                                    "src/clj/"))
-                '("core-specs-alpha-src"
-                  "data-generators-src"
-                  "spec-alpha-src"
-                  "test-check-src"
-                  "test-generative-src"
-                  "tools-namespace-src"))
-               #t))
-           (add-after 'unpack 'fix-manifest-classpath
-             (lambda _
-               (substitute* "build.xml"
-                 (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
-               #t))
-           ;; The javadoc target is not built by default.
-           (add-after 'build 'build-doc
-             (lambda _
-               (invoke "ant" "javadoc")))
-           ;; Needed since no install target is provided.
-           (replace 'install
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((java-dir (string-append (assoc-ref outputs "out")
-                                              "/share/java/")))
-                 ;; Install versioned to avoid collisions.
-                 (install-file (string-append "clojure-" ,version ".jar")
-                               java-dir)
-                 #t)))
-           ;; Needed since no install-doc target is provided.
-           (add-after 'install 'install-doc
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((doc-dir (string-append (assoc-ref outputs "out")
-                                             "/share/doc/clojure-"
-                                             ,version "/")))
-                 (copy-recursively "doc/clojure" doc-dir)
-                 (copy-recursively "target/javadoc/"
-                                   (string-append doc-dir "javadoc/"))
-                 (for-each (cut install-file <> doc-dir)
-                           (filter (cut string-match
-                                     ".*\\.(html|markdown|md|txt)"
-                                     <>)
-                                   (scandir "./")))
-                 #t))))))
-      ;; The native-inputs below are needed to run the tests.
-      (native-inputs
-       `(("core-specs-alpha-src"
-          ,(submodule "core.specs.alpha/archive/core.specs.alpha-"
-                      "0.1.24"
-                      "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
-         ("data-generators-src"
-          ,(submodule "data.generators/archive/data.generators-"
-                      "0.1.2"
-                      "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
-         ("spec-alpha-src"
-          ,(submodule "spec.alpha/archive/spec.alpha-"
-                      "0.1.143"
-                      "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
-         ("test-check-src"
-          ,(submodule "test.check/archive/test.check-"
-                      "0.9.0"
-                      "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
-         ("test-generative-src"
-          ,(submodule "test.generative/archive/test.generative-"
-                      "0.5.2"
-                      "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
-         ("tools-namespace-src"
-          ,(submodule "tools.namespace/archive/tools.namespace-"
-                      "0.2.11"
-                      "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
-      (home-page "https://clojure.org/")
-      (synopsis "Lisp dialect running on the JVM")
-      (description "Clojure is a dynamic, general-purpose programming language,
-combining the approachability and interactive development of a scripting
-language with an efficient and robust infrastructure for multithreaded
-programming.  Clojure is a compiled language, yet remains completely dynamic
-– every feature supported by Clojure is supported at runtime.  Clojure
-provides easy access to the Java frameworks, with optional type hints and type
-inference, to ensure that calls to Java can avoid reflection.
-
-Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy
-and a powerful macro system.  Clojure is predominantly a functional programming
-language, and features a rich set of immutable, persistent data structures.
-When mutable state is needed, Clojure offers a software transactional memory
-system and reactive Agent system that ensure clean, correct, multithreaded
-designs.")
-      ;; Clojure is licensed under EPL1.0
-      ;; ASM bytecode manipulation library is licensed under BSD-3
-      ;; Guava Murmur3 hash implementation is licensed under APL2.0
-      ;; src/clj/repl.clj is licensed under CPL1.0
-      ;;
-      ;; See readme.html or readme.txt for details.
-      (license (list license:epl1.0
-                     license:bsd-3
-                     license:asl2.0
-                     license:cpl1.0)))))
-
 (define-public javacc-4
   (package
     (name "javacc")
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index bdad1602b9..661b7ed2ca 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -400,8 +400,8 @@ It has been modified to remove all non-free binary blobs.")
 ;; supports qemu "virt" machine and possibly a large number of ARM boards.
 ;; See : https://wiki.debian.org/DebianKernel/ARMMP.
 
-(define %linux-libre-version "4.19.1")
-(define %linux-libre-hash "12mrrgg2ih4jiylpy45q5nsd8afj3nya0klr543s0mcga88v9527")
+(define %linux-libre-version "4.19.2")
+(define %linux-libre-hash "1yh4ll9qh4wmf9r62ksyic57g1iy1b84qbv855l545ilk12znbmj")
 
 (define %linux-libre-4.19-patches
   (list %boot-logo-patch
@@ -423,8 +423,8 @@ It has been modified to remove all non-free binary blobs.")
                     #:patches %linux-libre-4.19-patches
                     #:configuration-file kernel-config))
 
-(define %linux-libre-4.14-version "4.14.80")
-(define %linux-libre-4.14-hash "0h4hi5lqizdx5nk0f3immbcv2n7p5jh26m80v4x6bw4wi5b44fra")
+(define %linux-libre-4.14-version "4.14.81")
+(define %linux-libre-4.14-hash "0vxs8k7ka8aqnn1fcr88bhr07wa5jg83pq1rcjby9k422mbv254q")
 
 (define-public linux-libre-4.14
   (make-linux-libre %linux-libre-4.14-version
@@ -433,8 +433,8 @@ It has been modified to remove all non-free binary blobs.")
                     #:configuration-file kernel-config))
 
 (define-public linux-libre-4.9
-  (make-linux-libre "4.9.136"
-                    "1kk6px1jcwbgkpfmf9pdklk6kz90h5l8fvdqwmvnk4bz6b2xrrfp"
+  (make-linux-libre "4.9.137"
+                    "1d8313r2k0qr4x7nqlnbwn5lzfc7dz6w8sfg47jml1q38c2fyjf2"
                     %intel-compatible-systems
                     #:configuration-file kernel-config))
 
@@ -3188,7 +3188,7 @@ is flexible, efficient and uses a modular implementation.")
 (define-public fuse-exfat
   (package
     (name "fuse-exfat")
-    (version "1.2.8")
+    (version "1.3.0")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -3196,7 +3196,7 @@ is flexible, efficient and uses a modular implementation.")
                     version "/" name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1jwnxw0bg9v5ij8xvbg4xpjr50nykq8a1lmc2xkblz204rq7wd8z"))))
+                "1lz00q8g4590mrdqmf13ba1s9zrqq645ymgm5p9y99ad0qv22r87"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)))
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 9fb25a15a2..6849cdd2bf 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
+;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -34,6 +35,8 @@
   #:use-module (guix hg-download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system ant)
+  #:use-module (guix build-system clojure)
   #:use-module (guix build-system asdf)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages admin)
@@ -530,8 +533,12 @@ statistical profiler, a code coverage tool, and many other extensions.")
                (install-file kernel libdir)
                (install-file heap libdir)
 
-               (let ((dirs '("lib" "library" "examples" "contrib"
-                             "tools" "objc-bridge")))
+               (let ((dirs '("lib" "library" "examples" "tools" "objc-bridge"
+                             ,(match (%current-system)
+                                ("x86_64-linux"
+                                 "x86-headers64")
+                                ("i686-linux"
+                                 "x86-headers")))))
                  (for-each copy-recursively
                            dirs
                            (map (cut string-append libdir <>) dirs)))
@@ -559,6 +566,119 @@ interface.")
     (license (list license:lgpl2.1
                    license:clarified-artistic)))) ;TRIVIAL-LDAP package
 
+(define-public clojure
+  (let* ((lib (lambda (prefix version hash)
+                (origin (method url-fetch)
+                        (uri (string-append "https://github.com/clojure/"
+                                            prefix version ".tar.gz"))
+                        (sha256 (base32 hash)))))
+         ;; The libraries below are needed to run the tests.
+         (libraries
+          `(("core-specs-alpha-src"
+             ,(lib "core.specs.alpha/archive/core.specs.alpha-"
+                   "0.1.24"
+                   "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
+            ("data-generators-src"
+             ,(lib "data.generators/archive/data.generators-"
+                   "0.1.2"
+                   "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
+            ("spec-alpha-src"
+             ,(lib "spec.alpha/archive/spec.alpha-"
+                   "0.1.143"
+                   "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
+            ("test-check-src"
+             ,(lib "test.check/archive/test.check-"
+                   "0.9.0"
+                   "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
+            ("test-generative-src"
+             ,(lib "test.generative/archive/test.generative-"
+                   "0.5.2"
+                   "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
+            ("tools-namespace-src"
+             ,(lib "tools.namespace/archive/tools.namespace-"
+                   "0.2.11"
+                   "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
+         (library-names (match libraries
+                          (((library-name _) ...)
+                           library-name))))
+
+    (package
+      (name "clojure")
+      (version "1.9.0")
+      (source
+       (origin
+         (method url-fetch)
+         (uri
+          (string-append "https://github.com/clojure/clojure/archive/clojure-"
+                         version ".tar.gz"))
+         (sha256
+          (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"))))
+      (build-system ant-build-system)
+      (arguments
+       `(#:imported-modules ((guix build clojure-utils)
+                             (guix build guile-build-system)
+                             ,@%ant-build-system-modules)
+         #:modules ((guix build ant-build-system)
+                    (guix build clojure-utils)
+                    (guix build java-utils)
+                    (guix build utils)
+                    (srfi srfi-26))
+         #:test-target "test"
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'unpack-library-sources
+             (lambda* (#:key inputs #:allow-other-keys)
+               (define (extract-library name)
+                 (mkdir-p name)
+                 (with-directory-excursion name
+                   (invoke "tar"
+                           "--extract"
+                           "--verbose"
+                           "--file" (assoc-ref inputs name)
+                           "--strip-components=1"))
+                 (copy-recursively (string-append name "/src/main/clojure/")
+                                   "src/clj/"))
+               (for-each extract-library ',library-names)
+               #t))
+           (add-after 'unpack-library-sources 'fix-manifest-classpath
+             (lambda _
+               (substitute* "build.xml"
+                 (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
+               #t))
+           (add-after 'build 'build-javadoc ant-build-javadoc)
+           (replace 'install (install-jars "./"))
+           (add-after 'install-license-files 'install-doc
+             (cut install-doc #:doc-dirs '("doc/clojure/") <...>))
+           (add-after 'install-doc 'install-javadoc
+             (install-javadoc "target/javadoc/")))))
+      (native-inputs libraries)
+      (home-page "https://clojure.org/")
+      (synopsis "Lisp dialect running on the JVM")
+      (description "Clojure is a dynamic, general-purpose programming language,
+combining the approachability and interactive development of a scripting
+language with an efficient and robust infrastructure for multithreaded
+programming.  Clojure is a compiled language, yet remains completely dynamic
+– every feature supported by Clojure is supported at runtime.  Clojure
+provides easy access to the Java frameworks, with optional type hints and type
+inference, to ensure that calls to Java can avoid reflection.
+
+Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy
+and a powerful macro system.  Clojure is predominantly a functional programming
+language, and features a rich set of immutable, persistent data structures.
+When mutable state is needed, Clojure offers a software transactional memory
+system and reactive Agent system that ensure clean, correct, multithreaded
+designs.")
+      ;; Clojure is licensed under EPL1.0
+      ;; ASM bytecode manipulation library is licensed under BSD-3
+      ;; Guava Murmur3 hash implementation is licensed under APL2.0
+      ;; src/clj/repl.clj is licensed under CPL1.0
+
+      ;; See readme.html or readme.txt for details.
+      (license (list license:epl1.0
+                     license:bsd-3
+                     license:asl2.0
+                     license:cpl1.0)))))
+
 (define-public femtolisp
   (let ((commit "68c5b1225572ecf2c52baf62f928063e5a30511b")
         (revision "1"))
@@ -1488,6 +1608,158 @@ compressor.  It works on data produced by @code{parse-js} to generate a
        ("sbcl-cl-uglify-js" ,sbcl-cl-uglify-js)))
     (synopsis "JavaScript compressor")))
 
+(define-public clojure-algo-generic
+  (package
+    (name "clojure-algo-generic")
+    (version "0.1.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://github.com/clojure/algo.generic/archive"
+                       "/algo.generic-" version ".tar.gz"))
+       (sha256
+        (base32 "12w9681i545gp1af4576z1qbixwps1j13c16fmcc7zsb0bd1zr7w"))))
+    (build-system clojure-build-system)
+    (arguments
+     '(#:source-dirs '("src/main/clojure/")
+       #:test-dirs '("src/test/clojure/")
+       #:doc-dirs '()))
+    (synopsis "Generic versions of common functions")
+    (description
+     "Generic versions of commonly used functions, implemented as multimethods
+that can be implemented for any data type.")
+    (home-page "https://github.com/clojure/algo.generic")
+    (license license:epl1.0)))
+
+(define-public clojure-algo-monads
+  (package
+    (name "clojure-algo-monads")
+    (version "0.1.6")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://github.com/clojure/algo.monads/archive"
+                       "/algo.monads-" version ".tar.gz"))
+       (sha256
+        (base32 "14gbvfgmrda990h45yn7zag83vp1kdkz4f4yzmyvkr0sjihlgdmq"))))
+    (build-system clojure-build-system)
+    (arguments
+     '(#:source-dirs '("src/main/clojure/")
+       #:test-dirs '("src/test/clojure/")
+       #:doc-dirs '()))
+    (native-inputs
+     `(("clojure-tools-macro" ,clojure-tools-macro)))
+    (synopsis
+     "Monad Macros and Definitions")
+    (description
+     "This library contains the most commonly used monads as well as macros for
+defining and using monads and useful monadic functions.")
+    (home-page "https://github.com/clojure/algo.monads")
+    (license license:epl1.0)))
+
+(define-public clojure-core-match
+  (let ((commit "1837ffbd4a150e8f3953b2d9ed5cf4a4ad3720a7")
+        (revision "1")) ; this is the 1st commit buildable with clojure 1.9
+    (package
+      (name "clojure-core-match")
+      (version (git-version "0.3.0-alpha5" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/clojure/core.match.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "04bdlp5dgkrqzrz0lw3mfwmygj2218qnm1cz3dkb9wy4m0238s4d"))))
+      (build-system clojure-build-system)
+      (arguments
+       '(#:source-dirs '("src/main/clojure")
+         #:test-dirs '("src/test/clojure")
+         #:doc-dirs '()))
+      (synopsis "Optimized pattern matching for Clojure")
+      (description
+       "An optimized pattern matching library for Clojure.
+It supports Clojure 1.5.1 and later as well as ClojureScript.")
+      (home-page "https://github.com/clojure/core.match")
+      (license license:epl1.0))))
+
+(define-public clojure-instaparse
+  (let ((commit "dcfffad5b065e750f0f5835f017cdd8188b8ca2e")
+        (version "1.4.9")) ; upstream forget to tag this release
+    (package
+      (name "clojure-instaparse")
+      (version version)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/Engelberg/instaparse.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "002mrgin4z3dqy88r1lak7smd0m7x8d22vmliw0m6w6mh5pa17lk"))))
+      (build-system clojure-build-system)
+      (arguments
+       '(#:doc-dirs '("docs/")))
+      (synopsis "No grammar left behind")
+      (description
+       "Instaparse aims to be the simplest way to build parsers in Clojure.
+
+@itemize
+@item Turns @emph{standard EBNF or ABNF notation} for context-free grammars
+into an executable parser that takes a string as an input and produces a parse
+tree for that string.
+
+@item @dfn{No Grammar Left Behind}: Works for @emph{any} context-free grammar,
+including @emph{left-recursive}, @emph{right-recursive}, and @emph{ambiguous}
+grammars.
+
+@item Extends the power of context-free grammars with PEG-like syntax for
+lookahead and negative lookahead.
+
+@item Supports both of Clojure's most popular tree formats (hiccup and enlive)
+as output targets
+
+@item Detailed reporting of parse errors.
+
+@item Optionally produces lazy sequence of all parses (especially useful for
+diagnosing and debugging ambiguous grammars).
+
+@item ``Total parsing'' mode where leftover string is embedded in the parse
+tree.
+
+@item Optional combinator library for building grammars programmatically.
+
+@item Performant.
+@end itemize")
+      (home-page "https://github.com/Engelberg/instaparse")
+      (license license:epl1.0))))
+
+(define-public clojure-tools-macro
+  (package
+    (name "clojure-tools-macro")
+    (version "0.1.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://github.com/clojure/tools.macro/archive"
+                       "/tools.macro-" version ".tar.gz"))
+       (sha256
+        (base32 "0fs64a0g63xx6g7sj6vrsqknhl90s0isf6k053nw8vv5prfzc7v6"))))
+    (build-system clojure-build-system)
+    (arguments
+     '(#:source-dirs '("src/main/clojure/")
+       #:test-dirs '("src/test/clojure/")
+       #:doc-dirs '()))
+    (synopsis "Utilities for macro writers")
+    (description "Tools for writing macros.")
+    (home-page "https://github.com/clojure/tools.macro")
+    (license license:epl1.0)))
+
 (define-public confusion-mdl
   (let* ((commit "12a055581fc262225272df43287dae48281900f5"))
     (package
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index f57e263449..0d3bff9476 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2016 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2016, 2018 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Dennis Mungai <dmngaie@gmail.com>
@@ -66,6 +66,7 @@
                            "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
                            "-DBUILD_SHARED_LIBS:BOOL=TRUE"
                            "-DLLVM_ENABLE_FFI:BOOL=TRUE"
+                           "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities
                            "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc.
 
        ;; Don't use '-g' during the build, to save space.
@@ -91,6 +92,26 @@ languages is in development.  The compiler infrastructure includes mirror sets
 of programming tools as well as libraries with equivalent functionality.")
     (license license:ncsa)))
 
+;; FIXME: This package is here to prevent many rebuilds on x86_64 and i686
+;; from commit fc9dbf41311d99d0fd8befc789ea7c0e35911890.  Update users of
+;; this in the next rebuild cycle.
+(define-public llvm-without-rtti
+  (package
+    (inherit llvm)
+    (arguments
+     `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE"
+                           "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
+                           "-DBUILD_SHARED_LIBS:BOOL=TRUE"
+                           "-DLLVM_ENABLE_FFI:BOOL=TRUE"
+                           "-DLLVM_INSTALL_UTILS=ON")
+       #:build-type "Release"
+       #:phases (modify-phases %standard-phases
+                  (add-before 'build 'shared-lib-workaround
+                    (lambda _
+                      (setenv "LD_LIBRARY_PATH"
+                              (string-append (getcwd) "/lib"))
+                      #t)))))))
+
 (define* (clang-runtime-from-llvm llvm hash
                                   #:optional (patches '()))
   (package
@@ -281,18 +302,6 @@ code analysis tools.")
        (base32
         "1ybmnid4pw2hxn12ax5qa5kl1ldfns0njg8533y3mzslvd5cx0kf"))))))
 
-;; This is for Faust 2
-(define-public llvm-3.8-with-rtti
-  (package (inherit llvm-3.8)
-    (name "llvm-with-rtti")
-    (arguments
-     (substitute-keyword-arguments (package-arguments llvm)
-       ((#:configure-flags flags)
-        `(append '("-DCMAKE_SKIP_BUILD_RPATH=FALSE"
-                   "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
-                   "-DLLVM_REQUIRES_RTTI=1")
-                 ,flags))))))
-
 (define-public clang-runtime-3.8
   (clang-runtime-from-llvm
    llvm-3.8
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 990a6c771a..09c525ff20 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2018 Mark Meyer <mark@ofosos.org>
 ;;; Copyright © 2018 Ben Woodcroft <donttrustben@gmail.com>
 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
+;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -300,7 +301,9 @@ networks) based on simulation of (stochastic) flow in graphs.")
          "1l5jbhwjpsj38x8b9698hfpkv75h8hn3kj0gihjhn8ym2cwwv110"))))
     (build-system ocaml-build-system)
     (arguments
-     `(#:phases
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib
+       #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'patch-paths
            (lambda _
diff --git a/gnu/packages/man.scm b/gnu/packages/man.scm
index 58e26d82ff..b640884933 100644
--- a/gnu/packages/man.scm
+++ b/gnu/packages/man.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2014, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 David Thompson <dthompson2@worcester.edu>
 ;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
@@ -216,6 +216,18 @@ Linux kernel and C library interfaces employed by user-space programs.")
 automatically.")
     (license gpl3+)))
 
+(define-public help2man/latest
+  (package
+    (inherit help2man)
+    (version "1.47.8")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/help2man/help2man-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "1p5830h88cx0zn0snwaj0vpph81xicpsirfwlxmcgjrlmn0nm3sj"))))))
+
 (define-public txt2man
   (package
     (name "txt2man")
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 3e1fe7c2c1..7dc8b62a47 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -28,6 +28,7 @@
 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
+;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1808,6 +1809,41 @@ scientific applications modeled by partial differential equations.")
            ,@(delete "--with-mpi=0" ,cf)))))
     (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
 
+(define-public python-petsc4py
+  (package
+    (name "python-petsc4py")
+    (version "3.9.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "petsc4py" version))
+        (sha256
+          (base32
+            "1f8zd1ac9irsgkyqmzq30d9kl10fy1nh6zk312dhs43g449fkkhc"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'pre-build
+           (lambda _
+             ;; Define path to PETSc installation.
+             (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
+             #t))
+         (add-before 'check 'mpi-setup
+           ,%openmpi-setup))))
+    (inputs
+     `(("petsc" ,petsc-openmpi)
+       ("python-numpy" ,python-numpy)))
+    (home-page "https://bitbucket.org/petsc/petsc4py/")
+    (synopsis "Python bindings for PETSc")
+    (description "PETSc, the Portable, Extensible Toolkit for
+Scientific Computation, is a suite of data structures and routines for
+the scalable (parallel) solution of scientific applications modeled by
+partial differential equations.  It employs the MPI standard for all
+message-passing communication.  @code{petsc4py} provides Python
+bindings to almost all functions of PETSc.")
+    (license license:bsd-3)))
+
 (define-public python-kiwisolver
   (package
     (name "python-kiwisolver")
@@ -1939,6 +1975,43 @@ arising after the discretization of partial differential equations.")
        ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
     (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
 
+(define-public python-slepc4py
+  (package
+    (name "python-slepc4py")
+    (version "3.9.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "slepc4py" version))
+        (sha256
+          (base32
+            "02xr0vndgibgkz3rgprqk05n3mk5mpgqw550sr4681vcsgz4zvb7"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'pre-build
+           (lambda _
+             ;; Define path to PETSc installation.
+             (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
+             ;; Define path to SLEPc installation.
+             (setenv "SLEPC_DIR" (assoc-ref %build-inputs "slepc"))
+             #t))
+         (add-before 'check 'mpi-setup
+           ,%openmpi-setup))))
+    (inputs
+     `(("python-numpy" ,python-numpy)
+       ("python-petsc4py" ,python-petsc4py)
+       ("slepc" ,slepc-openmpi)))
+    (home-page "https://bitbucket.org/slepc/slepc4py/")
+    (synopsis "Python bindings for SLEPc")
+    (description "SLEPc, the Scalable Library for Eigenvalue Problem
+Computations, is based on PETSc, the Portable, Extensible Toolkit for
+Scientific Computation.  It employs the MPI standard for all
+message-passing communication.  @code{slepc4py} provides Python
+bindings to almost all functions of SLEPc.")
+    (license license:bsd-3)))
+
 (define-public mumps
   (package
     (name "mumps")
@@ -2716,6 +2789,18 @@ to BMP, JPEG or PNG image formats.")
            (lambda _
              (chmod "src/maxima" #o555)
              #t))
+         (replace 'check
+           (lambda _
+             ;; This is derived from the testing code in the "debian/rules" file
+             ;; of Debian's Maxima package.
+             ;; If Maxima can successfully run this, the binary to be installed
+             ;; should be fine.
+             (zero?
+              (system
+               (string-append "./maxima-local "
+                              "--lisp=gcl "
+                              "--batch-string=\"run_testsuite();\" "
+                              "| grep -q \"No unexpected errors found\"")))))
          ;; Make sure the doc and emacs files are found in the
          ;; standard location.  Also configure maxima to find gnuplot
          ;; without having it on the PATH.
@@ -3861,15 +3946,15 @@ as equations, scalars, vectors, and matrices.")
 (define-public z3
   (package
     (name "z3")
-    (version "4.5.0")
+    (version "4.8.1")
+    (home-page "https://github.com/Z3Prover/z3")
     (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "https://github.com/Z3Prover/z3/archive/z3-"
-                    version ".tar.gz"))
+              (method git-fetch)
+              (uri (git-reference (url home-page)
+                                  (commit (string-append "z3-" version))))
               (sha256
                (base32
-                "032a5lvji2liwmc25jv52bdrhimqflvqbpg77ccaq1jykhiivbmf"))))
+                "1vr57bwx40sd5riijyrhy70i2wnv9xrdihf6y5zdz56yq88rl48f"))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags
@@ -3898,43 +3983,57 @@ as equations, scalars, vectors, and matrices.")
     (synopsis "Theorem prover")
     (description "Z3 is a theorem prover and @dfn{satisfiability modulo
 theories} (SMT) solver.  It provides a C/C++ API, as well as Python bindings.")
-    (home-page "https://github.com/Z3Prover/z3")
     (license license:expat)))
 
 (define-public cubicle
   (package
     (name "cubicle")
-    (version "1.1.1")
+    (version "1.1.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://cubicle.lri.fr/cubicle-"
                                   version ".tar.gz"))
               (sha256
                (base32
-                "1sny9c4fm14k014pk62ibpwbrjjirkx8xmhs9jg7q1hk7y7x3q2h"))))
+                "10kk80jdmpdvql88sdjsh7vqzlpaphd8vip2lp47aarxjkwjlz1q"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("ocaml" ,ocaml)
+     `(("automake" ,automake)
+       ("ocaml" ,ocaml)
        ("which" ,(@@ (gnu packages base) which))))
     (propagated-inputs
-     `(("z3" ,z3)))
+     `(("ocaml-num" ,ocaml-num)
+       ("z3" ,z3)))
     (arguments
      `(#:configure-flags (list "--with-z3")
+       #:make-flags (list "QUIET=")
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'configure-for-release
            (lambda _
              (substitute* "Makefile.in"
-               (("SVNREV=") "#SVNREV="))))
+               (("SVNREV=") "#SVNREV="))
+             #t))
          (add-before 'configure 'fix-/bin/sh
            (lambda _
              (substitute* "configure"
-               (("/bin/sh") (which "sh")))))
+               (("-/bin/sh") (string-append "-" (which "sh"))))
+             #t))
          (add-before 'configure 'fix-smt-z3wrapper.ml
            (lambda _
              (substitute* "Makefile.in"
-               (("\\\\n") "")))))))
+               (("\\\\n") ""))
+             #t))
+         (add-before 'configure 'fix-ocaml-num
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "Makefile.in"
+               (("= \\$\\(FUNCTORYLIB\\)")
+                (string-append "= -I "
+                               (assoc-ref inputs "ocaml-num")
+                               "/lib/ocaml/site-lib"
+                               " $(FUNCTORYLIB)")))
+             #t)))))
     (home-page "http://cubicle.lri.fr/")
     (synopsis "Model checker for array-based systems")
     (description "Cubicle is a model checker for verifying safety properties
diff --git a/gnu/packages/mpi.scm b/gnu/packages/mpi.scm
index fc8aadef29..f08a7f5f88 100644
--- a/gnu/packages/mpi.scm
+++ b/gnu/packages/mpi.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2017 Dave Love <fx@gnu.org>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Paul Garlick <pgarlick@tourbillion-technology.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -29,6 +30,7 @@
   #:use-module (guix download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages linux)
@@ -263,3 +265,43 @@ only provides @code{MPI_THREAD_FUNNELED}.")))
      ;; in the build environment than the package wants while testing.
      (setenv "OMPI_MCA_rmaps_base_oversubscribe" "yes")
      #t))
+
+(define-public python-mpi4py
+  (package
+    (name "python-mpi4py")
+    (version "3.0.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "mpi4py" version))
+        (sha256
+          (base32
+            "1mzgd26dfv4vwbci8gq77ss9f0x26i9aqzq9b9vs9ndxhlnv0mxl"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'mpi-setup
+           ,%openmpi-setup)
+         (add-before 'check 'pre-check
+           (lambda _
+             ;; Skip BaseTestSpawn class (causes error 'ompi_dpm_dyn_init()
+             ;; failed --> Returned "Unreachable"' in chroot environment).
+             (substitute* "test/test_spawn.py"
+               (("unittest.skipMPI\\('openmpi\\(<3.0.0\\)'\\)")
+                "unittest.skipMPI('openmpi')"))
+             #t)))))
+    (inputs
+     `(("openmpi" ,openmpi)))
+    (home-page "https://bitbucket.org/mpi4py/mpi4py/")
+    (synopsis "Python bindings for the Message Passing Interface standard")
+    (description "MPI for Python (mpi4py) provides bindings of the Message
+Passing Interface (MPI) standard for the Python programming language, allowing
+any Python program to exploit multiple processors.
+
+mpi4py is constructed on top of the MPI-1/MPI-2 specification and provides an
+object oriented interface which closely follows MPI-2 C++ bindings.  It
+supports point-to-point and collective communications of any picklable Python
+object as well as optimized communications of Python objects (such as NumPy
+arrays) that expose a buffer interface.")
+    (license bsd-3)))
diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm
index 4f5eac16b9..71e1efcd8c 100644
--- a/gnu/packages/multiprecision.scm
+++ b/gnu/packages/multiprecision.scm
@@ -26,6 +26,7 @@
 (define-module (gnu packages multiprecision)
   #:use-module (guix licenses)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages gcc)
   #:use-module (guix packages)
@@ -225,3 +226,68 @@ minor changes to the source code.  In most cases only a few type statements
 and (for Fortran-90 programs) read/write statements need to be changed.  PSLQ
 and numerical quadrature programs are included.")
     (license bsd-3)))
+
+(define-public tomsfastmath
+  (package
+    (name "tomsfastmath")
+    (version "0.13.0")
+    (synopsis "Large integer arithmetic library")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/libtom/tomsfastmath/"
+                                  "releases/download/v" version "/"
+                                  "tfm-" (version-major+minor version) ".tar.bz2"))
+              (sha256
+               (base32
+                "01rlsvp6lskk2a0gfdi24ak5h8vdwi6kqbvbwjnmb92r0zrfdvwd"))
+              (patches (search-patches "tomsfastmath-constness.patch"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("libtool" ,libtool)))
+    (arguments
+     `(#:make-flags (list "-f" "makefile.shared"
+                          (string-append "LIBPATH=" %output "/lib")
+                          (string-append "INCPATH=" %output "/include")
+                          "GROUP=root" "USER=root"
+                          "CC=gcc")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)            ;no configuration
+         (replace 'check
+           (lambda* (#:key make-flags #:allow-other-keys)
+             (and (zero? (apply system* "make"
+                                "stest" "test_standalone"
+                                make-flags))
+                  (zero? (system* "./stest"))
+                  (zero? (system* "./test")))))
+         (add-before 'install 'install-nogroup
+           (lambda _
+             ;; Let permissions inherit from the current process
+             (substitute* "makefile.shared"
+               (("-g \\$\\(GROUP\\) -o \\$\\(USER\\)") ""))
+             #t))
+         (add-after 'install 'install-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((docdir (string-append (assoc-ref outputs "out")
+                                          "/share/doc/tomsfastmath")))
+               (install-file "doc/tfm.pdf" docdir)
+               #t)))
+         (add-after 'install 'install-pc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (pc-dir (string-append out "/lib/pkgconfig")))
+               (call-with-output-file "tomsfastmath.pc"
+                 (lambda (port)
+                   (format port "~
+Name: TomsFastMath
+Description: ~a
+Version: ~a
+Libs: -L~a/lib -ltfm~%"
+                           ,synopsis ,version out)))
+               (install-file "tomsfastmath.pc" pc-dir)
+               #t))))))
+    (home-page "http://www.libtom.org/TomsFastMath/")
+    (description "TomsFastMath is a large integer library written in portable
+ISO C.  It is a port of LibTomMath with optional support for inline assembler
+multiplies.")
+    (license public-domain)))
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 6b55e84fed..e1323582a2 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -6,7 +6,7 @@
 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016, 2018 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2016-2018 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Peter Kreye <kreyepr@gmail.com>
@@ -120,7 +120,7 @@
                          "/lib/ocaml/site-lib"))
     #:phases (modify-phases %standard-phases (delete 'configure))))
 
-(define-public ocaml
+(define-public ocaml-4.02
   (package
     (name "ocaml")
     (version "4.02.3")
@@ -145,7 +145,8 @@
             (files (list "lib/ocaml" "lib/ocaml/site-lib")))
            (search-path-specification
             (variable "CAML_LD_LIBRARY_PATH")
-            (files (list "lib/ocaml/site-lib/stubslibs")))))
+            (files (list "lib/ocaml/site-lib/stubslibs"
+                         "lib/ocaml/site-lib/stublibs")))))
     (native-inputs
      `(("perl" ,perl)
        ("pkg-config" ,pkg-config)))
@@ -228,7 +229,7 @@ functional, imperative and object-oriented styles of programming.")
 
 (define-public ocaml-4.01
   (package
-    (inherit ocaml)
+    (inherit ocaml-4.02)
     (version "4.01.0")
     (source (origin
               (method url-fetch)
@@ -240,7 +241,7 @@ functional, imperative and object-oriented styles of programming.")
                (base32
                 "03d7ida94s1gpr3gadf4jyhmh5rrszd5s4m4z59daaib25rvfyv7"))))
     (arguments
-     (substitute-keyword-arguments (package-arguments ocaml)
+     (substitute-keyword-arguments (package-arguments ocaml-4.02)
        ((#:phases phases)
         `(modify-phases ,phases
            (replace 'build
@@ -256,10 +257,78 @@ functional, imperative and object-oriented styles of programming.")
                          (string-append
                           "TOPDIR=" (getcwd) "/.."))))))))))))
 
+(define-public ocaml-4.07
+  (package
+    (inherit ocaml-4.02)
+    (version "4.07.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://caml.inria.fr/pub/distrib/ocaml-"
+                    (version-major+minor version)
+                    "/ocaml-" version ".tar.xz"))
+              (sha256
+               (base32
+                "03wzkzv6w4rdiiva20g5amz0n4x75swpjl8d80468p6zm8hgfnzl"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments ocaml-4.02)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (delete 'prepare-socket-test)
+           (replace 'check
+             (lambda _
+               (with-directory-excursion "testsuite"
+                 (invoke "make" "all"))
+               #t))))))))
+
+(define-public ocaml ocaml-4.07)
+
+(define-public ocamlbuild
+	  (package
+	    (name "ocamlbuild")
+	    (version "0.13.1")
+	    (source (origin
+	              (method url-fetch)
+	              (uri (string-append "https://github.com/ocaml/ocamlbuild/archive/"
+	                                  version ".tar.gz"))
+	              (file-name (string-append name "-" version ".tar.gz"))
+	              (sha256
+	               (base32
+	                "1320cfkixs1xlng5av04pa5qjb3ynvi2kl3k1ngqzg5fpi29b0vr"))))
+	    (build-system gnu-build-system)
+	    (arguments
+	     `(#:test-target "test"
+	       #:tests? #f; tests require findlib
+	       #:make-flags
+	       (list (string-append "OCAMLBUILD_PREFIX=" (assoc-ref %outputs "out"))
+	             (string-append "OCAMLBUILD_BINDIR=" (assoc-ref %outputs "out")
+                                "/bin")
+	             (string-append "OCAMLBUILD_LIBDIR=" (assoc-ref %outputs "out")
+                                "/lib/ocaml/site-lib")
+	             (string-append "OCAMLBUILD_MANDIR=" (assoc-ref %outputs "out")
+                                "/share/man"))
+	       #:phases
+	       (modify-phases %standard-phases
+	         (delete 'bootstrap)
+	         (delete 'configure)
+	         (add-before 'build 'findlib-environment
+	           (lambda* (#:key outputs #:allow-other-keys)
+	             (let* ((out (assoc-ref outputs "out")))
+	               (setenv "OCAMLFIND_DESTDIR" (string-append out "/lib/ocaml/site-lib"))
+	               (setenv "OCAMLFIND_LDCONF" "ignore")
+	               #t))))))
+	    (native-inputs
+	     `(("ocaml" ,ocaml)))
+	    (home-page "https://github.com/ocaml/ocamlbuild")
+	    (synopsis "OCaml build tool")
+	    (description "OCamlbuild is a generic build tool, that has built-in rules
+	for building OCaml library and programs.")
+	    (license license:lgpl2.1+)))
+
 (define-public opam
   (package
     (name "opam")
-    (version "1.2.2")
+    (version "2.0.0")
     (source (origin
               (method url-fetch)
               ;; Use the '-full' version, which includes all the dependencies.
@@ -271,7 +340,7 @@ functional, imperative and object-oriented styles of programming.")
                )
               (sha256
                (base32
-                "004gwn6rbpcb53y3rpb3v23vk39rp2xmf0liyd5iy12ij8bigrhm"))))
+                "09gdpxiqmyr6z78l85d7pwhiwrycdi2xi1b2mafqr1sk9z5lzbcx"))))
     (build-system gnu-build-system)
     (arguments
      '(;; Sometimes, 'make -jX' would fail right after ./configure with
@@ -321,7 +390,7 @@ Git-friendly development workflow.")
     ;; The 'LICENSE' file waives some requirements compared to LGPLv3.
     (license license:lgpl3)))
 
-(define-public camlp4
+(define-public camlp4-4.02
   (package
     (name "camlp4")
     (version "4.02+6")
@@ -334,9 +403,9 @@ Git-friendly development workflow.")
                 "0icdfzhsbgf89925gc8gl3fm8z2xzszzlib0v9dj5wyzkyv3a342"))
               (file-name (string-append name "-" version ".tar.gz"))))
     (build-system gnu-build-system)
-    (native-inputs `(("ocaml" ,ocaml)
+    (native-inputs `(("ocaml" ,ocaml-4.02)
                      ("which" ,which)))
-    (inputs `(("ocaml" ,ocaml)))
+    (inputs `(("ocaml" ,ocaml-4.02)))
     (arguments
      '(#:tests? #f                                ;no documented test target
        ;; a race-condition will lead byte and native targets to  mkdir _build
@@ -377,17 +446,42 @@ syntax of OCaml.")
     ;; against the library to be released under any terms.
     (license license:lgpl2.0)))
 
+(define-public camlp4-4.07
+  (package
+    (inherit camlp4-4.02)
+    (name "camlp4")
+    (version "4.07+1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/ocaml/camlp4/archive/"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "143hhxv1i6aq413z0i1pynrjcfl2g5gnh5r3863v6h9z0riqknzc"))
+              (file-name (string-append name "-" version ".tar.gz"))))
+    (properties
+     `((ocaml4.02-variant . ,(delay camlp4-4.02))))
+    (native-inputs
+     `(("ocaml" ,ocaml-4.07)
+       ("ocamlbuild" ,ocamlbuild)
+       ("which" ,which)))
+    (inputs
+     `(("ocaml" ,ocaml-4.07)))))
+
+(define-public camlp4 camlp4-4.07)
+
 (define-public camlp5
   (package
     (name "camlp5")
-    (version "6.14")
+    (version "7.06")
     (source (origin
               (method url-fetch)
-              (uri (string-append "http://camlp5.gforge.inria.fr/distrib/src/"
-                                  name "-" version ".tgz"))
+              (uri (string-append "https://github.com/camlp5/camlp5/archive/rel"
+                                  (string-delete #\. version) ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1ql04iyvclpyy9805kpddc4ndjb5d0qg4shhi2fc6bixi49fvy89"))))
+                "08kr0h2rq3jh3kzqh5f6pr589bqw3y76z8k59ad2kdh50fjgp8xy"))))
     (build-system gnu-build-system)
     (inputs
      `(("ocaml" ,ocaml)))
@@ -404,6 +498,11 @@ syntax of OCaml.")
                       (invoke "./configure"
                               "--prefix" out
                               "--mandir" mandir))))
+         (add-before 'build 'fix-/bin-references
+           (lambda _
+             (substitute* "config/Makefile"
+               (("/bin/rm") "rm"))
+             #t))
          (replace 'build
                   (lambda _
                     (invoke "make" "-j" (number->string
@@ -427,17 +526,19 @@ concrete syntax of the language (Quotations, Syntax Extensions).")
 (define-public hevea
   (package
     (name "hevea")
-    (version "2.28")
+    (version "2.32")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://hevea.inria.fr/old/"
                                   name "-" version ".tar.gz"))
               (sha256
                (base32
-                "14fns13wlnpiv9i05841kvi3cq4b9v2sw5x3ff6ziws28q701qnd"))))
+                "1s4yqphfcr1pf5mcj5c84mvmd107k525iiym5jdwsxz0ka0ccmfy"))))
     (build-system gnu-build-system)
     (inputs
      `(("ocaml" ,ocaml)))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)))
     (arguments
      `(#:tests? #f  ; no test suite
        #:make-flags (list (string-append "PREFIX=" %output))
@@ -455,6 +556,50 @@ concrete syntax of the language (Quotations, Syntax Extensions).")
 written in Objective Caml.")
     (license license:qpl)))
 
+(define-public ocaml-num
+  (package
+    (name "ocaml-num")
+    (version "1.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/ocaml/num/archive/v"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1xlkd0svc0mgq5s7nrm2rjrsvg15i9wxqkc1kvwjp6sv8vv8bb04"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'fix-makefile
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; This package supposes we install to the same directory as
+             ;; the ocaml package.
+             (substitute* "src/META"
+               (("\"\\^\"") (string-append "\"" (assoc-ref outputs "out")
+                                           "/lib/ocaml/site-lib\"")))
+             (substitute* "src/Makefile"
+               (("\\) \\$\\(STDLIBDIR\\)")
+                (string-append ") " (assoc-ref outputs "out")
+                               "/lib/ocaml/site-lib")))
+             #t))
+         (add-after 'install 'fix-stubslib
+           (lambda* (#:key outputs #:allow-other-keys)
+             (format #t "~a~%" (find-files "." ".*.so"))
+             (let ((stubdir (string-append (assoc-ref outputs "out")
+                                           "/lib/ocaml/site-lib")))
+               (mkdir-p stubdir)
+               (install-file "src/dllnums.so" stubdir))
+             #t)))))
+    (home-page "https://github.com/ocaml/num")
+    (synopsis "Arbitrary-precision integer and rational arithmetic")
+    (description "OCaml-Num contains the legacy Num library for
+arbitrary-precision integer and rational arithmetic that used to be part of
+the OCaml core distribution.")
+    (license license:lgpl2.1+))); with linking exception
+
 (define-public coq
   (package
     (name "coq")
@@ -478,7 +623,8 @@ written in Objective Caml.")
     (inputs
      `(("lablgtk" ,lablgtk)
        ("python" ,python-2)
-       ("camlp5" ,camlp5)))
+       ("camlp5" ,camlp5)
+       ("ocaml-num" ,ocaml-num)))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
@@ -598,7 +744,7 @@ provers.")
 (define-public emacs-tuareg
   (package
     (name "emacs-tuareg")
-    (version "2.0.10")
+    (version "2.2.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/ocaml/tuareg/archive/"
@@ -606,7 +752,7 @@ provers.")
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1r2smclcs63n74lcyckbp90j09wyjdngn816cqzfkw54iwh3hd7q"))))
+                "1ynpfc170f9jqx49biji9npfkvfpflbm29xf24wc7fnxxayr49ig"))))
     (build-system gnu-build-system)
     (native-inputs `(("emacs" ,emacs-minimal)
                      ("opam" ,opam)))
@@ -650,6 +796,8 @@ Emacs.")
     (build-system gnu-build-system)
     (inputs
      `(("ocaml" ,ocaml)))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)))
     (arguments
      `(#:parallel-build? #f ; Parallel build causes failure
        #:tests? #f ; No check target
@@ -660,6 +808,8 @@ Emacs.")
              (let ((out (assoc-ref outputs "out")))
                (setenv "PREFIX" out))
              #t)))))
+    (properties
+     `((ocaml4.02-variant . ,(delay ocaml4.02-menhir))))
     (home-page "http://gallium.inria.fr/~fpottier/menhir")
     (synopsis "Parser generator")
     (description "Menhir is a parser generator.  It turns high-level grammar
@@ -671,17 +821,26 @@ Knuth’s LR(1) parser construction technique.")
     ;; are QPL licensed.
     (license (list license:gpl2+ license:qpl))))
 
+(define-public ocaml4.02-menhir
+  (package
+    (inherit ocaml-menhir)
+    (name "ocaml4.02-menhir")
+    (inputs `(("ocaml" ,ocaml-4.02)))
+    (native-inputs '())))
+
 (define-public lablgtk
   (package
     (name "lablgtk")
-    (version "2.18.5")
+    (version "2.18.6")
     (source (origin
               (method url-fetch)
-              (uri (ocaml-forge-uri name version 1627))
+              (uri (ocaml-forge-uri name version 1726))
               (sha256
                (base32
-                "0cyj6sfdvzx8hw7553lhgwc0krlgvlza0ph3dk9gsxy047dm3wib"))))
+                "1y38fdvswy6hmppm65qvgdk4pb3ghhnvz7n4ialf46340r1s5p2d"))))
     (build-system gnu-build-system)
+    (properties
+     `((ocaml4.02-variant . ,(delay ocaml4.02-lablgtk))))
     (native-inputs
      `(("camlp4" ,camlp4)
        ("ocaml" ,ocaml)
@@ -732,6 +891,23 @@ libglade (and it an generate OCaml code from .glade files),
 libpanel, librsvg and quartz.")
     (license license:lgpl2.1)))
 
+(define-public ocaml4.02-lablgtk
+  (package
+    (inherit lablgtk)
+    (name "ocaml4.02-lablgtk")
+    (version "2.18.5")
+    (source (origin
+              (method url-fetch)
+              (uri (ocaml-forge-uri name version 1627))
+              (sha256
+               (base32
+                "0cyj6sfdvzx8hw7553lhgwc0krlgvlza0ph3dk9gsxy047dm3wib"))))
+    (native-inputs
+     `(("camlp4" ,camlp4-4.02)
+       ("ocaml" ,ocaml-4.02)
+       ("findlib" ,ocaml4.02-findlib)
+       ("pkg-config" ,pkg-config)))))
+
 (define-public unison
   (package
     (name "unison")
@@ -792,12 +968,13 @@ libpanel, librsvg and quartz.")
     (outputs '("out"
                "doc"))                  ; 1.9 MiB of documentation
     (native-inputs
-     `(("ocaml" ,ocaml)
+     `(("ocaml" ,ocaml-4.02)
        ;; For documentation
        ("ghostscript" ,ghostscript)
        ("texlive" ,texlive)
        ("hevea" ,hevea)
-       ("lynx" ,lynx)))
+       ("lynx" ,lynx)
+       ("which" ,which)))
     (arguments
      `(#:parallel-build? #f
        #:parallel-tests? #f
@@ -827,6 +1004,14 @@ libpanel, librsvg and quartz.")
                (let ((doc (string-append (assoc-ref outputs "doc")
                                          "/share/doc/unison")))
                  (mkdir-p doc)
+                 ;; This is a workaround to prevent a build failure. Running
+                 ;; make docs somehow allows it to pass, but the generated
+                 ;; documentation is not pretty.
+                 (catch #t
+                   (lambda _
+                     (invoke "make" "docs"
+                             "TEXDIRECTIVES=\\\\draftfalse"))
+                   (lambda _ #t))
                  ;; This file needs write-permissions, because it's
                  ;; overwritten by 'docs' during documentation generation.
                  (chmod "src/strings.ml" #o600)
@@ -856,14 +1041,14 @@ to the other.")
 (define-public ocaml-findlib
   (package
     (name "ocaml-findlib")
-    (version "1.7.3")
+    (version "1.8.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://download.camlcity.org/download/"
                                   "findlib" "-" version ".tar.gz"))
               (sha256
                (base32
-                "12xx8si1qv3xz90qsrpazjjk4lc1989fzm97rsmc4diwla7n15ni"))))
+                "1b97zqjdriqd2ikgh4rmqajgxwdwn013riji5j53y3xvcmnpsyrb"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("camlp4" ,camlp4)
@@ -912,6 +1097,15 @@ compilation and linkage, there are new frontends of the various OCaml
 compilers that can directly deal with packages.")
     (license license:x11)))
 
+(define-public ocaml4.02-findlib
+  (package
+    (inherit ocaml-findlib)
+    (name "ocaml4.02-findlib")
+    (native-inputs
+     `(("camlp4" ,camlp4-4.02)
+       ("m4" ,m4)
+       ("ocaml" ,ocaml-4.02)))))
+
 (define-public ocaml4.01-findlib
   (package
     (inherit ocaml-findlib)
@@ -933,7 +1127,8 @@ compilers that can directly deal with packages.")
                 "03ifp9hjcxg4m5j190iy373jcn4039d3vy10kmd8p4lfciwzwc1f"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("libxml2" ,libxml2)))           ; for xmllint
+     `(("libxml2" ,libxml2)           ; for xmllint
+       ("ocamlbuild" ,ocamlbuild)))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
@@ -947,6 +1142,9 @@ other XUnit testing frameworks.")
 (define-public ocaml4.01-ounit
   (package-with-ocaml4.01 ocaml-ounit))
 
+(define-public ocaml4.02-ounit
+  (package-with-ocaml4.02 ocaml-ounit))
+
 (define-public camlzip
   (package
     (name "camlzip")
@@ -1007,19 +1205,23 @@ files in these formats.")
           (base32
            "0syh72jk9s0qwjmmfrkqchaj98m020ii082jn38pwnmb6v3p02wk")))))))
 
+(define-public ocaml4.02-camlzip
+  (package-with-ocaml4.02 camlzip))
+
 (define-public ocamlmod
   (package
     (name "ocamlmod")
-    (version "0.0.8")
+    (version "0.0.9")
     (source (origin
               (method url-fetch)
-              (uri (ocaml-forge-uri name version 1544))
+              (uri (ocaml-forge-uri name version 1702))
               (sha256
                (base32
-                "1w0w8lfyymvk300dv13gvhrddpcyknvyp4g2yvq2vaw7khkhjs9g"))))
+                "0cgp9qqrq7ayyhddrmqmq1affvfqcn722qiakjq4dkywvp67h4aa"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("ounit" ,ocaml-ounit)))
+     `(("ounit" ,ocaml-ounit)
+       ("ocamlbuild" ,ocamlbuild)))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
@@ -1030,6 +1232,9 @@ files in these formats.")
     (description "Generate modules from OCaml source files.")
     (license license:lgpl2.1+))) ; with an exception
 
+(define-public ocaml4.02-ocamlmod
+  (package-with-ocaml4.02 ocamlmod))
+
 (define-public ocaml-zarith
   (package
     (name "ocaml-zarith")
@@ -1060,6 +1265,9 @@ over big integers. Small integers are represented as Caml unboxed integers,
 for speed and space economy.")
     (license license:lgpl2.1+))) ; with an exception
 
+(define-public ocaml4.02-zarith
+  (package-with-ocaml4.02 ocaml-zarith))
+
 (define-public ocaml-frontc
   (package
     (name "ocaml-frontc")
@@ -1073,7 +1281,9 @@ for speed and space economy.")
                 "16dz153s92dgbw1rrfwbhscy73did87kfmjwyh3qpvs748h1sc4g"))))
     (build-system ocaml-build-system)
     (arguments
-     `(#:phases
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib
+       #:phases
        (modify-phases %standard-phases
          (delete 'configure)
          (add-after 'install 'install-meta
@@ -1116,7 +1326,8 @@ GNU CC attributes.  It provides also a C pretty printer as an example of use.")
                 "1zs1pg5cb1iry554v3cdmmiglsrwmsqa9x8zxmzb118fnk5d3ha6"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("ounit" ,ocaml-ounit)))
+     `(("ounit" ,ocaml-ounit)
+       ("ocamlbuild" ,ocamlbuild)))
     (home-page "https://github.com/c-cube/qcheck")
     (synopsis "QuickCheck inspired property-based testing for OCaml")
     (description "QuickCheck inspired property-based testing for OCaml. This
@@ -1125,6 +1336,9 @@ generated instances of the type. It provides combinators for generating
 instances and printing them.")
     (license license:lgpl3+)))
 
+(define-public ocaml4.02-qcheck
+  (package-with-ocaml4.02 ocaml-qcheck))
+
 (define-public ocaml-qtest
   (package
     (name "ocaml-qtest")
@@ -1139,7 +1353,7 @@ instances and printing them.")
                 "1ff4if64mc9c7wmhjdgnlnh6k6a713piqzr4043zzj4s5pw7smxk"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("findlib" ,ocaml-findlib)))
+     `(("ocamlbuild" ,ocamlbuild)))
     (propagated-inputs
      `(("ounit" ,ocaml-ounit)
        ("qcheck" ,ocaml-qcheck)))
@@ -1161,6 +1375,9 @@ to use -- to sophisticated random generation of test cases.")
 (define-public ocaml4.01-qtest
   (package-with-ocaml4.01 ocaml-qtest))
 
+(define-public ocaml4.02-qtest
+  (package-with-ocaml4.02 ocaml-qtest))
+
 (define-public ocaml-stringext
   (package
     (name "ocaml-stringext")
@@ -1175,7 +1392,8 @@ to use -- to sophisticated random generation of test cases.")
                 "19g6lfn03iki9f8h91hi0yiqn0b3wkxyq08b3y23wgv6jw6mssfh"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("qtest" ,ocaml-qtest)))
+     `(("ocamlbuild" ,ocamlbuild)
+       ("qtest" ,ocaml-qtest)))
     (home-page "https://github.com/rgrinberg/stringext")
     (synopsis "Extra string functions for OCaml")
     (description "Provides a single module named Stringext that provides a grab
@@ -1185,17 +1403,21 @@ full_split, cut, rcut, etc..")
     ;; where it says `mit'.
     (license license:expat)))
 
+(define-public ocaml4.02-stringext
+  (package-with-ocaml4.02 ocaml-stringext))
 
 (define-public ocaml-bisect
   (package
     (name "ocaml-bisect")
-    (version "1.3")
+    (version "1.3.1")
     (source (origin
               (method url-fetch)
-              (uri (ocaml-forge-uri "bisect" version 1051))
+              (uri (string-append "https://github.com/gasche/bisect/archive/"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "0kcg2rh0qlkfpbv3nhcb75n62b04gbrz0zasq15ynln91zd5qrg0"))
+                "0p67fppk5ifb63b00kxwrb1xg75hrqhknng3bsdyw3gxxqyjlpmx"))
               (patches
                (search-patches
                 "ocaml-bisect-fix-camlp4-in-another-directory.patch"))))
@@ -1203,6 +1425,7 @@ full_split, cut, rcut, etc..")
     (native-inputs
      `(("camlp4" ,camlp4)
        ("libxml2" ,libxml2)
+       ("ocamlbuild" ,ocamlbuild)
        ("which" ,which)))
     (propagated-inputs
      `(("camlp4" ,camlp4)))
@@ -1215,9 +1438,11 @@ full_split, cut, rcut, etc..")
        #:phases
        (modify-phases %standard-phases
          (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             (zero? (system* "./configure" "-prefix"
-                             (assoc-ref outputs "out"))))))))
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (invoke "./configure" "-prefix" (assoc-ref outputs "out")
+                     "-ocaml-prefix" (assoc-ref inputs "ocaml")
+                     "-camlp4-prefix" (assoc-ref inputs "camlp4"))
+             #t)))))
     (home-page "http://bisect.x9c.fr")
     (synopsis "Code coverage tool for the OCaml language")
     (description "Bisect is a code coverage tool for the OCaml language.  It is
@@ -1225,46 +1450,260 @@ a camlp4-based tool that allows to instrument your application before running
 tests.  After application execution, it is possible to generate a report in HTML
 format that is the replica of the application source code annotated with code
 coverage information.")
-    (properties `((ocaml4.01-variant . ,(delay ocaml4.01-bisect))))
+    (properties
+     `((ocaml4.01-variant . ,(delay ocaml4.01-bisect))
+       (ocaml4.02-variant . ,(delay ocaml4.02-bisect))))
     (license license:gpl3+)))
 
 (define-public ocaml4.01-bisect
   (let ((base (package-with-ocaml4.01 (strip-ocaml4.01-variant ocaml-bisect))))
     (package
       (inherit base)
+      (version "1.3")
+      (source (origin
+                (method url-fetch)
+                (uri (string-append "https://github.com/gasche/bisect/archive/"
+                                    version ".tar.gz"))
+                (file-name (string-append "ocaml-bisect-" version ".tar.gz"))
+                (sha256
+                 (base32
+                  "1ip49jqf0kkbrqf8qspmfjbg9ap9fhvjkg718myzix88dg5rv8d4"))))
       (arguments
        `(#:ocaml ,ocaml-4.01
-         ;; Camlp4 is included with OCaml 4.01, so do not include it as a
-         ;; separate input.
-         ,@(strip-keyword-arguments '(#:make-flags) (package-arguments base))))
+         ,@(substitute-keyword-arguments (package-arguments ocaml-bisect)
+            ((#:make-flags flags)
+             `(list "all"))
+            ((#:phases phases)
+             `(modify-phases ,phases
+                (replace 'configure
+                  (lambda* (#:key inputs outputs #:allow-other-keys)
+                    (invoke "./configure"
+                            "-ocaml-prefix" (assoc-ref inputs "ocaml"))
+                    #t)))))))
       (native-inputs `(,@(alist-delete "camlp4" (package-native-inputs base))))
       (propagated-inputs
        `(,@(alist-delete "camlp4" (package-propagated-inputs base)))))))
 
+(define-public ocaml4.02-bisect
+  (let ((base (package-with-ocaml4.02 (strip-ocaml4.02-variant ocaml-bisect))))
+    (package
+      (inherit base)
+      (native-inputs
+       `(("camlp4" ,camlp4-4.02)
+         ("libxml2" ,libxml2)
+         ("which" ,which)))
+      (propagated-inputs
+       `(("camlp4" ,camlp4-4.02))))))
+
+(define-public dune
+  (package
+    (name "dune")
+    (version "1.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/ocaml/dune/releases/"
+                                  "download/" version "/dune-" version ".tbz"))
+              (sha256
+               (base32
+                "00c5dbm4hkdapc2i7pg07b2lj8sv6ly38qr7zid58cdmbmzq21z9"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:tests? #f; require odoc
+       #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "./configure")
+             #t)))))
+    (home-page "https://github.com/ocaml/dune")
+    (synopsis "OCaml build system")
+    (description "Dune is a build system that was designed to simplify the
+release of Jane Street packages.  It reads metadata from @file{dune} files
+following a very simple s-expression syntax.")
+    (license license:expat)))
+
+(define-public ocaml-migrate-parsetree
+  (package
+    (name "ocaml-migrate-parsetree")
+    (version "1.1.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/ocaml-ppx/"
+                                  "ocaml-migrate-parsetree/releases/download/v"
+                                  version "/ocaml-migrate-parsetree-"
+                                  version ".tbz"))
+              (sha256
+               (base32
+                "01zjp1q4hryqaxv4apkjd868fycz2kf887r6lkb6x2a545h1lh7f"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (invoke "jbuilder" "build" "@install")
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "jbuilder" "install"
+                     "--prefix" (assoc-ref outputs "out"))
+             #t)))))
+    (propagated-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("ocaml-result" ,ocaml-result)))
+    (native-inputs
+     `(("dune" ,dune)))
+    (home-page "https://github.com/ocaml-ppx/ocaml-migrate-parsetree")
+    (synopsis "OCaml parsetree convertor")
+    (description "This library converts between parsetrees of different OCaml
+versions.  For each version, there is a snapshot of the parsetree and conversion
+functions to the next and/or previous version.")
+    (license license:lgpl2.1+)))
+ 
+(define-public ocaml-ppx-tools-versioned
+  (package
+    (name "ocaml-ppx-tools-versioned")
+    (version "5.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/ocaml-ppx/"
+                                  "ppx_tools_versioned/archive/"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1x2xfjpkzbcz4rza1d7gh3ipliw6jqfcklbsln82v3561qgkqgmh"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (invoke "dune" "build" "@install")
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "dune" "install"
+                     "--prefix" (assoc-ref outputs "out"))
+             #t)))))
+    (native-inputs
+     `(("dune" ,dune)))
+    (propagated-inputs
+     `(("ocaml-migrate-parsetree" ,ocaml-migrate-parsetree)))
+    (home-page "https://github.com/let-def/ppx_tools_versioned")
+    (synopsis "Variant of ppx_tools")
+    (description "This package is a variant of ppx_tools based on
+ocaml-migrate-parsetree")
+    (license license:expat)))
+
+(define-public ocaml-ppx-tools-versioned
+  (package
+    (name "ocaml-ppx-tools-versioned")
+    (version "5.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/ocaml-ppx/"
+                                  "ppx_tools_versioned/archive/"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1x2xfjpkzbcz4rza1d7gh3ipliw6jqfcklbsln82v3561qgkqgmh"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (invoke "dune" "build" "@install")
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "dune" "install"
+                     "--prefix" (assoc-ref outputs "out"))
+             #t)))))
+    (native-inputs
+     `(("dune" ,dune)))
+    (propagated-inputs
+     `(("ocaml-migrate-parsetree" ,ocaml-migrate-parsetree)))
+    (home-page "https://github.com/let-def/ppx_tools_versioned")
+    (synopsis "Variant of ppx_tools")
+    (description "This package is a variant of ppx_tools based on
+ocaml-migrate-parsetree")
+    (license license:expat)))
+
 (define-public ocaml-bitstring
   (package
     (name "ocaml-bitstring")
-    (version "2.1.1")
+    (version "3.1.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append "https://github.com/xguerin/bitstring"
-                                  "/archive/v" version ".tar.gz"))
+              (uri (string-append "https://bitbucket.org/thanatonauts/bitstring/"
+                                  "get/v" version ".tar.gz"))
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "0vy8ibrxccii1jbsk5q6yh1kxjigqvi7lhhcmizvd5gfhf7mfyc8"))
-              (patches (search-patches "ocaml-bitstring-fix-configure.patch"))))
+                "15jjk2pq1vx311gl49s5ag6x5y0654x35w75z07g7kr2q334hqps"))))
     (build-system ocaml-build-system)
     (native-inputs
      `(("camlp4" ,camlp4)
        ("time" ,time)
        ("autoconf" ,autoconf)
        ("automake" ,automake)
-       ("bisect" ,ocaml-bisect)))
+       ("bisect" ,ocaml-bisect)
+       ("dune" ,dune)))
     (propagated-inputs
-     `(("camlp4" ,camlp4)))
+     `(("camlp4" ,camlp4)
+       ("ocaml-ppx-tools-versioned" ,ocaml-ppx-tools-versioned)))
     (arguments
-     `(#:configure-flags
+     `(#:tests? #f; Tests fail to build
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (invoke "jbuilder" "build" "@install")
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "dune" "install"
+                     "--prefix" (assoc-ref outputs "out"))
+             #t)))))
+    (properties
+      `((ocaml4.02-variant . ,(delay ocaml4.02-bitstring))))
+    (home-page "https://github.com/xguerin/bitstring")
+    (synopsis "Bitstrings and bitstring matching for OCaml")
+    (description "Adds Erlang-style bitstrings and matching over bitstrings as
+a syntax extension and library for OCaml.  You can use this module to both parse
+and generate binary formats, files and protocols.  Bitstring handling is added
+as primitives to the language, making it exceptionally simple to use and very
+powerful.")
+    (license license:isc)))
+ 
+(define-public ocaml4.02-bitstring
+  (let ((base (package-with-ocaml4.02 (strip-ocaml4.02-variant ocaml-bitstring))))
+    (package
+      (inherit base)
+      (version "2.1.1")
+      (source (origin
+                (method url-fetch)
+                (uri (string-append "https://github.com/xguerin/bitstring"
+                                    "/archive/v" version ".tar.gz"))
+                (file-name (string-append "ocaml-bitstring-" version ".tar.gz"))
+                (sha256
+                 (base32
+                  "0vy8ibrxccii1jbsk5q6yh1kxjigqvi7lhhcmizvd5gfhf7mfyc8"))
+                (patches (search-patches "ocaml-bitstring-fix-configure.patch"))))
+    (arguments
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib
+       #:configure-flags
        (list "CAMLP4OF=camlp4of" "--enable-coverage")
        #:make-flags
        (list (string-append "BISECTLIB="
@@ -1280,14 +1719,6 @@ coverage information.")
                             "$(BISECTLIB)/bisect"))
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'fix-configure
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* "Makefile.in"
-               (("@abs_top_builddir@")
-                (string-append "@abs_top_builddir@:" (getenv "LIBRARY_PATH"))))
-             (substitute* "configure"
-               (("-/bin/sh") (string-append "-" (assoc-ref inputs "bash")
-                                            "/bin/sh")))))
          (add-after 'install 'link-lib
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -1297,15 +1728,24 @@ coverage information.")
                                         "/lib/ocaml/site-lib/bitstring")))
                (mkdir-p stubs)
                (symlink (string-append lib "/dllbitstring.so")
-                        (string-append stubs "/dllbitstring.so"))))))))
-    (home-page "https://github.com/xguerin/bitstring")
-    (synopsis "Bitstrings and bitstring matching for OCaml")
-    (description "Adds Erlang-style bitstrings and matching over bitstrings as
-a syntax extension and library for OCaml.  You can use this module to both parse
-and generate binary formats, files and protocols.  Bitstring handling is added
-as primitives to the language, making it exceptionally simple to use and very
-powerful.")
-    (license license:isc)))
+                        (string-append stubs "/dllbitstring.so")))
+             #t))
+         (add-before 'configure 'fix-configure
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "Makefile.in"
+               (("@abs_top_builddir@")
+                (string-append "@abs_top_builddir@:" (getenv "LIBRARY_PATH"))))
+             (substitute* "configure"
+               (("-/bin/sh") (string-append "-" (assoc-ref inputs "bash")
+                                            "/bin/sh"))))))))
+      (native-inputs
+       `(("camlp4" ,camlp4-4.02)
+         ("time" ,time)
+         ("autoconf" ,autoconf)
+         ("automake" ,automake)
+         ("bisect" ,ocaml4.02-bisect)))
+      (propagated-inputs
+       `(("camlp4" ,camlp4-4.02))))))
 
 (define-public ocaml-result
   (package
@@ -1331,6 +1771,9 @@ powerful.")
 staying compatible with older version of OCaml should use the Result module
 defined in this library.")
     (license license:bsd-3)))
+ 
+(define-public ocaml4.02-result
+  (package-with-ocaml4.02 ocaml-result))
 
 (define-public ocaml-topkg
   (package
@@ -1345,7 +1788,8 @@ defined in this library.")
                 "18rrh6fmf708z7dd30amljmcgaypj3kk49jrmrj68r4wnw8004j8"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("opam" ,opam)))
+     `(("opam" ,opam)
+       ("ocamlbuild" ,ocamlbuild)))
     (propagated-inputs
      `(("result" ,ocaml-result)))
     (arguments
@@ -1361,6 +1805,9 @@ provides an API to describe the files a package installs in a given build
 configuration and to specify information about the package's distribution,
 creation and publication procedures.")
     (license license:isc)))
+ 
+(define-public ocaml4.02-topkg
+  (package-with-ocaml4.02 ocaml-topkg))
 
 (define-public ocaml-rresult
   (package
@@ -1375,7 +1822,8 @@ creation and publication procedures.")
                 "1xxycxhdhaq8p9vhwi93s2mlxjwgm44fcxybx5vghzgbankz9yhm"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("opam" ,opam)))
+     `(("opam" ,opam)
+       ("ocamlbuild" ,ocamlbuild)))
     (propagated-inputs
      `(("topkg" ,ocaml-topkg)))
     (arguments
@@ -1392,6 +1840,9 @@ to operate on the result type available from OCaml 4.03 in the standard
 library.")
     (license license:isc)))
 
+(define-public ocaml4.02-rresult
+  (package-with-ocaml4.02 ocaml-rresult))
+
 (define-public ocaml-sqlite3
   (package
     (name "ocaml-sqlite3")
@@ -1407,7 +1858,8 @@ library.")
          "14c1nir7c6bivajg0vyx853y7la7r5d25g1v5hjb2wfi73r15p1m"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("pkg-config" ,pkg-config)))
+     `(("ocamlbuild" ,ocamlbuild)
+       ("pkg-config" ,pkg-config)))
     (inputs
      `(("sqlite" ,sqlite)))
     (home-page "https://mmottl.github.io/sqlite3-ocaml")
@@ -1424,6 +1876,9 @@ coexistence with the old (version 2) SQLite and its OCaml wrapper
 (define-public ocaml4.01-sqlite3
   (package-with-ocaml4.01 ocaml-sqlite3))
 
+(define-public ocaml4.02-sqlite3
+  (package-with-ocaml4.02 ocaml-sqlite3))
+
 (define-public ocaml-csv
   (package
     (name "ocaml-csv")
@@ -1439,6 +1894,8 @@ coexistence with the old (version 2) SQLite and its OCaml wrapper
         (base32
          "0rv7x843vn6scxj87hzl01yqrl26rc27lr8s7z6rp9vs745g05zj"))))
     (build-system ocaml-build-system)
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)))
     (home-page "https://github.com/Chris00/ocaml-csv")
     (synopsis "Pure OCaml functions to read and write CSV")
     (description
@@ -1451,6 +1908,9 @@ manipulate such data.")
 (define-public ocaml4.01-csv
   (package-with-ocaml4.01 ocaml-csv))
 
+(define-public ocaml4.02-csv
+  (package-with-ocaml4.02 ocaml-csv))
+
 (define-public ocaml-mtime
   (package
     (name "ocaml-mtime")
@@ -1464,7 +1924,8 @@ manipulate such data.")
                 "1hfx4ny2dkw6jf3jppz0640dafl5xgn8r2si9kpwzhmibal8qrah"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("opam" ,opam)))
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)))
     (propagated-inputs
      `(("topkg" ,ocaml-topkg)))
     (arguments
@@ -1480,6 +1941,9 @@ manipulate such data.")
 spans without being subject to operating system calendar time adjustments.")
     (license license:isc)))
 
+(define-public ocaml4.02-mtime
+  (package-with-ocaml4.02 ocaml-mtime))
+
 (define-public ocaml-cmdliner
   (package
     (name "ocaml-cmdliner")
@@ -1493,7 +1957,8 @@ spans without being subject to operating system calendar time adjustments.")
                 "0hdxlkgiwjml9dpaa80282a8350if7mc1m6yz2mrd7gci3fszykx"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("opam" ,opam)))
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)))
     (arguments
      `(#:tests? #f
        #:build-flags '("native=true" "native-dynlink=true")
@@ -1510,6 +1975,9 @@ generation. It supports programs with single or multiple commands and respects
 most of the POSIX and GNU conventions.")
     (license license:bsd-3)))
 
+(define-public ocaml4.02-cmdliner
+  (package-with-ocaml4.02 ocaml-cmdliner))
+
 (define-public ocaml-fmt
   (package
     (name "ocaml-fmt")
@@ -1522,10 +1990,13 @@ most of the POSIX and GNU conventions.")
         (sha256 (base32
                   "16y7ibndnairb53j8a6qgipyqwjxncn4pl9jiw5bxjfjm59108px"))))
     (build-system ocaml-build-system)
-    (native-inputs `(("opam" ,opam)
-                     ("topkg" ,ocaml-topkg)))
-    (propagated-inputs `(("result" ,ocaml-result)
-                         ("cmdliner" ,ocaml-cmdliner)))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)
+       ("topkg" ,ocaml-topkg)))
+    (propagated-inputs
+     `(("result" ,ocaml-result)
+       ("cmdliner" ,ocaml-cmdliner)))
     (arguments `(#:tests? #f
                  #:build-flags (list "build" "--with-base-unix" "true"
                                      "--with-cmdliner" "true")
@@ -1538,6 +2009,9 @@ most of the POSIX and GNU conventions.")
 functions.")
     (license license:isc)))
 
+(define-public ocaml4.02-fmt
+  (package-with-ocaml4.02 ocaml-fmt))
+
 (define-public ocaml-astring
   (package
     (name "ocaml-astring")
@@ -1550,13 +2024,16 @@ functions.")
         (sha256 (base32
                   "0ixjwc3plrljvj24za3l9gy0w30lsbggp8yh02lwrzw61ls4cri0"))))
     (build-system ocaml-build-system)
-    (native-inputs `(("opam" ,opam)
-                     ("topkg" ,ocaml-topkg)))
-    (arguments `(#:tests? #f
-                 #:build-flags (list "build")
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)
+       ("topkg" ,ocaml-topkg)))
+    (arguments
+     `(#:tests? #f
+       #:build-flags (list "build")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
     (home-page "http://erratique.ch/software/astring")
     (synopsis "Alternative String module for OCaml")
     (description "Astring exposes an alternative String module for OCaml.  This
@@ -1568,6 +2045,9 @@ adds a few missing functions and fully exploits OCaml's newfound string
 immutability.")
     (license license:isc)))
 
+(define-public ocaml4.02-astring
+  (package-with-ocaml4.02 ocaml-astring))
+
 (define-public ocaml-alcotest
   (package
     (name "ocaml-alcotest")
@@ -1580,15 +2060,19 @@ immutability.")
                 (base32
                   "0g5lzk0gpfx4q8hyhr460gr4lab5wakfxsmhfwvb3yinxwzs95gc"))))
     (build-system ocaml-build-system)
-    (arguments `(#:tests? #f
-                 #:build-flags (list "build")
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure))))
-    (native-inputs `(("opam" ,opam)
-                     ("topkg" ,ocaml-topkg)))
-    (propagated-inputs `(("fmt" ,ocaml-fmt)
-                         ("astring" ,ocaml-astring)))
+    (arguments
+     `(#:tests? #f
+       #:build-flags (list "build")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)
+       ("topkg" ,ocaml-topkg)))
+    (propagated-inputs
+     `(("fmt" ,ocaml-fmt)
+       ("astring" ,ocaml-astring)))
     (home-page "https://github.com/mirage/alcotest")
     (synopsis "Lightweight OCaml test framework")
     (description "Alcotest exposes simple interface to perform unit tests.  It
@@ -1599,25 +2083,44 @@ displayed at the end of the run (with the full logs ready to inspect), with a
 simple (yet expressive) query language to select the tests to run.")
     (license license:isc)))
 
+(define-public ocaml4.02-alcotest
+  (package-with-ocaml4.02 ocaml-alcotest))
+
 (define-public ocaml-ppx-tools
   (package
     (name "ocaml-ppx-tools")
-    (version "5.0+4.02.0")
+    (version "5.1+4.06.0")
     (source
       (origin
         (method url-fetch)
         (uri (string-append "https://github.com/alainfrisch/ppx_tools/archive/"
                             version ".tar.gz"))
         (sha256 (base32
-                  "0rjg4rngi8k9873z4zq95zn9hj8qyw1vcrf11y15aqasfpqq16rc"))))
+                  "0mncpy9v2mcjgnj7s2vqpp2b1ixv54djicfx66ic9wny9d202gj1"))))
     (build-system ocaml-build-system)
-    (arguments `(#:phases (modify-phases %standard-phases (delete 'configure))
-                 #:tests? #f))
+    (arguments
+     `(#:phases (modify-phases %standard-phases (delete 'configure))
+       #:tests? #f))
+    (properties
+      `((ocaml4.02-variant . ,(delay ocaml4.02-ppx-tools))))
     (home-page "https://github.com/alainfrisch/ppx_tools")
     (synopsis "Tools for authors of ppx rewriters and other syntactic tools")
     (description "Tools for authors of ppx rewriters and other syntactic tools.")
     (license license:expat)))
 
+(define-public ocaml4.02-ppx-tools
+  (let ((base (package-with-ocaml4.02 (strip-ocaml4.02-variant ocaml-ppx-tools))))
+    (package
+      (inherit base)
+      (version "5.0+4.02.0")
+      (source
+        (origin
+          (method url-fetch)
+          (uri (string-append "https://github.com/alainfrisch/ppx_tools/archive/"
+                              version ".tar.gz"))
+          (sha256 (base32
+                    "0rjg4rngi8k9873z4zq95zn9hj8qyw1vcrf11y15aqasfpqq16rc")))))))
+
 (define-public ocaml-react
   (package
     (name "ocaml-react")
@@ -1630,12 +2133,15 @@ simple (yet expressive) query language to select the tests to run.")
         (sha256 (base32
                   "0knhgbngphv5sp1yskfd97crf169qhpc0igr6w7vqw0q36lswyl8"))))
     (build-system ocaml-build-system)
-    (native-inputs `(("opam" ,opam)))
-    (arguments `(#:tests? #f
-                 #:build-flags (list "native=true" "native-dynlink=true")
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)))
+    (arguments
+     `(#:tests? #f
+       #:build-flags (list "native=true" "native-dynlink=true")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
     (home-page "http://erratique.ch/software/react")
     (synopsis "Declarative events and signals for OCaml")
     (description "React is an OCaml module for functional reactive programming
@@ -1644,6 +2150,9 @@ events and signals.  React doesn't define any primitive event or signal, it
 lets the client choose the concrete timeline.")
     (license license:bsd-3)))
 
+(define-public ocaml4.02-react
+  (package-with-ocaml4.02 ocaml-react))
+
 (define-public ocaml-ssl
   (package
     (name "ocaml-ssl")
@@ -1658,20 +2167,23 @@ lets the client choose the concrete timeline.")
         (sha256 (base32
                   "0fviq8xhp3qk7pmkl7knchywsipxgb7p0z489hj8qnf2sx8xzdmy"))))
     (build-system ocaml-build-system)
-    (arguments `(#:tests? #f
-                 #:make-flags (list "OCAMLFIND_LDCONF=ignore")
-                 #:phases
-                 (modify-phases %standard-phases
-                   (add-after 'unpack 'bootstrap
-                     (lambda* (#:key #:allow-other-keys)
-                       (system* "sh" "bootstrap")
-                       (substitute* "src/OCamlMakefile"
-                         (("/bin/sh") (which "bash")))
-                       (substitute* "configure"
-                         (("/bin/sh") (which "bash"))))))))
-    (native-inputs `(("autoconf" ,autoconf)
-                     ("automake" ,automake)
-                     ("which" ,which)))
+    (arguments
+     `(#:tests? #f
+       #:make-flags (list "OCAMLFIND_LDCONF=ignore")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'bootstrap
+           (lambda* (#:key #:allow-other-keys)
+             (system* "sh" "bootstrap")
+             (substitute* "src/OCamlMakefile"
+               (("/bin/sh") (which "bash")))
+             (substitute* "configure"
+               (("/bin/sh") (which "bash")))
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("which" ,which)))
     (propagated-inputs `(("openssl" ,openssl)))
     (home-page "https://github.com/savonet/ocaml-ssl/")
     (synopsis "OCaml bindings for OpenSSL")
@@ -1680,10 +2192,13 @@ lets the client choose the concrete timeline.")
 through Transport Layer Security (@dfn{TLS}) encrypted connections.")
     (license license:lgpl2.1)))
 
+(define-public ocaml4.02-ssl
+  (package-with-ocaml4.02 ocaml-ssl))
+
 (define-public ocaml-lwt
   (package
     (name "ocaml-lwt")
-    (version "2.6.0")
+    (version "4.1.0")
     (source
       (origin
         (method url-fetch)
@@ -1691,35 +2206,37 @@ through Transport Layer Security (@dfn{TLS}) encrypted connections.")
                             ".tar.gz"))
         (file-name (string-append name "-" version ".tar.gz"))
         (sha256 (base32
-                  "1gbw0g8a5a4b16diqrmlhc8ilnikrm4w3jjm1zq310maqg8z0zxz"))))
+                  "0mhh019bjkg5xfvpy1pxs4xdxb759fyydmgb6l4j0qww1qgr8klp"))))
     (build-system ocaml-build-system)
     (arguments
-     `(#:configure-flags
-       (list "--enable-ssl" "--enable-glib" "--enable-react"
-             "--enable-ppx")
+     `(#:tests? #f; require lwt_ppx
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'disable-some-checks
-           (lambda* (#:key #:allow-other-keys)
-             (substitute* "tests/unix/main.ml"
-               (("Test_mcast.suite;") ""))))
-         (add-after 'install 'link-stubs
+         (replace 'configure
+           (lambda _
+             (invoke "ocaml" "src/util/configure.ml" "-use-libev" "true")
+             #t))
+         (replace 'build
+           (lambda _
+             (invoke "jbuilder" "build" "@install")
+             #t))
+         (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (stubs (string-append out "/lib/ocaml/site-lib/stubslibs"))
-                    (lib (string-append out "/lib/ocaml/site-lib/lwt")))
-               (mkdir-p stubs)
-               (symlink (string-append lib "/dlllwt-glib_stubs.so")
-                        (string-append stubs "/dlllwt-glib_stubs.so"))
-               (symlink (string-append lib "/dlllwt-unix_stubs.so")
-                        (string-append stubs "/dlllwt-unix_stubs.so"))))))))
-    (native-inputs `(("pkg-config" ,pkg-config)
-                     ("ppx-tools" ,ocaml-ppx-tools)))
-    (inputs `(("libev" ,libev)
-              ("glib" ,glib)))
-    (propagated-inputs `(("result" ,ocaml-result)
-                         ("ocaml-ssl" ,ocaml-ssl)
-                         ("ocaml-react" ,ocaml-react)))
+             (invoke "jbuilder" "install" "--prefix" (assoc-ref outputs "out"))
+             #t)))))
+    (native-inputs
+     `(("dune" ,dune)
+       ("ocaml-cppo" ,ocaml-cppo)
+       ("ocaml-migrate-parsetree" ,ocaml-migrate-parsetree)
+       ("pkg-config" ,pkg-config)
+       ("ppx-tools-versioned" ,ocaml-ppx-tools-versioned)))
+    (inputs
+     `(("libev" ,libev)
+       ("glib" ,glib)))
+    (propagated-inputs
+     `(("result" ,ocaml-result)
+       ("ocaml-ssl" ,ocaml-ssl)
+       ("ocaml-react" ,ocaml-react)))
     (home-page "https://github.com/ocsigen/lwt")
     (synopsis "Cooperative threads and I/O in monadic style")
     (description "Lwt provides typed, composable cooperative threads.  These
@@ -1728,6 +2245,48 @@ process.  Also, in many cases, Lwt threads can interact without the need for
 locks or other synchronization primitives.")
     (license license:lgpl2.1)))
 
+(define-public ocaml4.02-lwt
+  (package-with-ocaml4.02 ocaml-lwt))
+
+(define-public ocaml-lwt-log
+  (package
+    (name "ocaml-lwt-log")
+    (version "1.1.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/aantron/lwt_log/archive/" version
+                            ".tar.gz"))
+        (file-name (string-append name "-" version ".tar.gz"))
+        (sha256 (base32
+                  "1lr62j2266pbsi54xmzsfvl2z7fi7smhak7fp1ybl8hssxwi6in2"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:tests? #f; require lwt_ppx
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (invoke "jbuilder" "build" "@install")
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "jbuilder" "install" "--prefix" (assoc-ref outputs "out"))
+             #t)))))
+    (native-inputs
+     `(("dune" ,dune)))
+    (propagated-inputs
+     `(("lwt" ,ocaml-lwt)))
+    (home-page "https://github.com/aantron/lwt_log")
+    (synopsis "Logging library")
+    (description "This package provides a deprecated logging component for
+ocaml lwt.")
+    (license license:lgpl2.1)))
+
+(define-public ocaml4.02-lwt-log
+  (package-with-ocaml4.02 ocaml-lwt-log))
+
 (define-public ocaml-logs
   (package
     (name "ocaml-logs")
@@ -1740,18 +2299,22 @@ locks or other synchronization primitives.")
                 (base32
                   "1khbn7jqpid83zn8rvyh1x1sirls7zc878zj4fz985m5xlsfy853"))))
     (build-system ocaml-build-system)
-    (arguments `(#:tests? #f
-                 #:build-flags (list "build" "--with-js_of_ocaml" "false")
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure))))
-    (native-inputs `(("opam" ,opam)))
-    (propagated-inputs `(("fmt" ,ocaml-fmt)
-                         ("lwt" ,ocaml-lwt)
-                         ("mtime" ,ocaml-mtime)
-                         ("result" ,ocaml-result)
-                         ("cmdliner" ,ocaml-cmdliner)
-                         ("topkg" ,ocaml-topkg)))
+    (arguments
+     `(#:tests? #f
+       #:build-flags (list "build" "--with-js_of_ocaml" "false")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)))
+    (propagated-inputs
+     `(("fmt" ,ocaml-fmt)
+       ("lwt" ,ocaml-lwt)
+       ("mtime" ,ocaml-mtime)
+       ("result" ,ocaml-result)
+       ("cmdliner" ,ocaml-cmdliner)
+       ("topkg" ,ocaml-topkg)))
     (home-page "http://erratique.ch/software/logs")
     (synopsis "Logging infrastructure for OCaml")
     (description "Logs provides a logging infrastructure for OCaml.  Logging is
@@ -1759,6 +2322,9 @@ performed on sources whose reporting level can be set independently.  Log
 message report is decoupled from logging and is handled by a reporter.")
     (license license:isc)))
 
+(define-public ocaml4.02-logs
+  (package-with-ocaml4.02 ocaml-logs))
+
 (define-public ocaml-fpath
   (package
     (name "ocaml-fpath")
@@ -1771,14 +2337,18 @@ message report is decoupled from logging and is handled by a reporter.")
                 (base32
                   "05134ij27xjl6gaqsc65yl19vfj6cjxq3mbm9bf4mija8grdpn6g"))))
     (build-system ocaml-build-system)
-    (arguments `(#:tests? #f
-                 #:build-flags (list "build")
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure))))
-    (native-inputs `(("opam" ,opam)))
-    (propagated-inputs `(("topkg" ,ocaml-topkg)
-                         ("astring" ,ocaml-astring)))
+    (arguments
+     `(#:tests? #f
+       #:build-flags (list "build")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)))
+    (propagated-inputs
+     `(("topkg" ,ocaml-topkg)
+       ("astring" ,ocaml-astring)))
     (home-page "http://erratique.ch/software/fpath")
     (synopsis "File system paths for OCaml")
     (description "Fpath is an OCaml module for handling file system paths with
@@ -1786,6 +2356,9 @@ POSIX or Windows conventions.  Fpath processes paths without accessing the
 file system and is independent from any system library.")
     (license license:isc)))
 
+(define-public ocaml4.02-fpath
+  (package-with-ocaml4.02 ocaml-fpath))
+
 (define-public ocaml-bos
   (package
     (name "ocaml-bos")
@@ -1798,18 +2371,22 @@ file system and is independent from any system library.")
                 (base32
                   "1ly66lysk4w6mdy4k1n3ynlpfpq7lw4wshcpzgx58v6x613w5s7q"))))
     (build-system ocaml-build-system)
-    (arguments `(#:tests? #f
-                 #:build-flags (list "build")
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure))))
-    (native-inputs `(("opam" ,opam)))
-    (propagated-inputs `(("topkg" ,ocaml-topkg)
-                         ("astring" ,ocaml-astring)
-                         ("fmt" ,ocaml-fmt)
-                         ("fpath" ,ocaml-fpath)
-                         ("logs" ,ocaml-logs)
-                         ("rresult" ,ocaml-rresult)))
+    (arguments
+     `(#:tests? #f
+       #:build-flags (list "build")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)))
+    (propagated-inputs
+     `(("topkg" ,ocaml-topkg)
+       ("astring" ,ocaml-astring)
+       ("fmt" ,ocaml-fmt)
+       ("fpath" ,ocaml-fpath)
+       ("logs" ,ocaml-logs)
+       ("rresult" ,ocaml-rresult)))
     (home-page "http://erratique.ch/software/bos")
     (synopsis "Basic OS interaction for OCaml")
     (description "Bos provides support for basic and robust interaction with
@@ -1818,26 +2395,31 @@ environment, parse command line arguments, interact with the file system and
 run command line programs.")
     (license license:isc)))
 
+(define-public ocaml4.02-bos
+  (package-with-ocaml4.02 ocaml-bos))
+
 (define-public ocaml-xmlm
   (package
     (name "ocaml-xmlm")
-    (version "1.2.0")
+    (version "1.3.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://erratique.ch/software/xmlm/releases/"
                                   "xmlm-" version ".tbz"))
               (sha256
                 (base32
-                  "1jywcrwn5z3gkgvicr004cxmdaqfmq8wh72f81jqz56iyn5024nh"))))
+                  "1rrdxg5kh9zaqmgapy9bhdqyxbbvxxib3bdfg1vhw4rrkp1z0x8n"))))
     (build-system ocaml-build-system)
-    (arguments `(#:tests? #f
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure)
-                   (replace 'build
-                     (lambda* (#:key #:allow-other-keys)
-                       (zero? (system* "pkg/build" "true")))))))
-    (native-inputs `(("opam" ,opam)))
+    (arguments
+     `(#:tests? #f
+       #:build-flags (list "build")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("ocaml-topkg" ,ocaml-topkg)
+       ("opam" ,opam)))
     (home-page "http://erratique.ch/software/xmlm")
     (synopsis "Streaming XML codec for OCaml")
     (description "Xmlm is a streaming codec to decode and encode the XML data
@@ -1848,32 +2430,41 @@ representation of the data.")
 (define-public ocaml4.01-xmlm
   (package-with-ocaml4.01 ocaml-xmlm))
 
+(define-public ocaml4.02-xmlm
+  (package-with-ocaml4.02 ocaml-xmlm))
+
 (define-public ocaml-ulex
   (package
     (name "ocaml-ulex")
-    (version "1.1")
+    (version "1.2")
     (source (origin
               (method url-fetch)
-              (uri (string-append "http://www.cduce.org/download/ulex-"
+              (uri (string-append "https://github.com/whitequark/ulex/archive/v"
                                   version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                 (base32
-                  "0fjlkwps14adfgxdrbb4yg65fhyimplvjjs1xqj5np197cig67x0"))))
+                  "16gnbhqs6y2v89vw4igzvxdf2g8ybh5643636824aldcv8sscac0"))))
     (build-system ocaml-build-system)
-    (arguments `(#:phases (modify-phases %standard-phases (delete 'configure))
-                 #:tests? #f
-                 #:make-flags
-                 (list "all.opt"
-                       (string-append "OCAMLBUILD=ocamlbuild -byte-plugin "
-                                      "-cflags -I,"
-                                      (assoc-ref %build-inputs "camlp4")
-                                      "/lib/ocaml/site-lib/camlp4"))))
-    (native-inputs `(("camlp4" ,camlp4)))
+    (arguments
+     `(#:phases (modify-phases %standard-phases (delete 'configure))
+       #:tests? #f
+       #:make-flags
+       (list "all.opt"
+             (string-append "OCAMLBUILD=ocamlbuild -byte-plugin "
+                            "-cflags -I," (assoc-ref %build-inputs "camlp4")
+                            "/lib/ocaml/site-lib/camlp4"))))
+    (native-inputs
+     `(("camlp4" ,camlp4)
+       ("ocamlbuild" ,ocamlbuild)))
     (home-page "http://www.cduce.org/download.html#side")
     (synopsis "Lexer generator for Unicode and OCaml")
     (description "Lexer generator for Unicode and OCaml.")
     (license license:expat)))
 
+(define-public ocaml4.02-ulex
+  (package-with-ocaml4.02 ocaml-ulex))
+
 (define-public ocaml-uchar
   (package
     (name "ocaml-uchar")
@@ -1886,39 +2477,49 @@ representation of the data.")
         (sha256 (base32
                   "0ficw1x7ymbd6m8hqw3w1aycwm1hbwd6bad3c5pspwnzh3qlikhi"))))
     (build-system ocaml-build-system)
-    (arguments `(#:tests? #f
-                 #:build-flags (list "native=true" "native-dynlink=true")
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure))))
-    (native-inputs `(("opam" ,opam)))
+    (arguments
+     `(#:tests? #f
+       #:build-flags (list "native=true" "native-dynlink=true")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)))
     (home-page "https://github.com/ocaml/uchar")
     (synopsis "Compatibility library for OCaml's Uchar module")
     (description "The uchar package provides a compatibility library for the
 `Uchar` module introduced in OCaml 4.03.")
     (license license:lgpl2.1)))
 
+(define-public ocaml4.02-uchar
+  (package-with-ocaml4.02 ocaml-uchar))
+
 (define-public ocaml-uutf
   (package
     (name "ocaml-uutf")
-    (version "1.0.0")
+    (version "1.0.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://erratique.ch/software/uutf/releases/"
                                   "uutf-" version ".tbz"))
               (sha256
                 (base32
-                  "08i0cw02cxw4mi2rs01v9xi307qshs6fnd1dlqyb52kcxzblpp37"))))
+                  "1gp96dcggq7s84934vimxh89caaxa77lqiff1yywbwkilkkjcfqj"))))
     (build-system ocaml-build-system)
-    (arguments `(#:tests? #f
-                 #:build-flags (list "build")
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure))))
-    (native-inputs `(("opam" ,opam)
-                     ("topkg" ,ocaml-topkg)))
-    (propagated-inputs `(("uchar" ,ocaml-uchar)
-                         ("cmdliner" ,ocaml-cmdliner)))
+    (arguments
+     `(#:tests? #f
+       #:build-flags (list "build")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)
+       ("topkg" ,ocaml-topkg)))
+    (propagated-inputs
+     `(("uchar" ,ocaml-uchar)
+       ("cmdliner" ,ocaml-cmdliner)))
     (home-page "http://erratique.ch/software/uutf")
     (synopsis "Non-blocking streaming Unicode codec for OCaml")
     (description "Uutf is a non-blocking streaming codec to decode and encode
@@ -1930,27 +2531,34 @@ Functions are also provided to fold over the characters of UTF encoded OCaml
 string values and to directly encode characters in OCaml Buffer.t values.")
     (license license:isc)))
 
+(define-public ocaml4.02-uutf
+  (package-with-ocaml4.02 ocaml-uutf))
+
 (define-public ocaml-jsonm
   (package
     (name "ocaml-jsonm")
-    (version "1.0.0")
+    (version "1.0.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://erratique.ch/software/jsonm/releases/"
                                   "jsonm-" version ".tbz"))
               (sha256
                 (base32
-                  "1v3ln6d965lplj28snjdqdqablpp1kx8bw2cfx0m6i157mqyln62"))))
+                  "1176dcmxb11fnw49b7yysvkjh0kpzx4s48lmdn5psq9vshp5c29w"))))
     (build-system ocaml-build-system)
-    (arguments `(#:tests? #f
-                 #:build-flags (list "build")
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure))))
-    (native-inputs `(("opam" ,opam)
-                     ("topkg" ,ocaml-topkg)))
-    (propagated-inputs `(("uutf" ,ocaml-uutf)
-                         ("cmdliner" ,ocaml-cmdliner)))
+    (arguments
+     `(#:tests? #f
+       #:build-flags (list "build")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)
+       ("topkg" ,ocaml-topkg)))
+    (propagated-inputs
+     `(("uutf" ,ocaml-uutf)
+       ("cmdliner" ,ocaml-cmdliner)))
     (home-page "http://erratique.ch/software/jsonm")
     (synopsis "Non-blocking streaming JSON codec for OCaml")
     (description "Jsonm is a non-blocking streaming codec to decode and encode
@@ -1958,25 +2566,30 @@ the JSON data format.  It can process JSON text without blocking on IO and
 without a complete in-memory representation of the data.")
     (license license:isc)))
 
+(define-public ocaml4.02-jsonm
+  (package-with-ocaml4.02 ocaml-jsonm))
+
 (define-public ocaml-ocurl
   (package
     (name "ocaml-ocurl")
-    (version "0.7.9")
+    (version "0.8.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://ygrek.org.ua/p/release/ocurl/ocurl-"
                                   version ".tar.gz"))
               (sha256
                 (base32
-                  "0pm6nm33wi0p9h765k6zb94ljpknryam4qd1hmb2rsk2y0y1181n"))))
+                  "1ax3xdlzgb1zg7d0wr9nwgmh6a45a764m0wk8p6mx07ad94hz0q9"))))
     (build-system ocaml-build-system)
-    (arguments `(#:phases
-                 (modify-phases %standard-phases
-                   (add-before 'configure 'fix-/bin/sh
-                     (lambda* (#:key inputs #:allow-other-keys)
-                       (substitute* "configure"
-                         (("-/bin/sh") (string-append "-" (which "bash")))))))))
-    (native-inputs `(("pkg-config" ,pkg-config)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'fix-/bin/sh
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "configure"
+               (("-/bin/sh") (string-append "-" (which "bash")))))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
     (inputs `(("curl" ,curl)))
     (home-page "http://ocurl.forge.ocamlcore.org/")
     (synopsis "OCaml bindings for libcurl")
@@ -1984,6 +2597,9 @@ without a complete in-memory representation of the data.")
 multitude of other network protocols (FTP/SMTP/RTSP/etc).")
     (license license:isc)))
 
+(define-public ocaml4.02-ocurl
+  (package-with-ocaml4.02 ocaml-ocurl))
+
 (define-public ocaml-base64
   (package
     (name "ocaml-base64")
@@ -2005,6 +2621,7 @@ multitude of other network protocols (FTP/SMTP/RTSP/etc).")
          (delete 'configure))))
     (native-inputs
      `(("topkg" ,ocaml-topkg)
+       ("ocamlbuild" ,ocamlbuild)
        ("opam" ,opam)
        ("rresult" ,ocaml-rresult)
        ("bos" ,ocaml-bos)
@@ -2016,6 +2633,9 @@ that represent binary data in an ASCII string format by translating it into a
 radix-64 representation.  It is specified in RFC 4648.")
     (license license:isc)))
 
+(define-public ocaml4.02-base64
+  (package-with-ocaml4.02 ocaml-base64))
+
 (define-public ocamlify
   (package
     (name "ocamlify")
@@ -2029,7 +2649,9 @@ radix-64 representation.  It is specified in RFC 4648.")
     (build-system ocaml-build-system)
     ; tests are done during build
     (arguments
-     `(#:phases
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib
+       #:phases
        (modify-phases %standard-phases
          (delete 'check))))
     (home-page "https://forge.ocamlcore.org/projects/ocamlify")
@@ -2043,14 +2665,14 @@ OCaml code.")
 (define-public omake
   (package
     (name "omake")
-    (version "0.10.1")
+    (version "0.10.3")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://download.camlcity.org/download/"
                                   "omake-" version ".tar.gz"))
               (sha256
                (base32
-                "093ansbppms90hiqvzar2a46fj8gm9iwnf8gn38s6piyp70lrbsj"))
+                "07bdg1h5i7qnlv9xq81ad5hfypl10hxm771h4rjyl5cn8plhfcgz"))
               (patches (search-patches "omake-fix-non-determinism.patch"))))
     (build-system ocaml-build-system)
     (arguments
@@ -2063,6 +2685,8 @@ OCaml code.")
                      (lambda* (#:key outputs #:allow-other-keys)
                        (substitute* "mk/osconfig_unix.mk"
                                     (("CC = cc") "CC = gcc")))))))
+    (properties
+      `((ocaml4.02-variant . ,(delay ocaml4.02-omake))))
     (native-inputs `(("hevea" ,hevea)))
     (home-page "http://projects.camlcity.org/projects/omake.html")
     (synopsis "Build system designed for scalability and portability")
@@ -2084,28 +2708,66 @@ many additional enhancements, including:
                    license:gpl2)))) ; OMake itself, with ocaml linking exception
                                     ; see LICENSE.OMake
 
+(define-public ocaml4.02-omake
+  (let ((base (package-with-ocaml4.02 (strip-ocaml4.02-variant omake))))
+    (package
+      (inherit base)
+      (version "0.10.2")
+      (source (origin
+                (method url-fetch)
+                (uri (string-append "http://download.camlcity.org/download/"
+                                    "omake-" version ".tar.gz"))
+                (sha256
+                 (base32
+                  "1znnlkpz89hk44byvnl1pr92ym6hwfyyw2qm9clq446r6l2z4m64"))
+                (patches (search-patches "omake-fix-non-determinism.patch")))))))
+
 (define-public ocaml-batteries
   (package
     (name "ocaml-batteries")
-    (version "2.5.3")
+    (version "2.9.0")
     (source (origin
               (method url-fetch)
-              (uri (ocaml-forge-uri "batteries" version 1650))
+              (uri (string-append "https://github.com/ocaml-batteries-team/"
+                                  "batteries-included/releases/download/v"
+                                  version "/batteries-" version ".tar.gz"))
               (sha256
                (base32
-                "1a97w3x2l1jr5x9kj5gqm1x6b0q9fjqdcsvls7arnl3bvzgsia0n"))))
+                "0lkdmv2my5hirkswmci2cch341n6wkkj2q8apjhs83sg6528caxi"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("qtest" ,ocaml-qtest)
+     `(("ocamlbuild" ,ocamlbuild)
+       ("qtest" ,ocaml-qtest)
        ("bisect" ,ocaml-bisect)
        ("ounit" ,ocaml-ounit)))
+    (propagated-inputs
+     `(("ocaml-num" ,ocaml-num)))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
          (delete 'check) ; tests are run by the build phase
          (replace 'build
-           (lambda* (#:key outputs #:allow-other-keys)
-             (zero? (system* "ocaml" "setup.ml" "-build")))))))
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((files
+                     (map (lambda (str)
+                            (substring str 0 (- (string-length str) 1)))
+                          (append
+                            (find-files "src" ".*.mliv")
+                            (find-files "src" ".*.mlv")
+                            (find-files "src" ".*.mlp")))))
+               (apply invoke "ocamlbuild" "-no-links" "-use-ocamlfind" "-I" "num"
+                      "-lflag" "-dllpath-all" files)
+               (for-each (lambda (file)
+                           (copy-file (string-append "_build/" file) file))
+                         files))
+             (invoke "ocamlbuild" "-no-links" "-use-ocamlfind" "-I" "num"
+                     "-lflag" "-dllpath-all" "build/mkconf.byte")
+             (copy-file "_build/build/mkconf.byte" "build/mkconf.byte")
+             (invoke "make" "all")
+             #t)))))
+    (properties
+      `((ocaml4.01-variant . ,(delay ocaml4.01-batteries))
+        (ocaml4.02-variant . ,(delay ocaml4.02-batteries))))
     (home-page "http://batteries.forge.ocamlcore.org/")
     (synopsis "Development platform for the OCaml programming language")
     (description "Define a standard set of libraries which may be expected on
@@ -2113,8 +2775,24 @@ every compliant installation of OCaml and organize these libraries into a
 hierarchy of modules.")
     (license license:lgpl2.1+)))
 
+(define-public ocaml4.02-batteries
+  (let ((base (package-with-ocaml4.02 (strip-ocaml4.02-variant ocaml-batteries))))
+    (package
+      (inherit base)
+      (version "2.5.3")
+      (source (origin
+                (method url-fetch)
+                (uri (ocaml-forge-uri "batteries" version 1650))
+                (sha256
+                 (base32
+                  "1a97w3x2l1jr5x9kj5gqm1x6b0q9fjqdcsvls7arnl3bvzgsia0n"))))
+      (propagated-inputs '()))))
+
 (define-public ocaml4.01-batteries
-  (package-with-ocaml4.01 ocaml-batteries))
+  (let ((base (package-with-ocaml4.01 (strip-ocaml4.01-variant ocaml4.02-batteries))))
+    (package
+      (inherit base)
+      (name "ocaml4.01-batteries"))))
 
 (define-public ocaml-pcre
   (package
@@ -2139,9 +2817,11 @@ hierarchy of modules.")
                     (lib (string-append out "/lib/ocaml/site-lib/pcre")))
                (mkdir-p stubs)
                (symlink (string-append lib "/dllpcre_stubs.so")
-                        (string-append stubs "/dllpcre_stubs.so"))))))))
+                        (string-append stubs "/dllpcre_stubs.so")))
+             #t)))))
     (native-inputs
      `(("batteries" ,ocaml-batteries)
+       ("ocamlbuild" ,ocamlbuild)
        ("pcre:bin" ,pcre "bin")))
     (propagated-inputs `(("pcre" ,pcre)))
     (home-page "https://mmottl.github.io/pcre-ocaml")
@@ -2151,19 +2831,26 @@ matching and substitution, similar to the functionality offered by the Perl
 language.")
     (license license:lgpl2.1+))); with the OCaml link exception
 
+(define-public ocaml4.02-pcre
+  (package-with-ocaml4.02 ocaml-pcre))
+
 (define-public ocaml-expect
   (package
     (name "ocaml-expect")
-    (version "0.0.5")
+    (version "0.0.6")
     (source (origin
               (method url-fetch)
-              (uri (ocaml-forge-uri name version 1372))
+              (uri (ocaml-forge-uri name version 1736))
               (sha256
                (base32
-                "07xq8w2x2vffc32z7vk6y14jwbfb1cw0m2lm1jzi60hnr1dvg8by"))))
+                "098qvg9d4yrqzr5ax291y3whrpax0m3sx4gi6is0mblc96r9yqk0"))))
+    (arguments
+     `(#:tests? #f))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("ocaml-pcre" ,ocaml-pcre)
+     `(("ocamlbuild" ,ocamlbuild)
+       ("ocaml-num" ,ocaml-num)
+       ("ocaml-pcre" ,ocaml-pcre)
        ("ounit" ,ocaml-ounit)))
     (propagated-inputs `(("batteries" ,ocaml-batteries)))
     (home-page "https://forge.ocamlcore.org/projects/ocaml-expect/")
@@ -2172,18 +2859,22 @@ language.")
 can match the question using a regular expression or a timeout.")
     (license license:lgpl2.1+))) ; with the OCaml static compilation exception
 
-(define-public ocaml-fileutils
+(define-public ocaml4.02-fileutils
   (package
-    (name "ocaml-fileutils")
-    (version "0.5.1")
+    (name "ocaml4.02-fileutils")
+    (version "0.5.3")
     (source (origin
               (method url-fetch)
-              (uri (ocaml-forge-uri name version 1651))
+              (uri (ocaml-forge-uri name version 1728))
               (sha256
                (base32
-                "0g6zx2rcvacklxyli19ixcf6ich9ipxsps4k3jz98f5zlaab0a7g"))))
+                "1rc4cqlvdhbs55i85zfbfhz938fsy4fj6kwlkfm3ra7bpwn8bmpd"))))
     (build-system ocaml-build-system)
-    (native-inputs `(("ounit" ,ocaml-ounit)))
+    (arguments
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib))
+    (native-inputs
+     `(("ounit" ,ocaml4.02-ounit)))
     (home-page "http://ocaml-fileutils.forge.ocamlcore.org")
     (synopsis "Pure OCaml functions to manipulate real file and filename")
     (description "Library to provide pure OCaml functions to manipulate real
@@ -2193,20 +2884,20 @@ file (POSIX like) and filename.")
 (define-public ocaml-oasis
   (package
     (name "ocaml-oasis")
-    (version "0.4.8")
+    (version "0.4.11")
     (source (origin
               (method url-fetch)
-              (uri (ocaml-forge-uri name version 1669))
+              (uri (ocaml-forge-uri name version 1757))
               (sha256
                (base32
-                "1ln7vc7ip6s5xbi20mhnn087xi4a2m5vqawx0703qqnfkzhmslqy"))
+                "0bn13mzfa98dq3y0jwzzndl55mnywaxv693z6f1rlvpdykp3vdqq"))
             (modules '((guix build utils)))
             (snippet
              '(begin
                 (substitute* "test/test-main/Test.ml"
                   ;; most of these tests fail because ld cannot find crti.o, but according
                   ;; to the log file, the environment variables {LD_,}LIBRARY_PATH
-                  ;; are set correctly whene LD_LIBRARY_PATH is defined beforhand.
+                  ;; are set correctly when LD_LIBRARY_PATH is defined beforhand.
                   (("TestBaseCompat.tests;") "")
                   (("TestExamples.tests;") "")
                   (("TestFull.tests;") "")
@@ -2216,17 +2907,12 @@ file (POSIX like) and filename.")
                   (("TestPluginOMake.tests;") ""))
                 #t))))
     (build-system ocaml-build-system)
+    (arguments
+     `(#:tests? #f))
     (native-inputs
-     `(("ocamlify" ,ocamlify)
-       ("ocamlmod" ,ocamlmod)
-       ("ounit" ,ocaml-ounit)
-       ("omake" ,omake)
-       ("ocaml-expect" ,ocaml-expect)
-       ("ocaml-pcre" ,ocaml-pcre)
-       ("ocaml-fileutils" ,ocaml-fileutils)
-       ("camlp4" ,camlp4)
-       ("texlive" ,texlive)
-       ("pkg-config" ,pkg-config)))
+     `(("ocamlbuild" ,ocamlbuild)
+       ("ocamlify" ,ocamlify)
+       ("ocamlmod" ,ocamlmod)))
     (home-page "https://oasis.forge.ocamlcore.org")
     (synopsis "Integrates a configure, build, install system in OCaml projects")
     (description "OASIS is a tool to integrate a configure, build and install
@@ -2234,6 +2920,9 @@ system in your OCaml projects.  It helps to create standard entry points in your
 build system and allows external tools to analyse your project easily.")
     (license license:lgpl2.1+))) ; with ocaml static compilation exception
 
+(define-public ocaml4.02-oasis
+  (package-with-ocaml4.02 ocaml-oasis))
+
 (define-public ocaml-js-build-tools
   (package
     (name "ocaml-js-build-tools")
@@ -2242,6 +2931,7 @@ build system and allows external tools to analyse your project easily.")
               "0r8z4fz8iy5y6hkdlkpwf6rk4qigcr3dzyv35585xgg2ahf12zy6"))
     (native-inputs
      `(("oasis" ,ocaml-oasis)
+       ("ocamlbuild" ,ocamlbuild)
        ("opam" ,opam)))
     (build-system ocaml-build-system)
     (arguments janestreet-arguments)
@@ -2256,17 +2946,23 @@ from the oasis build log
 @end enumerate")
     (license license:asl2.0)))
 
-(define-public ocaml-bin-prot
+(define-public ocaml4.02-js-build-tools
+  (package-with-ocaml4.02 ocaml-js-build-tools))
+
+(define-public ocaml4.02-bin-prot
   (package
-    (name "ocaml-bin-prot")
+    (name "ocaml4.02-bin-prot")
     (version "113.33.03")
     (source (janestreet-origin "bin_prot" version
                "1ws8c017z8nbj3vw92ndvjk9011f71rmp3llncbv8r5fc76wqv3l"))
+    (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
-    (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/bin_prot/")
     (synopsis "Binary protocol generator")
     (description "This library contains functionality for reading and writing
@@ -2277,17 +2973,20 @@ protocol is also heavily optimized for size, making it ideal for long-term
 storage of large amounts of data.")
     (license license:asl2.0)))
 
-(define-public ocaml-fieldslib
+(define-public ocaml4.02-fieldslib
   (package
-    (name "ocaml-fieldslib")
+    (name "ocaml4.02-fieldslib")
     (version "113.33.03")
     (source (janestreet-origin "fieldslib" version
                "1rm3bn54bzk2hlq8f3w067ak8s772w4a8f78i3yh79vxfzq8ncvv"))
+    (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
-    (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/fieldslib/")
     (synopsis "Syntax extension to record fields")
     (description "Syntax extension to define first class values representing
@@ -2295,18 +2994,21 @@ record fields, to get and set record fields, iterate and fold over all fields
 of a record and create new record values.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-core
+(define-public ocaml4.02-ppx-core
   (package
-    (name "ocaml-ppx-core")
+    (name "ocaml4.02-ppx-core")
     (version "113.33.03")
     (source (janestreet-origin "ppx_core" version
                "0f69l4czhgssnhb5ds2j9dbqjyz8dp1y3i3x0i4h6pxnms20zbxa"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
-    (inputs `(("ppx-tools" ,ocaml-ppx-tools)))
-    (arguments janestreet-arguments)
+    (inputs `(("ppx-tools" ,ocaml4.02-ppx-tools)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_core/")
     (synopsis "Standard library for ppx rewriters")
     (description "Ppx_core is a standard library for OCaml AST transformers.
@@ -2319,20 +3021,23 @@ It contains:
 @end enumerate")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-optcomp
+(define-public ocaml4.02-ppx-optcomp
   (package
-    (name "ocaml-ppx-optcomp")
+    (name "ocaml4.02-ppx-optcomp")
     (version "113.33.03")
     (source (janestreet-origin "ppx_optcomp" version
                "13an8p2r7sd0d5lv54mlzrxdni47408bwqi3bjcx4m6005170q30"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_optcomp/")
     (synopsis "Optional compilation for OCaml")
     (description "Ppx_optcomp stands for Optional Compilation.  It is a tool
@@ -2340,21 +3045,24 @@ used to handle optional compilations of pieces of code depending of the word
 size, the version of the compiler, ...")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-driver
+(define-public ocaml4.02-ppx-driver
   (package
-    (name "ocaml-ppx-driver")
+    (name "ocaml4.02-ppx-driver")
     (version "113.33.03")
     (source (janestreet-origin "ppx_driver" version
               "011zzr45897j49b7iiybb29k7pspcx36mlnp7nh6pxb8b0ga76fh"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)
-       ("ppx-optcomp" ,ocaml-ppx-optcomp)))
+       ("ppx-optcomp" ,ocaml4.02-ppx-optcomp)))
     (propagated-inputs
-     `(("ppx-optcomp" ,ocaml-ppx-optcomp)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("ppx-optcomp" ,ocaml4.02-ppx-optcomp)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_driver/")
     (synopsis "Feature-full driver for OCaml AST transformers")
     (description "A driver is an executable created from a set of OCaml AST
@@ -2372,21 +3080,33 @@ provide a tool that can be used to:
 (define-public ocaml-cppo
   (package
     (name "ocaml-cppo")
-    (version "1.4.1")
+    (version "1.6.5")
     (source
       (origin
         (method url-fetch)
         (uri (string-append "https://github.com/mjambon/cppo/archive/v" version
                             ".tar.gz"))
         (sha256 (base32
-                  "02gma6nw09vfnd6h7bl3n70lwz7m9z2svplxyfh6h5bf4lqgqzjv"))
+                  "1dkm3d5h6h56y937gcdk2wixlpzl59vv5pmiafglr89p20kf7gqf"))
         (file-name (string-append name "-" version ".tar.gz"))))
     (build-system ocaml-build-system)
     (arguments
-     `(#:phases (modify-phases %standard-phases (delete 'configure))
-       #:make-flags (list (string-append "BINDIR="
-                                         (assoc-ref %outputs "out") "/bin"))
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (invoke "dune" "build" "@install" "--profile" "release")
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "dune" "install"
+                     "--prefix" (assoc-ref outputs "out"))
+             #t)))
        #:tests? #f))
+    (native-inputs
+     `(("dune" ,dune)
+       ("ocamlbuild" ,ocamlbuild)))
     (home-page "https://github.com/mjambon/cppo")
     (synopsis "Equivalent of the C preprocessor for OCaml programs")
     (description "Cppo is an equivalent of the C preprocessor for OCaml
@@ -2399,11 +3119,14 @@ programs.  It allows the definition of simple macros and file inclusion.  Cpp oi
 @end enumerate")
     (license license:bsd-3)))
 
+(define-public ocaml4.02-cppo
+  (package-with-ocaml4.02 ocaml-cppo))
+
 ;; this package is not reproducible. This is related to temporary filenames
 ;; such as findlib_initxxxxx where xxxxx is random.
-(define-public ocaml-ppx-deriving
+(define-public ocaml4.02-ppx-deriving
   (package
-    (name "ocaml-ppx-deriving")
+    (name "ocaml4.02-ppx-deriving")
     (version "4.1")
     (source
       (origin
@@ -2415,15 +3138,17 @@ programs.  It allows the definition of simple macros and file inclusion.  Cpp oi
         (file-name (string-append name "-" version ".tar.gz"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
-       ("cppo" ,ocaml-cppo)
-       ("ounit" ,ocaml-ounit)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
+       ("cppo" ,ocaml4.02-cppo)
+       ("ounit" ,ocaml4.02-ounit)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("result" ,ocaml-result)
-       ("ppx-tools" ,ocaml-ppx-tools)))
+     `(("result" ,ocaml4.02-result)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)))
     (arguments
-     `(#:phases
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib
+       #:phases
        (modify-phases %standard-phases
          (delete 'configure)
            (add-before 'install 'fix-environment
@@ -2438,90 +3163,100 @@ programs.  It allows the definition of simple macros and file inclusion.  Cpp oi
 code based on type definitions, and a set of useful plugins for common tasks.")
     (license license:expat)))
 
-(define-public ocaml-ppx-type-conv
+(define-public ocaml4.02-ppx-type-conv
   (package
-    (name "ocaml-ppx-type-conv")
+    (name "ocaml4.02-ppx-type-conv")
     (version "113.33.03")
     (source
       (janestreet-origin "ppx_type_conv" version
         "1sp602ads2f250nv4d4rgw54d14k7flyhb4w8ff084f657hhmxv2"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-deriving" ,ocaml-ppx-deriving)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("result" ,ocaml-result)
-       ("ppx-core" ,ocaml-ppx-core)
-       ("ppx-driver" ,ocaml-ppx-driver)))
-    (arguments janestreet-arguments)
+     `(("ppx-deriving" ,ocaml4.02-ppx-deriving)
+       ("ppx-core" ,ocaml4.02-ppx-core)
+       ("ppx-driver" ,ocaml4.02-ppx-driver)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_type_conv/")
     (synopsis "Support Library for type-driven code generators")
     (description "The type_conv library factors out functionality needed by
 different preprocessors that generate code from type specifications.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-inline-test
+(define-public ocaml4.02-ppx-inline-test
   (package
-    (name "ocaml-ppx-inline-test")
+    (name "ocaml4.02-ppx-inline-test")
     (version "113.33.03")
     (source (janestreet-origin "ppx_inline_test" version
               "0859ni43fl39dd5g6cxfhq0prxmx59bd2bfq8jafp593ba4q0icq"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)
-       ("ppx-core" ,ocaml-ppx-core)))
+       ("ppx-core" ,ocaml4.02-ppx-core)))
     (propagated-inputs
-      `(("ppx-driver" ,ocaml-ppx-driver)
-        ("ppx-tools" ,ocaml-ppx-tools)
-        ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+      `(("ppx-driver" ,ocaml4.02-ppx-driver)
+        ("ppx-tools" ,ocaml4.02-ppx-tools)
+        ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_inline_test/")
     (synopsis "Syntax extension for writing in-line tests in ocaml code")
     (description "Syntax extension for writing in-line tests in ocaml code.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-bench
+(define-public ocaml4.02-ppx-bench
   (package
-    (name "ocaml-ppx-bench")
+    (name "ocaml4.02-ppx-bench")
     (version "113.33.03")
     (source (janestreet-origin "ppx_bench" version
                    "1hky3y17qpb925rymf97wv54di9gaqdmkix7wpkjw14qzl512b68"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)
-       ("ppx-core" ,ocaml-ppx-core)))
+       ("ppx-core" ,ocaml4.02-ppx-core)))
     (propagated-inputs
-     `(("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-inline-test" ,ocaml-ppx-inline-test)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-inline-test" ,ocaml4.02-ppx-inline-test)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_bench/")
     (synopsis "Syntax extension for writing in-line benchmarks in ocaml code")
     (description "Syntax extension for writing in-line benchmarks in ocaml code.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-compare
+(define-public ocaml4.02-ppx-compare
   (package
-    (name "ocaml-ppx-compare")
+    (name "ocaml4.02-ppx-compare")
     (version "113.33.03")
     (source (janestreet-origin "ppx_compare" version
               "0bfhi33kq9l4q6zzc6svki2csracz5j4731c3npcy6cs73jynn0z"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)
-       ("ppx-core" ,ocaml-ppx-core)))
+       ("ppx-core" ,ocaml4.02-ppx-core)))
     (propagated-inputs
-     `(("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-core" ,ocaml-ppx-core)
-       ("ppx-type-conv" ,ocaml-ppx-type-conv)))
-    (arguments janestreet-arguments)
+     `(("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-core" ,ocaml4.02-ppx-core)
+       ("ppx-type-conv" ,ocaml4.02-ppx-type-conv)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_compare/")
     (synopsis "Generation of comparison functions from types")
     (description "Generation of fast comparison functions from type expressions
@@ -2532,94 +3267,109 @@ flexibility by allowing you to override them for a specific type and more safety
 by making sure that you only compare comparable values.")
     (license license:asl2.0)))
 
-(define-public ocaml-sexplib
+(define-public ocaml4.02-sexplib
   (package
-    (name "ocaml-sexplib")
+    (name "ocaml4.02-sexplib")
     (version "113.33.03")
     (source (janestreet-origin "sexplib" version
               "1ffjmj8if9lyv965cgn2ld1xv7g52qsr8mqflbm515ck1i8l2ima"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/sexplib/")
     (synopsis "Library for serializing OCaml values to and from S-expressions")
     (description "Sexplib contains functionality for parsing and pretty-printing
 s-expressions.")
     (license license:asl2.0)))
 
-(define-public ocaml-typerep
+(define-public ocaml4.02-typerep
   (package
-    (name "ocaml-typerep")
+    (name "ocaml4.02-typerep")
     (version "113.33.03")
     (source (janestreet-origin "typerep" version
               "1b9v5bmi824a9d4sx0f40ixq0yfcbiqxafg4a1jx95xg9199zafy"))
+    (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
-    (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/typerep/")
     (synopsis "Typerep is a library for runtime types")
     (description "Typerep is a library for runtime types.")
     (license license:asl2.0)))
 
-(define-public ocaml-variantslib
+(define-public ocaml4.02-variantslib
   (package
-    (name "ocaml-variantslib")
+    (name "ocaml4.02-variantslib")
     (version "113.33.03")
     (source (janestreet-origin "variantslib" version
               "05vp799vl38fvl98ga5miwbzh09cnnpapi6q6gdvwyqi6w7s919n"))
+    (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
-    (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/variantslib")
     (synopsis "OCaml variants as first class values")
     (description "OCaml variants as first class values.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-sexp-conv
+(define-public ocaml4.02-ppx-sexp-conv
   (package
-    (name "ocaml-ppx-sexp-conv")
+    (name "ocaml4.02-ppx-sexp-conv")
     (version "113.33.03")
     (source (janestreet-origin "ppx_sexp_conv" version
               "1rbj6d5dl625gdxih34xcrdvikci6h8i2dl9x3wraa4qrgishiw7"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)
-       ("ppx-core" ,ocaml-ppx-core)))
+       ("ppx-core" ,ocaml4.02-ppx-core)))
     (propagated-inputs
-     `(("sexplib" ,ocaml-sexplib)
-       ("ppx-core" ,ocaml-ppx-core)
-       ("ppx-type-conv" ,ocaml-ppx-type-conv)
-       ("ppx-tools" ,ocaml-ppx-tools)))
-    (arguments janestreet-arguments)
+     `(("sexplib" ,ocaml4.02-sexplib)
+       ("ppx-core" ,ocaml4.02-ppx-core)
+       ("ppx-type-conv" ,ocaml4.02-ppx-type-conv)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_sexp_conv")
     (synopsis "Generation of S-expression conversion functions from type definitions")
     (description "Generation of S-expression conversion functions from type
 definitions.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-variants-conv
+(define-public ocaml4.02-ppx-variants-conv
   (package
-    (name "ocaml-ppx-variants-conv")
+    (name "ocaml4.02-ppx-variants-conv")
     (version "113.33.03")
     (source (janestreet-origin "ppx_variants_conv" version
               "0vnn2l1118cj72413d3f7frlw6yc09l8f64jlzkzbgb9bxpalx34"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-core" ,ocaml-ppx-core)
-       ("variantslib" ,ocaml-variantslib)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-type-conv" ,ocaml-ppx-type-conv)))
-    (arguments janestreet-arguments)
+     `(("ppx-core" ,ocaml4.02-ppx-core)
+       ("variantslib" ,ocaml4.02-variantslib)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-type-conv" ,ocaml4.02-ppx-type-conv)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_variants_conv")
     (synopsis "Generation of accessor and iteration functions for ocaml variant
 types")
@@ -2627,65 +3377,74 @@ types")
 variant types.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-here
+(define-public ocaml4.02-ppx-here
   (package
-    (name "ocaml-ppx-here")
+    (name "ocaml4.02-ppx-here")
     (version "113.33.03")
     (source (janestreet-origin "ppx_here" version
               "1ay8lfxi0qg3ib2zkwh4h0vqk3gjmxaz572gzab0bbxyqn3z86v7"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_here")
     (synopsis "Expands [%here] into its location")
     (description "Expands [%here] into its location.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-assert
+(define-public ocaml4.02-ppx-assert
   (package
-    (name "ocaml-ppx-assert")
+    (name "ocaml4.02-ppx-assert")
     (version "113.33.03")
     (source (janestreet-origin "ppx_assert" version
               "1k5kxmqkibp5fk25pgz81f3c1r4mgvb5byzf6bnmxd24y60wn46p"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-compare" ,ocaml-ppx-compare)
-       ("ppx-core" ,ocaml-ppx-core)
-       ("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-sexp-conv" ,ocaml-ppx-sexp-conv)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-type-conv" ,ocaml-ppx-type-conv)
-       ("ppx-sexplib" ,ocaml-sexplib)
-       ("ppx-here" ,ocaml-ppx-here)))
-    (arguments janestreet-arguments)
+     `(("ppx-compare" ,ocaml4.02-ppx-compare)
+       ("ppx-core" ,ocaml4.02-ppx-core)
+       ("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-sexp-conv" ,ocaml4.02-ppx-sexp-conv)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-type-conv" ,ocaml4.02-ppx-type-conv)
+       ("ppx-sexplib" ,ocaml4.02-sexplib)
+       ("ppx-here" ,ocaml4.02-ppx-here)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_assert")
     (synopsis "Assert-like extension nodes that raise useful errors on failure")
     (description "Assert-like extension nodes that raise useful errors on failure.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-enumerate
+(define-public ocaml4.02-ppx-enumerate
   (package
-    (name "ocaml-ppx-enumerate")
+    (name "ocaml4.02-ppx-enumerate")
     (version "113.33.03")
     (source (janestreet-origin "ppx_enumerate" version
               "15g7yfv9wg2h9r6k6q1zrhygmsl4xrfn25mrb0i4czjjivzmxjh4"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-type-conv" ,ocaml-ppx-type-conv)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-type-conv" ,ocaml4.02-ppx-type-conv)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_enumerate")
     (synopsis "Generate a list containing all values of a finite type")
     (description "Ppx_enumerate is a ppx rewriter which generates a definition
@@ -2693,174 +3452,198 @@ for the list of all values of a type (for a type which only has finitely
 many values).")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-let
+(define-public ocaml4.02-ppx-let
   (package
-    (name "ocaml-ppx-let")
+    (name "ocaml4.02-ppx-let")
     (version "113.33.03")
     (source (janestreet-origin "ppx_let" version
               "0gd6d3gdaqfwjcs7gaw1qxc30i584q6a86ndaj1bx1q63xqd6yx9"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_let")
     (synopsis "Monadic let-bindings")
     (description "A ppx rewriter for monadic and applicative let bindings,
 match expressions, and if expressions.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-typerep-conv
+(define-public ocaml4.02-ppx-typerep-conv
   (package
-    (name "ocaml-ppx-typerep-conv")
+    (name "ocaml4.02-ppx-typerep-conv")
     (version "113.33.03")
     (source (janestreet-origin "ppx_typerep_conv" version
               "0g0xqm9s1b2jjvxb8yp69281q2s3bwz6sibn10fvgcdawpa0rmrg"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-type-conv" ,ocaml-ppx-type-conv)
-       ("ppx-core" ,ocaml-ppx-core)
-       ("typerep" ,ocaml-typerep)))
-    (arguments janestreet-arguments)
+     `(("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-type-conv" ,ocaml4.02-ppx-type-conv)
+       ("ppx-core" ,ocaml4.02-ppx-core)
+       ("typerep" ,ocaml4.02-typerep)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_typerep_conv")
     (synopsis "Generation of runtime types from type declarations")
     (description "Automatic generation of runtime types from type definitions.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-sexp-value
+(define-public ocaml4.02-ppx-sexp-value
   (package
-    (name "ocaml-ppx-sexp-value")
+    (name "ocaml4.02-ppx-sexp-value")
     (version "113.33.03")
     (source (janestreet-origin "ppx_sexp_value" version
               "0m3ag23mbqm0i2pv1dzilfks15ipa5q60mf57a0cd3p0pvarq10g"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-here" ,ocaml-ppx-here)
-       ("ppx-sexp-conv" ,ocaml-ppx-sexp-conv)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-here" ,ocaml4.02-ppx-here)
+       ("ppx-sexp-conv" ,ocaml4.02-ppx-sexp-conv)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_sexp_value/")
     (synopsis "Simplify building s-expressions from ocaml values")
     (description "A ppx rewriter that simplifies building s-expressions from
 ocaml values.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-pipebang
+(define-public ocaml4.02-ppx-pipebang
   (package
-    (name "ocaml-ppx-pipebang")
+    (name "ocaml4.02-ppx-pipebang")
     (version "113.33.03")
     (source (janestreet-origin "ppx_pipebang" version
               "1965c7hymp26ncmjs0pfxi2s5jlj60z2c9b194lgcwxqiav56pcw"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_pipebang/")
     (synopsis "Inline reverse application operators `|>` and `|!`")
     (description "A ppx rewriter that inlines reverse application operators
 @code{|>} and @code{|!}.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-bin-prot
+(define-public ocaml4.02-ppx-bin-prot
   (package
-    (name "ocaml-ppx-bin-prot")
+    (name "ocaml4.02-ppx-bin-prot")
     (version "113.33.03")
     (source (janestreet-origin "ppx_bin_prot" version
               "173kjv36giik11zgfvsbzwfbpr66dm2pcha9vf990jgzh8hqz39h"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("bin-prot" ,ocaml-bin-prot)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-type-conv" ,ocaml-ppx-type-conv)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("bin-prot" ,ocaml4.02-bin-prot)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-type-conv" ,ocaml4.02-ppx-type-conv)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_bin_prot/")
     (synopsis "Generation of bin_prot readers and writers from types")
     (description "Generation of binary serialization and deserialization
 functions from type definitions.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-fail
+(define-public ocaml4.02-ppx-fail
   (package
-    (name "ocaml-ppx-fail")
+    (name "ocaml4.02-ppx-fail")
     (version "113.33.03")
     (source (janestreet-origin "ppx_fail" version
               "1dwgad0f05gqp5rnwf9dcasidpfi7q3mrpazsw3a2vijjblbhjgn"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-here" ,ocaml-ppx-here)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-here" ,ocaml4.02-ppx-here)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_fail/")
     (synopsis "Add location to calls to failwiths")
     (description "Syntax extension that makes [failwiths] always include a
 position.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-custom-printf
+(define-public ocaml4.02-ppx-custom-printf
   (package
-    (name "ocaml-ppx-custom-printf")
+    (name "ocaml4.02-ppx-custom-printf")
     (version "113.33.03")
     (source (janestreet-origin "ppx_custom_printf" version
               "11jlx0n87g2j1vyyp343dibx7lvvwig5j5q0nq0b80kbsq0k6yr8"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-sexp-conv" ,ocaml-ppx-sexp-conv)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-core" ,ocaml-ppx-core)
-       ("ppx-driver" ,ocaml-ppx-driver)))
-    (arguments janestreet-arguments)
+     `(("ppx-sexp-conv" ,ocaml4.02-ppx-sexp-conv)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-core" ,ocaml4.02-ppx-core)
+       ("ppx-driver" ,ocaml4.02-ppx-driver)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_custom_printf/")
     (synopsis "Printf-style format-strings for user-defined string conversion")
     (description "Extensions to printf-style format-strings for user-defined
 string conversion.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-sexp-message
+(define-public ocaml4.02-ppx-sexp-message
   (package
-    (name "ocaml-ppx-sexp-message")
+    (name "ocaml4.02-ppx-sexp-message")
     (version "113.33.03")
     (source (janestreet-origin "ppx_sexp_message" version
               "084w1l3gnyw4ri9vbn7bv9b2xkw1520qczfxpxdarfivdrz8xr68"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-here" ,ocaml-ppx-here)
-       ("ppx-sexp-conv" ,ocaml-ppx-sexp-conv)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-core" ,ocaml-ppx-core)))
-    (arguments janestreet-arguments)
+     `(("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-here" ,ocaml4.02-ppx-here)
+       ("ppx-sexp-conv" ,ocaml4.02-ppx-sexp-conv)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-core" ,ocaml4.02-ppx-core)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_sexp_message/")
     (synopsis "A ppx rewriter for easy construction of s-expressions")
     (description "Ppx_sexp_message aims to ease the creation of s-expressions
@@ -2869,23 +3652,26 @@ where one needs to construct a s-expression based on various element of the
 context such as function arguments.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-fields-conv
+(define-public ocaml4.02-ppx-fields-conv
   (package
-    (name "ocaml-ppx-fields-conv")
+    (name "ocaml4.02-ppx-fields-conv")
     (version "113.33.03")
     (source (janestreet-origin "ppx_fields_conv" version
               "1vzbdz27g5qhhfs7wx6rjf979q4xyssxqbmp6sc1sxknbghslbdv"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)
-       ("ppx-core" ,ocaml-ppx-core)))
+       ("ppx-core" ,ocaml4.02-ppx-core)))
     (propagated-inputs
-     `(("fieldslib" ,ocaml-fieldslib)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-core" ,ocaml-ppx-core)
-       ("ppx-type-conv" ,ocaml-ppx-type-conv)))
-    (arguments janestreet-arguments)
+     `(("fieldslib" ,ocaml4.02-fieldslib)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-core" ,ocaml4.02-ppx-core)
+       ("ppx-type-conv" ,ocaml4.02-ppx-type-conv)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_fields_conv/")
     (synopsis "Generation of accessor and iteration functions for ocaml records")
     (description "Ppx_fields_conv is a ppx rewriter that can be used to define
@@ -2894,10 +3680,59 @@ and set record fields, iterate and fold over all fields of a record and create
 new record values.")
     (license license:asl2.0)))
 
+(define-public ocaml-seq
+  (package
+    (name "ocaml-seq")
+    (version "0.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/c-cube/seq/archive/"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "02lb2d9i12bxrz2ba5wygk2bycan316skqlyri0597q7j9210g8r"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((install-dir (string-append (assoc-ref outputs "out")
+                                               "/lib/ocaml/site-lib/seq")))
+               (mkdir-p install-dir)
+               (with-output-to-file (string-append install-dir "/META")
+                 (lambda _
+                   (display "name=\"seq\"
+version=\"[distributed with ocaml]\"
+description=\"dummy package for compatibility\"
+requires=\"\"")))
+             #t))))))
+    (properties
+      `((ocaml4.02-variant . ,(delay ocaml4.02-seq))))
+    (home-page "https://github.com/c-cube/seq")
+    (synopsis "OCaml's standard iterator type")
+    (description "This package is a compatibility package for OCaml's
+standard iterator type starting from 4.07.")
+    (license license:lgpl2.1+)))
+
+(define-public ocaml4.02-seq
+  (let ((base (package-with-ocaml4.02 (strip-ocaml4.02-variant ocaml-seq))))
+    (package
+      (inherit base)
+      (arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib
+         #:tests? #f; no tests
+         #:phases (modify-phases %standard-phases (delete 'configure)))))))
+
 (define-public ocaml-re
   (package
     (name "ocaml-re")
-    (version "1.7.1")
+    (version "1.8.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/ocaml/ocaml-re//archive/"
@@ -2905,9 +3740,27 @@ new record values.")
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1s3rcr76cgm4p1xmaazc58arkg2lz3zfcp1icm00m6s5ccnkh67b"))))
+                "1pdb0mr6z5ax6szblr3f5lbdnqq9grm97cmsfjmdma60yrx2rqhd"))))
     (build-system ocaml-build-system)
-    (native-inputs `(("ounit" ,ocaml-ounit)))
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (invoke "dune" "build" "@install" "--profile" "release")
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "dune" "install"
+                     "--prefix" (assoc-ref outputs "out"))
+             #t)))))
+    (propagated-inputs
+     `(("ocaml-seq" ,ocaml-seq)))
+    (native-inputs
+     `(("dune" ,dune)
+       ("ounit" ,ocaml-ounit)))
     (home-page "https://github.com/ocaml/ocaml-re/")
     (synopsis "Regular expression library for OCaml")
     (description "Pure OCaml regular expressions with:
@@ -2920,32 +3773,38 @@ new record values.")
 @end enumerate")
     (license license:expat)))
 
-(define-public ocaml-ppx-expect
+(define-public ocaml4.02-re
+  (package-with-ocaml4.02 ocaml-re))
+
+(define-public ocaml4.02-ppx-expect
   (package
-    (name "ocaml-ppx-expect")
+    (name "ocaml4.02-ppx-expect")
     (version "113.33.03")
     (source (janestreet-origin "ppx_expect" version
               "03sbs4s5i8l9syr45v25f5hzy7msd2b47k2a9wsq9m43d4imgkrc"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("fieldslib" ,ocaml-fieldslib)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("ppx-assert" ,ocaml-ppx-assert)
-       ("ppx-compare" ,ocaml-ppx-compare)
-       ("ppx-core" ,ocaml-ppx-core)
-       ("ppx-custom-printf" ,ocaml-ppx-custom-printf)
-       ("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-fields-conv" ,ocaml-ppx-fields-conv)
-       ("ppx-inline-test" ,ocaml-ppx-inline-test)
-       ("ppx-sexp-conv" ,ocaml-ppx-sexp-conv)
-       ("ppx-variants-conv" ,ocaml-ppx-variants-conv)
-       ("re" ,ocaml-re)
-       ("sexplib" ,ocaml-sexplib)
-       ("variantslib" ,ocaml-variantslib)))
-    (arguments janestreet-arguments)
+     `(("fieldslib" ,ocaml4.02-fieldslib)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("ppx-assert" ,ocaml4.02-ppx-assert)
+       ("ppx-compare" ,ocaml4.02-ppx-compare)
+       ("ppx-core" ,ocaml4.02-ppx-core)
+       ("ppx-custom-printf" ,ocaml4.02-ppx-custom-printf)
+       ("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-fields-conv" ,ocaml4.02-ppx-fields-conv)
+       ("ppx-inline-test" ,ocaml4.02-ppx-inline-test)
+       ("ppx-sexp-conv" ,ocaml4.02-ppx-sexp-conv)
+       ("ppx-variants-conv" ,ocaml4.02-ppx-variants-conv)
+       ("re" ,ocaml4.02-re)
+       ("sexplib" ,ocaml4.02-sexplib)
+       ("variantslib" ,ocaml4.02-variantslib)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_expect/")
     (synopsis "Cram like framework for OCaml")
     (description "Expect-test is a framework for writing tests in OCaml, similar
@@ -2955,66 +3814,72 @@ output-generating code, interleaved with %expect extension expressions to denote
 the expected output.")
     (license license:asl2.0)))
 
-(define-public ocaml-ppx-jane
+(define-public ocaml4.02-ppx-jane
   (package
-    (name "ocaml-ppx-jane")
+    (name "ocaml4.02-ppx-jane")
     (version "113.33.03")
     (source (janestreet-origin "ppx_jane" version
               "0bjxkhmzgm6x9dcvjwybbccn34khbvyyjimcbaja30fp6qcqk5yl"))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("ppx-assert" ,ocaml-ppx-assert)
-       ("ppx-bench" ,ocaml-ppx-bench)
-       ("ppx-bin-prot" ,ocaml-ppx-bin-prot)
-       ("ppx-compare" ,ocaml-ppx-compare)
-       ("ppx-custom-printf" ,ocaml-ppx-custom-printf)
-       ("ppx-deriving" ,ocaml-ppx-deriving)
-       ("ppx-enumerate" ,ocaml-ppx-enumerate)
-       ("ppx-expect" ,ocaml-ppx-expect)
-       ("ppx-fail" ,ocaml-ppx-fail)
-       ("ppx-fields-conv" ,ocaml-ppx-fields-conv)
-       ("ppx-here" ,ocaml-ppx-here)
-       ("ppx-inline-test" ,ocaml-ppx-inline-test)
-       ("ppx-let" ,ocaml-ppx-let)
-       ("ppx-pipebang" ,ocaml-ppx-pipebang)
-       ("ppx-sexp-conv" ,ocaml-ppx-sexp-conv)
-       ("ppx-sexp-message" ,ocaml-ppx-sexp-message)
-       ("ppx-sexp-value" ,ocaml-ppx-sexp-value)
-       ("ppx-typerep-conv" ,ocaml-ppx-typerep-conv)
-       ("ppx-variants-conv" ,ocaml-ppx-variants-conv)))
-    (arguments janestreet-arguments)
+     `(("ppx-assert" ,ocaml4.02-ppx-assert)
+       ("ppx-bench" ,ocaml4.02-ppx-bench)
+       ("ppx-bin-prot" ,ocaml4.02-ppx-bin-prot)
+       ("ppx-compare" ,ocaml4.02-ppx-compare)
+       ("ppx-custom-printf" ,ocaml4.02-ppx-custom-printf)
+       ("ppx-deriving" ,ocaml4.02-ppx-deriving)
+       ("ppx-enumerate" ,ocaml4.02-ppx-enumerate)
+       ("ppx-expect" ,ocaml4.02-ppx-expect)
+       ("ppx-fail" ,ocaml4.02-ppx-fail)
+       ("ppx-fields-conv" ,ocaml4.02-ppx-fields-conv)
+       ("ppx-here" ,ocaml4.02-ppx-here)
+       ("ppx-inline-test" ,ocaml4.02-ppx-inline-test)
+       ("ppx-let" ,ocaml4.02-ppx-let)
+       ("ppx-pipebang" ,ocaml4.02-ppx-pipebang)
+       ("ppx-sexp-conv" ,ocaml4.02-ppx-sexp-conv)
+       ("ppx-sexp-message" ,ocaml4.02-ppx-sexp-message)
+       ("ppx-sexp-value" ,ocaml4.02-ppx-sexp-value)
+       ("ppx-typerep-conv" ,ocaml4.02-ppx-typerep-conv)
+       ("ppx-variants-conv" ,ocaml4.02-ppx-variants-conv)))
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/ppx_jane/")
     (synopsis "Standard Jane Street ppx rewriters")
     (description "Ppx_jane is a ppx_driver including all standard ppx rewriters.")
     (license license:asl2.0)))
 
-(define-public ocaml-core-kernel
+(define-public ocaml4.02-core-kernel
   (package
-    (name "ocaml-core-kernel")
+    (name "ocaml4.02-core-kernel")
     (version "113.33.03")
     (source (janestreet-origin "core_kernel" version
                "0fl23jrwivixawhxinbwaw9cabqnzn7fini7dxpxjjvkxdc8ip5y"))
     (native-inputs
-     `(("js-build-tools" ,ocaml-js-build-tools)
-       ("ppx-jane" ,ocaml-ppx-jane)
+     `(("js-build-tools" ,ocaml4.02-js-build-tools)
+       ("ppx-jane" ,ocaml4.02-ppx-jane)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("bin_prot" ,ocaml-bin-prot)
-       ("ppx-assert" ,ocaml-ppx-assert)
-       ("ppx-bench" ,ocaml-ppx-bench)
-       ("ppx-driver" ,ocaml-ppx-driver)
-       ("ppx-expect" ,ocaml-ppx-expect)
-       ("ppx-inline-test" ,ocaml-ppx-inline-test)
-       ("typerep" ,ocaml-typerep)
-       ("sexplib" ,ocaml-sexplib)
-       ("variantslib" ,ocaml-variantslib)
-       ("result" ,ocaml-result)
-       ("fieldslib" ,ocaml-fieldslib)))
+     `(("bin_prot" ,ocaml4.02-bin-prot)
+       ("ppx-assert" ,ocaml4.02-ppx-assert)
+       ("ppx-bench" ,ocaml4.02-ppx-bench)
+       ("ppx-driver" ,ocaml4.02-ppx-driver)
+       ("ppx-expect" ,ocaml4.02-ppx-expect)
+       ("ppx-inline-test" ,ocaml4.02-ppx-inline-test)
+       ("typerep" ,ocaml4.02-typerep)
+       ("sexplib" ,ocaml4.02-sexplib)
+       ("variantslib" ,ocaml4.02-variantslib)
+       ("result" ,ocaml4.02-result)
+       ("fieldslib" ,ocaml4.02-fieldslib)))
     (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/core_kernel/")
     (synopsis "Portable standard library for OCaml")
     (description "Core is an alternative to the OCaml standard library.
@@ -3023,127 +3888,145 @@ Core_kernel is the system-independent part of Core.  It is aimed for cases when
 the full Core is not available, such as in Javascript.")
     (license license:asl2.0)))
 
-(define-public ocaml-async-kernel
+(define-public ocaml4.02-async-kernel
   (package
-    (name "ocaml-async-kernel")
+    (name "ocaml4.02-async-kernel")
     (version "113.33.03")
     (source (janestreet-origin "async_kernel" version
               "04bjsaa23j831r09r38x6xx9nhryvp0z5ihickvhxqa4fb2snyvd"))
     (native-inputs
      `(("oasis" ,ocaml-oasis)
-       ("js-build-tools" ,ocaml-js-build-tools)
-       ("ppx-jane" ,ocaml-ppx-jane)
+       ("js-build-tools" ,ocaml4.02-js-build-tools)
+       ("ppx-jane" ,ocaml4.02-ppx-jane)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("core-kernel" ,ocaml-core-kernel)))
+     `(("core-kernel" ,ocaml4.02-core-kernel)))
     (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/async_kernel/")
     (synopsis "Monadic concurrency library")
     (description "Async-kernel is a library for concurrent programming in OCaml.")
     (license license:asl2.0)))
 
-(define-public ocaml-async-rpc-kernel
+(define-public ocaml4.02-async-rpc-kernel
   (package
-    (name "ocaml-async-rpc-kernel")
+    (name "ocaml4.02-async-rpc-kernel")
     (version "113.33.03")
     (source (janestreet-origin "async_rpc_kernel" version
              "0y97h9pkb00v7jpf87m8cbb0ffkclj9g26ph6sq97q8dpisnkjwh"))
     (native-inputs
      `(("oasis" ,ocaml-oasis)
-       ("js-build-tools" ,ocaml-js-build-tools)
-       ("ppx-jane" ,ocaml-ppx-jane)
+       ("js-build-tools" ,ocaml4.02-js-build-tools)
+       ("ppx-jane" ,ocaml4.02-ppx-jane)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("async-kernel" ,ocaml-async-kernel)))
+     `(("async-kernel" ,ocaml4.02-async-kernel)))
     (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/async_rpc_kernel/")
     (synopsis "Platform-independent core of the Async RPC library")
     (description "Async_rpc_kernel is the platform-independent core of
 the Async RPC library.")
     (license license:asl2.0)))
 
-(define-public ocaml-core
+(define-public ocaml4.02-core
   (package
-    (name "ocaml-core")
+    (name "ocaml4.02-core")
     (version "113.33.03")
     (source (janestreet-origin "core" version
               "1znll157qg56g9d3247fjibv1hxv3r9wxgr4nhy19j2vzdh6a268"))
     (native-inputs
      `(("oasis" ,ocaml-oasis)
-       ("js-build-tools" ,ocaml-js-build-tools)
-       ("ppx-jane" ,ocaml-ppx-jane)
+       ("js-build-tools" ,ocaml4.02-js-build-tools)
+       ("ppx-jane" ,ocaml4.02-ppx-jane)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("core-kernel" ,ocaml-core-kernel)))
+     `(("core-kernel" ,ocaml4.02-core-kernel)))
     (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/core/")
     (synopsis "Alternative to OCaml's standard library")
     (description "The Core suite of libraries is an alternative to OCaml's
 standard library that was developed by Jane Street.")
     (license license:asl2.0)))
 
-(define-public ocaml-async-unix
+(define-public ocaml4.02-async-unix
   (package
-    (name "ocaml-async-unix")
+    (name "ocaml4.02-async-unix")
     (version "113.33.03")
     (source (janestreet-origin "async_unix" version
               "1fwl0lfrizllcfjk8hk8m7lsz9ha2jg6qgk4gssfyz377qvpcq4h"))
     (native-inputs
      `(("oasis" ,ocaml-oasis)
-       ("js-build-tools" ,ocaml-js-build-tools)
-       ("ppx-jane" ,ocaml-ppx-jane)
+       ("js-build-tools" ,ocaml4.02-js-build-tools)
+       ("ppx-jane" ,ocaml4.02-ppx-jane)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("async-kernel" ,ocaml-async-kernel)
-       ("core" ,ocaml-core)))
+     `(("async-kernel" ,ocaml4.02-async-kernel)
+       ("core" ,ocaml4.02-core)))
     (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/async_unix")
     (synopsis "Asynchronous execution library for Unix")
     (description "Async_unix is an asynchronous execution library for Unix.")
     (license license:asl2.0)))
 
-(define-public ocaml-async-extra
+(define-public ocaml4.02-async-extra
   (package
-    (name "ocaml-async-extra")
+    (name "ocaml4.02-async-extra")
     (version "113.33.03")
     (source (janestreet-origin "async_extra" version
               "1si8jgiq5xh5sl9f2b7f9p17p7zx5h1pg557x2cxywi2x7pxqg4f"))
     (native-inputs
      `(("oasis" ,ocaml-oasis)
-       ("js-build-tools" ,ocaml-js-build-tools)
-       ("ppx-jane" ,ocaml-ppx-jane)
+       ("js-build-tools" ,ocaml4.02-js-build-tools)
+       ("ppx-jane" ,ocaml4.02-ppx-jane)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("async-rpc-kernel" ,ocaml-async-rpc-kernel)
-       ("async-unix" ,ocaml-async-unix)
-       ("core" ,ocaml-core)))
+     `(("async-rpc-kernel" ,ocaml4.02-async-rpc-kernel)
+       ("async-unix" ,ocaml4.02-async-unix)
+       ("core" ,ocaml4.02-core)))
     (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/async_extra")
     (synopsis "Extra functionnalities for the async library")
     (description "Async_extra provides additional functionnalities for the
 async library.")
     (license license:asl2.0)))
 
-(define-public ocaml-async
+(define-public ocaml4.02-async
   (package
-    (name "ocaml-async")
+    (name "ocaml4.02-async")
     (version "113.33.03")
     (source (janestreet-origin "async" version
               "0210fyhcs12kpmmd26015bgivkfd2wqkyn3c5wd7688d0f872y25"))
     (native-inputs
      `(("oasis" ,ocaml-oasis)
-       ("js-build-tools" ,ocaml-js-build-tools)
-       ("ppx-jane" ,ocaml-ppx-jane)
+       ("js-build-tools" ,ocaml4.02-js-build-tools)
+       ("ppx-jane" ,ocaml4.02-ppx-jane)
        ("opam" ,opam)))
     (propagated-inputs
-     `(("async-extra" ,ocaml-async-extra)))
+     `(("async-extra" ,ocaml4.02-async-extra)))
     (build-system ocaml-build-system)
-    (arguments janestreet-arguments)
+    (arguments
+      (ensure-keyword-arguments janestreet-arguments
+       `(#:ocaml ,ocaml-4.02
+         #:findlib ,ocaml4.02-findlib)))
     (home-page "https://github.com/janestreet/async")
     (synopsis "Monadic concurrency library")
     (description "Async is a library for concurrent programming in OCaml.")
@@ -3162,7 +4045,9 @@ async library.")
                 "0hwj09rnzjs0m0kazz5h2mgs6p95j0zlga8cda5srnzqmzhniwkn"))
               (file-name (string-append name "-" version ".tar.gz"))))
     (build-system ocaml-build-system)
-    (native-inputs `(("cppo" ,ocaml-cppo)))
+    (native-inputs
+     `(("cppo" ,ocaml-cppo)
+       ("ocamlbuild" ,ocamlbuild)))
     (home-page "https://github.com/OCamlPro/ocplib-endian")
     (synopsis "Optimised functions to read and write int16/32/64 from strings
 and bigarrays")
@@ -3172,9 +4057,12 @@ strings, bytes and bigstring (Bigarrys of chars), and provides submodules for
 big- and little-endian, with their unsafe counter-parts.")
     (license license:lgpl2.1)))
 
-(define-public ocaml-cstruct
+(define-public ocaml4.02-ocplib-endian
+  (package-with-ocaml4.02 ocaml-ocplib-endian))
+
+(define-public ocaml4.02-cstruct
   (package
-    (name "ocaml-cstruct")
+    (name "ocaml4.02-cstruct")
     (version "2.3.1")
     (source (origin
               (method url-fetch)
@@ -3186,7 +4074,9 @@ big- and little-endian, with their unsafe counter-parts.")
               (file-name (string-append name "-" version ".tar.gz"))))
     (build-system ocaml-build-system)
     (arguments
-     `(#:configure-flags
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib
+       #:configure-flags
        (list "--enable-lwt" "--enable-async")
        #:phases
        (modify-phases %standard-phases
@@ -3199,14 +4089,14 @@ big- and little-endian, with their unsafe counter-parts.")
                (symlink (string-append lib "/dllcstruct_stubs.so")
                         (string-append stubs "/dllcstruct_stubs.so"))))))))
     (native-inputs
-     `(("ounit" ,ocaml-ounit)
-       ("ppx-tools" ,ocaml-ppx-tools)
-       ("camlp4" ,camlp4)))
+     `(("ounit" ,ocaml4.02-ounit)
+       ("ppx-tools" ,ocaml4.02-ppx-tools)
+       ("camlp4" ,camlp4-4.02)))
     (propagated-inputs
-     `(("ocplib-endian" ,ocaml-ocplib-endian)
-       ("lwt" ,ocaml-lwt)
-       ("async" ,ocaml-async)
-       ("sexplib" ,ocaml-sexplib)))
+     `(("ocplib-endian" ,ocaml4.02-ocplib-endian)
+       ("lwt" ,ocaml4.02-lwt)
+       ("async" ,ocaml4.02-async)
+       ("sexplib" ,ocaml4.02-sexplib)))
     (home-page "https://github.com/mirage/ocaml-cstruct")
     (synopsis "Access C structures via a camlp4 extension")
     (description "Cstruct is a library and syntax extension to make it easier
@@ -3214,9 +4104,9 @@ to access C-like structures directly from OCaml.  It supports both reading and
 writing to these structures, and they are accessed via the Bigarray module.")
     (license license:isc)))
 
-(define-public ocaml-hex
+(define-public ocaml4.02-hex
   (package
-    (name "ocaml-hex")
+    (name "ocaml4.02-hex")
     (version "1.0.0")
     (source (origin
               (method url-fetch)
@@ -3227,15 +4117,19 @@ writing to these structures, and they are accessed via the Bigarray module.")
                 "0s63g0b8gfv2xm6fv6xg7bva8h76b5pcjb0zw3f8cygs0lq9072v"))
               (file-name (string-append name "-" version ".tar.gz"))))
     (build-system ocaml-build-system)
-    (propagated-inputs `(("cstruct" ,ocaml-cstruct)))
+    (arguments
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib))
+    (propagated-inputs
+     `(("cstruct" ,ocaml4.02-cstruct)))
     (home-page "https://github.com/mirage/ocaml-hex/")
     (synopsis "Minimal library providing hexadecimal converters")
     (description "Hex is a minimal library providing hexadecimal converters.")
     (license license:isc)))
 
-(define-public ocaml-ezjsonm
+(define-public ocaml4.02-ezjsonm
   (package
-    (name "ocaml-ezjsonm")
+    (name "ocaml4.02-ezjsonm")
     (version "0.4.3")
     (source (origin
               (method url-fetch)
@@ -3247,14 +4141,16 @@ writing to these structures, and they are accessed via the Bigarray module.")
               (file-name (string-append name "-" version ".tar.gz"))))
     (build-system ocaml-build-system)
     (native-inputs
-     `(("alcotest" ,ocaml-alcotest)))
+     `(("alcotest" ,ocaml4.02-alcotest)))
     (propagated-inputs
-     `(("hex" ,ocaml-hex)
-       ("jsonm" ,ocaml-jsonm)
-       ("lwt" ,ocaml-lwt)
-       ("sexplib" ,ocaml-sexplib)))
+     `(("hex" ,ocaml4.02-hex)
+       ("jsonm" ,ocaml4.02-jsonm)
+       ("lwt" ,ocaml4.02-lwt)
+       ("sexplib" ,ocaml4.02-sexplib)))
     (arguments
-     `(#:configure-flags (list "--enable-lwt")))
+     `(#:configure-flags (list "--enable-lwt")
+       #:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib))
     (home-page "https://github.com/mirage/ezjsonm/")
     (synopsis "Read and write JSON data")
     (description "Ezjsonm provides more convenient (but far less flexible) input
@@ -3263,9 +4159,9 @@ the need to write signal code, which is useful for quick scripts that manipulate
 JSON.")
     (license license:isc)))
 
-(define-public ocaml-uri
+(define-public ocaml4.02-uri
   (package
-    (name "ocaml-uri")
+    (name "ocaml4.02-uri")
     (version "1.9.2")
     (source (origin
               (method url-fetch)
@@ -3276,14 +4172,17 @@ JSON.")
                 "02bzrag79prx261rxf9mlak749pwf4flpfl8p012x1xznv9m0clc"))
               (file-name (string-append name "-" version ".tar.gz"))))
     (build-system ocaml-build-system)
+    (arguments
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib))
     (native-inputs
-     `(("ounit" ,ocaml-ounit)))
+     `(("ounit" ,ocaml4.02-ounit)))
     (propagated-inputs
-     `(("ppx-sexp-conv" ,ocaml-ppx-sexp-conv)
-       ("re" ,ocaml-re)
-       ("ppx-deriving" ,ocaml-ppx-deriving)
-       ("sexplib" ,ocaml-sexplib)
-       ("stringext" ,ocaml-stringext)))
+     `(("ppx-sexp-conv" ,ocaml4.02-ppx-sexp-conv)
+       ("re" ,ocaml4.02-re)
+       ("ppx-deriving" ,ocaml4.02-ppx-deriving)
+       ("sexplib" ,ocaml4.02-sexplib)
+       ("stringext" ,ocaml4.02-stringext)))
     (home-page "https://github.com/mirage/ocaml-uri")
     (synopsis "RFC3986 URI/URL parsing library")
     (description "OCaml-uri is a library for parsing URI/URL in the RFC3986 format.")
@@ -3312,6 +4211,9 @@ JSON.")
 Format module of the OCaml standard library.")
     (license license:bsd-3)))
 
+(define-public ocaml4.02-easy-format
+  (package-with-ocaml4.02 ocaml-easy-format))
+
 (define-public optcomp
   (package
     (name "optcomp")
@@ -3326,13 +4228,15 @@ Format module of the OCaml standard library.")
               (file-name (string-append name "-" version ".tar.gz"))))
     (build-system ocaml-build-system)
     (arguments
-     `(#:use-make? #t
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib
+       #:use-make? #t
        #:make-flags
        (list (string-append "BUILDFLAGS=\"-cflags -I,"
                             (assoc-ref %build-inputs "camlp4")
                             "/lib/ocaml/site-lib/camlp4/Camlp4Parsers\""))))
-    (native-inputs `(("camlp4" ,camlp4)))
-    (propagated-inputs `(("camlp4" ,camlp4)))
+    (native-inputs `(("camlp4" ,camlp4-4.02)))
+    (propagated-inputs `(("camlp4" ,camlp4-4.02)))
     (home-page "https://github.com/diml/optcomp")
     (synopsis "Optional compilation for OCaml")
     (description "Optcomp provides an optional compilation facility with
@@ -3342,14 +4246,14 @@ cpp-like directives.")
 (define-public ocaml-piqilib
   (package
     (name "ocaml-piqilib")
-    (version "0.6.13")
+    (version "0.6.14")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/alavrik/piqi/archive/v"
                                   version ".tar.gz"))
               (sha256
                (base32
-                "1whqr2bb3gds2zmrzqnv8vqka9928w4lx6mi6g244kmbwb2h8d8l"))
+                "1ssccnwqzfyf7syfq2fv4zyhwayxwd75rhq9y28mvq1w6qbww4l7"))
               (file-name (string-append name "-" version ".tar.gz"))))
     (build-system ocaml-build-system)
     (arguments
@@ -3365,14 +4269,17 @@ cpp-like directives.")
              (let ((out (assoc-ref outputs "out")))
                (substitute* "make/OCamlMakefile"
                  (("/bin/sh") (which "bash")))
-               (zero? (system* "./configure" "--prefix" out "--ocaml-libdir"
-                               (string-append out "/lib/ocaml/site-lib"))))))
+               (invoke "./configure" "--prefix" out "--ocaml-libdir"
+                       (string-append out "/lib/ocaml/site-lib")))
+             #t))
        (add-after 'build 'build-ocaml
          (lambda* (#:key outputs #:allow-other-keys)
-           (zero? (system* "make" "ocaml")))) 
+           (invoke "make" "ocaml")
+           #t))
        (add-after 'install 'install-ocaml
          (lambda* (#:key outputs #:allow-other-keys)
-           (zero? (system* "make" "ocaml-install"))))
+           (invoke "make" "ocaml-install")
+           #t))
        (add-after 'install-ocaml 'link-stubs
          (lambda* (#:key outputs #:allow-other-keys)
            (let* ((out (assoc-ref outputs "out"))
@@ -3388,15 +4295,18 @@ cpp-like directives.")
     (propagated-inputs
      `(("xmlm" ,ocaml-xmlm)
        ("ulex" ,ocaml-ulex)
-       ("optcomp" ,optcomp)
        ("easy-format" ,ocaml-easy-format)
        ("base64" ,ocaml-base64)))
+    (home-page "http://www.cduce.org/download.html#side")
     (home-page "http://piqi.org")
     (synopsis "Data serialization and conversion library")
     (description "Piqilib is the common library used by the piqi command-line
 tool and piqi-ocaml.")
     (license license:asl2.0)))
 
+(define-public ocaml4.02-piqilib
+  (package-with-ocaml4.02 ocaml-piqilib))
+
 (define-public ocaml-uuidm
   (package
     (name "ocaml-uuidm")
@@ -3416,7 +4326,8 @@ tool and piqi-ocaml.")
        (modify-phases %standard-phases
          (delete 'configure))))
     (native-inputs
-     `(("opam" ,opam)))
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)))
     (propagated-inputs
      `(("cmdliner" ,ocaml-cmdliner)
        ("topkg" ,ocaml-topkg)))
@@ -3427,21 +4338,24 @@ unique identifiers (UUIDs) version 3, 5 (named based with MD5, SHA-1 hashing)
 and 4 (random based) according to RFC 4122.")
     (license license:isc)))
 
+(define-public ocaml4.02-uuidm
+  (package-with-ocaml4.02 ocaml-uuidm))
+
 (define-public ocaml-graph
   (package
     (name "ocaml-graph")
-    (version "1.8.7")
+    (version "1.8.8")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://ocamlgraph.lri.fr/download/"
                                   "ocamlgraph-" version ".tar.gz"))
               (sha256
                (base32
-                "1845r537swjil2fcj7lgbibc2zybfwqqasrd2s7bncajs83cl1nz"))
-              (patches (search-patches "ocaml-graph-honor-source-date-epoch.patch"))))
+                "0m9g16wrrr86gw4fz2fazrh8nkqms0n863w7ndcvrmyafgxvxsnr"))))
     (build-system ocaml-build-system)
     (arguments
      `(#:install-target "install-findlib"
+       #:tests? #f
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'set-shell
@@ -3454,10 +4368,13 @@ and 4 (random based) according to RFC 4122.")
     (description "OCamlgraph is a generic graph library for OCaml.")
     (license license:lgpl2.1)))
 
+(define-public ocaml4.02-graph
+  (package-with-ocaml4.02 ocaml-graph))
+
 (define-public ocaml-piqi
   (package
     (name "ocaml-piqi")
-    (version "0.7.5")
+    (version "0.7.6")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/alavrik/piqi-ocaml/"
@@ -3465,7 +4382,7 @@ and 4 (random based) according to RFC 4122.")
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "0ngz6y8i98i5v2ma8nk6mc83pdsmf2z0ks7m3xi6clfg3zqbddrv"))))
+                "0da0v2v28aj65b0cwpvvmcqyrfvz94pp3j5zgfdr1jrl5s37c21g"))))
     (build-system ocaml-build-system)
     (arguments
      `(#:make-flags
@@ -3477,9 +4394,13 @@ and 4 (random based) according to RFC 4122.")
          (delete 'configure))))
     (native-inputs
      `(("which" ,which)
+       ("camlp4" ,camlp4)
        ("protobuf" ,protobuf))) ; for tests
     (propagated-inputs
-     `(("piqilib" ,ocaml-piqilib)))
+     `(("num" ,ocaml-num)
+       ("piqilib" ,ocaml-piqilib)))
+    (properties
+      `((ocaml4.02-variant . ,(delay ocaml4.02-piqi))))
     (home-page "https://github.com/alavrik/piqi-ocaml")
     (synopsis "Protocol serialization system for OCaml")
     (description "Piqi is a multi-format data serialization system for OCaml.
@@ -3487,67 +4408,73 @@ It provides a uniform interface for serializing OCaml data structures to JSON,
 XML and Protocol Buffers formats.")
     (license license:asl2.0)))
 
+(define-public ocaml4.02-piqi
+  (let ((base (package-with-ocaml4.02 (strip-ocaml4.02-variant ocaml-piqi))))
+    (package
+      (inherit base)
+      (propagated-inputs
+       `(("piqilib" ,ocaml4.02-piqilib))))))
+
 (define-public bap
   (package
     (name "bap")
-    (version "1.1.0")
+    (version "1.3.0")
     (home-page "https://github.com/BinaryAnalysisPlatform/bap")
     (source (origin
               (method url-fetch)
               (uri (string-append home-page "/archive/v" version ".tar.gz"))
               (sha256
                (base32
-                "1ms95m4j1qrmy7zqmsn2izh7gq68lnmssl7chyhk977kd3sxj66m"))
+                "0v95v9mp7mg8fj25ry0w7566zd9xp6cs8nnqj4l38q54fb1hfav9"))
               (file-name (string-append name "-" version ".tar.gz"))))
    (build-system ocaml-build-system)
    (native-inputs
-    `(("oasis" ,ocaml-oasis)
+    `(("oasis" ,ocaml4.02-oasis)
       ("clang" ,clang-3.8)
-      ("ounit" ,ocaml-ounit)))
+      ("ounit" ,ocaml4.02-ounit)))
    (propagated-inputs
-    `(("core-kernel" ,ocaml-core-kernel)
-      ("ppx-driver" ,ocaml-ppx-driver)
-      ("uri" ,ocaml-uri)
+    `(("core-kernel" ,ocaml4.02-core-kernel)
+      ("ppx-driver" ,ocaml4.02-ppx-driver)
+      ("bin-prot" ,ocaml4.02-bin-prot)
+      ("uri" ,ocaml4.02-uri)
       ("llvm" ,llvm-3.8)
       ("gmp" ,gmp)
       ("clang-runtime" ,clang-runtime)
-      ("fileutils" ,ocaml-fileutils)
-      ("cmdliner" ,ocaml-cmdliner)
-      ("zarith" ,ocaml-zarith)
-      ("uuidm" ,ocaml-uuidm)
-      ("camlzip" ,camlzip)
+      ("fileutils" ,ocaml4.02-fileutils)
+      ("cmdliner" ,ocaml4.02-cmdliner)
+      ("zarith" ,ocaml4.02-zarith)
+      ("uuidm" ,ocaml4.02-uuidm)
+      ("camlzip" ,ocaml4.02-camlzip)
       ("frontc" ,ocaml-frontc)
-      ("ezjsonm" ,ocaml-ezjsonm)
-      ("ocurl" ,ocaml-ocurl)
-      ("piqi" ,ocaml-piqi)
-      ("ocamlgraph" ,ocaml-graph)
-      ("bitstring" ,ocaml-bitstring)
-      ("ppx-jane" ,ocaml-ppx-jane)
-      ("re" ,ocaml-re)))
+      ("ezjsonm" ,ocaml4.02-ezjsonm)
+      ("ocurl" ,ocaml4.02-ocurl)
+      ("piqi" ,ocaml4.02-piqi)
+      ("ocamlgraph" ,ocaml4.02-graph)
+      ("bitstring" ,ocaml4.02-bitstring)
+      ("ppx-jane" ,ocaml4.02-ppx-jane)
+      ("re" ,ocaml4.02-re)))
    (inputs `(("llvm" ,llvm-3.8)))
    (arguments
-    `(#:use-make? #t
+    `(#:ocaml ,ocaml-4.02
+      #:findlib ,ocaml4.02-findlib
+      #:use-make? #t
       #:phases
       (modify-phases %standard-phases
         (replace 'configure
-          (lambda* (#:key outputs #:allow-other-keys)
-            (zero? (system* "./configure" "--prefix"
-                            (assoc-ref outputs "out")
-                            "--libdir"
-                            (string-append
-                              (assoc-ref outputs "out")
-                              "/lib/ocaml/site-lib")
-                            "--with-llvm-version=3.8"
-                            "--with-llvm-config=llvm-config"
-                            "--enable-everything"))))
-        (add-after 'install 'link-stubs
-          (lambda* (#:key outputs #:allow-other-keys)
-            (let* ((out (assoc-ref outputs "out"))
-                   (stubs (string-append out "/lib/ocaml/site-lib/stubslibs"))
-                   (lib (string-append out "/lib/ocaml/site-lib/bap-plugin-llvm")))
-              (mkdir-p stubs)
-              (symlink (string-append lib "/dllllvm_plugin_stubs.so")
-                       (string-append stubs "/dllllvm_plugin_stubs.so"))))))))
+          (lambda* (#:key outputs inputs #:allow-other-keys)
+            (invoke "./configure" "--prefix"
+                    (assoc-ref outputs "out")
+                    "--libdir"
+                    (string-append
+                      (assoc-ref outputs "out")
+                      "/lib/ocaml/site-lib")
+                    "--with-llvm-version=3.8"
+                    "--with-llvm-config=llvm-config"
+                    "--enable-everything")
+            (substitute* "plugins/objdump/objdump_main.ml"
+              (("Re_perl") "Re.Perl"))
+            (substitute* "oasis/objdump"
+              (("re.pcre") "re.pcre, re.perl")))))))
    (synopsis "Binary Analysis Platform")
    (description "Binary Analysis Platform is a framework for writing program
 analysis tools, that target binary files.  The framework consists of a plethora
@@ -3558,23 +4485,33 @@ the plugins facilitate extensibility, and the frontends serve as entry points.")
 (define-public ocaml-camomile
   (package
     (name "ocaml-camomile")
-    (version "0.8.5")
+    (version "1.0.1")
     (home-page "https://github.com/yoriyuki/Camomile")
     (source (origin
               (method url-fetch)
-              (uri (string-append home-page "/releases/download/rel-" version
-                                  "/camomile-" version ".tar.bz2"))
+              (uri (string-append home-page "/releases/download/" version
+                                  "/camomile-" version ".tbz"))
               (sha256
                (base32
-                "003ikpvpaliy5hblhckfmln34zqz0mk3y2m1fqvbjngh3h2np045"))))
+                "01ssjrqz41jvrqh27jxnh9cx7ywi9b5sgsykd00i7z9nrcwhlfy2"))))
     (build-system ocaml-build-system)
-    (native-inputs `(("camlp4" ,camlp4)))
+    (native-inputs
+     `(("camlp4" ,camlp4)
+       ("dune" ,dune)))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'fix-bin/sh
+         (delete 'configure)
+         (replace 'build
            (lambda _
-             (setenv "CONFIG_SHELL" (which "bash")))))))
+             (invoke "dune" "build" "@install" "--profile" "release")
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "dune" "install"
+                     "--prefix" (assoc-ref outputs "out"))
+             #t)))
+       #:tests? #f))
     (synopsis "Comprehensive Unicode library")
     (description "Camomile is a Unicode library for OCaml.  Camomile provides
 Unicode character type, UTF-8, UTF-16, UTF-32 strings, conversion to/from about
@@ -3583,6 +4520,9 @@ library is currently designed for Unicode Standard 3.2.")
     ;; with an exception for linked libraries to use a different license
     (license license:lgpl2.0+)))
 
+(define-public ocaml4.02-camomile
+  (package-with-ocaml4.02 ocaml-camomile))
+
 (define-public ocaml-jbuilder
   (package
     (name "ocaml-jbuilder")
@@ -3595,10 +4535,12 @@ library is currently designed for Unicode Standard 3.2.")
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "0gcy52y0mkg450yxwszp3lww303a1154566r8jb4hh5l61dh4dwj"))))
+                "1cy07pwvbrlysszs938yd74yyvvbgkffpb82qrjph77zf0h2gdi7"))))
     (build-system ocaml-build-system)
     (arguments
-     `(#:phases
+     `(#:ocaml ,ocaml-4.02
+       #:findlib ,ocaml4.02-findlib
+       #:phases
        (modify-phases %standard-phases
          (replace 'configure
            (lambda* (#:key outputs #:allow-other-keys)
@@ -3606,7 +4548,7 @@ library is currently designed for Unicode Standard 3.2.")
                (setenv "PREFIX" out))
              #t)))))
     (native-inputs
-     `(("menhir" ,ocaml-menhir)))
+     `(("menhir" ,ocaml4.02-menhir)))
     (propagated-inputs
      `(("opam" ,opam)))
     (home-page "https://github.com/janestreet/jbuilder")
@@ -3654,10 +4596,13 @@ to write text editors, edition widgets, readlines, etc.  You just have to
 connect an engine to your inputs and rendering functions to get an editor.")
     (license license:bsd-3)))
 
+(define-public ocaml4.02-zed
+  (package-with-ocaml4.02 ocaml-zed))
+
 (define-public ocaml-lambda-term
   (package
     (name "ocaml-lambda-term")
-    (version "1.11")
+    (version "1.13")
     (source
      (origin
        (method url-fetch)
@@ -3665,26 +4610,27 @@ connect an engine to your inputs and rendering functions to get an editor.")
                            version ".tar.gz"))
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
-        (base32 "10lx1jqgmmfwwlv64di4a8nia9l53v7179z70n9fx6aq5l7r8nba"))))
+        (base32 "1hy5ryagqclgdm9lzh1qil5mrynlypv7mn6qm858hdcnmz9zzn0l"))))
     (build-system ocaml-build-system)
     (arguments
-     `(#:test-target "test"
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (delete 'configure)
-         ;; currently, ocaml-lwt is an old version of lwt from before lwt.react
-         ;; was split into a separate module called lwt_react
-         (add-before 'build 'use-old-lwt-react-name
+         (replace 'build
            (lambda _
-             (substitute* "src/jbuild" (("lwt_react") "lwt.react"))))
+             (invoke "dune" "build" "@install" "--profile" "release")
+             #t))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (zero? (system* "jbuilder" "install" "--prefix" out))))))))
+             (invoke "dune" "install"
+                     "--prefix" (assoc-ref outputs "out"))
+             #t)))
+       #:tests? #f))
     (native-inputs
-     `(("jbuilder" ,ocaml-jbuilder)))
+     `(("dune" ,dune)))
     (propagated-inputs
      `(("lwt" ,ocaml-lwt)
+       ("lwt-log" ,ocaml-lwt-log)
        ("zed" ,ocaml-zed)))
     (home-page "https://github.com/diml/lambda-term")
     (synopsis "Terminal manipulation library for OCaml")
@@ -3696,18 +4642,21 @@ manipulation than, for example, ncurses, by providing a native OCaml interface
 instead of bindings to a C library.")
     (license license:bsd-3)))
 
+(define-public ocaml4.02-lambda-term
+  (package-with-ocaml4.02 ocaml-lambda-term))
+
 (define-public ocaml-utop
   (package
     (name "ocaml-utop")
-    (version "2.0.2")
+    (version "2.2.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append "https://github.com/diml/utop/archive/"
+              (uri (string-append "https://github.com/ocaml-community/utop/archive/"
                                   version ".tar.gz"))
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "0rglznh4prcix8spi3f060jz2gngk7x8vkd291fxs10b88aqcpxf"))))
+                "1414snwmqaxs1x8wbpjf6fn3jsl01hq0phrr7639xmb5vh15mgd4"))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
@@ -3761,6 +4710,8 @@ sensitive completion, colors, and more.")
        #:phases
        (modify-phases %standard-phases
          (delete 'configure))))
+    (native-inputs
+     `(("ocamlbuild" ,ocamlbuild)))
     (inputs
      `(("topkg" ,ocaml-topkg)
        ("opam" ,opam)))
@@ -3773,7 +4724,7 @@ long and size_t whose sizes depend on the host platform.")
 (define-public ocaml-ctypes
   (package
    (name "ocaml-ctypes")
-   (version "0.13.1")
+   (version "0.14.0")
    (home-page "https://github.com/ocamllabs/ocaml-ctypes")
    (source (origin
              (method url-fetch)
@@ -3781,10 +4732,11 @@ long and size_t whose sizes depend on the host platform.")
              (file-name (string-append name "-" version ".tar.gz"))
              (sha256
               (base32
-               "17w0pr5k0zjcjns4y9n36rjpfl35zhvp3h8ggqs9lz12qhshdk2m"))))
+               "0zrsd42q2nciyg9375g2kydqax6ay299rhyfgms59qiw7d9ylyp9"))))
    (build-system ocaml-build-system)
    (arguments
-    `(#:make-flags
+    `(#:tests? #f; require an old lwt
+      #:make-flags
       (list (string-append "INSTALL_HEADERS = $(wildcard $($(PROJECT).dir)/*.h)"))
       #:phases
       (modify-phases %standard-phases
@@ -3832,7 +4784,8 @@ without writing or generating any C!")
     `(("topkg" ,ocaml-topkg)
       ("opam" ,opam)))
    (native-inputs
-    `(("astring" ,ocaml-astring)))
+    `(("astring" ,ocaml-astring)
+      ("ocamlbuild" ,ocamlbuild)))
    (synopsis "OCamlbuild plugin for C stubs")
    (description "Ocb-stubblr is about ten lines of code that you need to
 repeat over, over, over and over again if you are using ocamlbuild to build
@@ -3860,7 +4813,8 @@ OCaml projects that contain C stubs.")
        (modify-phases %standard-phases
          (delete 'configure))))
     (native-inputs
-     `(("opam" ,opam)
+     `(("ocamlbuild" ,ocamlbuild)
+       ("opam" ,opam)
        ("pkg-config" ,pkg-config)))
     (inputs
      `(("topkg" ,ocaml-topkg)
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index fe784ffaa1..471a08b799 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -343,7 +343,8 @@ the Nix package manager.")
            (replace 'install
              (lambda* (#:key outputs #:allow-other-keys)
                (invoke "make" "install-binPROGRAMS"
-                       "install-nodist_pkglibexecSCRIPTS")
+                       "install-nodist_pkglibexecSCRIPTS"
+                       "install-nodist_libexecSCRIPTS") ;guix-authenticate
 
                ;; We need to tell 'guix-daemon' which 'guix' command to use.
                ;; Here we use a questionable hack where we hard-code root's
@@ -568,13 +569,13 @@ transactions from C or Python.")
 (define-public diffoscope
   (package
     (name "diffoscope")
-    (version "104")
+    (version "105")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri name version))
               (sha256
                (base32
-                "0vnfhnvqvdwgh1sh2lmwad8jk2vjvq76p5xm3pfgxdik2yblmvqd"))))
+                "0bqkwvrvlvybqfi73qv1k5xic2qzw5lv20imqadf1wc4l8vc0vq3"))))
     (build-system python-build-system)
     (arguments
      `(#:phases (modify-phases %standard-phases
diff --git a/gnu/packages/patches/clamav-config-llvm-libs.patch b/gnu/packages/patches/clamav-config-llvm-libs.patch
new file mode 100644
index 0000000000..054264ee2e
--- /dev/null
+++ b/gnu/packages/patches/clamav-config-llvm-libs.patch
@@ -0,0 +1,14 @@
+Our llvm does not contain a single top-level library, so consult llvm-config
+for the libraries that need to be linked against.
+
+--- clamav-0.100.2/libclamav/c++/configure.ac	2018-09-19 14:29:07.000000000 -0500
++++ clamav-0.100.2/libclamav/c++/configure.ac	2018-10-06 21:45:09.377249158 -0500
+@@ -105,7 +105,7 @@
+ 
+     if test "x$llvm_linking" = "xdynamic"; then
+         AC_SUBST(LLVMCONFIG_LDFLAGS, [`$llvmconfig --ldflags`])
+-        AC_SUBST(LLVMCONFIG_LIBS, [-lLLVM-$llvmver])
++        AC_SUBST(LLVMCONFIG_LIBS, [`$llvmconfig --libs $llvmcomp`])
+         AC_SUBST(LLVMCONFIG_LIBFILES, [])
+     else
+         if test $llvmver_test -ge 350; then
diff --git a/gnu/packages/patches/clamav-system-tomsfastmath.patch b/gnu/packages/patches/clamav-system-tomsfastmath.patch
new file mode 100644
index 0000000000..07ab79f3f7
--- /dev/null
+++ b/gnu/packages/patches/clamav-system-tomsfastmath.patch
@@ -0,0 +1,102 @@
+From 756ff89526b5ffaa7a4f49b1bbecf2ecbd6f85f9 Mon Sep 17 00:00:00 2001
+From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
+Date: Wed, 11 Mar 2015 20:03:15 +0100
+Subject: add support for system tomsfastmath
+
+Patch-Name: add-support-for-system-tomsfastmath.patch
+---
+ configure.ac                           |    2 ++
+ libclamav/Makefile.am                  |   10 ++++++++--
+ libclamav/bignum.h                     |    6 +++++-
+ libclamav/xdp.c                        |    2 +-
+ m4/reorganization/libs/tomsfastmath.m4 |   12 ++++++++++++
+ 5 files changed, 28 insertions(+), 4 deletions(-)
+ create mode 100644 m4/reorganization/libs/tomsfastmath.m4
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -82,6 +82,7 @@ m4_include([m4/reorganization/libs/xml.m
+ m4_include([m4/reorganization/libs/openssl.m4])
+ m4_include([m4/reorganization/libs/json.m4])
+ m4_include([m4/reorganization/libs/pcre.m4])
++m4_include([m4/reorganization/libs/tomsfastmath.m4])
+ 
+ AM_MAINTAINER_MODE
+ m4_include([m4/reorganization/libs/libz.m4])
+@@ -285,6 +286,7 @@ else
+ fi
+ CL_MSG_STATUS([yara        ],[$enable_yara],[$enable_yara])
+ CL_MSG_STATUS([fts         ],[yes],[$lfs_fts_msg])
++CL_MSG_STATUS([tomsfastmath],[yes],[$tomsfastmath_msg])
+ 
+ 
+ # Yep, downgrading the compiler avoids the bug too:
+--- a/libclamav/Makefile.am
++++ b/libclamav/Makefile.am
+@@ -496,8 +496,10 @@ libclamav_la_SOURCES += yara_arena.c \
+ 	yara_clam.h
+ endif
+ 
+-libclamav_la_SOURCES += bignum.h\
+-	bignum_fast.h\
++libclamav_la_SOURCES += bignum.h
++
++if !SYSTEM_TOMSFASTMATH
++libclamav_la_SOURCES += bignum_fast.h\
+         tomsfastmath/addsub/fp_add.c\
+         tomsfastmath/addsub/fp_add_d.c\
+         tomsfastmath/addsub/fp_addmod.c\
+@@ -579,6 +581,10 @@ libclamav_la_SOURCES += bignum.h\
+         tomsfastmath/sqr/fp_sqr_comba_generic.c\
+         tomsfastmath/sqr/fp_sqr_comba_small_set.c\
+ 	tomsfastmath/sqr/fp_sqrmod.c
++else
++libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS)
++libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS)
++endif
+ 
+ .PHONY: version.h.tmp
+ version.c: version.h
+--- a/libclamav/bignum.h
++++ b/libclamav/bignum.h
+@@ -1,9 +1,13 @@
+ #ifndef BIGNUM_H_
+ #define BIGNUM_H_
+ 
++#if HAVE_SYSTEM_TOMSFASTMATH
++#include <tfm.h>
++#else
+ #define TFM_CHECK
+-
+ #include "bignum_fast.h"
++#endif
++
+ typedef fp_int mp_int;
+ #define mp_cmp fp_cmp
+ #define mp_toradix_n(a,b,c,d) fp_toradix_n(a,b,c,d)
+--- a/libclamav/xdp.c
++++ b/libclamav/xdp.c
+@@ -57,7 +57,7 @@
+ #include "scanners.h"
+ #include "conv.h"
+ #include "xdp.h"
+-#include "bignum_fast.h"
++#include "bignum.h"
+ #include "filetypes.h"
+ 
+ static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz);
+--- /dev/null
++++ b/m4/reorganization/libs/tomsfastmath.m4
+@@ -0,0 +1,12 @@
++dnl Check for system tomsfastmath
++PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no])
++
++AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"])
++
++if test "x$have_system_tomsfastmath" = "xyes"; then
++    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library])
++    tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS"
++else
++    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library])
++    tomsfastmath_msg="Internal"
++fi
diff --git a/gnu/packages/patches/emacs-realgud-fix-configure-ac.patch b/gnu/packages/patches/emacs-realgud-fix-configure-ac.patch
new file mode 100644
index 0000000000..8165857c87
--- /dev/null
+++ b/gnu/packages/patches/emacs-realgud-fix-configure-ac.patch
@@ -0,0 +1,27 @@
+From a293690f29407ac54a218d6d20c2142e1a0319d1 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Wed, 31 Oct 2018 00:08:34 -0400
+Subject: [PATCH] configure.ac: Fix NO_CHECK_EMACS_PACKAGES elisp.
+
+Remove the extraneous trailing parenthesis.
+---
+ configure.ac | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index de0d932..69bcea7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -25,8 +25,7 @@ AC_MSG_NOTICE("Checking prerequiste packages")
+ $EMACS -batch -q --no-site-file -eval \
+   '(dolist (package
+          (quote (cl-lib loc-changes load-relative test-simple)))
+-        (require package))
+-   )'
++        (require package))'
+ fi
+ if test $? -ne 0 ; then
+     AC_MSG_ERROR([Can't continue until above error is corrected.])
+-- 
+2.19.0
+
diff --git a/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch b/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch
index 2056b42356..fd9a4c9401 100644
--- a/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch
+++ b/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch
@@ -1,16 +1,28 @@
-From 26cac62fe0154cf65c06faaee10805531e9dade8 Mon Sep 17 00:00:00 2001
+From bc3b353cb2f26cf10aa5c5caebddf6d3d5b1e318 Mon Sep 17 00:00:00 2001
 From: Julien Lepiller <julien@lepiller.eu>
-Date: Wed, 14 Dec 2016 14:14:59 +0100
+Date: Fri, 21 Sep 2018 22:31:29 +0200
 Subject: [PATCH] fix camlp4 in another directory
 
 ---
- Makefile        | 11 ++++++-----
- configure       | 13 ++++++++++++-
- myocamlbuild.ml |  2 +-
- 3 files changed, 19 insertions(+), 7 deletions(-)
+ Makefile                              | 11 ++++++-----
+ configure                             | 13 ++++++++++++-
+ tests/Makefile                        |  2 +-
+ tests/camlp4-comments/Makefile        |  2 +-
+ tests/camlp4-exclude-file/Makefile    |  2 +-
+ tests/camlp4-exclude/Makefile         |  2 +-
+ tests/camlp4-instrument-fast/Makefile |  2 +-
+ tests/camlp4-instrument/Makefile      |  2 +-
+ tests/combine-expr/Makefile           |  2 +-
+ tests/ppx-comments/Makefile           |  2 +-
+ tests/ppx-exclude-file/Makefile       |  2 +-
+ tests/ppx-exclude/Makefile            |  2 +-
+ tests/ppx-instrument-fast/Makefile    |  2 +-
+ tests/ppx-instrument/Makefile         |  2 +-
+ tests/report/Makefile                 |  2 +-
+ 15 files changed, 31 insertions(+), 19 deletions(-)
 
 diff --git a/Makefile b/Makefile
-index 4a8ce17..d94a6d5 100644
+index b0980ee..6697922 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -25,7 +25,7 @@ PATH_BUILD=$(PATH_BASE)/_build
@@ -19,12 +31,12 @@ index 4a8ce17..d94a6d5 100644
  PATH_TESTS=$(PATH_BASE)/tests
 -PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect
 +PATH_INSTALL=$(PREFIX)/lib/ocaml/bisect
-
-
+ 
+ 
  # DEFINITIONS
 @@ -33,7 +33,8 @@ PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect
  PROJECT_NAME=bisect
- OCAMLBUILD=$(PATH_OCAML_PREFIX)/bin/ocamlbuild
+ OCAMLBUILD=ocamlbuild
  OCAMLBUILD_ENV=WARNINGS=$(WARNINGS) PATH_OCAML_PREFIX=$(PATH_OCAML_PREFIX)
 -OCAMLBUILD_FLAGS=-classic-display -no-links
 +CAMLP4_INCLUDE=$(shell test -z $(CAMLP4_LIBDIR) || echo "-cflags -I,$(CAMLP4_LIBDIR)")
@@ -33,22 +45,22 @@ index 4a8ce17..d94a6d5 100644
  MODULES_MLPACK=$(PROJECT_NAME).mlpack
  MODULES_MLPACK_PP=$(PROJECT_NAME)_pp.mlpack
 @@ -80,11 +81,11 @@ veryclean: clean
-	rm -f $(PATH_OCAMLDOC)/*.html $(PATH_OCAMLDOC)/*.css
-
+ 	rm -f $(PATH_OCAMLDOC)/*.html $(PATH_OCAMLDOC)/*.css
+ 
  install: FORCE
 -	cp $(PATH_BUILD)/src/report/report.byte $(PATH_OCAML_PREFIX)/bin/bisect-report; \
 +	cp $(PATH_BUILD)/src/report/report.byte $(PREFIX)/bin/bisect-report; \
-	if [ "$(PPX)" = "TRUE" ]; then \
+ 	if [ "$(PPX)" = "TRUE" ]; then \
 -	  cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PATH_OCAML_PREFIX)/bin; \
 +	  cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PREFIX)/bin; \
-	fi; \
--	(test -x $(PATH_OCAML_PREFIX)/bin/ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PATH_OCAML_PREFIX)/bin/bisect-report.opt || true); \
-+	(test -x $(PATH_OCAML_PREFIX)/bin/ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PREFIX)/bin/bisect-report.opt || true); \
-	if [ -x "$(PATH_OCAMLFIND)" ]; then \
-	  $(PATH_OCAMLFIND) query $(PROJECT_NAME) && $(PATH_OCAMLFIND) remove $(PROJECT_NAME) || true; \
-	  $(PATH_OCAMLFIND) install $(PROJECT_NAME) META -optional \
+ 	fi; \
+-	(which ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PATH_OCAML_PREFIX)/bin/bisect-report.opt || true); \
++	(which ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PREFIX)/bin/bisect-report.opt || true); \
+ 	if [ -x "$(PATH_OCAMLFIND)" ]; then \
+ 	  $(PATH_OCAMLFIND) query $(PROJECT_NAME) && $(PATH_OCAMLFIND) remove $(PROJECT_NAME) || true; \
+ 	  $(PATH_OCAMLFIND) install $(PROJECT_NAME) META -optional \
 diff --git a/configure b/configure
-index bb7ebf4..61a3095 100755
+index bb7ebf4..43ef46b 100755
 --- a/configure
 +++ b/configure
 @@ -21,7 +21,9 @@
@@ -79,47 +91,193 @@ index bb7ebf4..61a3095 100755
              ppx='TRUE';;
          *)
 -            echo "usage: $0 [-ocaml-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]";
-+            echo "usage: $0 [-prefix <path>] [-ocaml-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]";
++            echo "usage: $0 [-prefix <path>] [-ocaml-prefix <path>] [-camlp4-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]";
              exit 1;;
          esac
          shift
 @@ -57,6 +63,9 @@ if [ "$no_camlp4" = "TRUE" -a "$ppx" = "FALSE" ]; then
    exit 1
  fi
-
+ 
 +# prefix default value
 +test -z $prefix && prefix=$ocaml_prefix
 +
  # make options
  make_quiet=`make -f - <<EOF
  default: gnumake
-@@ -67,11 +76,13 @@ EOF`
+@@ -66,7 +75,9 @@ EOF`
+ 
  # file creation
  echo "# timestamp: `date`" > Makefile.config
++echo "PREFIX=$prefix" >> Makefile.config
  echo "PATH_OCAML_PREFIX=$ocaml_prefix" >> Makefile.config
 +echo "PATH_CAMLP4_PREFIX=$camlp4_prefix" >> Makefile.config
  echo "PATH_OCAMLFIND=$ocamlfind" >> Makefile.config
  echo "NATIVE_DYNLINK=$native_dynlink" >> Makefile.config
  echo "WARNINGS=$devel" >> Makefile.config
- echo "NO_CAMLP4=$no_camlp4" >> Makefile.config
- echo "PPX=$ppx" >> Makefile.config
- echo "MAKE_QUIET=$make_quiet" >> Makefile.config
-+echo "PREFIX=$prefix" >> Makefile.config
- echo "" >> Makefile.config
- echo 'Makefile.config successfully created'
-diff --git a/myocamlbuild.ml b/myocamlbuild.ml
-index 8aa25fd..09a7d48 100644
---- a/myocamlbuild.ml
-+++ b/myocamlbuild.ml
-@@ -70,7 +70,7 @@ let () =
-     | After_rules ->
-         let camlp4of =
-           try
--            let path_bin = Filename.concat (Sys.getenv "PATH_OCAML_PREFIX") "bin" in
-+            let path_bin = Filename.concat (Sys.getenv "PATH_CAMLP4_PREFIX") "bin" in
-             Filename.concat path_bin "camlp4of"
-           with _ -> "camlp4of" in
-         flag ["ocaml"; "compile"; "pp_camlp4of"] (S[A"-pp"; A camlp4of]);
---
-2.7.4
+diff --git a/tests/Makefile b/tests/Makefile
+index 1aba27f..9642323 100644
+--- a/tests/Makefile
++++ b/tests/Makefile
+@@ -41,7 +41,7 @@ one: FORCE
+ 	else \
+ 	  echo "Running tests for '$(NAME)'..." | tee -a _log; \
+           (cd $(NAME) && \
+-	    $(MAKE) PATH_OCAML_BIN=$(PATH_OCAML_PREFIX)/bin \
++	    $(MAKE) PATH_OCAML_BIN=$(PATH_OCAML_PREFIX)/bin PATH_CAMLP4_PREFIX=$(PATH_CAMLP4_PREFIX) \
+ 	    COMPILER=ocamlc EXECUTABLE=bytecode RUN=./ LIB_EXT=cma EXE_SUFFIX='' \
+ 	    REPORT=../../_build/src/report/report.byte && \
+ 	  cd ..) || echo '*** error' >> _log; \
+diff --git a/tests/camlp4-comments/Makefile b/tests/camlp4-comments/Makefile
+index 33fca72..a918118 100644
+--- a/tests/camlp4-comments/Makefile
++++ b/tests/camlp4-comments/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cmp
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cmp
+diff --git a/tests/camlp4-exclude-file/Makefile b/tests/camlp4-exclude-file/Makefile
+index ab13983..e2520fa 100644
+--- a/tests/camlp4-exclude-file/Makefile
++++ b/tests/camlp4-exclude-file/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cmp
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude-file exclusions -o $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude-file exclusions -o $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cmp
+diff --git a/tests/camlp4-exclude/Makefile b/tests/camlp4-exclude/Makefile
+index 18aada4..d71a7bc 100644
+--- a/tests/camlp4-exclude/Makefile
++++ b/tests/camlp4-exclude/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cmp
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude 'f.*' -o $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude 'f.*' -o $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cmp
+diff --git a/tests/camlp4-instrument-fast/Makefile b/tests/camlp4-instrument-fast/Makefile
+index f60767f..8506e38 100644
+--- a/tests/camlp4-instrument-fast/Makefile
++++ b/tests/camlp4-instrument-fast/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cmp
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo -mode fast $$file -o $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo -mode fast $$file -o $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cmp
+diff --git a/tests/camlp4-instrument/Makefile b/tests/camlp4-instrument/Makefile
+index 33fca72..a918118 100644
+--- a/tests/camlp4-instrument/Makefile
++++ b/tests/camlp4-instrument/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cmp
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cmp
+diff --git a/tests/combine-expr/Makefile b/tests/combine-expr/Makefile
+index 46ae9eb..e8e2af2 100644
+--- a/tests/combine-expr/Makefile
++++ b/tests/combine-expr/Makefile
+@@ -1,4 +1,4 @@
+-COMPILE_FLAGS=-I ../../_build -pp '$(PATH_OCAML_BIN)/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
++COMPILE_FLAGS=-I ../../_build -pp '$(PATH_CAMLP4_PREFIX)/bin/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
+ 
+ default: clean compile run report
+ 
+diff --git a/tests/ppx-comments/Makefile b/tests/ppx-comments/Makefile
+index f8c645a..667526f 100644
+--- a/tests/ppx-comments/Makefile
++++ b/tests/ppx-comments/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cm*
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cm*
+diff --git a/tests/ppx-exclude-file/Makefile b/tests/ppx-exclude-file/Makefile
+index a575a77..0dd1a20 100644
+--- a/tests/ppx-exclude-file/Makefile
++++ b/tests/ppx-exclude-file/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cm*
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -exclude-file exclusions' -dsource $$file 2> $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -exclude-file exclusions' -dsource $$file 2> $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cm*
+diff --git a/tests/ppx-exclude/Makefile b/tests/ppx-exclude/Makefile
+index a517af4..f502a42 100644
+--- a/tests/ppx-exclude/Makefile
++++ b/tests/ppx-exclude/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cm*
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx "../../_build/src/syntax/bisect_ppx.byte -exclude 'f.*'" -dsource $$file 2> $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx "../../_build/src/syntax/bisect_ppx.byte -exclude 'f.*'" -dsource $$file 2> $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cm*
+diff --git a/tests/ppx-instrument-fast/Makefile b/tests/ppx-instrument-fast/Makefile
+index da78bb6..1195988 100644
+--- a/tests/ppx-instrument-fast/Makefile
++++ b/tests/ppx-instrument-fast/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cm*
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -mode fast' -dsource $$file 2> $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -mode fast' -dsource $$file 2> $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cm*
+diff --git a/tests/ppx-instrument/Makefile b/tests/ppx-instrument/Makefile
+index f8c645a..667526f 100644
+--- a/tests/ppx-instrument/Makefile
++++ b/tests/ppx-instrument/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cm*
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cm*
+diff --git a/tests/report/Makefile b/tests/report/Makefile
+index a7ffe44..a968bf9 100644
+--- a/tests/report/Makefile
++++ b/tests/report/Makefile
+@@ -1,4 +1,4 @@
+-COMPILE_FLAGS=-I ../../_build -pp '$(PATH_OCAML_BIN)/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
++COMPILE_FLAGS=-I ../../_build -pp '$(PATH_CAMLP4_PREFIX)/bin/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
+ XMLLINT=$(shell which xmllint)
+ 
+ default: clean compile run report
+-- 
+2.18.0
 
diff --git a/gnu/packages/patches/tomsfastmath-constness.patch b/gnu/packages/patches/tomsfastmath-constness.patch
new file mode 100644
index 0000000000..7c6ab5bbec
--- /dev/null
+++ b/gnu/packages/patches/tomsfastmath-constness.patch
@@ -0,0 +1,76 @@
+From dac089515901d6bf315cd15a6e744b8d2c02c1cb Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
+Date: Sat, 31 Oct 2015 22:48:07 +0100
+Subject: [PATCH] tfm: make a few functions static
+
+clamav expects them to be static and it does not seem bad to do so.
+
+Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
+---
+ src/bin/fp_read_radix.c        | 2 +-
+ src/bin/fp_read_signed_bin.c   | 2 +-
+ src/bin/fp_read_unsigned_bin.c | 2 +-
+ src/headers/tfm.h              | 6 +++---
+ 4 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/bin/fp_read_radix.c b/src/bin/fp_read_radix.c
+index 0b5e826..431afa0 100644
+--- a/src/bin/fp_read_radix.c
++++ b/src/bin/fp_read_radix.c
+@@ -9,7 +9,7 @@
+  */
+ #include <tfm_private.h>
+ 
+-int fp_read_radix(fp_int *a, char *str, int radix)
++int fp_read_radix(fp_int *a, const char *str, int radix)
+ {
+   int     y, neg;
+   char    ch;
+diff --git a/src/bin/fp_read_signed_bin.c b/src/bin/fp_read_signed_bin.c
+index e2b8003..6467d19 100644
+--- a/src/bin/fp_read_signed_bin.c
++++ b/src/bin/fp_read_signed_bin.c
+@@ -9,7 +9,7 @@
+  */
+ #include <tfm_private.h>
+ 
+-void fp_read_signed_bin(fp_int *a, unsigned char *b, int c)
++void fp_read_signed_bin(fp_int *a, const unsigned char *b, int c)
+ {
+   /* read magnitude */
+   fp_read_unsigned_bin (a, b + 1, c - 1);
+diff --git a/src/bin/fp_read_unsigned_bin.c b/src/bin/fp_read_unsigned_bin.c
+index 3ee64c0..2ee89cb 100644
+--- a/src/bin/fp_read_unsigned_bin.c
++++ b/src/bin/fp_read_unsigned_bin.c
+@@ -9,7 +9,7 @@
+  */
+ #include <tfm_private.h>
+ 
+-void fp_read_unsigned_bin(fp_int *a, unsigned char *b, int c)
++void fp_read_unsigned_bin(fp_int *a, const unsigned char *b, int c)
+ {
+   /* zero the int */
+   fp_zero (a);
+diff --git a/src/headers/tfm.h b/src/headers/tfm.h
+index af87b56..f406388 100644
+--- a/src/headers/tfm.h
++++ b/src/headers/tfm.h
+@@ -467,14 +467,14 @@ int fp_prime_random_ex(fp_int *a, int t, int size, int flags, tfm_prime_callback
+ int fp_count_bits(fp_int *a);
+ 
+ int fp_unsigned_bin_size(fp_int *a);
+-void fp_read_unsigned_bin(fp_int *a, unsigned char *b, int c);
++void fp_read_unsigned_bin(fp_int *a, const unsigned char *b, int c);
+ void fp_to_unsigned_bin(fp_int *a, unsigned char *b);
+ 
+ int fp_signed_bin_size(fp_int *a);
+-void fp_read_signed_bin(fp_int *a, unsigned char *b, int c);
++void fp_read_signed_bin(fp_int *a, const unsigned char *b, int c);
+ void fp_to_signed_bin(fp_int *a, unsigned char *b);
+ 
+-int fp_read_radix(fp_int *a, char *str, int radix);
++int fp_read_radix(fp_int *a, const char *str, int radix);
+ 
+ int fp_radix_size(fp_int *a, int radix, int *size);
+ int fp_toradix(fp_int *a, char *str, int radix);
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index c2f73e3f5c..ba7ebcbdbe 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -2381,48 +2381,22 @@ logic-free templating system Mustache.")
 (define-public python-joblib
   (package
     (name "python-joblib")
-    (version "0.10.3")
+    (version "0.13.0")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "joblib" version))
               (sha256
                (base32
-                "0787k919zlfmgymprz5bzv0v1df5bbirlf3awrghmjgvkrd9dci9"))
-       (modules '((guix build utils)))
-       (snippet
-        '(begin
-           ;; Remove pre-compiled .pyc files from source.
-           (for-each delete-file-recursively
-                     (find-files "." "__pycache__" #:directories? #t))
-           (for-each delete-file (find-files "." "\\.pyc$"))
-           #t))))
+                "0612nazad8dxmn3xghfrmjax6456l4xy6hn9cngs7vydi14ds7v5"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
        (modify-phases %standard-phases
-         (add-before 'check 'disable-failing-tests
-           (lambda _
-             ;; This numpydoc tests fails for unknown reasons
-             (delete-file "doc/sphinxext/numpydoc/tests/test_docscrape.py")
-             ;; This numpydoc test depends on matplotlib, which is not a
-             ;; required input.
-             (delete-file "doc/sphinxext/numpydoc/tests/test_plot_directive.py")
-             ;; These tests fail to execute sys.executable
-             (substitute* "joblib/test/test_parallel.py"
-               (("import nose" line)
-                (string-append "from nose.plugins.skip import SkipTest\n" line))
-               (("def test_nested_parallel_warnings" line)
-                (string-append "@SkipTest\n" line))
-               (("def test_parallel_with_interactively_defined_functions" line)
-                (string-append "@SkipTest\n" line)))
-             #t)))))
-    ;; Provide nose to enable tests command
+         (replace 'check
+           (lambda _ (invoke "pytest" "-v" "joblib"))))))
     (native-inputs
-     `(("python-nose"       ,python-nose)
-       ("python-sphinx"     ,python-sphinx)
-       ("python-docutils"   ,python-docutils)
-       ("python-numpydoc"   ,python-numpydoc)))
-    (home-page "http://pythonhosted.org/joblib/")
+     `(("python-pytest" ,python-pytest)))
+    (home-page "https://joblib.readthedocs.io/")
     (synopsis "Using Python functions as pipeline jobs")
     (description
      "Joblib is a set of tools to provide lightweight pipelining in Python.
@@ -9875,7 +9849,7 @@ and/or Xon/Xoff.  The port is accessed in RAW mode.")
 (define-public python-kivy
   (package
     (name "python-kivy")
-    (version "1.10.0")
+    (version "1.10.1")
     (source
      (origin
        (method url-fetch)
@@ -9883,7 +9857,7 @@ and/or Xon/Xoff.  The port is accessed in RAW mode.")
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
-         "1394zh6kvf7k5d8vlzxcsfcailr3q59xwg9b1n7qaf25bvyq1h98"))))
+         "1zzxjdp78hfjjiklzr82l4zwibwcq4j6kgicspqs6iyyfn5yisbw"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f              ; Tests require many optional packages
@@ -10126,26 +10100,41 @@ Python to manipulate OpenDocument 1.2 files.")
 (define-public python-natsort
   (package
     (name "python-natsort")
-    (version "5.0.2")
+    (version "5.4.1")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "natsort" version))
               (sha256
                (base32
-                "0bh6j0l8iapjnsgg3bs6q075cnzjl6zw1vlgqyv3qrygm2cxypkn"))))
+                "0i732amg6yzkx4g4c9j09jmqq39q377x9cl2nbkm5hax2c2v0wxf"))))
     (build-system python-build-system)
     (arguments
-     `(#:phases
+     `(#:modules ((guix build utils)
+                  (guix build python-build-system)
+                  (srfi srfi-1)
+                  (srfi srfi-26)
+                  (ice-9 ftw))
+       #:phases
        (modify-phases %standard-phases
          (add-before 'check 'set-cachedir
            ;; Tests require write access to $HOME by default
-           (lambda _ (setenv "PYTHON_EGG_CACHE" "/tmp") #t)))))
+           (lambda _ (setenv "PYTHON_EGG_CACHE" "/tmp") #t))
+         (replace 'check
+           (lambda _
+             (let ((cwd (getcwd)))
+               (setenv "PYTHONPATH"
+                       (string-append
+                        cwd "/build/"
+                        (find (cut string-prefix? "lib" <>)
+                              (scandir (string-append cwd "/build")))
+                        ":"
+                        (getenv "PYTHONPATH")))
+               (invoke "pytest" "-v")))))))
     (native-inputs
      `(("python-hypothesis" ,python-hypothesis)
-       ("python-pytest-cache" ,python-pytest-cache)
        ("python-pytest-cov" ,python-pytest-cov)
-       ("python-pytest-flakes" ,python-pytest-flakes)
-       ("python-pytest-pep8" ,python-pytest-pep8)))
+       ("python-pytest-mock" ,python-pytest-mock)
+       ("python-pytest" ,python-pytest)))
     (propagated-inputs ; TODO: Add python-fastnumbers.
      `(("python-pyicu" ,python-pyicu)))
     (home-page "https://github.com/SethMMorton/natsort")
@@ -10167,8 +10156,6 @@ functionality in the command line.")
     (package (inherit base)
              (native-inputs
               `(("python2-pathlib" ,python2-pathlib)
-                ("python2-mock" ,python2-mock)
-                ("python2-enum34" ,python2-enum34)
                 ,@(package-native-inputs base))))))
 
 (define-public python-glances
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index a5b661e34d..6144e236a7 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com>
+;;; Copyright © 2017, 2018 Paul Garlick <pgarlick@tourbillion-technology.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -18,10 +18,13 @@
 
 (define-module (gnu packages simulation)
   #:use-module (gnu packages)
+  #:use-module (gnu packages algebra)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages check)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages gettext)
@@ -35,6 +38,8 @@
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
@@ -42,7 +47,9 @@
   #:use-module (gnu packages xorg)
   #:use-module (guix download)
   #:use-module (guix build utils)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix utils)
@@ -221,3 +228,484 @@ with gas/liquid interfaces.  Large problems may be split into smaller, connected
 problems for efficient solution on parallel systems.")
     (license license:gpl3+)
     (home-page "https://openfoam.org")))
+
+(define-public python-fenics-dijitso
+  (package
+    (name "python-fenics-dijitso")
+    (version "2018.1.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "fenics-dijitso" version))
+        (sha256
+          (base32
+            "1qax2f52qsjbd1h5lk5i5shp448qlakxabjjybrfc1w823p0yql9"))))
+    (build-system python-build-system)
+    (inputs
+     `(("openmpi" ,openmpi)
+       ("python-numpy" ,python-numpy)))
+    (native-inputs
+     `(("python-pytest-cov" ,python-pytest-cov)))
+    (propagated-inputs
+     `(("python-mpi4py" ,python-mpi4py)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'mpi-setup
+           ,%openmpi-setup)
+         (replace 'check
+           (lambda _
+             (setenv "HOME" "/tmp")
+             (setenv "PYTHONPATH"
+                     (string-append (getcwd) ":" (getenv "PYTHONPATH")))
+             (with-directory-excursion "test"
+               (invoke "./runtests.sh"))
+             #t)))))
+    (home-page "https://bitbucket.org/fenics-project/dijitso/")
+    (synopsis "Distributed just-in-time building of shared libraries")
+    (description
+      "Dijitso provides a core component of the @code{FEniCS} framework,
+namely the just-in-time compilation of C++ code that is generated from
+Python modules.  It is called from within a C++ library, using ctypes
+to import the dynamic shared library directly.
+
+As long as the compiled code can provide a simple factory function to
+a class implementing a predefined C++ interface, there is no limit to
+the complexity of that interface.  Parallel support depends on the
+@code{mpi4py} interface.")
+    (license license:lgpl3+)))
+
+(define-public python-fenics-ufl
+  (package
+    (name "python-fenics-ufl")
+    (version "2018.1.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "fenics-ufl" version))
+        (sha256
+          (base32
+            "1fq8yc86s1s3c8c0b1rc2vf265q0hrkzg57100fg1nghcz0p4vla"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-numpy" ,python-numpy)))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (setenv "PYTHONPATH"
+                     (string-append (getcwd) ":" (getenv "PYTHONPATH")))
+             (with-directory-excursion "test"
+               (invoke "py.test"))
+             #t)))))
+    (home-page "https://bitbucket.org/fenics-project/ufl/")
+    (synopsis "Unified language for form-compilers")
+    (description "The Unified Form Language (UFL) is a domain specific
+language for declaration of finite element discretizations of
+variational forms.  More precisely, it defines a flexible interface
+for choosing finite element spaces and defining expressions for weak
+forms in a notation close to mathematical notation.
+
+UFL is part of the FEniCS Project.")
+    (license license:lgpl3+)))
+
+(define-public python-fenics-fiat
+  (package
+    (name "python-fenics-fiat")
+    (version "2018.1.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "fenics-fiat" version))
+        (sha256
+          (base32
+            "0fmjd93r6bwf6xs8csw86qzphrnr66xwv7f372w59gmq8mg6rljc"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
+    (propagated-inputs
+     `(("python-numpy" ,python-numpy)
+       ("python-sympy" ,python-sympy)))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (setenv "PYTHONPATH"
+                     (string-append (getcwd) ":" (getenv "PYTHONPATH")))
+             (with-directory-excursion "test"
+               (invoke "py.test" "unit/"))
+             #t)))))
+    (home-page "https://bitbucket.org/fenics-project/fiat/")
+    (synopsis "Tabulation of finite element function spaces")
+    (description
+      "The FInite element Automatic Tabulator (FIAT) supports
+generation of arbitrary order instances of the Lagrange elements on
+lines, triangles, and tetrahedra.  It is also capable of generating
+arbitrary order instances of Jacobi-type quadrature rules on the same
+element shapes.  Further, H(div) and H(curl) conforming finite element
+spaces such as the families of Raviart-Thomas, Brezzi-Douglas-Marini
+and Nedelec are supported on triangles and tetrahedra.  Upcoming
+versions will also support Hermite and nonconforming elements.
+
+FIAT is part of the FEniCS Project.")
+    (license license:lgpl3+)))
+
+(define-public python-fenics-ffc
+  (package
+    (name "python-fenics-ffc")
+    (version "2018.1.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "fenics-ffc" version))
+        (sha256
+          (base32
+            "1b2ia5vlkw298x7rf0k2p3ihlpwkwgc98p3s6sbpds3hqmfrzdz9"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
+    (propagated-inputs
+     `(("python-fenics-dijitso" ,python-fenics-dijitso)
+       ("python-fenics-fiat" ,python-fenics-fiat)
+       ("python-fenics-ufl" ,python-fenics-ufl)))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (setenv "HOME" (getcwd))
+             (setenv "PYTHONPATH"
+                     (string-append (getcwd) ":" (getenv "PYTHONPATH")))
+             (with-directory-excursion "test"
+               ;; FIXME: the tests in subdirectory
+               ;; 'unit/ufc/finite_element' require the ffc_factory
+               ;; extension module.  This module, located in the 'libs'
+               ;; subdirectory, needs to be built and made accessible
+               ;; prior to running the tests.
+               (invoke "py.test" "unit/" "--ignore=unit/ufc/")
+               (with-directory-excursion "uflacs"
+                 (invoke "py.test" "unit/")))
+             #t)))))
+    (home-page "https://bitbucket.org/fenics-project/ffc/")
+    (synopsis "Compiler for finite element variational forms")
+    (description "The FEniCS Form Compiler (FFC) is a compiler for
+finite element variational forms.  From a high-level description of
+the form, it generates efficient low-level C++ code that can be used
+to assemble the corresponding discrete operator (tensor).  In
+particular, a bilinear form may be assembled into a matrix and a
+linear form may be assembled into a vector.  FFC may be used either
+from the command line (by invoking the @code{ffc} command) or as a
+Python module (@code{import ffc}).
+
+FFC is part of the FEniCS Project.")
+    ;; There are two files released with a public domain licence;
+    ;; ufc.h and ufc_geometry.h, in subdirectory 'ffc/backends/ufc'.
+    (license (list license:public-domain license:lgpl3+))))
+
+(define-public fenics-dolfin
+  (package
+    (name "fenics-dolfin")
+    (version "2018.1.0.post1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append
+              "https://bitbucket.org/fenics-project/dolfin/get/"
+              version ".tar.gz"))
+        (file-name (string-append name "-" version ".tar.gz"))
+        (sha256
+          (base32
+           "12zkk8j3xsg6l8p0ggwsl03084vlcivw4h99b7z9kndg7k89b3ya"))
+        (modules '((guix build utils)))
+        (snippet
+         '(begin
+            ;; Make sure we don't use the bundled test framework.
+            (delete-file-recursively "test/unit/cpp/catch")
+            (substitute* "test/unit/cpp/main.cpp"
+              ;; Use standard search paths for 'catch' header file.
+              (("#include.*")
+               "#include <catch.hpp>\n"))
+            (substitute* "test/unit/cpp/CMakeLists.txt"
+              ;; Add extra include directories required by the unit tests.
+              (("(^target_link_libraries.*)" line)
+               (string-append line "\n"
+                              "target_include_directories("
+                              "unittests PRIVATE "
+                              "${DOLFIN_SOURCE_DIR} "
+                              "${DOLFIN_SOURCE_DIR}/dolfin "
+                              "${DOLFIN_BINARY_DIR})\n"))
+              (("(^set\\(CATCH_INCLUDE_DIR ).*(/catch\\))" _ front back)
+               (string-append front
+                              "$ENV{CATCH_DIR}"
+                              "/include" back "\n")))
+            (substitute* "demo/CMakeLists.txt"
+              ;; Add extra include directories required by the demo tests.
+              (("(^#find_package.*)" line)
+               (string-append line "\n"
+                              "include_directories("
+                              "${DOLFIN_SOURCE_DIR} "
+                              "${DOLFIN_SOURCE_DIR}/dolfin "
+                              "${DOLFIN_BINARY_DIR})\n")))
+            #t))))
+    (build-system cmake-build-system)
+    (inputs
+     `(("blas" ,openblas)
+       ("boost" ,boost)
+       ("eigen" ,eigen)
+       ("hdf5" ,hdf5-parallel-openmpi)
+       ("lapack" ,lapack)
+       ("libxml2" ,libxml2)
+       ("openmpi" ,openmpi)
+       ("python" ,python-3)
+       ("scotch" ,pt-scotch32)
+       ("suitesparse" ,suitesparse)
+       ("sundials" ,sundials-openmpi)
+       ("zlib" ,zlib)))
+    (native-inputs
+     `(("catch" ,catch-framework2)
+       ("pkg-config" ,pkg-config)))
+    (propagated-inputs
+     `(("ffc" ,python-fenics-ffc)
+       ("petsc" ,petsc-openmpi)
+       ("slepc" ,slepc-openmpi)))
+    (arguments
+     `(#:configure-flags
+       `("-DDOLFIN_ENABLE_DOCS:BOOL=OFF"
+         "-DDOLFIN_ENABLE_HDF5:BOOL=ON"
+         "-DDOLFIN_ENABLE_MPI:BOOL=ON"
+         "-DDOLFIN_ENABLE_PARMETIS:BOOL=OFF"
+         "-DDOLFIN_ENABLE_SCOTCH:BOOL=ON"
+         "-DDOLFIN_ENABLE_SUNDIALS:BOOL=ON"
+         "-DDOLFIN_ENABLE_TRILINOS:BOOL=OFF")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-usr-bin-file 'mpi-setup
+           ,%openmpi-setup)
+         (add-after 'patch-source-shebangs 'set-paths
+           (lambda _
+             ;; Define paths to store locations.
+             (setenv "BLAS_DIR" (assoc-ref %build-inputs "blas"))
+             (setenv "CATCH_DIR" (assoc-ref %build-inputs "catch"))
+             (setenv "LAPACK_DIR" (assoc-ref %build-inputs "lapack"))
+             (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
+             (setenv "SLEPC_DIR" (assoc-ref %build-inputs "slepc"))
+             (setenv "SCOTCH_DIR" (assoc-ref %build-inputs "scotch"))
+             (setenv "SUNDIALS_DIR" (assoc-ref %build-inputs "sundials"))
+             (setenv "UMFPACK_DIR" (assoc-ref %build-inputs "suitesparse"))
+             #t))
+         (add-before 'check 'pre-check
+           (lambda _
+             ;; The Dolfin repository uses git-lfs, whereby web links are
+             ;; substituted for large files.  Guix does not currently support
+             ;; git-lfs, so only the links are downloaded.  The tests that
+             ;; require the absent meshes cannot run and are skipped.
+             ;;
+             ;; Two other serial tests fail and are skipped.
+             ;; i) demo_stokes-iterative_serial,
+             ;;   The MPI_Comm_rank() function was called before MPI_INIT was
+             ;;   invoked
+             ;; ii) demo_multimesh-stokes_serial:
+             ;;   Warning: Found no facets matching domain for boundary
+             ;;   condition.
+             ;;
+             ;; One mpi test fails and is skipped.
+             ;; i) demo_stokes-iterative_mpi:
+             ;;   The MPI_Comm_rank() function was called before MPI_INIT was
+             ;;   invoked
+             (call-with-output-file "CTestCustom.cmake"
+               (lambda (port)
+                 (display
+                   (string-append
+                    "set(CTEST_CUSTOM_TESTS_IGNORE "
+                    "demo_bcs_serial "
+                    "demo_bcs_mpi "
+                    "demo_eigenvalue_serial "
+                    "demo_eigenvalue_mpi "
+                    "demo_navier-stokes_serial "
+                    "demo_navier-stokes_mpi "
+                    "demo_stokes-taylor-hood_serial "
+                    "demo_stokes-taylor-hood_mpi "
+                    "demo_subdomains_serial "
+                    "demo_advection-diffusion_serial "
+                    "demo_advection-diffusion_mpi "
+                    "demo_auto-adaptive-navier-stokes_serial "
+                    "demo_contact-vi-snes_serial "
+                    "demo_contact-vi-snes_mpi "
+                    "demo_contact-vi-tao_serial "
+                    "demo_contact-vi-tao_mpi "
+                    "demo_curl-curl_serial "
+                    "demo_curl-curl_mpi "
+                    "demo_dg-advection-diffusion_serial "
+                    "demo_dg-advection-diffusion_mpi "
+                    "demo_elasticity_serial "
+                    "demo_elasticity_mpi "
+                    "demo_elastodynamics_serial "
+                    "demo_elastodynamics_mpi "
+                    "demo_lift-drag_serial "
+                    "demo_lift-drag_mpi "
+                    "demo_mesh-quality_serial "
+                    "demo_mesh-quality_mpi "
+                    "demo_multimesh-stokes_serial "
+                    "demo_stokes-iterative_serial "
+                    "demo_stokes-iterative_mpi "
+                    ")\n") port)))
+             #t))
+         (replace 'check
+           (lambda _
+             (and (invoke "make" "unittests")
+                  (invoke "make" "demos")
+                  (invoke "ctest" "-R" "unittests")
+                  (invoke "ctest" "-R" "demo" "-R" "serial")
+                  (invoke "ctest" "-R" "demo" "-R" "mpi")))))))
+    (home-page "https://bitbucket.org/fenics-project/dolfin/")
+    (synopsis "Problem solving environment for differential equations")
+    (description
+      "DOLFIN is a computational framework for finding numerical
+solutions to problems described by differential equations.  Numerical
+models in DOLFIN are constructed using general families of finite
+elements.  Data structures are provided for discretizing the governing
+system on a computational mesh.  A compact syntax, similar to
+mathematical notation, is made available for defining function spaces
+and expressing variational forms.  Interfaces to specialized matrix
+solvers are provided for solving the resultant linear systems.
+
+@code{fenics-dolfin} is part of the FEniCS project.  It is the C++
+user interface to the FEniCS core components and external libraries.")
+    ;; The source code for the DOLFIN C++ library is licensed under the
+    ;; GNU Lesser General Public License, version 3 or later, with the
+    ;; following exceptions:
+    ;;
+    ;; public-domain: dolfin/geometry/predicates.cpp
+    ;;                dolfin/geometry/predicates.h
+    ;;
+    ;; zlib:          dolfin/io/base64.cpp
+    ;;                dolfin/io/base64.h
+    ;;
+    ;; expat:         dolfin/io/pugiconfig.hpp
+    ;;                dolfin/io/pugixml.cpp
+    ;;                dolfin/io/pugixml.hpp
+    (license (list license:public-domain
+                   license:zlib
+                   license:expat
+                   license:lgpl3+))))
+
+(define-public fenics
+  (package (inherit fenics-dolfin)
+    (name "fenics")
+    (build-system python-build-system)
+    (inputs
+     `(("pybind11" ,pybind11)
+       ("python-matplotlib" ,python-matplotlib)
+       ,@(alist-delete "python" (package-inputs fenics-dolfin))))
+    (native-inputs
+     `(("cmake" ,cmake)
+       ("ply" ,python-ply)
+       ("pytest" ,python-pytest)
+       ("python-decorator" ,python-decorator)
+       ("python-pkgconfig" ,python-pkgconfig)
+       ,@(package-native-inputs fenics-dolfin)))
+    (propagated-inputs
+     `(("dolfin" ,fenics-dolfin)
+       ("petsc4py" ,python-petsc4py)
+       ("slepc4py" ,python-slepc4py)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-source-shebangs 'set-paths
+           (lambda _
+             ;; Define paths to store locations.
+             (setenv "PYBIND11_DIR" (assoc-ref %build-inputs "pybind11"))
+             ;; Move to python sub-directory.
+             (chdir "python")
+             #t))
+         (add-after 'build 'mpi-setup
+           ,%openmpi-setup)
+         (add-before 'check 'pre-check
+           (lambda _
+             ;; Exclude tests that require meshes supplied by git-lfs.
+             (substitute* "demo/test.py"
+               (("(.*stem !.*)" line)
+                (string-append
+                 line "\n"
+                 "excludeList = [\n"
+                 "'multimesh-quadrature', \n"
+                 "'multimesh-marking', \n"
+                 "'mixed-poisson-sphere', \n"
+                 "'mesh-quality', \n"
+                 "'lift-drag', \n"
+                 "'elastodynamics', \n"
+                 "'dg-advection-diffusion', \n"
+                 "'contact-vi-tao', \n"
+                 "'contact-vi-snes', \n"
+                 "'collision-detection', \n"
+                 "'buckling-tao', \n"
+                 "'auto-adaptive-navier-stokes', \n"
+                 "'advection-diffusion', \n"
+                 "'subdomains', \n"
+                 "'stokes-taylor-hood', \n"
+                 "'stokes-mini', \n"
+                 "'navier-stokes', \n"
+                 "'eigenvalue']\n"
+                 "demos = ["
+                 "d for d in demos if d[0].stem not in "
+                 "excludeList]\n")))
+             (setenv "HOME" (getcwd))
+             (setenv "PYTHONPATH"
+                     (string-append
+                      (getcwd) "/build/lib.linux-x86_64-"
+                      ,(version-major+minor (package-version python)) ":"
+                      (getenv "PYTHONPATH")))
+             ;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP.
+             (setenv "OPENBLAS_NUM_THREADS" "1")
+             #t))
+         (replace 'check
+           (lambda _
+             (with-directory-excursion "test"
+               ;; Note: The test test_snes_set_from_options() in the file
+               ;; unit/nls/test_PETScSNES_solver.py fails and is ignored.
+               (and (invoke "py.test" "unit" "--ignore"
+                            "unit/nls/test_PETScSNES_solver.py")
+                    (invoke "mpirun" "-np" "3" "python" "-B" "-m"
+                            "pytest" "unit" "--ignore"
+                            "unit/nls/test_PETScSNES_solver.py")))
+             (with-directory-excursion "demo"
+               ;; Check demos.
+               (invoke "python" "generate-demo-files.py")
+               (and (invoke "python" "-m" "pytest" "-v" "test.py")
+                    (invoke "python" "-m" "pytest" "-v" "test.py"
+                            "--mpiexec=mpiexec" "--num-proc=3")))
+             #t))
+         (add-after 'install 'install-demo-files
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((demos (string-append
+                            (assoc-ref outputs "out")
+                            "/share/python-dolfin/demo")))
+               (mkdir-p demos)
+               (with-directory-excursion "demo"
+                 (for-each (lambda (file)
+                             (let* ((dir (dirname file))
+                                    (tgt-dir (string-append demos "/" dir)))
+                               (unless (equal? "." dir)
+                                 (mkdir-p tgt-dir)
+                                 (install-file file tgt-dir))))
+                           (find-files "." ".*\\.(py|gz|xdmf)$"))))
+             #t)))))
+    (home-page "https://fenicsproject.org/")
+    (synopsis "High-level environment for solving differential equations")
+    (description
+      "@code{fenics} is a computing platform for solving general classes of
+problems that involve differential equations.  @code{fenics} facilitates
+access to efficient methods for dealing with ordinary differential
+equations (ODEs) and partial differential equations (PDEs).  Systems of
+equations such as these are commonly encountered in areas of engineering,
+mathematics and the physical sciences.  It is particularly well-suited to
+problems that can be solved using the Finite Element Method (FEM).
+
+@code{fenics} is the top level of the set of packages that are developed
+within the FEniCS project.  It provides the python user interface to the
+FEniCS core components and external libraries.")
+    (license license:lgpl3+)))
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 57fb99ef28..66f57ac879 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -2300,14 +2300,14 @@ collation, and NAMESPACE files.")
 (define-public r-openssl
   (package
     (name "r-openssl")
-    (version "1.0.2")
+    (version "1.1")
     (source
      (origin
        (method url-fetch)
        (uri (cran-uri "openssl" version))
        (sha256
         (base32
-         "1djfpnphkcxx8idk5rjfzg8r8dnqsgc0shh2pw8lns5hap2wc5rc"))))
+         "0ldxgcr33lawwr8wp14kdk2678gpkvqkzv6g333bhck1hn6qspzv"))))
     (build-system r-build-system)
     (inputs
      `(("libressl" ,libressl)))
@@ -4706,14 +4706,14 @@ models, generalized linear models and model-based clustering.")
 (define-public r-mclust
   (package
     (name "r-mclust")
-    (version "5.4.1")
+    (version "5.4.2")
     (source
      (origin
        (method url-fetch)
        (uri (cran-uri "mclust" version))
        (sha256
         (base32
-         "1vcl4nl8by2vj2k9k84imy5m850khkgd8q02a8ica1h8vz9ijgn4"))))
+         "09152swfpa3fzhmrq5cwb5kxgvrxvigv1m4v6rhcibrdhfd1x8x4"))))
     (build-system r-build-system)
     (native-inputs
      `(("gfortran" ,gfortran)))
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 04d28044dd..e0ad6248a5 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -2279,3 +2279,55 @@ used to keep a folder in sync between computers.")
     ;; The web app is released under the AGPLv3+.
     (license (list license:gpl3+
                    license:agpl3+))))
+
+(define-public git-when-merged
+  ;; Use an unreleased version to get a PY3 compatibility fix.
+  (let ((commit "ab6af7865a0ba55ba364a6c507e0be6f84f31c6d"))
+    (package
+      (name "git-when-merged")
+      (version (string-append "1.2.0-" (string-take commit 7)))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mhagger/git-when-merged/")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0iyk2psf97bc9h43m89p3xjmm79fsx99i7px29g4lcnmdy5kmz0p"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f                    ; there are no tests
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (delete 'build)
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (install-file "bin/git-when-merged"
+                             (string-append (assoc-ref outputs "out")
+                                            "/bin"))
+               #t))
+           (add-before 'install 'patch-git
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((git (string-append (assoc-ref inputs "git")
+                                         "/bin/git")))
+                 (substitute* "bin/git-when-merged"
+                   (("'git'") (string-append "'" git "'")))
+                 #t)))
+           (add-after 'install 'wrap-script
+             (lambda* (#:key outputs #:allow-other-keys)
+               (wrap-program (string-append (assoc-ref outputs "out")
+                                            "/bin/git-when-merged")
+                 `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH"))))
+               #t)))))
+      (inputs
+       `(("git" ,git)
+         ("python" ,python-wrapper)))
+      (home-page "https://github.com/mhagger/git-when-merged")
+      (synopsis "Determine when a commit was merged into a Git branch")
+      (description "This Git extension defines a subcommand,
+@code{when-merged}, whose core operation is to find the merge that brought a
+given commit into the specified ref(s).  It has various options that control
+how information about the merge is displayed.")
+      (license license:gpl2+))))
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index db1654afac..c8437bdf4e 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -5645,14 +5645,14 @@ application framework for R, making it easy to create attractive dashboards.")
 (define-public r-shinyfiles
   (package
     (name "r-shinyfiles")
-    (version "0.7.1")
+    (version "0.7.2")
     (source
      (origin
        (method url-fetch)
        (uri (cran-uri "shinyFiles" version))
        (sha256
         (base32
-         "1cbg09l7w2zbgxb4qjm9p873p0lzrihlzsk5xxi3cpxdckn6zsrm"))))
+         "0dlcjrw96x72grg6j915070x8x98l7629pn86gf148iknflm7gd5"))))
     (properties `((upstream-name . "shinyFiles")))
     (build-system r-build-system)
     (propagated-inputs
diff --git a/gnu/system.scm b/gnu/system.scm
index 99bc09873d..1766c8f90f 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -127,23 +127,21 @@
 ;;;
 ;;; Code:
 
-(define (bootable-kernel-arguments kernel-arguments system.drv root-device)
-  "Prepend extra arguments to KERNEL-ARGUMENTS that allow SYSTEM.DRV to be
-booted from ROOT-DEVICE"
-  (cons* (string-append "--root="
-                        (cond ((uuid? root-device)
-
-                               ;; Note: Always use the DCE format because that's
-                               ;; what (gnu build linux-boot) expects for the
-                               ;; '--root' kernel command-line option.
-                               (uuid->string (uuid-bytevector root-device)
-                                             'dce))
-                              ((file-system-label? root-device)
-                               (file-system-label->string root-device))
-                              (else root-device)))
-         #~(string-append "--system=" #$system.drv)
-         #~(string-append "--load=" #$system.drv "/boot")
-         kernel-arguments))
+(define (bootable-kernel-arguments system root-device)
+  "Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE."
+  (list (string-append "--root="
+                       (cond ((uuid? root-device)
+
+                              ;; Note: Always use the DCE format because that's
+                              ;; what (gnu build linux-boot) expects for the
+                              ;; '--root' kernel command-line option.
+                              (uuid->string (uuid-bytevector root-device)
+                                            'dce))
+                             ((file-system-label? root-device)
+                              (file-system-label->string root-device))
+                             (else root-device)))
+        #~(string-append "--system=" #$system)
+        #~(string-append "--load=" #$system "/boot")))
 
 ;; System-wide configuration.
 ;; TODO: Add per-field docstrings/stexi.
@@ -156,7 +154,7 @@ booted from ROOT-DEVICE"
                     (default '()))                ; list of gexps/strings
   (bootloader operating-system-bootloader)        ; <bootloader-configuration>
 
-  (initrd operating-system-initrd                 ; (list fs) -> M derivation
+  (initrd operating-system-initrd                 ; (list fs) -> file-like
           (default base-initrd))
   (initrd-modules operating-system-initrd-modules ; list of strings
                   (thunked)                       ; it's system-dependent
@@ -209,12 +207,11 @@ booted from ROOT-DEVICE"
   (sudoers-file operating-system-sudoers-file     ; file-like
                 (default %sudoers-specification)))
 
-(define (operating-system-kernel-arguments os system.drv root-device)
+(define (operating-system-kernel-arguments os root-device)
   "Return all the kernel arguments, including the ones not specified
 directly by the user."
-  (bootable-kernel-arguments (operating-system-user-kernel-arguments os)
-                             system.drv
-                             root-device))
+  (append (bootable-kernel-arguments os root-device)
+          (operating-system-user-kernel-arguments os)))
 
 
 ;;;
@@ -328,14 +325,11 @@ format is unrecognized.
 The object has its kernel-arguments extended in order to make it bootable."
   (let* ((file (string-append system "/parameters"))
          (params (call-with-input-file file read-boot-parameters))
-         (root (boot-parameters-root-device params))
-         (kernel-arguments (boot-parameters-kernel-arguments params)))
-    (if params
-      (boot-parameters
-        (inherit params)
-        (kernel-arguments (bootable-kernel-arguments kernel-arguments
-                                                     system root)))
-      #f)))
+         (root (boot-parameters-root-device params)))
+    (boot-parameters
+     (inherit params)
+     (kernel-arguments (append (bootable-kernel-arguments system root)
+                               (boot-parameters-kernel-arguments params))))))
 
 (define (boot-parameters->menu-entry conf)
   (menu-entry
@@ -448,7 +442,7 @@ value of the SYSTEM-SERVICE-TYPE service."
           (return `(("locale" ,locale)))
           (mlet %store-monad
               ((kernel  ->  (operating-system-kernel os))
-               (initrd      (operating-system-initrd-file os))
+               (initrd  ->  (operating-system-initrd-file os))
                (params      (operating-system-boot-parameters-file os)))
             (return `(("kernel" ,kernel)
                       ("parameters" ,params)
@@ -876,12 +870,12 @@ hardware-related operations as necessary when booting a Linux container."
   (define make-initrd
     (operating-system-initrd os))
 
-  (mlet %store-monad ((initrd (make-initrd boot-file-systems
-                                           #:linux (operating-system-kernel os)
-                                           #:linux-modules
-                                           (operating-system-initrd-modules os)
-                                           #:mapped-devices mapped-devices)))
-    (return (file-append initrd "/initrd"))))
+  (let ((initrd (make-initrd boot-file-systems
+                             #:linux (operating-system-kernel os)
+                             #:linux-modules
+                             (operating-system-initrd-modules os)
+                             #:mapped-devices mapped-devices)))
+    (file-append initrd "/initrd")))
 
 (define (locale-name->definition* name)
   "Variant of 'locale-name->definition' that raises an error upon failure."
@@ -939,42 +933,45 @@ listed in OS.  The C library expects to find it under
   (store-file-system (operating-system-file-systems os)))
 
 (define* (operating-system-bootcfg os #:optional (old-entries '()))
-  "Return the bootloader configuration file for OS.  Use OLD-ENTRIES
-(which is a list of <menu-entry>) to populate the \"old entries\" menu."
-  (mlet* %store-monad
-      ((system      (operating-system-derivation os))
-       (root-fs ->  (operating-system-root-file-system os))
-       (root-device -> (file-system-device root-fs))
-       (params (operating-system-boot-parameters os system root-device))
-       (entry -> (boot-parameters->menu-entry params))
-       (bootloader-conf -> (operating-system-bootloader os)))
-    ((bootloader-configuration-file-generator
-      (bootloader-configuration-bootloader bootloader-conf))
-     bootloader-conf (list entry) #:old-entries old-entries)))
-
-(define (operating-system-boot-parameters os system.drv root-device)
-  "Return a monadic <boot-parameters> record that describes the boot parameters
-of OS.  SYSTEM.DRV is either a derivation or #f.  If it's a derivation, adds
-kernel arguments for that derivation to <boot-parameters>."
-  (mlet* %store-monad
-      ((initrd (operating-system-initrd-file os))
-       (store -> (operating-system-store-file-system os))
-       (bootloader  -> (bootloader-configuration-bootloader
-                        (operating-system-bootloader os)))
-       (bootloader-name -> (bootloader-name bootloader))
-       (label -> (kernel->boot-label (operating-system-kernel os))))
-    (return (boot-parameters
-             (label label)
-             (root-device root-device)
-             (kernel (operating-system-kernel-file os))
-             (kernel-arguments
-              (if system.drv
-                (operating-system-kernel-arguments os system.drv root-device)
-                (operating-system-user-kernel-arguments os)))
-             (initrd initrd)
-             (bootloader-name bootloader-name)
-             (store-device (ensure-not-/dev (file-system-device store)))
-             (store-mount-point (file-system-mount-point store))))))
+  "Return the bootloader configuration file for OS.  Use OLD-ENTRIES,
+a list of <menu-entry>, to populate the \"old entries\" menu."
+  (let* ((root-fs         (operating-system-root-file-system os))
+         (root-device     (file-system-device root-fs))
+         (params          (operating-system-boot-parameters
+                           os root-device
+                           #:system-kernel-arguments? #t))
+         (entry           (boot-parameters->menu-entry params))
+         (bootloader-conf (operating-system-bootloader os)))
+    (define generate-config-file
+      (bootloader-configuration-file-generator
+       (bootloader-configuration-bootloader bootloader-conf)))
+
+    (generate-config-file bootloader-conf (list entry)
+                          #:old-entries old-entries)))
+
+(define* (operating-system-boot-parameters os root-device
+                                           #:key system-kernel-arguments?)
+  "Return a monadic <boot-parameters> record that describes the boot
+parameters of OS.  When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments
+such as '--root' and '--load' to <boot-parameters>."
+  (let* ((initrd          (operating-system-initrd-file os))
+         (store           (operating-system-store-file-system os))
+         (bootloader      (bootloader-configuration-bootloader
+                           (operating-system-bootloader os)))
+         (bootloader-name (bootloader-name bootloader))
+         (label           (kernel->boot-label (operating-system-kernel os))))
+    (boot-parameters
+     (label label)
+     (root-device root-device)
+     (kernel (operating-system-kernel-file os))
+     (kernel-arguments
+      (if system-kernel-arguments?
+          (operating-system-kernel-arguments os root-device)
+          (operating-system-user-kernel-arguments os)))
+     (initrd initrd)
+     (bootloader-name bootloader-name)
+     (store-device (ensure-not-/dev (file-system-device store)))
+     (store-mount-point (file-system-mount-point store)))))
 
 (define (device->sexp device)
   "Serialize DEVICE as an sexp (really, as an object with a read syntax.)"
@@ -986,19 +983,22 @@ kernel arguments for that derivation to <boot-parameters>."
     (_
      device)))
 
-(define* (operating-system-boot-parameters-file os #:optional (system.drv #f))
+(define* (operating-system-boot-parameters-file os
+                                                #:key system-kernel-arguments?)
    "Return a file that describes the boot parameters of OS.  The primary use of
 this file is the reconstruction of GRUB menu entries for old configurations.
-SYSTEM.DRV is optional.  If given, adds kernel arguments for that system to the
-returned file (since the returned file is then usually stored into the
-content-addressed \"system\" directory, it's usually not a good idea
-to give it because the content hash would change by the content hash
+
+When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments such as '--root'
+and '--load' to the returned file (since the returned file is then usually
+stored into the content-addressed \"system\" directory, it's usually not a
+good idea to give it because the content hash would change by the content hash
 being stored into the \"parameters\" file)."
-  (mlet* %store-monad ((root -> (operating-system-root-file-system os))
-                       (device -> (file-system-device root))
-                       (params (operating-system-boot-parameters os
-                                                                 system.drv
-                                                                 device)))
+   (let* ((root   (operating-system-root-file-system os))
+          (device (file-system-device root))
+          (params (operating-system-boot-parameters
+                   os device
+                   #:system-kernel-arguments?
+                   system-kernel-arguments?)))
      (gexp->file "parameters"
                  #~(boot-parameters
                     (version 0)
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index a5a111908f..a53d3cb106 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -20,8 +20,6 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu system linux-initrd)
-  #:use-module (guix monads)
-  #:use-module (guix store)
   #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module ((guix store)
@@ -63,7 +61,7 @@
                              (gzip gzip)
                              (name "guile-initrd")
                              (system (%current-system)))
-  "Return a derivation that builds a Linux initrd (a gzipped cpio archive)
+  "Return as a file-like object a Linux initrd (a gzipped cpio archive)
 containing GUILE and that evaluates EXP, a G-expression, upon booting.  All
 the derivations referenced by EXP are automatically copied to the initrd."
 
@@ -100,8 +98,9 @@ the derivations referenced by EXP are automatically copied to the initrd."
                         #:references-graphs '("closure")
                         #:gzip (string-append #$gzip "/bin/gzip")))))
 
-  (gexp->derivation name builder
-                    #:references-graphs `(("closure" ,init))))
+  (computed-file name builder
+                 #:options
+                 `(#:references-graphs (("closure" ,init)))))
 
 (define (flat-linux-module-directory linux modules)
   "Return a flat directory containing the Linux kernel modules listed in
@@ -143,7 +142,7 @@ MODULES and taken from LINUX."
                       qemu-networking?
                       volatile-root?
                       (on-error 'debug))
-  "Return a monadic derivation that builds a raw initrd, with kernel
+  "Return as a file-like object a raw initrd, with kernel
 modules taken from LINUX.  FILE-SYSTEMS is a list of file-systems to be
 mounted by the initrd, possibly in addition to the root file system specified
 on the kernel command line via '--root'. LINUX-MODULES is a list of kernel
@@ -294,7 +293,7 @@ FILE-SYSTEMS."
                       volatile-root?
                       (extra-modules '())         ;deprecated
                       (on-error 'debug))
-  "Return a monadic derivation that builds a generic initrd, with kernel
+  "Return as a file-like object a generic initrd, with kernel
 modules taken from LINUX.  FILE-SYSTEMS is a list of file-systems to be
 mounted by the initrd, possibly in addition to the root file system specified
 on the kernel command line via '--root'.  MAPPED-DEVICES is a list of device
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index a1b595d45d..8e310a1607 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -189,14 +189,12 @@ made available under the /xchg CIFS share."
                   #~(when (zero? (system* #$user-builder))
                       (reboot))))
 
-  (mlet* %store-monad
-      ((initrd       (if initrd                   ; use the default initrd?
-                         (return initrd)
-                         (base-initrd file-systems
-                                      #:on-error 'backtrace
-                                      #:linux linux
-                                      #:linux-modules %base-initrd-modules
-                                      #:qemu-networking? #t))))
+  (let ((initrd (or initrd
+                    (base-initrd file-systems
+                                 #:on-error 'backtrace
+                                 #:linux linux
+                                 #:linux-modules %base-initrd-modules
+                                 #:qemu-networking? #t))))
 
     (define builder
       ;; Code that launches the VM that evaluates EXP.
@@ -254,7 +252,7 @@ made available under the /xchg CIFS share."
                         file-system-uuid
                         (system (%current-system))
                         (qemu qemu-minimal)
-                        os-drv
+                        os
                         bootcfg-drv
                         bootloader
                         register-closures?
@@ -302,7 +300,7 @@ INPUTS is a list of inputs (as for packages)."
              (set-path-environment-variable "PATH" '("bin" "sbin") inputs)
              (make-iso9660-image #$(bootloader-package bootloader)
                                  #$bootcfg-drv
-                                 #$os-drv
+                                 #$os
                                  "/xchg/guixsd.iso"
                                  #:register-closures? #$register-closures?
                                  #:closures graphs
@@ -331,7 +329,7 @@ INPUTS is a list of inputs (as for packages)."
                      (file-system-type "ext4")
                      file-system-label
                      file-system-uuid
-                     os-drv
+                     os
                      bootcfg-drv
                      bootloader
                      (register-closures? #t)
@@ -397,7 +395,7 @@ the image."
                                  #:closures graphs
                                  #:copy-closures? #$copy-inputs?
                                  #:register-closures? #$register-closures?
-                                 #:system-directory #$os-drv
+                                 #:system-directory #$os
 
                                  ;; Disable deduplication to speed things up,
                                  ;; and because it doesn't help much for a
@@ -627,56 +625,54 @@ to USB sticks meant to be read-only."
               (string=? (file-system-mount-point fs) "/"))
             (operating-system-file-systems os)))
 
-  (let ((os (operating-system (inherit os)
-              ;; Since this is meant to be used on real hardware, don't
-              ;; install QEMU networking or anything like that.  Assume USB
-              ;; mass storage devices (usb-storage.ko) are available.
-              (initrd (lambda (file-systems . rest)
-                        (apply (operating-system-initrd os)
-                               file-systems
-                               #:volatile-root? #t
-                               rest)))
-
-              (bootloader (if (string=? "iso9660" file-system-type)
-                              (bootloader-configuration
-                                (inherit (operating-system-bootloader os))
-                                (bootloader grub-mkrescue-bootloader))
-                              (operating-system-bootloader os)))
-
-              ;; Force our own root file system.
-              (file-systems (cons (file-system
-                                    (mount-point "/")
-                                    (device root-uuid)
-                                    (type file-system-type))
-                                  file-systems-to-keep)))))
-
-    (mlet* %store-monad ((os-drv   (operating-system-derivation os))
-                         (bootcfg  (operating-system-bootcfg os)))
-      (if (string=? "iso9660" file-system-type)
-          (iso9660-image #:name name
-                         #:file-system-label root-label
-                         #:file-system-uuid root-uuid
-                         #:os-drv os-drv
-                         #:register-closures? #t
-                         #:bootcfg-drv bootcfg
-                         #:bootloader (bootloader-configuration-bootloader
-                                        (operating-system-bootloader os))
-                         #:inputs `(("system" ,os-drv)
-                                    ("bootcfg" ,bootcfg)))
-          (qemu-image #:name name
-                      #:os-drv os-drv
-                      #:bootcfg-drv bootcfg
-                      #:bootloader (bootloader-configuration-bootloader
-                                    (operating-system-bootloader os))
-                      #:disk-image-size disk-image-size
-                      #:disk-image-format "raw"
-                      #:file-system-type file-system-type
-                      #:file-system-label root-label
-                      #:file-system-uuid root-uuid
-                      #:copy-inputs? #t
-                      #:register-closures? #t
-                      #:inputs `(("system" ,os-drv)
-                                 ("bootcfg" ,bootcfg)))))))
+  (let* ((os (operating-system (inherit os)
+               ;; Since this is meant to be used on real hardware, don't
+               ;; install QEMU networking or anything like that.  Assume USB
+               ;; mass storage devices (usb-storage.ko) are available.
+               (initrd (lambda (file-systems . rest)
+                         (apply (operating-system-initrd os)
+                                file-systems
+                                #:volatile-root? #t
+                                rest)))
+
+               (bootloader (if (string=? "iso9660" file-system-type)
+                               (bootloader-configuration
+                                 (inherit (operating-system-bootloader os))
+                                 (bootloader grub-mkrescue-bootloader))
+                               (operating-system-bootloader os)))
+
+               ;; Force our own root file system.
+               (file-systems (cons (file-system
+                                     (mount-point "/")
+                                     (device root-uuid)
+                                     (type file-system-type))
+                                   file-systems-to-keep))))
+        (bootcfg (operating-system-bootcfg os)))
+    (if (string=? "iso9660" file-system-type)
+        (iso9660-image #:name name
+                       #:file-system-label root-label
+                       #:file-system-uuid root-uuid
+                       #:os os
+                       #:register-closures? #t
+                       #:bootcfg-drv bootcfg
+                       #:bootloader (bootloader-configuration-bootloader
+                                     (operating-system-bootloader os))
+                       #:inputs `(("system" ,os)
+                                  ("bootcfg" ,bootcfg)))
+        (qemu-image #:name name
+                    #:os os
+                    #:bootcfg-drv bootcfg
+                    #:bootloader (bootloader-configuration-bootloader
+                                  (operating-system-bootloader os))
+                    #:disk-image-size disk-image-size
+                    #:disk-image-format "raw"
+                    #:file-system-type file-system-type
+                    #:file-system-label root-label
+                    #:file-system-uuid root-uuid
+                    #:copy-inputs? #t
+                    #:register-closures? #t
+                    #:inputs `(("system" ,os)
+                               ("bootcfg" ,bootcfg))))))
 
 (define* (system-qemu-image os
                             #:key
@@ -702,30 +698,28 @@ of the GNU system as described by OS."
                                'dce)))
 
 
-  (let ((os (operating-system (inherit os)
-              ;; Assume we have an initrd with the whole QEMU shebang.
-
-              ;; Force our own root file system.  Refer to it by UUID so that
-              ;; it works regardless of how the image is used ("qemu -hda",
-              ;; Xen, etc.).
-              (file-systems (cons (file-system
-                                    (mount-point "/")
-                                    (device root-uuid)
-                                    (type file-system-type))
-                                  file-systems-to-keep)))))
-    (mlet* %store-monad
-        ((os-drv      (operating-system-derivation os))
-         (bootcfg     (operating-system-bootcfg os)))
-      (qemu-image  #:os-drv os-drv
-                   #:bootcfg-drv bootcfg
-                   #:bootloader (bootloader-configuration-bootloader
-                                 (operating-system-bootloader os))
-                   #:disk-image-size disk-image-size
-                   #:file-system-type file-system-type
-                   #:file-system-uuid root-uuid
-                   #:inputs `(("system" ,os-drv)
-                              ("bootcfg" ,bootcfg))
-                   #:copy-inputs? #t))))
+  (let* ((os (operating-system (inherit os)
+               ;; Assume we have an initrd with the whole QEMU shebang.
+
+               ;; Force our own root file system.  Refer to it by UUID so that
+               ;; it works regardless of how the image is used ("qemu -hda",
+               ;; Xen, etc.).
+               (file-systems (cons (file-system
+                                     (mount-point "/")
+                                     (device root-uuid)
+                                     (type file-system-type))
+                                   file-systems-to-keep))))
+         (bootcfg (operating-system-bootcfg os)))
+    (qemu-image  #:os os
+                 #:bootcfg-drv bootcfg
+                 #:bootloader (bootloader-configuration-bootloader
+                               (operating-system-bootloader os))
+                 #:disk-image-size disk-image-size
+                 #:file-system-type file-system-type
+                 #:file-system-uuid root-uuid
+                 #:inputs `(("system" ,os)
+                            ("bootcfg" ,bootcfg))
+                 #:copy-inputs? #t)))
 
 
 ;;;
@@ -829,25 +823,26 @@ bootloader refers to: OS kernel, initrd, bootloader data, etc."
     ;; Use a fixed UUID to improve determinism.
     (operating-system-uuid os 'dce))
 
-  (mlet* %store-monad ((os-drv   (operating-system-derivation os))
-                       (bootcfg  (operating-system-bootcfg os)))
-    ;; XXX: When FULL-BOOT? is true, we end up creating an image that contains
-    ;; BOOTCFG and all its dependencies, including the output of OS-DRV.
-    ;; This is more than needed (we only need the kernel, initrd, GRUB for its
-    ;; font, and the background image), but it's hard to filter that.
-    (qemu-image #:os-drv os-drv
-                #:bootcfg-drv bootcfg
-                #:bootloader (bootloader-configuration-bootloader
-                              (operating-system-bootloader os))
-                #:disk-image-size disk-image-size
-                #:file-system-uuid root-uuid
-                #:inputs (if full-boot?
-                             `(("bootcfg" ,bootcfg))
-                             '())
-
-                ;; XXX: Passing #t here is too slow, so let it off by default.
-                #:register-closures? #f
-                #:copy-inputs? full-boot?)))
+  (define bootcfg
+    (operating-system-bootcfg os))
+
+  ;; XXX: When FULL-BOOT? is true, we end up creating an image that contains
+  ;; BOOTCFG and all its dependencies, including the output of OS.
+  ;; This is more than needed (we only need the kernel, initrd, GRUB for its
+  ;; font, and the background image), but it's hard to filter that.
+  (qemu-image #:os os
+              #:bootcfg-drv bootcfg
+              #:bootloader (bootloader-configuration-bootloader
+                            (operating-system-bootloader os))
+              #:disk-image-size disk-image-size
+              #:file-system-uuid root-uuid
+              #:inputs (if full-boot?
+                           `(("bootcfg" ,bootcfg))
+                           '())
+
+              ;; XXX: Passing #t here is too slow, so let it off by default.
+              #:register-closures? #f
+              #:copy-inputs? full-boot?))
 
 (define* (common-qemu-options image shared-fs)
   "Return the a string-value gexp with the common QEMU options to boot IMAGE,
@@ -897,21 +892,20 @@ bootloader; otherwise it directly starts the operating system kernel.  The
 DISK-IMAGE-SIZE parameter specifies the size in bytes of the root disk image;
 it is mostly useful when FULL-BOOT?  is true."
   (mlet* %store-monad ((os ->  (virtualized-operating-system os mappings full-boot?))
-                       (os-drv (operating-system-derivation os))
                        (image  (system-qemu-image/shared-store
                                 os
                                 #:full-boot? full-boot?
                                 #:disk-image-size disk-image-size)))
     (define kernel-arguments
       #~(list #$@(if graphic? #~() #~("console=ttyS0"))
-              #+@(operating-system-kernel-arguments os os-drv "/dev/vda1")))
+              #+@(operating-system-kernel-arguments os "/dev/vda1")))
 
     (define qemu-exec
       #~(list (string-append #$qemu "/bin/" #$(qemu-command (%current-system)))
               #$@(if full-boot?
                      #~()
                      #~("-kernel" #$(operating-system-kernel-file os)
-                        "-initrd" #$(file-append os-drv "/initrd")
+                        "-initrd" #$(file-append os "/initrd")
                         (format #f "-append ~s"
                                 (string-join #$kernel-arguments " "))))
               #$@(common-qemu-options image
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 02882f4b46..03392cef38 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -154,10 +154,15 @@ info --version")
                                                  (#f (reverse result))
                                                  (x  (loop (cons x result))))))
                                           marionette)))
-              (lset= string=?
-                     (map passwd:name users)
+              (lset= equal?
+                     (map (lambda (user)
+                            (list (passwd:name user)
+                                  (passwd:dir user)))
+                          users)
                      (list
-                      #$@(map user-account-name
+                      #$@(map (lambda (account)
+                                `(list ,(user-account-name account)
+                                       ,(user-account-home-directory account)))
                               (operating-system-user-accounts os))))))
 
           (test-assert "shepherd services"
diff --git a/guix/build-system/clojure.scm b/guix/build-system/clojure.scm
new file mode 100644
index 0000000000..5a91bcba00
--- /dev/null
+++ b/guix/build-system/clojure.scm
@@ -0,0 +1,195 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
+;;;
+;;; 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 (guix build-system clojure)
+  #:use-module (guix build clojure-utils)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system ant)
+  #:use-module ((guix build-system gnu)
+                #:select (standard-packages)
+                #:prefix gnu:)
+
+  #:use-module (guix derivations)
+  #:use-module (guix packages)
+  #:use-module ((guix search-paths)
+                #:select
+                ((search-path-specification->sexp . search-path-spec->sexp)))
+  #:use-module (guix utils)
+
+  #:use-module (ice-9 match)
+  #:export (%clojure-build-system-modules
+            clojure-build
+            clojure-build-system))
+
+;; Commentary:
+;;
+;; Standard build procedure for Clojure packages.
+;;
+;; Code:
+
+(define-with-docs %clojure-build-system-modules
+  "Build-side modules imported and used by default."
+  `((guix build clojure-build-system)
+    (guix build clojure-utils)
+    (guix build guile-build-system)
+    ,@%ant-build-system-modules))
+
+(define-with-docs %default-clojure
+  "The default Clojure package."
+  (delay (@* (gnu packages lisp) clojure)))
+
+(define-with-docs %default-jdk
+  "The default JDK package."
+  (delay (@* (gnu packages java) icedtea)))
+
+(define-with-docs %default-zip
+  "The default ZIP package."
+  (delay (@* (gnu packages compression) zip)))
+
+(define* (lower name
+                #:key
+                source target
+                inputs native-inputs
+                (clojure (force %default-clojure))
+                (jdk (force %default-jdk))
+                (zip (force %default-zip))
+                outputs system
+                #:allow-other-keys
+                #:rest arguments)
+  "Return a bag for NAME."
+  (let ((private-keywords '(#:source #:target
+                            #:inputs #:native-inputs
+                            #:clojure #:jdk #:zip)))
+
+    (if target
+        (error "No cross-compilation for clojure-build-system yet: LOWER"
+               target) ; FIXME
+        (bag (name name)
+             (system system)
+             (host-inputs `(,@(if source
+                                  `(("source" ,source))
+                                  '())
+                            ,@inputs
+                            ,@(gnu:standard-packages)))
+             (build-inputs `(("clojure" ,clojure)
+                             ("jdk" ,jdk "jdk")
+                             ("zip" ,zip)
+                             ,@native-inputs))
+             (outputs outputs)
+             (build clojure-build)
+             (arguments (strip-keyword-arguments private-keywords
+                                                 arguments))))))
+
+(define-with-docs source->output-path
+  "Convert source input to output path."
+  (match-lambda
+    (((? derivation? source))
+     (derivation->output-path source))
+    ((source)
+     source)
+    (source
+     source)))
+
+(define-with-docs maybe-guile->guile
+  "Find the right guile."
+  (match-lambda
+    ((and maybe-guile (? package?))
+     maybe-guile)
+    (#f ; default
+     (@* (gnu packages commencement) guile-final))))
+
+(define* (clojure-build store name inputs
+                        #:key
+                        (source-dirs `',%source-dirs)
+                        (test-dirs `',%test-dirs)
+                        (compile-dir %compile-dir)
+
+                        (jar-names `',(package-name->jar-names name))
+                        (main-class %main-class)
+                        (omit-source? %omit-source?)
+
+                        (aot-include `',%aot-include)
+                        (aot-exclude `',%aot-exclude)
+
+                        doc-dirs ; no sensible default
+                        (doc-regex %doc-regex)
+
+                        (tests? %tests?)
+                        (test-include `',%test-include)
+                        (test-exclude `',%test-exclude)
+
+                        (phases '(@ (guix build clojure-build-system)
+                                    %standard-phases))
+                        (outputs '("out"))
+                        (search-paths '())
+                        (system (%current-system))
+                        (guile #f)
+
+                        (imported-modules %clojure-build-system-modules)
+                        (modules %clojure-build-system-modules))
+  "Build SOURCE with INPUTS."
+  (let ((builder `(begin
+                    (use-modules ,@modules)
+                    (clojure-build #:name ,name
+                                   #:source ,(source->output-path
+                                              (assoc-ref inputs "source"))
+
+                                   #:source-dirs ,source-dirs
+                                   #:test-dirs ,test-dirs
+                                   #:compile-dir ,compile-dir
+
+                                   #:jar-names ,jar-names
+                                   #:main-class ,main-class
+                                   #:omit-source? ,omit-source?
+
+                                   #:aot-include ,aot-include
+                                   #:aot-exclude ,aot-exclude
+
+                                   #:doc-dirs ,doc-dirs
+                                   #:doc-regex ,doc-regex
+
+                                   #:tests? ,tests?
+                                   #:test-include ,test-include
+                                   #:test-exclude ,test-exclude
+
+                                   #:phases ,phases
+                                   #:outputs %outputs
+                                   #:search-paths ',(map search-path-spec->sexp
+                                                         search-paths)
+                                   #:system ,system
+                                   #:inputs %build-inputs)))
+
+        (guile-for-build (package-derivation store
+                                             (maybe-guile->guile guile)
+                                             system
+                                             #:graft? #f)))
+
+    (build-expression->derivation store name builder
+                                  #:inputs inputs
+                                  #:system system
+                                  #:modules imported-modules
+                                  #:outputs outputs
+                                  #:guile-for-build guile-for-build)))
+
+(define clojure-build-system
+  (build-system
+    (name 'clojure)
+    (description "Simple Clojure build system using plain old 'compile'")
+    (lower lower)))
+
+;;; clojure.scm ends here
diff --git a/guix/build-system/ocaml.scm b/guix/build-system/ocaml.scm
index 34a22ecffa..e5b715f55d 100644
--- a/guix/build-system/ocaml.scm
+++ b/guix/build-system/ocaml.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2016, 2017, 2018 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -28,7 +28,9 @@
   #:use-module (srfi srfi-1)
   #:export (%ocaml-build-system-modules
             package-with-ocaml4.01
+            package-with-ocaml4.02
             strip-ocaml4.01-variant
+            strip-ocaml4.02-variant
             ocaml-build
             ocaml-build-system))
 
@@ -82,6 +84,14 @@
   (let ((module (resolve-interface '(gnu packages ocaml))))
     (module-ref module 'ocaml4.01-findlib)))
 
+(define (default-ocaml4.02)
+  (let ((ocaml (resolve-interface '(gnu packages ocaml))))
+    (module-ref ocaml 'ocaml-4.02)))
+
+(define (default-ocaml4.02-findlib)
+  (let ((module (resolve-interface '(gnu packages ocaml))))
+    (module-ref module 'ocaml4.02-findlib)))
+
 (define* (package-with-explicit-ocaml ocaml findlib old-prefix new-prefix
                                        #:key variant-property)
   "Return a procedure of one argument, P.  The procedure creates a package
@@ -139,12 +149,24 @@ pre-defined variants."
                                "ocaml-" "ocaml4.01-"
                                #:variant-property 'ocaml4.01-variant))
 
+(define package-with-ocaml4.02
+  (package-with-explicit-ocaml (delay (default-ocaml4.02))
+                               (delay (default-ocaml4.02-findlib))
+                               "ocaml-" "ocaml4.02-"
+                               #:variant-property 'ocaml4.02-variant))
+
 (define (strip-ocaml4.01-variant p)
   "Remove the 'ocaml4.01-variant' property from P."
   (package
     (inherit p)
     (properties (alist-delete 'ocaml4.01-variant (package-properties p)))))
 
+(define (strip-ocaml4.02-variant p)
+  "Remove the 'ocaml4.02-variant' property from P."
+  (package
+    (inherit p)
+    (properties (alist-delete 'ocaml4.02-variant (package-properties p)))))
+
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
                 (ocaml (default-ocaml))
diff --git a/guix/build/clojure-build-system.scm b/guix/build/clojure-build-system.scm
new file mode 100644
index 0000000000..d8f7c89f85
--- /dev/null
+++ b/guix/build/clojure-build-system.scm
@@ -0,0 +1,110 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
+;;;
+;;; 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 (guix build clojure-build-system)
+  #:use-module ((guix build ant-build-system)
+                #:select ((%standard-phases . %standard-phases@ant)
+                          ant-build))
+  #:use-module (guix build clojure-utils)
+  #:use-module (guix build java-utils)
+  #:use-module (guix build utils)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:export (%standard-phases
+            clojure-build))
+
+;; Commentary:
+;;
+;; Builder-side code of the standard build procedure for Clojure packages.
+;;
+;; Code:
+
+(define* (build #:key
+                source-dirs compile-dir
+                jar-names main-class omit-source?
+                aot-include aot-exclude
+                #:allow-other-keys)
+  "Standard 'build' phase for clojure-build-system."
+  (let* ((libs (append-map find-clojure-libs source-dirs))
+         (libs* (include-list\exclude-list aot-include
+                                           aot-exclude
+                                           #:all-list libs)))
+    (mkdir-p compile-dir)
+    (eval-with-clojure `(run! compile ',libs*)
+                       source-dirs)
+    (let ((source-dir-files-alist (map (lambda (dir)
+                                         (cons dir (find-files* dir)))
+                                       source-dirs))
+          ;; workaround transitive compilation in Clojure
+          (classes (filter (lambda (class)
+                             (any (cut compiled-from? class <>)
+                                  libs*))
+                           (find-files* compile-dir))))
+      (for-each (cut create-jar <> (cons (cons compile-dir classes)
+                                         (if omit-source?
+                                             '()
+                                             source-dir-files-alist))
+                     #:main-class main-class)
+                jar-names)
+      #t)))
+
+(define* (check #:key
+                test-dirs
+                jar-names
+                tests? test-include test-exclude
+                #:allow-other-keys)
+  "Standard 'check' phase for clojure-build-system.  Note that TEST-EXCLUDE has
+priority over TEST-INCLUDE."
+  (if tests?
+      (let* ((libs (append-map find-clojure-libs test-dirs))
+             (libs* (include-list\exclude-list test-include
+                                               test-exclude
+                                               #:all-list libs)))
+        (for-each (lambda (jar)
+                    (eval-with-clojure `(do (apply require
+                                                   '(clojure.test ,@libs*))
+                                            (apply clojure.test/run-tests
+                                                   ',libs*))
+                                       (cons jar test-dirs)))
+                  jar-names)))
+  #t)
+
+(define-with-docs install
+  "Standard 'install' phase for clojure-build-system."
+  (install-jars "./"))
+
+(define-with-docs %standard-phases
+  "Standard build phases for clojure-build-system."
+  (modify-phases %standard-phases@ant
+    (replace 'build build)
+    (replace 'check check)
+    (replace 'install install)
+    (add-after 'install-license-files 'install-doc install-doc)))
+
+(define* (clojure-build #:key
+                        inputs
+                        (phases %standard-phases)
+                        #:allow-other-keys
+                        #:rest args)
+  "Build the given Clojure package, applying all of PHASES in order."
+  (apply ant-build
+         #:inputs inputs
+         #:phases phases
+         args))
+
+;;; clojure-build-system.scm ends here
diff --git a/guix/build/clojure-utils.scm b/guix/build/clojure-utils.scm
new file mode 100644
index 0000000000..027777b4d1
--- /dev/null
+++ b/guix/build/clojure-utils.scm
@@ -0,0 +1,265 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
+;;;
+;;; 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 (guix build clojure-utils)
+  #:use-module (guix build utils)
+  #:use-module (ice-9 ftw)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 regex)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-8)
+  #:use-module (srfi srfi-26)
+  #:export (@*
+            @@*
+            define-with-docs
+
+            %doc-regex
+            install-doc
+
+            %source-dirs
+            %test-dirs
+            %compile-dir
+            package-name->jar-names
+            %main-class
+            %omit-source?
+            %aot-include
+            %aot-exclude
+            %tests?
+            %test-include
+            %test-exclude
+
+            %clojure-regex
+            canonicalize-relative-path
+            find-files*
+            file-sans-extension
+            relative-path->clojure-lib-string
+            find-clojure-libs
+            compiled-from?
+            include-list\exclude-list
+            eval-with-clojure
+            create-jar))
+
+(define-syntax-rule (@* module name)
+  "Like (@ MODULE NAME), but resolves at run time."
+  (module-ref (resolve-interface 'module) 'name))
+
+(define-syntax-rule (@@* module name)
+  "Like (@@ MODULE NAME), but resolves at run time."
+  (module-ref (resolve-module 'module) 'name))
+
+(define-syntax-rule (define-with-docs name docs val)
+  "Create top-level variable named NAME with doc string DOCS and value VAL."
+  (begin (define name val)
+         (set-object-property! name 'documentation docs)))
+
+(define-with-docs %doc-regex
+  "Default regex for matching the base name of top-level documentation files."
+  (format #f
+          "(~a)|(\\.(html|markdown|md|txt)$)"
+          (@@ (guix build guile-build-system)
+              %documentation-file-regexp)))
+
+(define* (install-doc #:key
+                      doc-dirs
+                      (doc-regex %doc-regex)
+                      outputs
+                      #:allow-other-keys)
+  "Install the following to the default documentation directory:
+
+1. Top-level files with base name matching DOC-REGEX.
+2. All files (recursively) inside DOC-DIRS.
+
+DOC-REGEX can be compiled or uncompiled."
+  (let* ((out (assoc-ref outputs "out"))
+         (doc (assoc-ref outputs "doc"))
+         (name-ver (strip-store-file-name out))
+         (dest-dir (string-append (or doc out) "/share/doc/" name-ver "/"))
+         (doc-regex* (if (string? doc-regex)
+                         (make-regexp doc-regex)
+                         doc-regex)))
+    (for-each (cut install-file <> dest-dir)
+              (remove (compose file-exists?
+                               (cut string-append dest-dir <>))
+                      (scandir "./" (cut regexp-exec doc-regex* <>))))
+    (for-each (cut copy-recursively <> dest-dir)
+              doc-dirs)
+    #t))
+
+(define-with-docs %source-dirs
+  "A default list of source directories."
+  '("src/"))
+
+(define-with-docs %test-dirs
+  "A default list of test directories."
+  '("test/"))
+
+(define-with-docs %compile-dir
+  "Default directory for holding class files."
+  "classes/")
+
+(define (package-name->jar-names name)
+  "Given NAME, a package name like \"foo-0.9.1b\",
+return the list of default jar names: (\"foo-0.9.1b.jar\" \"foo.jar\")."
+  (map (cut string-append <> ".jar")
+       (list name
+             (receive (base-name _)
+                 (package-name->name+version name)
+               base-name))))
+
+(define-with-docs %main-class
+  "Default name for main class.  It should be a symbol or #f."
+  #f)
+
+(define-with-docs %omit-source?
+  "Include source in jars by default."
+  #f)
+
+(define-with-docs %aot-include
+  "A default list of symbols deciding what to compile.  Note that the exclude
+list has priority over the include list.  The special keyword #:all represents
+all libraries found under the source directories."
+  '(#:all))
+
+(define-with-docs %aot-exclude
+  "A default list of symbols deciding what not to compile.
+See the doc string of '%aot-include' for more details."
+  '())
+
+(define-with-docs %tests?
+  "Enable tests by default."
+  #t)
+
+(define-with-docs %test-include
+  "A default list of symbols deciding what tests to include.  Note that the
+exclude list has priority over the include list.  The special keyword #:all
+represents all tests found under the test directories."
+  '(#:all))
+
+(define-with-docs %test-exclude
+  "A default list of symbols deciding what tests to exclude.
+See the doc string of '%test-include' for more details."
+  '())
+
+(define-with-docs %clojure-regex
+  "Default regex for matching the base name of clojure source files."
+  "\\.cljc?$")
+
+(define-with-docs canonicalize-relative-path
+  "Like 'canonicalize-path', but for relative paths.
+Canonicalizations requiring the path to exist are omitted."
+  (let ((remove.. (lambda (ls)
+                    (fold-right (match-lambda*
+                                  (((and comp (not "..")) (".." comps ...))
+                                   comps)
+                                  ((comp (comps ...))
+                                   (cons comp comps)))
+                                '()
+                                ls))))
+    (compose (match-lambda
+               (() ".")
+               (ls (string-join ls "/")))
+             remove..
+             (cut remove (cut member <> '("" ".")) <>)
+             (cut string-split <> #\/))))
+
+(define (find-files* base-dir . args)
+  "Similar to 'find-files', but with BASE-DIR stripped and result
+canonicalized."
+  (map canonicalize-relative-path
+       (with-directory-excursion base-dir
+         (apply find-files "./" args))))
+
+;;; FIXME: should be moved to (guix build utils)
+(define-with-docs file-sans-extension
+  "Strip extension from path, if any."
+  (@@ (guix build guile-build-system)
+      file-sans-extension))
+
+(define (relative-path->clojure-lib-string path)
+  "Convert PATH to a clojure library string."
+  (string-map (match-lambda
+                (#\/ #\.)
+                (#\_ #\-)
+                (chr chr))
+              (file-sans-extension path)))
+
+(define* (find-clojure-libs base-dir
+                            #:key (clojure-regex %clojure-regex))
+  "Return the list of clojure libraries found under BASE-DIR.
+
+CLOJURE-REGEX can be compiled or uncompiled."
+  (map (compose string->symbol
+                relative-path->clojure-lib-string)
+       (find-files* base-dir clojure-regex)))
+
+(define (compiled-from? class lib)
+  "Given class file CLASS and clojure library symbol LIB, decide if CLASS
+results from compiling LIB."
+  (string-prefix? (symbol->string lib)
+                  (relative-path->clojure-lib-string class)))
+
+(define* (include-list\exclude-list include-list exclude-list
+                                    #:key all-list)
+  "Given INCLUDE-LIST and EXCLUDE-LIST, replace all occurences of #:all by
+slicing ALL-LIST into them and compute their list difference."
+  (define (replace-#:all ls all-ls)
+    (append-map (match-lambda
+                  (#:all all-ls)
+                  (x (list x)))
+                ls))
+  (let ((include-list* (replace-#:all include-list all-list))
+        (exclude-list* (replace-#:all exclude-list all-list)))
+    (lset-difference equal? include-list* exclude-list*)))
+
+(define (eval-with-clojure expr extra-paths)
+  "Evaluate EXPR with clojure.
+
+EXPR must be a s-expression writable by guile and readable by clojure.
+For examples, '(require '[clojure.string]) will not work,
+because the guile writer converts brackets to parentheses.
+
+EXTRA-PATHS is a list of paths which will be appended to $CLASSPATH."
+  (let* ((classpath (getenv "CLASSPATH"))
+         (classpath* (string-join (cons classpath extra-paths) ":")))
+    (invoke "java"
+            "-classpath" classpath*
+            "clojure.main"
+            "--eval" (object->string expr))))
+
+(define* (create-jar output-jar dir-files-alist
+                     #:key
+                     (verbose? #t)
+                     (compress? #f)
+                     (main-class %main-class))
+  "Given DIR-FILES-ALIST, an alist of the form: ((DIR . FILES) ...)
+Create jar named OUTPUT-JAR from FILES with DIR stripped."
+  (let ((grouped-options (string-append "c"
+                                        (if verbose? "v" "")
+                                        "f"
+                                        (if compress? "" "0")
+                                        (if main-class "e" ""))))
+    (apply invoke `("jar"
+                    ,grouped-options
+                    ,output-jar
+                    ,@(if main-class (list (symbol->string main-class)) '())
+                    ,@(append-map (match-lambda
+                                    ((dir . files)
+                                     (append-map (lambda (file)
+                                                   `("-C" ,dir ,file))
+                                                 files)))
+                                  dir-files-alist)))))
diff --git a/guix/build/ocaml-build-system.scm b/guix/build/ocaml-build-system.scm
index d10431d8ef..99111ad300 100644
--- a/guix/build/ocaml-build-system.scm
+++ b/guix/build/ocaml-build-system.scm
@@ -49,37 +49,40 @@
                           '())
                     ,@configure-flags)))
         (format #t "running 'setup.ml' with arguments ~s~%" args)
-        (zero? (apply system* "ocaml" "setup.ml" args)))
+        (apply invoke "ocaml" "setup.ml" args))
        (let ((args `("-prefix" ,out ,@configure-flags)))
         (format #t "running 'configure' with arguments ~s~%" args)
-        (zero? (apply system* "./configure" args))))))
+        (apply invoke "./configure" args))))
+    #t)
 
 (define* (build #:key inputs outputs (build-flags '()) (make-flags '())
                 (use-make? #f) #:allow-other-keys)
   "Build the given package."
   (if (and (file-exists? "setup.ml") (not use-make?))
-    (zero? (apply system* "ocaml" "setup.ml" "-build" build-flags))
+    (apply invoke "ocaml" "setup.ml" "-build" build-flags)
     (if (file-exists? "Makefile")
-      (zero? (apply system* "make" make-flags))
+      (apply invoke "make" make-flags)
       (let ((file (if (file-exists? "pkg/pkg.ml") "pkg/pkg.ml" "pkg/build.ml")))
-        (zero? (apply system* "ocaml" "-I"
-                              (string-append (assoc-ref inputs "findlib")
-                                             "/lib/ocaml/site-lib")
-                              file build-flags))))))
+        (apply invoke "ocaml" "-I"
+                      (string-append (assoc-ref inputs "findlib")
+                                     "/lib/ocaml/site-lib")
+                      file build-flags))))
+  #t)
 
 (define* (check #:key inputs outputs (make-flags '()) (test-target "test") tests?
                   (use-make? #f) #:allow-other-keys)
   "Install the given package."
   (when tests?
     (if (and (file-exists? "setup.ml") (not use-make?))
-      (zero? (system* "ocaml" "setup.ml" (string-append "-" test-target)))
+      (invoke "ocaml" "setup.ml" (string-append "-" test-target))
       (if (file-exists? "Makefile")
-        (zero? (apply system* "make" test-target make-flags))
+        (apply invoke "make" test-target make-flags)
         (let ((file (if (file-exists? "pkg/pkg.ml") "pkg/pkg.ml" "pkg/build.ml")))
-          (zero? (system* "ocaml" "-I"
-                          (string-append (assoc-ref inputs "findlib")
-                                         "/lib/ocaml/site-lib")
-                          file test-target)))))))
+          (invoke "ocaml" "-I"
+                  (string-append (assoc-ref inputs "findlib")
+                                 "/lib/ocaml/site-lib")
+                  file test-target)))))
+  #t)
 
 (define* (install #:key outputs (build-flags '()) (make-flags '()) (use-make? #f)
                   (install-target "install")
@@ -87,17 +90,19 @@
   "Install the given package."
   (let ((out (assoc-ref outputs "out")))
     (if (and (file-exists? "setup.ml") (not use-make?))
-      (zero? (apply system* "ocaml" "setup.ml"
-                    (string-append "-" install-target) build-flags))
+      (apply invoke "ocaml" "setup.ml"
+             (string-append "-" install-target) build-flags)
       (if (file-exists? "Makefile")
-        (zero? (apply system* "make" install-target make-flags))
-        (zero? (system* "opam-installer" "-i" (string-append "--prefix=" out)
-                        (string-append "--libdir=" out "/lib/ocaml/site-lib")))))))
+        (apply invoke "make" install-target make-flags)
+        (invoke "opam-installer" "-i" (string-append "--prefix=" out)
+                (string-append "--libdir=" out "/lib/ocaml/site-lib")))))
+  #t)
 
 (define* (prepare-install #:key outputs #:allow-other-keys)
   "Prepare for building the given package."
   (mkdir-p (string-append (assoc-ref outputs "out") "/lib/ocaml/site-lib"))
-  (mkdir-p (string-append (assoc-ref outputs "out") "/bin")))
+  (mkdir-p (string-append (assoc-ref outputs "out") "/bin"))
+  #t)
 
 (define %standard-phases
   ;; Everything is as with the GNU Build System except for the `configure'
diff --git a/guix/download.scm b/guix/download.scm
index 988117885c..0f92e12c08 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -372,19 +372,28 @@
   ;; List of content-addressed mirrors.  Each mirror is represented as a
   ;; procedure that takes a file name, an algorithm (symbol) and a hash
   ;; (bytevector), and returns a URL or #f.
-  ;; Note: Avoid 'https' to mitigate <http://bugs.gnu.org/22774>.
-  ;; TODO: Add more.
-  '(list (lambda (file algo hash)
-           ;; Files served by 'guix publish' are accessible under a single
-           ;; hash algorithm.
-           (string-append "http://mirror.hydra.gnu.org/file/"
-                          file "/" (symbol->string algo) "/"
-                          (bytevector->nix-base32-string hash)))
-         (lambda (file algo hash)
-           ;; 'tarballs.nixos.org' supports several algorithms.
-           (string-append "http://tarballs.nixos.org/"
-                          (symbol->string algo) "/"
-                          (bytevector->nix-base32-string hash)))))
+  '(begin
+     (use-modules (guix base32) (guix base16))
+
+     (list (lambda (file algo hash)
+             ;; Files served by 'guix publish' are accessible under a single
+             ;; hash algorithm.
+             (string-append "https://mirror.hydra.gnu.org/file/"
+                            file "/" (symbol->string algo) "/"
+                            (bytevector->nix-base32-string hash)))
+           (lambda (file algo hash)
+             ;; 'tarballs.nixos.org' supports several algorithms.
+             (string-append "https://tarballs.nixos.org/"
+                            (symbol->string algo) "/"
+                            (bytevector->nix-base32-string hash)))
+           (lambda (file algo hash)
+             ;; Software Heritage usually archives VCS history rather than
+             ;; tarballs, but tarballs are sometimes available (and can be
+             ;; explicitly stored there.)  For example, see
+             ;; <https://archive.softwareheritage.org/api/1/content/sha256:92d0fa1c311cacefa89853bdb53c62f4110cdfda3820346b59cbd098f40f955e/>.
+             (string-append "https://archive.softwareheritage.org/api/1/content/"
+                            (symbol->string algo) ":"
+                            (bytevector->base16-string hash) "/raw/")))))
 
 (define %content-addressed-mirror-file
   ;; Content-addressed mirrors stored in a file.
diff --git a/guix/progress.scm b/guix/progress.scm
index 9da667a027..65080bcf24 100644
--- a/guix/progress.scm
+++ b/guix/progress.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2017 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2015 Steve Sprang <scs@stevesprang.com>
 ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -197,7 +198,7 @@ throughput."
   (define elapsed
     (duration->seconds
      (time-difference (current-time time-monotonic) start-time)))
-  (if (number? size)
+  (if (and (number? size) (not (zero? size)))
       (let* ((%  (* 100.0 (/ transferred size)))
              (throughput (/ transferred elapsed))
              (left       (format #f " ~a  ~a" file
@@ -211,17 +212,20 @@ throughput."
                                     (current-terminal-columns))
                  log-port)
         (force-output log-port))
-      (let* ((throughput (/ transferred elapsed))
-             (left       (format #f " ~a" file))
-             (right      (format #f "~a/s ~a | ~a transferred"
-                                 (byte-count->string throughput)
-                                 (seconds->string elapsed)
-                                 (byte-count->string transferred))))
-        (erase-current-line log-port)
-        (display (string-pad-middle left right
-                                    (current-terminal-columns))
-                 log-port)
-        (force-output log-port))))
+      ;; If we don't know the total size, the last transfer will have a 0B
+      ;; size.  Don't display it.
+      (unless (zero? transferred)
+        (let* ((throughput (/ transferred elapsed))
+               (left       (format #f " ~a" file))
+               (right      (format #f "~a/s ~a | ~a transferred"
+                                   (byte-count->string throughput)
+                                   (seconds->string elapsed)
+                                   (byte-count->string transferred))))
+          (erase-current-line log-port)
+          (display (string-pad-middle left right
+                                      (current-terminal-columns))
+                   log-port)
+          (force-output log-port)))))
 
 (define %progress-interval
   ;; Default interval between subsequent outputs for rate-limited displays.
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 9ba9428a08..00d2fe4829 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -175,12 +175,16 @@ TARGET, and register them."
 
     (return *unspecified*)))
 
-(define* (install-bootloader installer-drv
+(define* (install-bootloader installer
                              #:key
                              bootcfg bootcfg-file
                              target)
-  "Call INSTALLER-DRV with error handling, in %STORE-MONAD."
-  (with-monad %store-monad
+  "Run INSTALLER, a bootloader installation script, with error handling, in
+%STORE-MONAD."
+  (mlet %store-monad ((installer-drv (if installer
+                                         (lower-object installer)
+                                         (return #f)))
+                      (bootcfg       (lower-object bootcfg)))
     (let* ((gc-root      (string-append target %gc-roots-directory
                                         "/bootcfg"))
            (temp-gc-root (string-append gc-root ".new"))
@@ -247,21 +251,21 @@ the ownership of '~a' may be incorrect!~%")
         (format   (lift format %store-monad))
         (populate (lift2 populate-root-file-system %store-monad)))
 
-    (mbegin %store-monad
-      ;; Copy the closure of BOOTCFG, which includes OS-DIR,
-      ;; eventual background image and so on.
-      (maybe-copy
-       (derivation->output-path bootcfg))
+    (mlet %store-monad ((bootcfg (lower-object bootcfg)))
+      (mbegin %store-monad
+        ;; Copy the closure of BOOTCFG, which includes OS-DIR,
+        ;; eventual background image and so on.
+        (maybe-copy (derivation->output-path bootcfg))
 
-      ;; Create a bunch of additional files.
-      (format log-port "populating '~a'...~%" target)
-      (populate os-dir target)
+        ;; Create a bunch of additional files.
+        (format log-port "populating '~a'...~%" target)
+        (populate os-dir target)
 
-      (mwhen install-bootloader?
-        (install-bootloader bootloader-installer
-                            #:bootcfg bootcfg
-                            #:bootcfg-file bootcfg-file
-                            #:target target)))))
+        (mwhen install-bootloader?
+          (install-bootloader bootloader-installer
+                              #:bootcfg bootcfg
+                              #:bootcfg-file bootcfg-file
+                              #:target target))))))
 
 
 ;;;
@@ -790,19 +794,18 @@ checking this by themselves in their 'check' procedure."
     (warning (G_ "Consider running 'guix pull' before 'reconfigure'.~%"))
     (warning (G_ "Failing to do that may downgrade your system!~%"))))
 
-(define (bootloader-installer-derivation installer
-                                         bootloader device target)
+(define (bootloader-installer-script installer
+                                     bootloader device target)
   "Return a file calling INSTALLER gexp with given BOOTLOADER, DEVICE
 and TARGET arguments."
-  (with-monad %store-monad
-    (gexp->file "bootloader-installer"
-                (with-imported-modules '((gnu build bootloader)
-                                         (guix build utils))
-                  #~(begin
-                      (use-modules (gnu build bootloader)
-                                   (guix build utils)
-                                   (ice-9 binary-ports))
-                      (#$installer #$bootloader #$device #$target))))))
+  (scheme-file "bootloader-installer"
+               (with-imported-modules '((gnu build bootloader)
+                                        (guix build utils))
+                 #~(begin
+                     (use-modules (gnu build bootloader)
+                                  (guix build utils)
+                                  (ice-9 binary-ports))
+                     (#$installer #$bootloader #$device #$target)))))
 
 (define* (perform-action action os
                          #:key skip-safety-checks?
@@ -830,6 +833,25 @@ static checks."
   (define println
     (cut format #t "~a~%" <>))
 
+  (define menu-entries
+    (if (eq? 'init action)
+        '()
+        (map boot-parameters->menu-entry (profile-boot-parameters))))
+
+  (define bootloader
+    (bootloader-configuration-bootloader (operating-system-bootloader os)))
+
+  (define bootcfg
+    (and (not (eq? 'container action))
+         (operating-system-bootcfg os menu-entries)))
+
+  (define bootloader-script
+    (let ((installer (bootloader-installer bootloader))
+          (target    (or target "/")))
+      (bootloader-installer-script installer
+                                   (bootloader-package bootloader)
+                                   bootloader-target target)))
+
   (when (eq? action 'reconfigure)
     (maybe-suggest-running-guix-pull))
 
@@ -849,39 +871,16 @@ static checks."
                                                 #:image-size image-size
                                                 #:full-boot? full-boot?
                                                 #:mappings mappings))
-       (bootloader -> (bootloader-configuration-bootloader
-                       (operating-system-bootloader os)))
-       (bootloader-package
-        (let ((package (bootloader-package bootloader)))
-          (if package
-              (package->derivation package)
-              (return #f))))
-       (bootcfg  (if (eq? 'container action)
-                     (return #f)
-                     (operating-system-bootcfg
-                      os
-                      (if (eq? 'init action)
-                          '()
-                          (map boot-parameters->menu-entry
-                               (profile-boot-parameters))))))
-       (bootcfg-file -> (bootloader-configuration-file bootloader))
-       (bootloader-installer
-        (let ((installer (bootloader-installer bootloader))
-              (target    (or target "/")))
-          (bootloader-installer-derivation installer
-                                           bootloader-package
-                                           bootloader-target target)))
 
        ;; For 'init' and 'reconfigure', always build BOOTCFG, even if
        ;; --no-bootloader is passed, because we then use it as a GC root.
        ;; See <http://bugs.gnu.org/21068>.
-       (drvs   -> (if (memq action '(init reconfigure))
-                      (if (and install-bootloader? bootloader-package)
-                          (list sys bootcfg
-				bootloader-package
-				bootloader-installer)
-                          (list sys bootcfg))
-                      (list sys)))
+       (drvs      (mapm %store-monad lower-object
+                        (if (memq action '(init reconfigure))
+                            (if install-bootloader?
+                                (list sys bootcfg bootloader-script)
+                                (list sys bootcfg))
+                            (list sys))))
        (%         (if derivations-only?
                       (return (for-each (compose println derivation-file-name)
                                         drvs))
@@ -890,7 +889,7 @@ static checks."
 
     (if (or dry-run? derivations-only?)
         (return #f)
-        (begin
+        (let ((bootcfg-file (bootloader-configuration-file bootloader)))
           (for-each (compose println derivation->output-path)
                     drvs)
 
@@ -899,7 +898,7 @@ static checks."
              (mbegin %store-monad
                (switch-to-system os)
                (mwhen install-bootloader?
-                 (install-bootloader bootloader-installer
+                 (install-bootloader bootloader-script
                                      #:bootcfg bootcfg
                                      #:bootcfg-file bootcfg-file
                                      #:target "/"))))
diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc
index 4c55c6ea0d..0aed59710f 100644
--- a/nix/libstore/local-store.cc
+++ b/nix/libstore/local-store.cc
@@ -1222,6 +1222,18 @@ static void checkSecrecy(const Path & path)
 }
 
 
+static std::string runAuthenticationProgram(const Strings & args)
+{
+    /* Use the 'authenticate' script from 'LIBEXECDIR/guix' or just
+       'LIBEXECDIR', depending on whether we're uninstalled or not.  */
+    const bool installed = getenv("GUIX_UNINSTALLED") == NULL;
+    const string program = settings.nixLibexecDir
+	+ (installed ? "/guix" : "")
+	+ "/authenticate";
+
+    return runProgram(program, false, args);
+}
+
 void LocalStore::exportPath(const Path & path, bool sign,
     Sink & sink)
 {
@@ -1276,7 +1288,8 @@ void LocalStore::exportPath(const Path & path, bool sign,
         args.push_back(secretKey);
         args.push_back("-in");
         args.push_back(hashFile);
-        string signature = runProgram(OPENSSL_PATH, true, args);
+
+        string signature = runAuthenticationProgram(args);
 
         writeString(signature, hashAndWriteSink);
 
@@ -1366,7 +1379,7 @@ Path LocalStore::importPath(bool requireSignature, Source & source)
             args.push_back("-pubin");
             args.push_back("-in");
             args.push_back(sigFile);
-            string hash2 = runProgram(OPENSSL_PATH, true, args);
+            string hash2 = runAuthenticationProgram(args);
 
             /* Note: runProgram() throws an exception if the signature
                is invalid. */
diff --git a/nix/local.mk b/nix/local.mk
index 7d45f200b8..fe45c344f0 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -113,7 +113,6 @@ libstore_a_CPPFLAGS =				\
   -DGUIX_CONFIGURATION_DIRECTORY=\"$(sysconfdir)/guix\"		\
   -DNIX_LIBEXEC_DIR=\"$(libexecdir)\"		\
   -DNIX_BIN_DIR=\"$(bindir)\"			\
-  -DOPENSSL_PATH="\"guix-authenticate\""	\
   -DDEFAULT_CHROOT_DIRS="\"\""
 
 libstore_a_CXXFLAGS = $(AM_CXXFLAGS)		\
@@ -168,10 +167,8 @@ nodist_pkglibexec_SCRIPTS +=			\
 
 endif BUILD_DAEMON_OFFLOAD
 
-
-# XXX: It'd be better to hide it in $(pkglibexecdir).
-nodist_libexec_SCRIPTS =			\
-  %D%/scripts/guix-authenticate
+nodist_pkglibexec_SCRIPTS +=			\
+  %D%/scripts/authenticate
 
 # The '.service' files for systemd.
 systemdservicedir = $(libdir)/systemd/system
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index b71b100f6c..8fdab2d116 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -466,18 +466,6 @@ main (int argc, char *argv[])
     {
       settings.processEnvironment ();
 
-      /* Hackily help 'local-store.cc' find our 'guix-authenticate' program, which
-	 is known as 'OPENSSL_PATH' here.  */
-      std::string search_path;
-      search_path = settings.nixLibexecDir;
-      if (getenv ("PATH") != NULL)
-	{
-	  search_path += ":";
-	  search_path += getenv ("PATH");
-	}
-
-      setenv ("PATH", search_path.c_str (), 1);
-
       /* Use our substituter by default.  */
       settings.substituters.clear ();
       settings.set ("build-use-substitutes", "true");
diff --git a/nix/scripts/guix-authenticate.in b/nix/scripts/authenticate.in
index 5ce57915f0..5ce57915f0 100644
--- a/nix/scripts/guix-authenticate.in
+++ b/nix/scripts/authenticate.in