summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/guix.texi128
-rw-r--r--doc/images/gcc-mesboot-bag-graph.dot123
-rw-r--r--doc/local.mk1
-rw-r--r--gnu/local.mk23
-rw-r--r--gnu/packages.scm18
-rw-r--r--gnu/packages/backup.scm26
-rw-r--r--gnu/packages/base.scm66
-rw-r--r--gnu/packages/bash.scm41
-rw-r--r--gnu/packages/bdw-gc.scm8
-rw-r--r--gnu/packages/bison.scm5
-rw-r--r--gnu/packages/bootstrap.scm323
-rwxr-xr-xgnu/packages/bootstrap/x86_64-linux/bashbin1425560 -> 0 bytes
-rwxr-xr-xgnu/packages/bootstrap/x86_64-linux/mkdirbin792448 -> 0 bytes
-rwxr-xr-xgnu/packages/bootstrap/x86_64-linux/tarbin1369912 -> 0 bytes
-rwxr-xr-xgnu/packages/bootstrap/x86_64-linux/xzbin927264 -> 0 bytes
-rw-r--r--gnu/packages/commencement.scm1659
-rw-r--r--gnu/packages/compression.scm21
-rw-r--r--gnu/packages/cross-base.scm21
-rw-r--r--gnu/packages/ed.scm6
-rw-r--r--gnu/packages/file.scm9
-rw-r--r--gnu/packages/glib.scm16
-rw-r--r--gnu/packages/gnupg.scm7
-rw-r--r--gnu/packages/groff.scm15
-rw-r--r--gnu/packages/image.scm4
-rw-r--r--gnu/packages/kerberos.scm4
-rw-r--r--gnu/packages/make-bootstrap.scm87
-rw-r--r--gnu/packages/mes.scm51
-rw-r--r--gnu/packages/multiprecision.scm4
-rw-r--r--gnu/packages/patches/binutils-boot-2.20.1a.patch157
-rw-r--r--gnu/packages/patches/diffutils-getopt.patch44
-rw-r--r--gnu/packages/patches/gcc-boot-2.95.3.patch137
-rw-r--r--gnu/packages/patches/gcc-boot-4.7.4.patch68
-rw-r--r--gnu/packages/patches/glibc-boot-2.16.0.patch352
-rw-r--r--gnu/packages/patches/glibc-boot-2.2.5.patch251
-rw-r--r--gnu/packages/patches/glibc-bootstrap-system-2.16.0.patch30
-rw-r--r--gnu/packages/patches/glibc-supported-locales.patch33
-rw-r--r--gnu/packages/patches/groff-source-date-epoch.patch299
-rw-r--r--gnu/packages/patches/handbrake-opt-in-nvenc.patch14
-rw-r--r--gnu/packages/patches/libarchive-CVE-2017-14166.patch45
-rw-r--r--gnu/packages/patches/libarchive-CVE-2017-14502.patch40
-rw-r--r--gnu/packages/patches/libgcrypt-make-yat2m-reproducible.patch32
-rw-r--r--gnu/packages/patches/mescc-tools-boot.patch222
-rw-r--r--gnu/packages/patches/python-pycodestyle-stdlib-tokenize-fix.patch35
-rw-r--r--gnu/packages/patches/tcc-boot-0.9.27.patch26
-rw-r--r--gnu/packages/pcre.scm4
-rw-r--r--gnu/packages/perl.scm4
-rw-r--r--gnu/packages/python-xyz.scm26
-rw-r--r--gnu/packages/python.scm65
-rw-r--r--gnu/packages/readline.scm28
-rw-r--r--gnu/packages/sqlite.scm25
-rw-r--r--gnu/packages/tls.scm4
-rw-r--r--gnu/packages/version-control.scm11
-rw-r--r--gnu/packages/video.scm12
-rw-r--r--gnu/packages/xml.scm14
-rw-r--r--guix/build/gnu-build-system.scm49
-rw-r--r--guix/build/make-bootstrap.scm72
-rw-r--r--guix/build/python-build-system.scm9
-rw-r--r--guix/build/utils.scm177
-rw-r--r--guix/scripts/pack.scm6
-rw-r--r--tests/build-utils.scm102
-rw-r--r--tests/builders.scm23
-rw-r--r--tests/graph.scm4
-rw-r--r--tests/packages.scm19
-rw-r--r--tests/union.scm9
64 files changed, 4045 insertions, 1069 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index aab8978fca..a1a37771cc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -24285,7 +24285,80 @@ Binutils, libc, and the other packages mentioned above---the
 These bootstrap binaries are ``taken for granted'', though we can also
 re-create them if needed (more on that later).
 
-@unnumberedsec Preparing to Use the Bootstrap Binaries
+For @code{i686-linux} and @code{x86_64-linux} the Guix bootstrap process is
+more elaborate, @pxref{Reduced Binary Seed Bootstrap}.
+
+@menu
+* Reduced Binary Seed Bootstrap::  A Bootstrap worthy of GNU.
+* Preparing to Use the Bootstrap Binaries:: Building that what matters most.
+@end menu
+
+@node Reduced Binary Seed Bootstrap
+@section The Reduced Binary Seed Bootstrap
+
+Guix---like other GNU/Linux distributions---is traditionally bootstrapped from
+a set of bootstrap binaries: Bourne shell, command-line tools provided by GNU
+Coreutils, Awk, Findutils, `sed', and `grep' and Guile, GCC, Binutils, and the
+GNU C Library (@pxref{Bootstrapping}).  Usually, these bootstrap binaries are
+``taken for granted.''
+
+Taking these binaries for granted means that we consider them to be a correct
+and trustworthy `seed' for building the complete system.  Therein lies a
+problem: the current combined size of these bootstrap binaries is about 250MB
+(@pxref{Bootstrappable Builds,,, mes, GNU Mes}).  Auditing or even inspecting
+these is next to impossible.
+
+For @code{i686-linux} and @code{x86_64-linux}, Guix now features a ``Reduced
+Binary Seed'' bootstrap @footnote{We would like to say: ``Full Source
+Bootstrap'' and while we are working towards that goal it would be hyperbole
+to use that term for what we do now.}.
+
+The Reduced Binary Seed bootstrap removes the most critical tools---from a
+trust perspective---from the bootstrap binaries: GCC, Binutils and the GNU C
+Library are replaced by: @code{bootstrap-mescc-tools} (a tiny assembler and
+linker) and @code{bootstrap-mes} (a small Scheme Interpreter and a C compiler
+written in Scheme and the Mes C Library, built for TinyCC and for GCC).  Using
+these new binary seeds and a new set of
+@c
+packages@footnote{@c
+nyacc-boot,
+mes-boot,
+tcc-boot0,
+tcc-boot,
+make-mesboot0,
+diffutils-mesboot,
+binutils-mesboot0,
+gcc-core-mesboot,
+mesboot-headers,
+glibc-mesboot0,
+gcc-mesboot0,
+binutils-mesboot,
+make-mesboot,
+gcc-mesboot1,
+gcc-mesboot1-wrapper,
+glibc-headers-mesboot,
+glibc-mesboot,
+gcc-mesboot,
+and
+gcc-mesboot-wrapper.
+}
+@c
+the ``missing'' Binutils, GCC, and the GNU C Library are built from source.
+From here on the more traditional bootstrap process resumes.  This approach
+has reduced the bootstrap binaries in size to about 130MB.  Work is ongoing to
+reduce this further.  If you are interested, join us on @code{#bootstrappable}
+on the Freenode IRC network.
+
+@c ./pre-inst-env guix graph --type=bag -e '(begin (use-modules (guix packages)) (%current-system "i686-linux") (@@ (gnu packages commencement) gcc-mesboot))' > doc/images/gcc-mesboot-bag-graph.dot
+@c dot -T png doc/images/gcc-mesboot-bag-graph.dot > doc/images/gcc-mesboot-bag-graph.png
+
+Below is the generated dependency graph for @code{gcc-mesboot}, the bootstrap
+compiler used to build the rest of GuixSD.
+
+@image{images/gcc-mesboot-bag-graph,6in,,Dependency graph of the gcc-mesboot}
+
+@node Preparing to Use the Bootstrap Binaries
+@section Preparing to Use the Bootstrap Binaries
 
 @c As of Emacs 24.3, Info-mode displays the image, but since it's a
 @c large image, it's hard to scroll.  Oh well.
@@ -24299,7 +24372,15 @@ packages bootstrap)} module.  A similar figure can be generated with
 @example
 guix graph -t derivation \
   -e '(@@@@ (gnu packages bootstrap) %bootstrap-gcc)' \
-  | dot -Tps > t.ps
+  | dot -Tps > gcc.ps
+@end example
+
+or, for the Reduced Binary Seed bootstrap
+
+@example
+guix graph -t derivation \
+  -e '(@@@@ (gnu packages bootstrap) %bootstrap-mes)' \
+  | dot -Tps > mes.ps
 @end example
 
 At this level of detail, things are
@@ -24331,10 +24412,10 @@ write them in an output directory with the right layout.  This
 corresponds to the @code{#:modules} argument of
 @code{build-expression->derivation} (@pxref{Derivations}).
 
-Finally, the various tarballs are unpacked by the
-derivations @code{gcc-bootstrap-0.drv}, @code{glibc-bootstrap-0.drv},
-etc., at which point we have a working C tool chain.
-
+Finally, the various tarballs are unpacked by the derivations
+@code{gcc-bootstrap-0.drv}, @code{glibc-bootstrap-0.drv}, or
+@code{bootstrap-mes-0.drv} and @code{bootstrap-mescc-tools-0.drv}, at which
+point we have a working C tool chain.
 
 @unnumberedsec Building the Build Tools
 
@@ -24399,9 +24480,11 @@ those rarely need to be updated.  Nevertheless, it is useful to have an
 automated way to produce them, should an update occur, and this is what
 the @code{(gnu packages make-bootstrap)} module provides.
 
-The following command builds the tarballs containing the bootstrap
-binaries (Guile, Binutils, GCC, libc, and a tarball containing a mixture
-of Coreutils and other basic command-line tools):
+The following command builds the tarballs containing the bootstrap binaries
+(Binutils, GCC, glibc, for the traditional bootstrap and linux-libre-headers,
+bootstrap-mescc-tools, bootstrap-mes for the Reduced Binary Seed bootstrap,
+and Guile, and a tarball containing a mixture of Coreutils and other basic
+command-line tools):
 
 @example
 guix build bootstrap-tarballs
@@ -24419,12 +24502,12 @@ know.
 
 @unnumberedsec Reducing the Set of Bootstrap Binaries
 
-Our bootstrap binaries currently include GCC, Guile, etc.  That's a lot
-of binary code!  Why is that a problem?  It's a problem because these
-big chunks of binary code are practically non-auditable, which makes it
-hard to establish what source code produced them.  Every unauditable
-binary also leaves us vulnerable to compiler backdoors as described by
-Ken Thompson in the 1984 paper @emph{Reflections on Trusting Trust}.
+Our traditional bootstrap includes GCC, GNU Libc, Guile, etc.  That's a lot of
+binary code!  Why is that a problem?  It's a problem because these big chunks
+of binary code are practically non-auditable, which makes it hard to establish
+what source code produced them.  Every unauditable binary also leaves us
+vulnerable to compiler backdoors as described by Ken Thompson in the 1984
+paper @emph{Reflections on Trusting Trust}.
 
 This is mitigated by the fact that our bootstrap binaries were generated
 from an earlier Guix revision.  Nevertheless it lacks the level of
@@ -24436,8 +24519,19 @@ The @uref{http://bootstrappable.org, Bootstrappable.org web site} lists
 on-going projects to do that.  One of these is about replacing the
 bootstrap GCC with a sequence of assemblers, interpreters, and compilers
 of increasing complexity, which could be built from source starting from
-a simple and auditable assembler.  Your help is welcome!
-
+a simple and auditable assembler.
+
+Our first major achievement is the replacement of of GCC, the GNU C Library
+and Binutils by MesCC-Tools (a simple hex linker and macro assembler) and Mes
+(@pxref{Top, GNU Mes Reference Manual,, mes, GNU Mes}, a Scheme interpreter
+and C compiler in Scheme).  Neither MesCC-Tools nor Mes can be fully
+bootstrapped yet and thus we inject them as binary seeds.  We call this the
+Reduced Binary Seed bootstrap, as it has halved the size of our bootstrap
+binaries!  Also, it has eliminated the C compiler binary; i686-linux and
+x86_64-linux Guix packages are now bootstrapped without any binary C compiler.
+
+Work is ongoing to make MesCC-Tools and Mes fully bootstrappable and we are
+also looking at any other bootstrap binaries.  Your help is welcome!
 
 @node Porting
 @chapter Porting to a New Platform
diff --git a/doc/images/gcc-mesboot-bag-graph.dot b/doc/images/gcc-mesboot-bag-graph.dot
new file mode 100644
index 0000000000..74d1896fb1
--- /dev/null
+++ b/doc/images/gcc-mesboot-bag-graph.dot
@@ -0,0 +1,123 @@
+digraph "Guix bag" {
+  "/gnu/store/5gkanb1d995yrpdd2h4iqkjmc5g1j0q4-gcc-mesboot-4.9.4.drv" [label = "gcc-mesboot@4.9.4", shape = box, fontname = Helvetica];
+  "/gnu/store/5gkanb1d995yrpdd2h4iqkjmc5g1j0q4-gcc-mesboot-4.9.4.drv" -> "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" [color = darkviolet];
+  "/gnu/store/5gkanb1d995yrpdd2h4iqkjmc5g1j0q4-gcc-mesboot-4.9.4.drv" -> "/gnu/store/86dqsl7b3qrzxl0zd049i5rl7l19gnk0-gcc-mesboot1-wrapper-4.7.4.drv" [color = darkviolet];
+  "/gnu/store/5gkanb1d995yrpdd2h4iqkjmc5g1j0q4-gcc-mesboot-4.9.4.drv" -> "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" [color = darkviolet];
+  "/gnu/store/5gkanb1d995yrpdd2h4iqkjmc5g1j0q4-gcc-mesboot-4.9.4.drv" -> "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" [color = darkviolet];
+  "/gnu/store/5gkanb1d995yrpdd2h4iqkjmc5g1j0q4-gcc-mesboot-4.9.4.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkviolet];
+  "/gnu/store/5gkanb1d995yrpdd2h4iqkjmc5g1j0q4-gcc-mesboot-4.9.4.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkviolet];
+  "/gnu/store/5gkanb1d995yrpdd2h4iqkjmc5g1j0q4-gcc-mesboot-4.9.4.drv" -> "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" [color = darkviolet];
+  "/gnu/store/5gkanb1d995yrpdd2h4iqkjmc5g1j0q4-gcc-mesboot-4.9.4.drv" -> "/gnu/store/q8d60ln0dxjvqd2ymi1g6xyk3046m23n-linux-libre-headers-bootstrap-0.drv" [color = darkviolet];
+  "/gnu/store/5gkanb1d995yrpdd2h4iqkjmc5g1j0q4-gcc-mesboot-4.9.4.drv" -> "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" [color = darkviolet];
+  "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" [label = "binutils-mesboot@2.20.1a", shape = box, fontname = Helvetica];
+  "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" [color = dimgrey];
+  "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" [color = dimgrey];
+  "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" [color = dimgrey];
+  "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = dimgrey];
+  "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = dimgrey];
+  "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" [color = dimgrey];
+  "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/q8d60ln0dxjvqd2ymi1g6xyk3046m23n-linux-libre-headers-bootstrap-0.drv" [color = dimgrey];
+  "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" [color = dimgrey];
+  "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" [label = "binutils-mesboot0@2.20.1a", shape = box, fontname = Helvetica];
+  "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/xjvyz26a4m191p5aqyifi7fw57vjps15-tcc-boot-0.9.27.drv" [color = peachpuff4];
+  "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = peachpuff4];
+  "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = peachpuff4];
+  "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" [color = peachpuff4];
+  "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" [color = peachpuff4];
+  "/gnu/store/xjvyz26a4m191p5aqyifi7fw57vjps15-tcc-boot-0.9.27.drv" [label = "tcc-boot@0.9.27", shape = box, fontname = Helvetica];
+  "/gnu/store/xjvyz26a4m191p5aqyifi7fw57vjps15-tcc-boot-0.9.27.drv" -> "/gnu/store/as3hax4r1zzxz4ihlzj9yq3rs83gm93c-mes-boot-0.18.drv" [color = cyan3];
+  "/gnu/store/xjvyz26a4m191p5aqyifi7fw57vjps15-tcc-boot-0.9.27.drv" -> "/gnu/store/p437zhq42yavzknp3miacrgnaw206h7i-tcc-boot0-0.9.26-5.c7b3f59.drv" [color = cyan3];
+  "/gnu/store/xjvyz26a4m191p5aqyifi7fw57vjps15-tcc-boot-0.9.27.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = cyan3];
+  "/gnu/store/as3hax4r1zzxz4ihlzj9yq3rs83gm93c-mes-boot-0.18.drv" [label = "mes-boot@0.18", shape = box, fontname = Helvetica];
+  "/gnu/store/as3hax4r1zzxz4ihlzj9yq3rs83gm93c-mes-boot-0.18.drv" -> "/gnu/store/gd83makzwnb2aq1x0hylfsi8gaxln5js-bootstrap-mescc-tools-0.5.2.drv" [color = darkviolet];
+  "/gnu/store/as3hax4r1zzxz4ihlzj9yq3rs83gm93c-mes-boot-0.18.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkviolet];
+  "/gnu/store/as3hax4r1zzxz4ihlzj9yq3rs83gm93c-mes-boot-0.18.drv" -> "/gnu/store/viccpx5izm9z0ci5nvib0xkdrsfqixlr-bootstrap-mes-0.drv" [color = darkviolet];
+  "/gnu/store/gd83makzwnb2aq1x0hylfsi8gaxln5js-bootstrap-mescc-tools-0.5.2.drv" [label = "bootstrap-mescc-tools@0.5.2", shape = box, fontname = Helvetica];
+  "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [label = "bootstrap-binaries@0", shape = box, fontname = Helvetica];
+  "/gnu/store/viccpx5izm9z0ci5nvib0xkdrsfqixlr-bootstrap-mes-0.drv" [label = "bootstrap-mes@0", shape = box, fontname = Helvetica];
+  "/gnu/store/p437zhq42yavzknp3miacrgnaw206h7i-tcc-boot0-0.9.26-5.c7b3f59.drv" [label = "tcc-boot0@0.9.26-5.c7b3f59", shape = box, fontname = Helvetica];
+  "/gnu/store/p437zhq42yavzknp3miacrgnaw206h7i-tcc-boot0-0.9.26-5.c7b3f59.drv" -> "/gnu/store/as3hax4r1zzxz4ihlzj9yq3rs83gm93c-mes-boot-0.18.drv" [color = dimgrey];
+  "/gnu/store/p437zhq42yavzknp3miacrgnaw206h7i-tcc-boot0-0.9.26-5.c7b3f59.drv" -> "/gnu/store/gd83makzwnb2aq1x0hylfsi8gaxln5js-bootstrap-mescc-tools-0.5.2.drv" [color = dimgrey];
+  "/gnu/store/p437zhq42yavzknp3miacrgnaw206h7i-tcc-boot0-0.9.26-5.c7b3f59.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = dimgrey];
+  "/gnu/store/p437zhq42yavzknp3miacrgnaw206h7i-tcc-boot0-0.9.26-5.c7b3f59.drv" -> "/gnu/store/viccpx5izm9z0ci5nvib0xkdrsfqixlr-bootstrap-mes-0.drv" [color = dimgrey];
+  "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" [label = "diffutils-mesboot@2.7", shape = box, fontname = Helvetica];
+  "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" -> "/gnu/store/as3hax4r1zzxz4ihlzj9yq3rs83gm93c-mes-boot-0.18.drv" [color = peachpuff4];
+  "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" -> "/gnu/store/xjvyz26a4m191p5aqyifi7fw57vjps15-tcc-boot-0.9.27.drv" [color = peachpuff4];
+  "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = peachpuff4];
+  "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = peachpuff4];
+  "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" -> "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" [color = peachpuff4];
+  "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" [label = "make-mesboot0@3.80", shape = box, fontname = Helvetica];
+  "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" -> "/gnu/store/xjvyz26a4m191p5aqyifi7fw57vjps15-tcc-boot-0.9.27.drv" [color = darkgoldenrod];
+  "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkgoldenrod];
+  "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkgoldenrod];
+  "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" [label = "glibc-mesboot0@2.2.5", shape = box, fontname = Helvetica];
+  "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" [color = darkseagreen];
+  "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/ia8z1bsk6hw80inpxxn751n4haas5zbv-gcc-core-mesboot-2.95.3.drv" [color = darkseagreen];
+  "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" [color = darkseagreen];
+  "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/kd7b9sba79s1l7hjdhav51gvci5ws4jy-mesboot-headers-0.18.drv" [color = darkseagreen];
+  "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" [color = darkseagreen];
+  "/gnu/store/ia8z1bsk6hw80inpxxn751n4haas5zbv-gcc-core-mesboot-2.95.3.drv" [label = "gcc-core-mesboot@2.95.3", shape = box, fontname = Helvetica];
+  "/gnu/store/ia8z1bsk6hw80inpxxn751n4haas5zbv-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" [color = dimgrey];
+  "/gnu/store/ia8z1bsk6hw80inpxxn751n4haas5zbv-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/xjvyz26a4m191p5aqyifi7fw57vjps15-tcc-boot-0.9.27.drv" [color = dimgrey];
+  "/gnu/store/ia8z1bsk6hw80inpxxn751n4haas5zbv-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = dimgrey];
+  "/gnu/store/ia8z1bsk6hw80inpxxn751n4haas5zbv-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = dimgrey];
+  "/gnu/store/ia8z1bsk6hw80inpxxn751n4haas5zbv-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" [color = dimgrey];
+  "/gnu/store/ia8z1bsk6hw80inpxxn751n4haas5zbv-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" [color = dimgrey];
+  "/gnu/store/kd7b9sba79s1l7hjdhav51gvci5ws4jy-mesboot-headers-0.18.drv" [label = "mesboot-headers@0.18", shape = box, fontname = Helvetica];
+  "/gnu/store/kd7b9sba79s1l7hjdhav51gvci5ws4jy-mesboot-headers-0.18.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = cyan3];
+  "/gnu/store/kd7b9sba79s1l7hjdhav51gvci5ws4jy-mesboot-headers-0.18.drv" -> "/gnu/store/q8d60ln0dxjvqd2ymi1g6xyk3046m23n-linux-libre-headers-bootstrap-0.drv" [color = cyan3];
+  "/gnu/store/q8d60ln0dxjvqd2ymi1g6xyk3046m23n-linux-libre-headers-bootstrap-0.drv" [label = "linux-libre-headers-bootstrap@0", shape = box, fontname = Helvetica];
+  "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" [label = "gcc-mesboot0@2.95.3", shape = box, fontname = Helvetica];
+  "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" [color = darkseagreen];
+  "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/ia8z1bsk6hw80inpxxn751n4haas5zbv-gcc-core-mesboot-2.95.3.drv" [color = darkseagreen];
+  "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" [color = darkseagreen];
+  "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" [color = darkseagreen];
+  "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/q8d60ln0dxjvqd2ymi1g6xyk3046m23n-linux-libre-headers-bootstrap-0.drv" [color = darkseagreen];
+  "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" [color = darkseagreen];
+  "/gnu/store/86dqsl7b3qrzxl0zd049i5rl7l19gnk0-gcc-mesboot1-wrapper-4.7.4.drv" [label = "gcc-mesboot1-wrapper@4.7.4", shape = box, fontname = Helvetica];
+  "/gnu/store/86dqsl7b3qrzxl0zd049i5rl7l19gnk0-gcc-mesboot1-wrapper-4.7.4.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = red];
+  "/gnu/store/86dqsl7b3qrzxl0zd049i5rl7l19gnk0-gcc-mesboot1-wrapper-4.7.4.drv" -> "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" [color = red];
+  "/gnu/store/86dqsl7b3qrzxl0zd049i5rl7l19gnk0-gcc-mesboot1-wrapper-4.7.4.drv" -> "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" [color = red];
+  "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" [label = "glibc-mesboot@2.16.0", shape = box, fontname = Helvetica];
+  "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" -> "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" [color = blue];
+  "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" -> "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" [color = blue];
+  "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" -> "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" [color = blue];
+  "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" -> "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" [color = blue];
+  "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = blue];
+  "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = blue];
+  "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" -> "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" [color = blue];
+  "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" -> "/gnu/store/q8d60ln0dxjvqd2ymi1g6xyk3046m23n-linux-libre-headers-bootstrap-0.drv" [color = blue];
+  "/gnu/store/f89fk16sm2l8amhjqli2zg6hil71c7m3-glibc-mesboot-2.16.0.drv" -> "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" [color = blue];
+  "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" [label = "glibc-headers-mesboot@2.16.0", shape = box, fontname = Helvetica];
+  "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" [color = red];
+  "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" [color = red];
+  "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" [color = red];
+  "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/kd7b9sba79s1l7hjdhav51gvci5ws4jy-mesboot-headers-0.18.drv" [color = red];
+  "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = red];
+  "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = red];
+  "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" [color = red];
+  "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/q8d60ln0dxjvqd2ymi1g6xyk3046m23n-linux-libre-headers-bootstrap-0.drv" [color = red];
+  "/gnu/store/l92gwa7d9jylv25q7fra0hd4cqsxyxz8-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" [color = red];
+  "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" [label = "gcc-mesboot1@4.7.4", shape = box, fontname = Helvetica];
+  "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/91nyq32kpndqj8qywqx17zy1ahv4xzgf-binutils-mesboot-2.20.1a.drv" [color = darkseagreen];
+  "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" [color = darkseagreen];
+  "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" [color = darkseagreen];
+  "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/yn5ryq346dhxhjsg3glcnb0wmdz4cn8c-diffutils-mesboot-2.7.drv" [color = darkseagreen];
+  "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/q8d60ln0dxjvqd2ymi1g6xyk3046m23n-linux-libre-headers-bootstrap-0.drv" [color = darkseagreen];
+  "/gnu/store/8jk8qkbvi8bgf1h2m0f8c2gmriql52p4-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" [color = darkseagreen];
+  "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" [label = "make-mesboot@3.82", shape = box, fontname = Helvetica];
+  "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" -> "/gnu/store/0w4i240rlsq7bd9ig4nixpbijkf4qy12-binutils-mesboot0-2.20.1a.drv" [color = magenta];
+  "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" -> "/gnu/store/0admz8igq3lvcyga32gp87q2g7918zwy-glibc-mesboot0-2.2.5.drv" [color = magenta];
+  "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" -> "/gnu/store/r9rsmhz659147krcvksx53b0mjdavr05-gcc-mesboot0-2.95.3.drv" [color = magenta];
+  "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" -> "/gnu/store/mrbi3ffh1v62b7sc3g40qvz0i0dbbvbi-make-mesboot0-3.80.drv" [color = magenta];
+  "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = magenta];
+  "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" -> "/gnu/store/00rjhpbkzk86s4pksjg934l310iaxxjr-bootstrap-binaries-0.drv" [color = magenta];
+  "/gnu/store/79zblx3zhbmycl30kvwylpxyhjv52qi4-make-mesboot-3.82.drv" -> "/gnu/store/q8d60ln0dxjvqd2ymi1g6xyk3046m23n-linux-libre-headers-bootstrap-0.drv" [color = magenta];
+
+}
diff --git a/doc/local.mk b/doc/local.mk
index adb7b5102d..525772019c 100644
--- a/doc/local.mk
+++ b/doc/local.mk
@@ -34,6 +34,7 @@ DOT_FILES =					\
   %D%/images/bootstrap-packages.dot		\
   %D%/images/coreutils-graph.dot		\
   %D%/images/coreutils-bag-graph.dot		\
+  %D%/images/gcc-mesboot-bag-graph.dot		\
   %D%/images/service-graph.dot			\
   %D%/images/shepherd-graph.dot
 
diff --git a/gnu/local.mk b/gnu/local.mk
index cf8d29e4ce..41f81d0d0b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -660,6 +660,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/bazaar-CVE-2017-14176.patch		\
   %D%/packages/patches/beets-python-3.7-fix.patch		\
   %D%/packages/patches/beignet-correct-file-names.patch		\
+  %D%/packages/patches/binutils-boot-2.20.1a.patch		\
   %D%/packages/patches/biber-fix-encoding-write.patch		\
   %D%/packages/patches/binutils-loongson-workaround.patch	\
   %D%/packages/patches/blast+-fix-makefile.patch		\
@@ -709,7 +710,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/deja-dup-use-ref-keyword-for-iter.patch	\
   %D%/packages/patches/dfu-programmer-fix-libusb.patch		\
   %D%/packages/patches/diffutils-gets-undeclared.patch		\
-  %D%/packages/patches/diffutils-getopt.patch			\
   %D%/packages/patches/docbook-xsl-nonrecursive-string-subst.patch	\
   %D%/packages/patches/doc++-include-directives.patch		\
   %D%/packages/patches/doc++-segfault-fix.patch			\
@@ -768,6 +768,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-arm-bug-71399.patch			\
   %D%/packages/patches/gcc-arm-link-spec-fix.patch		\
   %D%/packages/patches/gcc-asan-missing-include.patch		\
+  %D%/packages/patches/gcc-boot-2.95.3.patch			\
+  %D%/packages/patches/gcc-boot-4.7.4.patch			\
   %D%/packages/patches/gcc-cross-environment-variables.patch	\
   %D%/packages/patches/gcc-fix-texi2pod.patch			\
   %D%/packages/patches/gcc-4.8-libsanitizer-fix.patch		\
@@ -813,6 +815,9 @@ dist_patch_DATA =						\
   %D%/packages/patches/glibc-CVE-2017-1000366-pt2.patch		\
   %D%/packages/patches/glibc-CVE-2017-1000366-pt3.patch		\
   %D%/packages/patches/glibc-allow-kernel-2.6.32.patch		\
+  %D%/packages/patches/glibc-boot-2.16.0.patch			\
+  %D%/packages/patches/glibc-boot-2.2.5.patch			\
+  %D%/packages/patches/glibc-bootstrap-system-2.16.0.patch 	\
   %D%/packages/patches/glibc-bootstrap-system.patch		\
   %D%/packages/patches/glibc-hidden-visibility-ldconfig.patch	\
   %D%/packages/patches/glibc-hurd-magic-pid.patch		\
@@ -824,6 +829,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/glibc-versioned-locpath.patch		\
   %D%/packages/patches/glibc-2.27-git-fixes.patch		\
   %D%/packages/patches/glibc-2.28-git-fixes.patch		\
+  %D%/packages/patches/glibc-supported-locales.patch     	\
   %D%/packages/patches/glusterfs-use-PATH-instead-of-hardcodes.patch		\
   %D%/packages/patches/glog-gcc-5-demangling.patch		\
   %D%/packages/patches/gmp-arm-asm-nothumb.patch		\
@@ -839,7 +845,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/gpsbabel-minizip.patch     		\
   %D%/packages/patches/gpsbabel-qstring.patch     		\
   %D%/packages/patches/grep-timing-sensitive-test.patch		\
-  %D%/packages/patches/groff-source-date-epoch.patch		\
   %D%/packages/patches/groovy-add-exceptionutilsgenerator.patch	\
   %D%/packages/patches/grub-binutils-compat.patch		\
   %D%/packages/patches/grub-check-error-efibootmgr.patch	\
@@ -862,6 +867,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gtk3-respect-GUIX_GTK3_IM_MODULE_FILE.patch \
   %D%/packages/patches/gtkglext-disable-disable-deprecated.patch \
   %D%/packages/patches/gzdoom-search-in-installed-share.patch	\
+  %D%/packages/patches/handbrake-opt-in-nvenc.patch		\
   %D%/packages/patches/haskell-mode-unused-variables.patch	\
   %D%/packages/patches/haskell-mode-make-check.patch		\
   %D%/packages/patches/hdf4-architectures.patch 		\
@@ -934,8 +940,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/liba52-link-with-libm.patch		\
   %D%/packages/patches/liba52-set-soname.patch			\
   %D%/packages/patches/liba52-use-mtune-not-mcpu.patch		\
-  %D%/packages/patches/libarchive-CVE-2017-14166.patch		\
-  %D%/packages/patches/libarchive-CVE-2017-14502.patch		\
   %D%/packages/patches/libarchive-CVE-2018-1000877.patch	\
   %D%/packages/patches/libarchive-CVE-2018-1000878.patch	\
   %D%/packages/patches/libarchive-CVE-2018-1000880.patch	\
@@ -957,7 +961,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/libexif-CVE-2017-7544.patch		\
   %D%/packages/patches/libextractor-CVE-2018-20430.patch	\
   %D%/packages/patches/libextractor-CVE-2018-20431.patch	\
-  %D%/packages/patches/libgcrypt-make-yat2m-reproducible.patch	\
   %D%/packages/patches/libgit2-mtime-0.patch			\
   %D%/packages/patches/libgit2-oom-test.patch			\
   %D%/packages/patches/libgdata-fix-tests.patch			\
@@ -1031,6 +1034,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/mcrypt-CVE-2012-4426.patch			\
   %D%/packages/patches/mcrypt-CVE-2012-4527.patch			\
   %D%/packages/patches/mesa-skip-disk-cache-test.patch		\
+  %D%/packages/patches/mescc-tools-boot.patch			\
   %D%/packages/patches/meson-for-build-rpath.patch		\
   %D%/packages/patches/metabat-fix-compilation.patch		\
   %D%/packages/patches/mhash-keygen-test-segfault.patch		\
@@ -1167,6 +1171,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-mox3-python3.6-compat.patch	\
   %D%/packages/patches/python-testtools.patch			\
   %D%/packages/patches/python-paste-remove-timing-test.patch	\
+  %D%/packages/patches/python-pycodestyle-stdlib-tokenize-fix.patch	\
   %D%/packages/patches/python-pycrypto-CVE-2013-7459.patch	\
   %D%/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \
   %D%/packages/patches/python-pygpgme-fix-pinentry-tests.patch	\
@@ -1245,6 +1250,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/t1lib-CVE-2011-1552+.patch		\
   %D%/packages/patches/tar-remove-wholesparse-check.patch	\
   %D%/packages/patches/tar-skip-unreliable-tests.patch		\
+  %D%/packages/patches/tcc-boot-0.9.27.patch			\
   %D%/packages/patches/tclxml-3.2-install.patch			\
   %D%/packages/patches/tcsh-fix-autotest.patch			\
   %D%/packages/patches/tcsh-fix-out-of-bounds-read.patch	\
@@ -1342,18 +1348,11 @@ MISC_DISTRO_FILES =				\
   %D%/packages/ld-wrapper.in
 
 bootstrapdir = $(guilemoduledir)/%D%/packages/bootstrap
-bootstrap_x86_64_linuxdir = $(bootstrapdir)/x86_64-linux
 bootstrap_i686_linuxdir = $(bootstrapdir)/i686-linux
 bootstrap_armhf_linuxdir = $(bootstrapdir)/armhf-linux
 bootstrap_aarch64_linuxdir = $(bootstrapdir)/aarch64-linux
 bootstrap_mips64el_linuxdir = $(bootstrapdir)/mips64el-linux
 
-dist_bootstrap_x86_64_linux_DATA =		\
-  %D%/packages/bootstrap/x86_64-linux/bash	\
-  %D%/packages/bootstrap/x86_64-linux/mkdir	\
-  %D%/packages/bootstrap/x86_64-linux/tar	\
-  %D%/packages/bootstrap/x86_64-linux/xz
-
 dist_bootstrap_i686_linux_DATA =		\
   %D%/packages/bootstrap/i686-linux/bash	\
   %D%/packages/bootstrap/i686-linux/mkdir	\
diff --git a/gnu/packages.scm b/gnu/packages.scm
index a1814205f9..9cd57fc704 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -109,14 +109,18 @@ FILE-NAME found in %PATCH-PATH."
 (define (search-bootstrap-binary file-name system)
   "Search the bootstrap binary FILE-NAME for SYSTEM.  Raise an error if not
 found."
-  (or (search-path (%bootstrap-binaries-path)
-                   (string-append system "/" file-name))
-      (raise (condition
-              (&message
-               (message
-                (format #f (G_ "could not find bootstrap binary '~a' \
+  ;; On x86_64 always use the i686 binaries.
+  (let ((system (match system
+                  ("x86_64-linux" "i686-linux")
+                  (_ system))))
+    (or (search-path (%bootstrap-binaries-path)
+                     (string-append system "/" file-name))
+        (raise (condition
+                (&message
+                 (message
+                  (format #f (G_ "could not find bootstrap binary '~a' \
 for system '~a'")
-                        file-name system)))))))
+                          file-name system))))))))
 
 (define %distro-root-directory
   ;; Absolute file name of the module hierarchy.  Since (gnu packages …) might
diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index c312f23c1a..45b1be2413 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -197,18 +197,18 @@ backups (called chunks) to allow easy burning to CD/DVD.")
 (define-public libarchive
   (package
     (name "libarchive")
-    (replacement libarchive-3.3.3)
-    (version "3.3.2")
+    (version "3.3.3")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://libarchive.org/downloads/libarchive-"
                            version ".tar.gz"))
-       (patches (search-patches "libarchive-CVE-2017-14166.patch"
-                                "libarchive-CVE-2017-14502.patch"))
+       (patches (search-patches "libarchive-CVE-2018-1000877.patch"
+                                "libarchive-CVE-2018-1000878.patch"
+                                "libarchive-CVE-2018-1000880.patch"))
        (sha256
         (base32
-         "1km0mzfl6in7l5vz9kl09a88ajx562rw93ng9h2jqavrailvsbgd"))))
+         "0bhfncid058p7n1n8v29l6wxm3mhdqfassscihbsxfwz3iwb2zms"))))
     (build-system gnu-build-system)
     (inputs
      `(("zlib" ,zlib)
@@ -274,22 +274,6 @@ archive.  In particular, note that there is currently no built-in support for
 random access nor for in-place modification.")
     (license license:bsd-2)))
 
-(define-public libarchive-3.3.3
-  (package
-    (inherit libarchive)
-    (version "3.3.3")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://libarchive.org/downloads/libarchive-"
-                           version ".tar.gz"))
-       (patches (search-patches "libarchive-CVE-2018-1000877.patch"
-                                "libarchive-CVE-2018-1000878.patch"
-                                "libarchive-CVE-2018-1000880.patch"))
-       (sha256
-        (base32
-         "0bhfncid058p7n1n8v29l6wxm3mhdqfassscihbsxfwz3iwb2zms"))))))
-
 (define-public rdup
   (package
     (name "rdup")
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 67fab7c114..c3db665e98 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -91,14 +91,14 @@ command-line arguments, multiple languages, and so on.")
 (define-public grep
   (package
    (name "grep")
-   (version "3.1")
+   (version "3.3")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/grep/grep-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "0zm0ywmyz9g8vn1plw14mn8kj74yipx5qsljndbyfgmvndx5qqnv"))
+              "055mqp6vrd0brkygmygb2673qwz409a7kyp1mzbfy6cn94f58q5r"))
             (patches (search-patches "grep-timing-sensitive-test.patch"))))
    (build-system gnu-build-system)
    (native-inputs `(("perl" ,perl)))             ;some of the tests require it
@@ -106,15 +106,6 @@ command-line arguments, multiple languages, and so on.")
    (arguments
     `(#:phases
       (modify-phases %standard-phases
-        (add-before 'check 'disable-failing-tests
-          (lambda _
-            ;; These tests are expected to fail due to a glibc bug which has
-            ;; been fixed in 2.28, so they are unexpectedly passing.  They
-            ;; should be fixed for grep versions > 3.1.
-            (substitute* "tests/Makefile.in"
-              (("^[[:blank:]]+backref-alt[[:blank:]]+\\\\") "\\")
-              (("^[[:blank:]]+triple-backref[[:blank:]]+\\\\") "\\"))
-            #t))
         (add-after 'install 'fix-egrep-and-fgrep
           ;; Patch 'egrep' and 'fgrep' to execute 'grep' via its
           ;; absolute file name instead of searching for it in $PATH.
@@ -141,28 +132,16 @@ including, for example, recursive directory searching.")
 (define-public sed
   (package
    (name "sed")
-   (version "4.5")
+   (version "4.7")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/sed/sed-" version
                                 ".tar.xz"))
             (sha256
              (base32
-              "0h3b2jfj57wmz680vkbyavlsrkak556qhvs7m7fdlawwhg477bbs"))))
+              "0smxcx66vx29djzb542nxcynl7qnzxqa5032ibazi7x2s267d198"))))
    (build-system gnu-build-system)
    (synopsis "Stream editor")
-   (arguments
-    `(#:phases
-      (modify-phases %standard-phases
-        (add-after 'unpack 'dont-rebuild-sed.1
-          (lambda _
-            ;; Make sure we do not attempt to rebuild 'doc/sed.1', which does
-            ;; not work when cross-compiling because we cannot run 'sed'.
-            ;; This is fixed upstream as commit a0a25e3.
-            (substitute* "Makefile.in"
-              (("^doc/sed\\.1:.*")
-               "doc/sed.1:\n"))
-            #t)))))
    (native-inputs
     `(("perl" ,perl)))                            ;for tests
    (description
@@ -177,14 +156,14 @@ implementation offers several extensions over the standard utility.")
 (define-public tar
   (package
    (name "tar")
-   (version "1.30")
+   (version "1.31")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/tar/tar-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "1lyjyk8z8hdddsxw0ikchrsfg3i0x3fsh7l63a8jgaz1n7dr5gzi"))
+              "1h9dxhjhz1jnyhmh6jfhqw1g1sxqbg3cd32vpwg7x2xxxqffzwrp"))
             (patches (search-patches "tar-skip-unreliable-tests.patch"
                                      "tar-remove-wholesparse-check.patch"))))
    (build-system gnu-build-system)
@@ -270,16 +249,16 @@ differences.")
 (define-public diffutils
   (package
    (name "diffutils")
-   (version "3.6")
+   (version "3.7")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/diffutils/diffutils-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "1mivg0fy3a6fcn535ln8nkgfj6vxh5hsxxs5h6692wxmsjyyh8fn"))
-            (patches (search-patches "diffutils-getopt.patch"))))
+              "09isrg0isjinv8c535nxsi1s86wfdfzml80dbw41dj9x3hiad9xk"))))
    (build-system gnu-build-system)
+   (native-inputs `(("perl" ,perl)))
    (synopsis "Comparing and merging files")
    (description
     "GNU Diffutils is a package containing tools for finding the
@@ -460,14 +439,14 @@ change.  GNU make offers many powerful extensions over the standard utility.")
 (define-public binutils
   (package
    (name "binutils")
-   (version "2.31.1")
+   (version "2.32")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/binutils/binutils-"
                                 version ".tar.bz2"))
             (sha256
              (base32
-              "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z"))
+              "0b8767nyal1bc4cyzg5h9iis8kpkln1i3wkamig75cifj1fb2f6y"))
             (patches (search-patches "binutils-loongson-workaround.patch"))))
    (build-system gnu-build-system)
 
@@ -637,7 +616,9 @@ store.")
                                      "glibc-hidden-visibility-ldconfig.patch"
                                      "glibc-versioned-locpath.patch"
                                      "glibc-allow-kernel-2.6.32.patch"
-                                     "glibc-reinstate-prlimit64-fallback.patch"))))
+                                     "glibc-reinstate-prlimit64-fallback.patch"
+                                     "glibc-hurd-magic-pid.patch"
+                                     "glibc-supported-locales.patch"))))
    (build-system gnu-build-system)
 
    ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
@@ -712,18 +693,6 @@ store.")
 
       #:tests? #f                                 ; XXX
       #:phases (modify-phases %standard-phases
-                 ,@(if (hurd-target?)
-                       `((add-after 'unpack 'apply-hurd-patch
-                           (lambda* (#:key inputs native-inputs
-                                     #:allow-other-keys)
-                             ;; TODO: Move this to 'patches' field.
-                             (let ((patch (or (assoc-ref native-inputs
-                                                         "hurd-magic-pid-patch")
-                                              (assoc-ref inputs
-                                                         "hurd-magic-pid-patch"))))
-                               (invoke "patch" "-p1" "--force" "--input"
-                                       patch)))))
-                       '())
                  (add-before
                   'configure 'pre-configure
                   (lambda* (#:key inputs native-inputs outputs
@@ -849,9 +818,7 @@ store.")
 
                     ,@(if (hurd-target?)
                           `(("mig" ,mig)
-                            ("perl" ,perl)
-                            ("hurd-magic-pid-patch"
-                             ,(search-patch "glibc-hurd-magic-pid.patch")))
+                            ("perl" ,perl))
                           '())))
 
    (native-search-paths
@@ -892,7 +859,8 @@ with the Linux kernel.")
                                        "glibc-hidden-visibility-ldconfig.patch"
                                        "glibc-versioned-locpath.patch"
                                        "glibc-allow-kernel-2.6.32.patch"
-                                       "glibc-reinstate-prlimit64-fallback.patch"))))))
+                                       "glibc-reinstate-prlimit64-fallback.patch"
+				       "glibc-supported-locales.patch"))))))
 
 (define-public glibc-2.26
   (package
diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index fb4e3f4be3..9fd4b30e62 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015, 2017 Leo Famulari <leo@famulari.name>
-;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -44,7 +44,7 @@
 
 (define (patch-url seqno)
   "Return the URL of Bash patch number SEQNO."
-  (format #f "mirror://gnu/bash/bash-4.4-patches/bash44-~3,'0d" seqno))
+  (format #f "mirror://gnu/bash/bash-5.0-patches/bash50-~3,'0d" seqno))
 
 (define (bash-patch seqno sha256)
   "Return the origin of Bash patch SEQNO, with expected hash SHA256"
@@ -57,33 +57,11 @@
   (list (bash-patch seqno (base32 hash))
         ...))
 
-(define %patch-series-4.4
-  ;; This is the current patches series for 4.4, generated using
+(define %patch-series-5.0
+  ;; This is the current patches series for 5.0, generated using
   ;; 'download-patches' below.
   (patch-series
-   (1 "03vzy7qwjdd5qvl3ydg99naazas2qmyd0yhnrflgjbbm64axja1y")
-   (2 "0lrwq6vyqism3yqv9s7kzaf3dsl4q5w9r5svcqz279qp7qca083h")
-   (3 "1chqww2rj6g42b8s60q5zlzy0jzp684jkpsbrbfy1vzxja8mmpsi")
-   (4 "1cy8abf96hkrjhw921ndr0shlcnc52bg45rn6xri4v5clhq0l25d")
-   (5 "0a8515kyk4zsgmvlqvlganjfr7pq0j6kzpr4d6xx02kpbdr4n7i2")
-   (6 "1f24wgqngmj2mrj9yibwvc2zvlmn5xi53mnw777g3l40c4m2x3ka")
-   (7 "1bzdsnqaf05gdbqpsixhan8vygjxpcxlz1dd8d9f5jdznw3wq76y") ;CVE-2017-5932
-   (8 "1firw915mjm03hbbw9a70ch3cpgrgnvqjpllgdnn6csr8q04f546")
-   (9 "0g1l56kvw61rpw7dqa9fcl9llkl693h73g631hrhxlm030ddssqb")
-   (10 "01lfhrkdsdkdz8ypzapr614ras23x7ckjnr60aa5bzkaqprccrc4")
-   (11 "038p7mhnq9m65g505hi3827jkf9f35nd1cy00w8mwafpyxp44mnx")
-   (12 "0gh6lbb1rwpk44pvbamm6vzdfi50xnwkqd9v7s8cjwk3pz973hps")
-   (13 "1djkx0w9v62q78gz3jsvamj1jq53i6hbfrfhhsw86ihwpjnfy98v")
-   (14 "0z5ikcq9zyxw79d0z36r5p0mspnb5piavbv03jmlan1wnknmrxx7")
-   (15 "09n307fi1j257abhm295k6ksmnzw47ka2zhnr0i5lbdnpvn04xnk")
-   (16 "1cgi1y6mifm8hsgv4avj5ih76535js3qba1sqwbfvp7si76927sh")
-   (17 "0w6jpj2giakji1ir83rpkx1y7n7xqppah3j748m6dm38hywr0gvp")
-   (18 "1k58h4wxbsg7r4rwhrvzx5hfbapba2nxjysbhh6qp6ki5ys99i2v")
-   (19 "07n1i5610lbs672x1s8g82qn3qfj06s0ip3z80sri0g8vxp0s5r7")
-   (20 "0b2jk5n1af1vh590qfc52hv65mafb4vl1xv26s8j5a3byb5y4h0q")
-   (21 "1hblcd2xmqqlp0idnavw66570n7m0yv5rbbr873c2gkn982mk3xx")
-   (22 "0yfbjzr79vzjs2hyi5m8iy2b38fq7vikdfa4zqdvjsp36q4iycs5")
-   (23 "1dlism6qdx60nvzj0v7ndr7lfahl4a8zmzckp13hqgdx7xpj7v2g")))
+    ))
 
 (define (download-patches store count)
   "Download COUNT Bash patches into store.  Return a list of
@@ -119,7 +97,7 @@ number/base32-hash tuples, directly usable in the 'patch-series' form."
                " -Wl,-rpath -Wl,"
                (assoc-ref %build-inputs "ncurses")
                "/lib")))
-         (version "4.4"))
+         (version "5.0"))
     (package
      (name "bash")
      (source (origin
@@ -128,11 +106,8 @@ number/base32-hash tuples, directly usable in the 'patch-series' form."
                     "mirror://gnu/bash/bash-" version ".tar.gz"))
               (sha256
                (base32
-                "1jyz6snd63xjn6skk7za6psgidsd53k05cr3lksqybi0q6936syq"))
-              (patch-flags '("-p0"))
-              (patches %patch-series-4.4)))
-     (version (string-append version "."
-                             (number->string (length %patch-series-4.4))))
+                "0kgvfwqdcd90waczf4gx39xnrxzijhjrzyzv7s8v4w31qqm0za5l"))))
+     (version version)
      (build-system gnu-build-system)
 
      (outputs '("out"
diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm
index c7491f845f..d816b66615 100644
--- a/gnu/packages/bdw-gc.scm
+++ b/gnu/packages/bdw-gc.scm
@@ -30,14 +30,14 @@
 (define-public libgc
   (package
    (name "libgc")
-   (version "7.6.6")
+   (version "7.6.8")
    (source (origin
             (method url-fetch)
             (uri (string-append "https://github.com/ivmai/bdwgc/releases"
                                 "/download/v" version "/gc-" version ".tar.gz"))
             (sha256
              (base32
-              "1p1r015a7jbpvkkbgzv1y8nxrbbp6dg0mq3ksi6ji0qdz3wfss79"))))
+              "0n720a0i584ghcwmdsjiq6bl9ig0p9mrja29rp4cgsqvpz6wa2h4"))))
    (build-system gnu-build-system)
    (arguments
     `(#:configure-flags
@@ -91,7 +91,7 @@ C or C++ programs, though that is not its primary goal.")
 (define-public libatomic-ops
   (package
     (name "libatomic-ops")
-    (version "7.6.6")
+    (version "7.6.8")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -99,7 +99,7 @@ C or C++ programs, though that is not its primary goal.")
                     version "/libatomic_ops-" version ".tar.gz"))
               (sha256
                (base32
-                "0x7071z707msvyrv9dmgahd1sghbkw8fpbagvcag6xs8yp2spzlr"))))
+                "0rgni7056gnbn105lln629gwd6s51779yb5ds9s7wxl1vyg2fshx"))))
     (build-system gnu-build-system)
     (outputs '("out" "debug"))
     (synopsis "Accessing hardware atomic memory update operations")
diff --git a/gnu/packages/bison.scm b/gnu/packages/bison.scm
index 71de47762d..ae37a8f80c 100644
--- a/gnu/packages/bison.scm
+++ b/gnu/packages/bison.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -30,7 +31,7 @@
 (define-public bison
   (package
     (name "bison")
-    (version "3.0.5")
+    (version "3.3.2")
     (source
      (origin
       (method url-fetch)
@@ -38,7 +39,7 @@
                           version ".tar.xz"))
       (sha256
        (base32
-        "0f7kjygrckkx8vas2nm673592jif0a9mw5g8207f6hj6h4pfyp07"))))
+        "016qp59wxakz3ckxwyrmzxk406q0h286ydz8ww1m0pnrc5dy97h3"))))
     (build-system gnu-build-system)
     (native-inputs `(("perl" ,perl)
                      ;; m4 is not present in PATH when cross-building.
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index a3ecbeb076..16ed15c237 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -43,10 +44,13 @@
 
             %bootstrap-guile
             %bootstrap-coreutils&co
+            %bootstrap-linux-libre-headers
             %bootstrap-binutils
             %bootstrap-gcc
             %bootstrap-glibc
-            %bootstrap-inputs))
+            %bootstrap-inputs
+            %bootstrap-mescc-tools
+            %bootstrap-mes))
 
 ;;; Commentary:
 ;;;
@@ -97,10 +101,10 @@
 (define* (package-from-tarball name source program-to-test description
                                #:key snippet)
   "Return a package that correspond to the extraction of SOURCE.
-PROGRAM-TO-TEST is a program to run after extraction of SOURCE, to check
-whether everything is alright.  If SNIPPET is provided, it is evaluated after
-extracting SOURCE.  SNIPPET should raise an exception to signal an error; its
-return value is ignored."
+PROGRAM-TO-TEST is #f or a string: the program to run after extraction of
+SOURCE to check whether everything is alright.  If SNIPPET is provided, it is
+evaluated after extracting SOURCE.  SNIPPET should return true if successful,
+or false to signal an error."
   (package
     (name name)
     (version "0")
@@ -109,22 +113,25 @@ return value is ignored."
      `(#:guile ,%bootstrap-guile
        #:modules ((guix build utils))
        #:builder
-       (let ((out     (assoc-ref %outputs "out"))
-             (tar     (assoc-ref %build-inputs "tar"))
-             (xz      (assoc-ref %build-inputs "xz"))
-             (tarball (assoc-ref %build-inputs "tarball")))
+       (begin
          (use-modules (guix build utils))
 
-         (mkdir out)
-         (copy-file tarball "binaries.tar.xz")
-         (invoke xz "-d" "binaries.tar.xz")
-         (let ((builddir (getcwd)))
-           (with-directory-excursion out
-             (invoke tar "xvf"
-                     (string-append builddir "/binaries.tar"))
-             ,@(if snippet (list snippet) '())
-             (invoke (string-append "bin/" ,program-to-test)
-                     "--version"))))))
+         (let ((out     (assoc-ref %outputs "out"))
+              (tar     (assoc-ref %build-inputs "tar"))
+              (xz      (assoc-ref %build-inputs "xz"))
+              (tarball (assoc-ref %build-inputs "tarball")))
+
+          (mkdir out)
+          (copy-file tarball "binaries.tar.xz")
+          (invoke xz "-d" "binaries.tar.xz")
+          (let ((builddir (getcwd)))
+            (with-directory-excursion out
+              (invoke tar "xvf"
+                      (string-append builddir "/binaries.tar"))
+              ,@(if snippet (list snippet) '())
+              (or (not ,program-to-test)
+                  (invoke (string-append "bin/" ,program-to-test)
+                          "--version"))))))))
     (inputs
      `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
        ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
@@ -392,6 +399,22 @@ $out/bin/guile --version~%"
                                (("^exec grep") (string-append (getcwd) "/bin/grep"))))
                            (chmod "bin" #o555))))
 
+(define-public %bootstrap-linux-libre-headers
+  (package-from-tarball
+   "linux-libre-headers-bootstrap"
+   (lambda (system)
+     (origin
+       (method url-fetch)
+       (uri (map (cute string-append <>
+                       "/i686-linux/20181020/"
+                       "linux-libre-headers-stripped-4.14.67-i686-linux.tar.xz")
+                 %bootstrap-base-urls))
+       (sha256
+        (base32
+         "0sm2z9x4wk45bh6qfs94p0w1d6hsy6dqx9sw38qsqbvxwa1qzk8s"))))
+   #f                                   ; no program to test
+   "Bootstrap linux-libre-headers"))
+
 (define %bootstrap-binutils
   (package-from-tarball "binutils-bootstrap"
                         (lambda (system)
@@ -437,28 +460,30 @@ $out/bin/guile --version~%"
      `(#:guile ,%bootstrap-guile
        #:modules ((guix build utils))
        #:builder
-       (let ((out     (assoc-ref %outputs "out"))
-             (tar     (assoc-ref %build-inputs "tar"))
-             (xz      (assoc-ref %build-inputs "xz"))
-             (tarball (assoc-ref %build-inputs "tarball")))
+       (begin
          (use-modules (guix build utils))
 
-         (mkdir out)
-         (copy-file tarball "binaries.tar.xz")
-         (invoke xz "-d" "binaries.tar.xz")
-         (let ((builddir (getcwd)))
-           (with-directory-excursion out
-             (invoke tar "xvf"
-                     (string-append builddir
-                                    "/binaries.tar"))
-             (chmod "lib" #o755)
-
-             ;; Patch libc.so so it refers to the right path.
-             (substitute* "lib/libc.so"
-               (("/[^ ]+/lib/(libc|ld)" _ prefix)
-                (string-append out "/lib/" prefix)))
-
-             #t)))))
+         (let ((out     (assoc-ref %outputs "out"))
+              (tar     (assoc-ref %build-inputs "tar"))
+              (xz      (assoc-ref %build-inputs "xz"))
+              (tarball (assoc-ref %build-inputs "tarball")))
+
+          (mkdir out)
+          (copy-file tarball "binaries.tar.xz")
+          (invoke xz "-d" "binaries.tar.xz")
+          (let ((builddir (getcwd)))
+            (with-directory-excursion out
+              (invoke tar "xvf"
+                      (string-append builddir
+                                     "/binaries.tar"))
+              (chmod "lib" #o755)
+
+              ;; Patch libc.so so it refers to the right path.
+              (substitute* "lib/libc.so"
+                (("/[^ ]+/lib/(libc|ld)" _ prefix)
+                 (string-append out "/lib/" prefix)))
+
+              #t))))))
     (inputs
      `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
        ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
@@ -508,39 +533,41 @@ $out/bin/guile --version~%"
      `(#:guile ,%bootstrap-guile
        #:modules ((guix build utils))
        #:builder
-       (let ((out     (assoc-ref %outputs "out"))
-             (tar     (assoc-ref %build-inputs "tar"))
-             (xz      (assoc-ref %build-inputs "xz"))
-             (bash    (assoc-ref %build-inputs "bash"))
-             (libc    (assoc-ref %build-inputs "libc"))
-             (tarball (assoc-ref %build-inputs "tarball")))
+       (begin
          (use-modules (guix build utils)
                       (ice-9 popen))
 
-         (mkdir out)
-         (copy-file tarball "binaries.tar.xz")
-         (invoke xz "-d" "binaries.tar.xz")
-         (let ((builddir (getcwd))
-               (bindir   (string-append out "/bin")))
-           (with-directory-excursion out
-             (invoke tar "xvf"
-                     (string-append builddir "/binaries.tar")))
-
-           (with-directory-excursion bindir
-             (chmod "." #o755)
-             (rename-file "gcc" ".gcc-wrapped")
-             (call-with-output-file "gcc"
-               (lambda (p)
-                 (format p "#!~a
+         (let ((out     (assoc-ref %outputs "out"))
+               (tar     (assoc-ref %build-inputs "tar"))
+               (xz      (assoc-ref %build-inputs "xz"))
+               (bash    (assoc-ref %build-inputs "bash"))
+               (libc    (assoc-ref %build-inputs "libc"))
+               (tarball (assoc-ref %build-inputs "tarball")))
+
+           (mkdir out)
+           (copy-file tarball "binaries.tar.xz")
+           (invoke xz "-d" "binaries.tar.xz")
+           (let ((builddir (getcwd))
+                 (bindir   (string-append out "/bin")))
+             (with-directory-excursion out
+               (invoke tar "xvf"
+                       (string-append builddir "/binaries.tar")))
+
+             (with-directory-excursion bindir
+               (chmod "." #o755)
+               (rename-file "gcc" ".gcc-wrapped")
+               (call-with-output-file "gcc"
+                 (lambda (p)
+                   (format p "#!~a
 exec ~a/bin/.gcc-wrapped -B~a/lib \
      -Wl,-rpath -Wl,~a/lib \
      -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
-                         bash
-                         out libc libc libc
-                         ,(glibc-dynamic-linker))))
+                           bash
+                           out libc libc libc
+                           ,(glibc-dynamic-linker))))
 
-             (chmod "gcc" #o555)
-             #t)))))
+               (chmod "gcc" #o555)
+               #t))))))
     (inputs
      `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
        ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
@@ -548,33 +575,33 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
        ("libc" ,%bootstrap-glibc)
        ("tarball" ,(bootstrap-origin
                     (origin
-                     (method url-fetch)
-                     (uri (map (cut string-append <> "/" (%current-system)
-                                    (match (%current-system)
-                                      ("armhf-linux"
-                                       "/20150101/gcc-4.8.4.tar.xz")
-                                      ("aarch64-linux"
-                                       "/20170217/gcc-5.4.0.tar.xz")
-                                      (_
-                                       "/20131110/gcc-4.8.2.tar.xz")))
-                               %bootstrap-base-urls))
-                     (sha256
-                      (match (%current-system)
-                        ("x86_64-linux"
-                         (base32
-                          "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls"))
-                        ("i686-linux"
-                         (base32
-                          "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
-                        ("armhf-linux"
-                         (base32
-                          "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v"))
-                        ("aarch64-linux"
-                         (base32
-                          "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1"))
-                        ("mips64el-linux"
-                         (base32
-                          "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
+                      (method url-fetch)
+                      (uri (map (cut string-append <> "/" (%current-system)
+                                     (match (%current-system)
+                                       ("armhf-linux"
+                                        "/20150101/gcc-4.8.4.tar.xz")
+                                       ("aarch64-linux"
+                                        "/20170217/gcc-5.4.0.tar.xz")
+                                       (_
+                                        "/20131110/gcc-4.8.2.tar.xz")))
+                                %bootstrap-base-urls))
+                      (sha256
+                       (match (%current-system)
+                         ("x86_64-linux"
+                          (base32
+                           "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls"))
+                         ("i686-linux"
+                          (base32
+                           "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
+                         ("armhf-linux"
+                          (base32
+                           "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v"))
+                         ("aarch64-linux"
+                          (base32
+                           "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1"))
+                         ("mips64el-linux"
+                          (base32
+                           "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
     (native-search-paths
      (list (search-path-specification
             (variable "CPATH")
@@ -587,12 +614,116 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
     (home-page #f)
     (license gpl3+)))
 
-(define %bootstrap-inputs
+(define %bootstrap-mescc-tools
+  ;; The initial MesCC tools.  Uses binaries from a tarball typically built by
+  ;; %MESCC-TOOLS-BOOTSTRAP-TARBALL.
+  (package
+    (name "bootstrap-mescc-tools")
+    (version "0.5.2")
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     `(#:guile ,%bootstrap-guile
+       #:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 popen))
+         (let ((out     (assoc-ref %outputs "out"))
+               (tar     (assoc-ref %build-inputs "tar"))
+               (xz      (assoc-ref %build-inputs "xz"))
+               (tarball (assoc-ref %build-inputs "tarball")))
+
+           (mkdir out)
+           (copy-file tarball "binaries.tar.xz")
+           (invoke xz "-d" "binaries.tar.xz")
+           (let ((builddir (getcwd))
+                 (bindir   (string-append out "/bin")))
+             (with-directory-excursion out
+               (invoke tar "xvf"
+                       (string-append builddir "/binaries.tar"))))))))
+    (inputs
+     `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
+       ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
+       ("tarball"
+        ,(bootstrap-origin
+          (origin
+            (method url-fetch)
+            (uri (map
+                  (cute string-append <>
+                        "/i686-linux/20181020/"
+                        "mescc-tools-static-0.5.2-0.bb062b0-i686-linux.tar.xz")
+                  %bootstrap-base-urls))
+            (sha256
+             (base32
+              "11lniw0vg61kmyhvnwkmcnkci9ym6hbmiksiqggd0hkipbq7hvlz")))))))
+    (synopsis "Bootstrap binaries of MesCC Tools")
+    (description synopsis)
+    (home-page #f)
+    (supported-systems '("i686-linux" "x86_64-linux"))
+    (license gpl3+)))
+
+(define %bootstrap-mes
+  ;; The initial Mes.  Uses binaries from a tarball typically built by
+  ;; %MES-BOOTSTRAP-TARBALL.
+  (package
+    (name "bootstrap-mes")
+    (version "0")
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     `(#:guile ,%bootstrap-guile
+       #:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 popen))
+         (let ((out     (assoc-ref %outputs "out"))
+               (tar     (assoc-ref %build-inputs "tar"))
+               (xz      (assoc-ref %build-inputs "xz"))
+               (tarball (assoc-ref %build-inputs "tarball")))
+
+           (mkdir out)
+           (copy-file tarball "binaries.tar.xz")
+           (invoke xz "-d" "binaries.tar.xz")
+           (let ((builddir (getcwd))
+                 (bindir   (string-append out "/bin")))
+             (with-directory-excursion out
+               (invoke tar "xvf"
+                       (string-append builddir "/binaries.tar"))))))))
+    (inputs
+     `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
+       ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
+       ("tarball"
+        ,(bootstrap-origin
+          (origin
+            (method url-fetch)
+            (uri (map
+                  (cute string-append <>
+                        "/i686-linux/20181020/"
+                        "mes-minimal-stripped-0.19-i686-linux.tar.xz")
+                  %bootstrap-base-urls))
+            (sha256
+             (base32
+              "0k7kkl68a6xaadv47ij0nr9jm5ca1ffj38n7f2lg80y72wdkwr9h")))))))
+    (supported-systems '("i686-linux" "x86_64-linux"))
+    (synopsis "Bootstrap binaries of Mes")
+    (description synopsis)
+    (home-page #f)
+    (license gpl3+)))
+
+(define (%bootstrap-inputs)
   ;; The initial, pre-built inputs.  From now on, we can start building our
   ;; own packages.
-  `(("libc" ,%bootstrap-glibc)
-    ("gcc" ,%bootstrap-gcc)
-    ("binutils" ,%bootstrap-binutils)
+  `(,@(match (%current-system)
+        ((or "i686-linux" "x86_64-linux")
+         `(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
+           ("bootstrap-mescc-tools" ,%bootstrap-mescc-tools)
+           ("mes" ,%bootstrap-mes)))
+        (_
+         `(("libc" ,%bootstrap-glibc)
+           ("gcc" ,%bootstrap-gcc)
+           ("binutils" ,%bootstrap-binutils))))
     ("coreutils&co" ,%bootstrap-coreutils&co)
 
     ;; In gnu-build-system.scm, we rely on the availability of Bash.
diff --git a/gnu/packages/bootstrap/x86_64-linux/bash b/gnu/packages/bootstrap/x86_64-linux/bash
deleted file mode 100755
index b9c410b7cf..0000000000
--- a/gnu/packages/bootstrap/x86_64-linux/bash
+++ /dev/null
Binary files differdiff --git a/gnu/packages/bootstrap/x86_64-linux/mkdir b/gnu/packages/bootstrap/x86_64-linux/mkdir
deleted file mode 100755
index f8250ae693..0000000000
--- a/gnu/packages/bootstrap/x86_64-linux/mkdir
+++ /dev/null
Binary files differdiff --git a/gnu/packages/bootstrap/x86_64-linux/tar b/gnu/packages/bootstrap/x86_64-linux/tar
deleted file mode 100755
index 90e492f89d..0000000000
--- a/gnu/packages/bootstrap/x86_64-linux/tar
+++ /dev/null
Binary files differdiff --git a/gnu/packages/bootstrap/x86_64-linux/xz b/gnu/packages/bootstrap/x86_64-linux/xz
deleted file mode 100755
index 6bfe3c6d96..0000000000
--- a/gnu/packages/bootstrap/x86_64-linux/xz
+++ /dev/null
Binary files differdiff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 0aa65fe638..79246a0c5d 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3,8 +3,9 @@
 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014, 2015, 2017 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,6 +29,7 @@
   #:use-module (gnu packages bootstrap)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages c)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages code)
@@ -39,6 +41,7 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages mes)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages hurd)
@@ -78,6 +81,1322 @@
 ;;;
 ;;; Code:
 
+(define mes-boot
+  (package-with-bootstrap-guile
+   (package
+     (inherit mes)
+     (name "mes-boot")
+     (inputs '())
+     (propagated-inputs '())
+     (native-inputs
+      `(("mescc-tools" ,%bootstrap-mescc-tools)
+        ("nyacc-source" ,(package-source nyacc))
+
+        ("coreutils" , %bootstrap-coreutils&co)
+        ("bootstrap-mes" ,%bootstrap-mes)))
+     (arguments
+      `(#:implicit-inputs? #f
+        #:guile ,%bootstrap-guile
+        #:strip-binaries? #f   ; binutil's strip b0rkes MesCC/M1/hex2 binaries
+        #:phases
+        (modify-phases %standard-phases
+          (add-after 'unpack 'unpack-seeds
+            (lambda _
+              (let ((nyacc-source (assoc-ref %build-inputs "nyacc-source"))
+                    (bootstrap-mes (assoc-ref %build-inputs "bootstrap-mes")))
+                (with-directory-excursion ".."
+                  (and
+                   (mkdir-p "nyacc-source")
+                   (invoke "tar" "--strip=1" "-C" "nyacc-source" "-xvf" nyacc-source)
+                   (symlink (string-append bootstrap-mes "/share/mes/lib") "mes-seed")
+                   #t)))))
+          (replace 'configure
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref %outputs "out")))
+                (setenv "GUILE" "mes")
+                (setenv "GUILE_EFFECTIVE_VERSION" "2.2")
+                (setenv "GUILE_LOAD_PATH" "nyacc")
+                (symlink (string-append "../nyacc-source/module") "nyacc")
+                (invoke "bash" "configure.sh"
+                        (string-append "--prefix=" out)))))
+          (replace 'build
+            (lambda _
+              (let ((mes (assoc-ref %build-inputs "bootstrap-mes")))
+                (setenv "MES_PREFIX" (string-append mes "/share/mes"))
+                (setenv "MES_ARENA" "100000000")
+                (setenv "MES_MAX_ARENA" "100000000")
+                (setenv "MES_STACK" "10000000")
+                (invoke "sh" "bootstrap.sh"))))
+          (replace 'check
+            (lambda _
+              (and
+               (setenv "DIFF" "sh scripts/diff.scm")
+               ;; fail fast tests
+               ;; (invoke "sh" "-x" "build-aux/test.sh" "scaffold/tests/t")
+               ;; (invoke "sh" "-x" "build-aux/test.sh" "scaffold/tests/63-struct-cell")
+               (invoke "sh" "check.sh"))))
+          (replace 'install
+            (lambda _
+              (invoke "sh" "install.sh"))))))
+     (native-search-paths
+      ;; Use the language-specific variables rather than 'CPATH' because they
+      ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
+      ;; The intent is to allow headers that are in the search path to be
+      ;; treated as "system headers" (headers exempt from warnings) just like
+      ;; the typical /usr/include headers on an FHS system.
+      (list (search-path-specification
+             (variable "C_INCLUDE_PATH")
+             (files '("share/mes/include")))
+            (search-path-specification
+             (variable "LIBRARY_PATH")
+             (files '("share/mes/lib"))))))))
+
+(define tcc-boot0
+  ;; Pristine tcc cannot be built by MesCC, we are keeping a delta of 11
+  ;; patches.  In a very early and rough form they were presented to the
+  ;; TinyCC developers, who at the time showed no interest in supporting the
+  ;; bootstrappable effort; we will try again later.  These patches have been
+  ;; ported to 0.9.27, alas the resulting tcc is buggy.  Once MesCC is more
+  ;; mature, this package should use the 0.9.27 sources (or later).
+  (let ((version "0.9.26")
+        (revision "6")
+        (commit "c004e9a34fb026bb44d211ab98bb768e79900eef"))
+    (package-with-bootstrap-guile
+     (package
+       (inherit tcc)
+       (name "tcc-boot0")
+       (version (string-append version "-" revision "." (string-take commit 7)))
+       (source (origin
+                 (method url-fetch)
+                 (uri (string-append "https://gitlab.com/janneke/tinycc"
+                                     "/-/archive/" commit
+                                     "/tinycc-" commit ".tar.gz"))
+                 (sha256
+                  (base32
+                   "1hmzn1pq0x22ppd80hyrn5qzqq94mxd0ychzj6vrr2vnj2frjv5b"))))
+       (build-system gnu-build-system)
+       (supported-systems '("i686-linux" "x86_64-linux"))
+       (inputs '())
+       (propagated-inputs '())
+       (native-inputs
+        `(("mes" ,mes-boot)
+          ("mescc-tools" ,%bootstrap-mescc-tools)
+          ("nyacc-source" ,(package-source nyacc))
+
+          ("coreutils" , %bootstrap-coreutils&co)
+          ("bootstrap-mes" ,%bootstrap-mes)))
+       (arguments
+        `(#:implicit-inputs? #f
+          #:guile ,%bootstrap-guile
+          #:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
+          #:phases
+          (modify-phases %standard-phases
+            (add-after 'unpack 'unpack-seeds
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let* ((coreutils (assoc-ref %build-inputs "coreutils"))
+                       (nyacc-source (assoc-ref %build-inputs "nyacc-source"))
+                       (bootstrap-mes (assoc-ref %build-inputs "bootstrap-mes")))
+                  (setenv "PATH" (string-append
+                                  coreutils "/bin"))
+                  (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+                  (with-directory-excursion ".."
+                    (and
+                     (mkdir-p "nyacc-source")
+                     (invoke "tar" "--strip=1" "-C" "nyacc-source"
+                             "-xvf" nyacc-source)
+                     (symlink (string-append bootstrap-mes "/share/mes/lib") "mes-seed")
+                     #t)))))
+            (replace 'configure
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let* ((out (assoc-ref %outputs "out"))
+                       (dir (with-directory-excursion ".." (getcwd)))
+                       (coreutils (assoc-ref %build-inputs "coreutils"))
+                       (mes (assoc-ref %build-inputs "mes"))
+                       (mescc-tools (assoc-ref %build-inputs "mescc-tools"))
+                       (libc (assoc-ref %build-inputs "libc"))
+                       (interpreter (if libc
+                                        ;; also for x86_64-linux, we are still on i686-linux
+                                        (string-append libc ,(glibc-dynamic-linker "i686-linux"))
+                                        (string-append mes "/lib/mes-loader"))))
+                  (setenv "PATH" (string-append
+                                  coreutils "/bin"
+                                  ":" mes "/bin"
+                                  ":" mescc-tools "/bin"))
+                  (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+
+                  (setenv "PREFIX" out)
+                  (symlink (string-append mes "/share/mes") "mes")
+                  (symlink (string-append "../nyacc-source/module") "nyacc")
+                  (setenv "MES_PREFIX" "mes")
+                  (setenv "MES_ARENA" "100000000")
+                  (setenv "MES_MAX_ARENA" "100000000")
+                  (setenv "MES_STACK" "10000000")
+                  (setenv "MES" "mes")
+                  (setenv "GUILE_LOAD_PATH" "nyacc")
+                  (invoke "sh" "configure"
+                          "--prefix=$PREFIX"
+                          (string-append "--elfinterp=" interpreter)
+                          "--crtprefix=."
+                          "--tccdir=."))))
+            (replace 'build
+              (lambda _
+                (substitute* "bootstrap.sh"
+                  (("^    cmp") "#    cmp"))
+                (invoke "sh" "bootstrap.sh")))
+            (replace 'check
+              (lambda _
+                (setenv "DIFF" "diff.scm")
+                (setenv "OBJDUMP" "true")
+                ;; fail fast tests
+                ;; (invoke "sh" "test.sh" "mes/scaffold/tests/30-strlen")
+                ;; (invoke "sh" "-x" "test.sh" "mes/scaffold/tinycc/00_assignment")
+                (setenv "TCC" "./tcc")
+                (invoke "sh" "check.sh")))
+            (replace 'install
+              (lambda _
+                (invoke "sh" "install.sh"))))))
+       (native-search-paths
+        ;; Use the language-specific variables rather than 'CPATH' because they
+        ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
+        ;; The intent is to allow headers that are in the search path to be
+        ;; treated as "system headers" (headers exempt from warnings) just like
+        ;; the typical /usr/include headers on an FHS system.
+        (list (search-path-specification
+               (variable "C_INCLUDE_PATH")
+               (files '("include")))
+              (search-path-specification
+               (variable "LIBRARY_PATH")
+               (files '("lib")))))))))
+
+(define tcc-boot
+  (package-with-bootstrap-guile
+   (package
+     (inherit tcc-boot0)
+     (name "tcc-boot")
+     (version "0.9.27")
+     (source (origin
+               (inherit (package-source tcc))
+               (patches (search-patches "tcc-boot-0.9.27.patch"))))
+     (build-system gnu-build-system)
+     (inputs '())
+     (propagated-inputs '())
+     (native-inputs
+      `(("mes" ,mes-boot)
+        ("tcc" ,tcc-boot0)
+
+        ("coreutils" , %bootstrap-coreutils&co)))
+     (arguments
+      `(#:implicit-inputs? #f
+        #:guile ,%bootstrap-guile
+        #:strip-binaries? #f            ; binutil's strip b0rkes MesCC/M1/hex2
+                                        ; binaries, tcc-boot also comes with
+                                        ; MesCC/M1/hex2-built binaries
+        #:phases
+        (modify-phases %standard-phases
+          (replace 'configure
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref %outputs "out"))
+                     (coreutils (assoc-ref %build-inputs "coreutils"))
+                     (mes (assoc-ref %build-inputs "mes"))
+                     (tcc (assoc-ref %build-inputs "tcc"))
+                     (libc (assoc-ref %build-inputs "libc"))
+                     (interpreter (if libc
+                                      ;; also for x86_64-linux, we are still on i686-linux
+                                      (string-append libc ,(glibc-dynamic-linker "i686-linux"))
+                                      (string-append mes "/lib/mes-loader"))))
+                ;; unpack
+                (setenv "PATH" (string-append
+                                coreutils "/bin"
+                                ":" tcc "/bin"))
+                (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+                (invoke "sh" "configure"
+                        (string-append "--cc=tcc")
+                        (string-append "--cpu=i386")
+                        (string-append "--prefix=" out)
+                        (string-append "--elfinterp=" interpreter)
+                        (string-append "--crtprefix=" tcc "/lib")
+                        (string-append "--sysincludepaths=" tcc "/include")
+                        (string-append "--libpaths=" tcc "/lib")))))
+          (replace 'build
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref %outputs "out"))
+                     (mes (assoc-ref %build-inputs "mes"))
+                     (tcc (assoc-ref %build-inputs "tcc"))
+                     (libc (assoc-ref %build-inputs "libc"))
+                     (interpreter (if libc
+                                      ;; also for x86_64-linux, we are still on i686-linux
+                                      (string-append libc ,(glibc-dynamic-linker "i686-linux"))
+                                      (string-append mes "/lib/mes-loader"))))
+                (invoke "tcc"
+                        "-vvv"
+                        "-D" "BOOTSTRAP=1"
+                        "-D" "ONE_SOURCE=1"
+                        "-D" "TCC_TARGET_I386=1"
+                        "-D" "CONFIG_TCC_STATIC=1"
+                        "-D" "CONFIG_USE_LIBGCC=1"
+                        "-D" (string-append "CONFIG_TCCDIR=\"" out "/lib/tcc\"")
+                        "-D" (string-append "CONFIG_TCC_CRTPREFIX=\"" out "/lib:{B}/lib:.\"")
+                        "-D" (string-append "CONFIG_TCC_CRTPREFIX=\"" out "/lib:{B}/lib:.\"")
+                        "-D" (string-append "CONFIG_TCC_ELFINTERP=\"" interpreter "\"")
+                        "-D" (string-append "CONFIG_TCC_LIBPATHS=\"" tcc "/lib:{B}/lib:.\"")
+                        "-D" (string-append "CONFIG_TCC_SYSINCLUDEPATHS=\"" tcc "/include" ":/include:{B}/include\"")
+                        "-D" (string-append "TCC_LIBGCC=\"" tcc "/lib/libc.a\"")
+                        "-o" "tcc"
+                        "tcc.c"))))
+          (replace 'check
+            (lambda _
+              ;; FIXME: add sensible check target (without depending on make)
+              ;; ./check.sh ?
+              (= 1 (status:exit-val (system* "./tcc" "--help")))))
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref %outputs "out"))
+                    (tcc (assoc-ref %build-inputs "tcc")))
+                (and
+                 (mkdir-p (string-append out "/bin"))
+                 (copy-file "tcc" (string-append out "/bin/tcc"))
+                 (mkdir-p (string-append out "/lib/tcc"))
+                 (copy-recursively (string-append tcc "/include")
+                                   (string-append out "/include"))
+                 (copy-recursively (string-append tcc "/lib")
+                                   (string-append out "/lib"))
+                 (invoke "tcc" "-D" "TCC_TARGET_I386=1" "-c" "-o" "libtcc1.o" "lib/libtcc1.c")
+                 (invoke "tcc" "-ar" "rc" "libtcc1.a" "libtcc1.o")
+                 (copy-file "libtcc1.a" (string-append out "/lib/libtcc1.a"))
+                 (delete-file (string-append out "/lib/tcc/libtcc1.a"))
+                 (copy-file "libtcc1.a" (string-append out "/lib/tcc/libtcc1.a"))
+                 #t))))))))))
+
+(define make-mesboot0
+  (package-with-bootstrap-guile
+   (package
+     (inherit gnu-make)
+     (name "make-mesboot0")
+     (version "3.80")
+     (source (origin
+               (method url-fetch)
+               (uri (string-append "mirror://gnu/make/make-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "1pb7fb7fqf9wz9najm85qdma1xhxzf1rhj5gwrlzdsz2zm0hpcv4"))))
+     (supported-systems '("i686-linux" "x86_64-linux"))
+     (inputs '())
+     (propagated-inputs '())
+     (native-inputs `(("tcc" ,tcc-boot)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)))
+     (arguments
+      `(#:implicit-inputs? #f
+        #:tests? #f                     ; check depends on perl
+        #:guile ,%bootstrap-guile
+        #:configure-flags `("CC=tcc -DO_RDONLY=0"
+                            "LD=tcc"
+                            "--disable-nls")
+        #:phases
+        (modify-phases %standard-phases
+          (add-after 'configure 'configure-fixup
+            (lambda _
+              (substitute* "build.sh"
+                (("^REMOTE=.*") "REMOTE=stub\n")
+                (("^extras=.*") "extras=getloadavg.c\n"))
+              (substitute* "make.h"
+                (("^extern long int lseek.*" all) (string-append "// " all)))
+              #t))
+          (delete 'patch-generated-file-shebangs) ; no perl
+          (replace 'build
+            (lambda _
+              (invoke "sh" "./build.sh")))
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (bin (string-append out "/bin")))
+                (install-file "make" bin))))))))))
+
+(define diffutils-mesboot
+  (package-with-bootstrap-guile
+   (package
+     (inherit diffutils)
+     (name "diffutils-mesboot")
+     (version "2.7")
+     (source (origin
+               (method url-fetch)
+               (uri (string-append "mirror://gnu/diffutils/diffutils-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "1mirn5i825bn5w7rh6mgn0r8aj9xqanav95dwcl1b8sn82f4iwnm"))))
+     (supported-systems '("i686-linux" "x86_64-linux"))
+     (inputs '())
+     (propagated-inputs '())
+     (native-inputs `(("mes" ,mes-boot)
+                      ("tcc" ,tcc-boot)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("make" ,make-mesboot0)))
+     (arguments
+      `(#:implicit-inputs? #f
+        #:guile ,%bootstrap-guile
+        #:parallel-build? #f
+        #:tests? #f           ; check is naive, also checks non-built PROGRAMS
+        #:strip-binaries? #f  ; no strip yet
+        #:phases
+        (modify-phases %standard-phases
+          ;; diffutils-2.7 needs more traditional configure
+          (replace 'configure
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out"))
+                    (bash (assoc-ref %build-inputs "bash")))
+                (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
+                (setenv "CC" "tcc")
+                (setenv "LD" "tcc")
+                (invoke "./configure" (string-append "--prefix=" out)))))
+          (add-before 'configure 'remove-diff3-sdiff
+            (lambda* (#:key outputs #:allow-other-keys)
+              (substitute* "Makefile.in"
+                (("PROGRAMS = .*" all) "PROGRAMS = cmp diff"))))))))))
+
+
+(define binutils-mesboot0
+  (package-with-bootstrap-guile
+   (package
+     (inherit binutils)
+     (name "binutils-mesboot0")
+     (version "2.20.1a")
+     (source (origin
+               (method url-fetch)
+               (uri (string-append "mirror://gnu/binutils/binutils-"
+                                   version ".tar.bz2"))
+               (patches (search-patches "binutils-boot-2.20.1a.patch"))
+               (sha256
+                (base32
+                 "0r7dr0brfpchh5ic0z9r4yxqn4ybzmlh25sbp30cacqk8nb7rlvi"))))
+     (inputs '())
+     (propagated-inputs '())
+     (native-inputs `(("tcc" ,tcc-boot)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("diffutils" ,diffutils-mesboot)
+                      ("make" ,make-mesboot0)))
+     (supported-systems '("i686-linux" "x86_64-linux"))
+     (arguments
+      `(#:implicit-inputs? #f
+        #:guile ,%bootstrap-guile
+        #:tests? #f                     ; runtest: command not found
+        #:parallel-build? #f
+        #:strip-binaries? #f            ; no strip yet
+        #:configure-flags
+        (let ((cppflags (string-append " -D __GLIBC_MINOR__=6"
+                                       " -D MES_BOOTSTRAP=1"))
+              (bash (assoc-ref %build-inputs "bash")))
+          `(,(string-append "CONFIG_SHELL=" bash "/bin/sh")
+            ,(string-append "CPPFLAGS=" cppflags)
+            "AR=tcc -ar"
+            "CXX=false"
+            "RANLIB=true"
+            ,(string-append "CC=tcc" cppflags)
+            "--disable-nls"
+            "--disable-shared"
+            "--disable-werror"
+            "--build=i686-unknown-linux-gnu"
+            "--host=i686-unknown-linux-gnu"
+            "--with-sysroot=/")))))))
+
+(define gcc-core-mesboot
+  ;; Gcc-2.95.3 is the most recent GCC that is supported by what the Mes C
+  ;; Library v0.16 offers.  Gcc-3.x (and 4.x) place higher demands on a C
+  ;; library, such as dir.h/struct DIR/readdir, locales, signals...  Also,
+  ;; with gcc-2.95.3, binutils-boot-2.20.1a and glibc-2.2.5 we found a GNU
+  ;; toolchain triplet "that works".
+  (package-with-bootstrap-guile
+   (package
+     (inherit gcc)
+     (name "gcc-core-mesboot")
+     (version "2.95.3")
+     (source (origin
+               (method url-fetch)
+               (uri (string-append "mirror://gnu/gcc/gcc-2.95.3/gcc-core-"
+                                   version
+                                   ".tar.gz"))
+               (patches (search-patches "gcc-boot-2.95.3.patch"))
+               (sha256
+                (base32
+                 "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an"))))
+     (supported-systems '("i686-linux" "x86_64-linux"))
+     (inputs '())
+     (propagated-inputs '())
+     (native-inputs `(("binutils" ,binutils-mesboot0)
+                      ("tcc" ,tcc-boot)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("diffutils" ,diffutils-mesboot)
+                      ("make" ,make-mesboot0)))
+     (outputs '("out"))
+     (arguments
+      `(#:implicit-inputs? #f
+        #:guile ,%bootstrap-guile
+        #:tests? #f
+        #:parallel-build? #f
+        #:strip-binaries? #f
+        #:configure-flags
+        (let ((out (assoc-ref %outputs "out")))
+          `("--enable-static"
+            "--disable-shared"
+            "--disable-werror"
+            "--build=i686-unknown-linux-gnu"
+            "--host=i686-unknown-linux-gnu"
+            ,(string-append "--prefix=" out)))
+        #:make-flags (list
+                      "CC=tcc -static -D __GLIBC_MINOR__=6"
+                      "OLDCC=tcc -static -D __GLIBC_MINOR__=6"
+                      "CC_FOR_BUILD=tcc -static -D __GLIBC_MINOR__=6"
+                      "AR=ar"
+                      "RANLIB=ranlib"
+                      (string-append "LIBGCC2_INCLUDES=-I "
+                                     (assoc-ref %build-inputs "tcc")
+                                     "/include")
+                      "LANGUAGES=c"
+                      (string-append "BOOT_LDFLAGS="
+                                     " -B" (assoc-ref %build-inputs "tcc")
+                                     "/lib/"))
+        #:modules ((guix build gnu-build-system)
+                   (guix build utils)
+                   (srfi srfi-1))
+        #:phases
+        (modify-phases %standard-phases
+          ;; gcc-2.95.3 needs more traditional configure
+          (add-before 'configure 'setenv
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out"))
+                    (bash (assoc-ref %build-inputs "bash"))
+                    (tcc (assoc-ref %build-inputs "tcc"))
+                    (cppflags " -D __GLIBC_MINOR__=6"))
+                (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
+                (setenv "CPPFLAGS" cppflags)
+                (setenv "CC" (string-append "tcc" cppflags))
+                (setenv "CC_FOR_BUILD" (string-append "tcc" cppflags))
+                (setenv "CPP" (string-append "tcc -E" cppflags))
+                (with-output-to-file "config.cache"
+                  (lambda _
+                    (display "
+ac_cv_c_float_format='IEEE (little-endian)'
+"))))))
+          (replace 'configure
+            (lambda* (#:key configure-flags  #:allow-other-keys)
+              (format (current-error-port)
+                      "running ./configure ~a\n" (string-join configure-flags))
+              (apply invoke "./configure" configure-flags)))
+          (add-after 'configure 'remove-info
+            (lambda _
+              ;; no info at this stage
+              (delete-file-recursively "texinfo")
+              (invoke "touch" "gcc/cpp.info" "gcc/gcc.info")))
+          (add-after 'install 'install2
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((tcc (assoc-ref %build-inputs "tcc"))
+                     (tcc-lib (string-append tcc "/lib/x86-mes-gcc"))
+                     (out (assoc-ref outputs "out"))
+                     (gcc-dir (string-append
+                               out "/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3")))
+                (and
+                 (mkdir-p "tmp")
+                 (zero? (system (string-append "set -x; cd tmp && ar x ../gcc/libgcc2.a")))
+                 (zero? (system (string-append "set -x; cd tmp && ar r " gcc-dir "/libgcc.a *.o")))
+                 (copy-file "gcc/libgcc2.a" (string-append out "/lib/libgcc2.a"))
+                 (copy-file (string-append tcc "/lib/libtcc1.a")
+                            (string-append out "/lib/libtcc1.a"))
+                 (invoke "ar" "r" (string-append gcc-dir "/libc.a")
+                         (string-append tcc-lib "/libc+gnu.o")
+                         (string-append tcc-lib "/libtcc1.o"))
+                 (invoke "ar" "r" (string-append out "/lib/libc.a")
+                         (string-append tcc-lib "/libc+gnu.o")
+                         (string-append tcc-lib "/libtcc1.o"))
+                 (invoke "ls" "-ltrF" gcc-dir)
+                 (copy-recursively (string-append tcc "/include")
+                                   (string-append out "/include"))
+                 #t)))))))
+     (native-search-paths
+      ;; Use the language-specific variables rather than 'CPATH' because they
+      ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
+      ;; The intent is to allow headers that are in the search path to be
+      ;; treated as "system headers" (headers exempt from warnings) just like
+      ;; the typical /usr/include headers on an FHS system.
+      (list (search-path-specification
+             (variable "C_INCLUDE_PATH")
+             (files '("include" "/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include")))
+            (search-path-specification
+             (variable "LIBRARY_PATH")
+             (files '("lib"))))))))
+
+(define mesboot-headers
+  (package-with-bootstrap-guile
+   (package
+     (inherit mes-boot)
+     (name "mesboot-headers")
+     (supported-systems '("i686-linux" "x86_64-linux"))
+     (inputs '())
+     (propagated-inputs '())
+     (native-inputs `(("coreutils" ,%bootstrap-coreutils&co)
+                      ("headers" ,%bootstrap-linux-libre-headers)))
+     (arguments
+      `(#:implicit-inputs? #f
+        #:guile ,%bootstrap-guile
+        #:tests? #f
+        #:strip-binaries? #f
+        #:phases
+        (modify-phases %standard-phases
+          (delete 'configure)
+          (delete 'build)
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (include (string-append out "/include"))
+                     (headers (assoc-ref %build-inputs "headers" )))
+                (mkdir-p include)
+                (copy-recursively "include" out)
+                (copy-recursively headers out)
+                #t))))))
+     (native-search-paths
+      ;; Use the language-specific variables rather than 'CPATH' because they
+      ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
+      ;; The intent is to allow headers that are in the search path to be
+      ;; treated as "system headers" (headers exempt from warnings) just like
+      ;; the typical /usr/include headers on an FHS system.
+      (list (search-path-specification
+             (variable "C_INCLUDE_PATH")
+             (files '("include"))))))))
+
+(define glibc-mesboot0
+  ;; GNU C Library 2.2.5 is the most recent glibc that we managed to build
+  ;; using gcc-2.95.3.  Newer versions (2.3.x, 2.6, 2.1x) seem to need a newer
+  ;; gcc.
+  (package-with-bootstrap-guile
+   (package
+     (inherit glibc)
+     (name "glibc-mesboot0")
+     (version "2.2.5")
+     (source (origin
+               (method url-fetch)
+               (uri (string-append "mirror://gnu/glibc/glibc-"
+                                   version
+                                   ".tar.gz"))
+               (patches (search-patches "glibc-boot-2.2.5.patch"))
+               (sha256
+                (base32
+                 "1vl48i16gx6h68whjyhgnn1s57vqq32f9ygfa2fls7pdkbsqvp2q"))))
+     (supported-systems '("i686-linux" "x86_64-linux"))
+     (inputs '())
+     (propagated-inputs '())
+     (native-inputs `(("binutils" ,binutils-mesboot0)
+                      ("gcc" ,gcc-core-mesboot)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("diffutils" ,diffutils-mesboot)
+                      ("headers" ,mesboot-headers)
+                      ("make" ,make-mesboot0)))
+     (outputs '("out"))
+     (arguments
+      `(#:implicit-inputs? #f
+        #:guile ,%bootstrap-guile
+        #:tests? #f
+        #:strip-binaries? #f
+        #:parallel-build? #f    ; gcc-2.95.3 ICEs on massively parallel builds
+        #:make-flags (list (string-append
+                            "SHELL="
+                            (assoc-ref %build-inputs "bash")
+                            "/bin/sh"))
+        #:configure-flags
+        (let ((out (assoc-ref %outputs "out"))
+              (headers (assoc-ref %build-inputs "headers")))
+          (list
+           "--disable-shared"
+           "--enable-static"
+           "--disable-sanity-checks"
+           "--build=i686-unknown-linux-gnu"
+           "--host=i686-unknown-linux-gnu"
+           (string-append "--with-headers=" headers "/include")
+           "--enable-static-nss"
+           "--without-__thread"
+           "--without-cvs"
+           "--without-gd"
+           "--without-tls"
+           (string-append "--prefix=" out)))
+        #:phases
+        (modify-phases %standard-phases
+          (add-before 'configure 'setenv
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (bash (assoc-ref %build-inputs "bash"))
+                     (gcc (assoc-ref %build-inputs "gcc"))
+                     (headers (assoc-ref %build-inputs "headers"))
+                     (cppflags (string-append
+                                ;;" -D __STDC__=1"
+                                " -D MES_BOOTSTRAP=1"
+                                " -D BOOTSTRAP_GLIBC=1"))
+                     (cflags (string-append " -L " (getcwd))))
+                (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
+                (setenv "SHELL" (getenv "CONFIG_SHELL"))
+                (setenv "CPP" (string-append gcc "/bin/gcc -E " cppflags))
+                (setenv "CC" (string-append gcc "/bin/gcc " cppflags cflags))
+                #t)))
+          ;; glibc-2.2.5 needs a more classic invocation of configure
+          ;; configure: warning: CONFIG_SHELL=/gnu/store/kpxi8h3669afr9r1bgvaf9ij3y4wdyyn-bash-minimal-4.4.12/bin/bash: invalid host type
+          (replace 'configure
+            (lambda* (#:key configure-flags #:allow-other-keys)
+              (format (current-error-port)
+                      "running ./configure ~a\n" (string-join configure-flags))
+              (apply invoke "./configure" configure-flags))))))
+     (native-search-paths
+      ;; Use the language-specific variables rather than 'CPATH' because they
+      ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
+      ;; The intent is to allow headers that are in the search path to be
+      ;; treated as "system headers" (headers exempt from warnings) just like
+      ;; the typical /usr/include headers on an FHS system.
+      (list (search-path-specification
+             (variable "C_INCLUDE_PATH")
+             (files '("include")))
+            (search-path-specification
+             (variable "CPLUS_INCLUDE_PATH")
+             (files '("include")))
+            (search-path-specification
+             (variable "LIBRARY_PATH")
+             (files '("lib"))))))))
+
+(define gcc-mesboot0
+  (package-with-bootstrap-guile
+   (package
+     (inherit gcc-core-mesboot)
+     (name "gcc-mesboot0")
+     (native-inputs `(("binutils" ,binutils-mesboot0)
+                      ("gcc" ,gcc-core-mesboot)
+                      ("libc" ,glibc-mesboot0)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("diffutils" ,diffutils-mesboot)
+                      ("kernel-headers" ,%bootstrap-linux-libre-headers)
+                      ("make" ,make-mesboot0)))
+     (arguments
+      (substitute-keyword-arguments (package-arguments gcc-core-mesboot)
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (replace 'setenv
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let ((out (assoc-ref outputs "out"))
+                      (bash (assoc-ref %build-inputs "bash"))
+                      (gcc (assoc-ref %build-inputs "gcc"))
+                      (glibc (assoc-ref %build-inputs "libc"))
+                      (kernel-headers (assoc-ref %build-inputs "kernel-headers")))
+                  (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
+                  (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH"))
+                  (setenv "C_INCLUDE_PATH" (string-append
+                                            gcc "/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include"
+                                            ":" kernel-headers "/include"
+                                            ":" glibc "/include"))
+                  (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH"))
+                  (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv "LIBRARY_PATH"))
+                  ;; FIXME: add glibc dirs to paths manually
+                  (setenv "LIBRARY_PATH" (string-join
+                                          (list (string-append glibc "/lib")
+                                                (getenv "LIBRARY_PATH"))
+                                          ":"))
+                  (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv "LIBRARY_PATH"))
+                  (with-output-to-file "config.cache"
+                    (lambda _
+                      (display "
+ac_cv_c_float_format='IEEE (little-endian)'
+")))
+                  #t)))
+            (replace 'install2
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let* ((out (assoc-ref outputs "out"))
+                       (gcc-dir (string-append
+                                 out "/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3")))
+                  (and
+                   (mkdir-p "tmp")
+                   (zero? (system (string-append "set -x; cd tmp && ar x ../gcc/libgcc2.a")))
+                   (zero? (system (string-append "set -x; cd tmp && ar r " gcc-dir "/libgcc.a *.o")))
+                   (copy-file "gcc/libgcc2.a" (string-append out "/lib/libgcc2.a"))))))))
+        ((#:configure-flags configure-flags)
+         `(let ((out (assoc-ref %outputs "out")))
+            `("--disable-shared"
+              "--disable-werror"
+              "--build=i686-unknown-linux-gnu"
+              "--host=i686-unknown-linux-gnu"
+              ,(string-append "--prefix=" out))))
+        ((#:make-flags make-flags)
+         `(let ((gcc (assoc-ref %build-inputs "gcc")))
+            `("RANLIB=true"
+              ,(string-append "LIBGCC2_INCLUDES=-I " gcc "/include")
+              "LANGUAGES=c"))))))))
+
+(define binutils-mesboot
+  (package-with-bootstrap-guile
+   (package
+     (inherit binutils-mesboot0)
+     (name "binutils-mesboot")
+     (native-inputs `(("binutils" ,binutils-mesboot0)
+                      ("libc" ,glibc-mesboot0)
+                      ("gcc" ,gcc-mesboot0)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("diffutils" ,diffutils-mesboot)
+                      ("kernel-headers" ,%bootstrap-linux-libre-headers)
+                      ("make" ,make-mesboot0)))
+     (arguments
+      (substitute-keyword-arguments (package-arguments binutils-mesboot0)
+        ((#:configure-flags configure-flags)
+         '(list "--disable-nls"
+                "--disable-shared"
+                "--disable-werror"
+                "--build=i686-unknown-linux-gnu"
+                "--host=i686-unknown-linux-gnu"
+                "--with-sysroot=/")))))))
+
+(define make-mesboot
+  (package-with-bootstrap-guile
+   (package
+     (inherit make-mesboot0)
+     (name "make-mesboot")
+     (version "3.82")
+     (source (origin
+               (method url-fetch)
+               (uri (string-append "mirror://gnu/make/make-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "1rs2f9hmvy3q6zkl15jnlmnpgffm0bhw5ax0h5c7q604wqrip69x"))))
+     (native-inputs `(("binutils" ,binutils-mesboot0)
+                      ("libc" ,glibc-mesboot0)
+                      ("gcc" ,gcc-mesboot0)
+                      ("make" ,make-mesboot0)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("kernel-headers" ,%bootstrap-linux-libre-headers)))
+     (arguments
+      (substitute-keyword-arguments (package-arguments make-mesboot0)
+        ((#:configure-flags configure-flags)
+         `(let ((out (assoc-ref %outputs "out")))
+            `(,(string-append "--prefix=" out))))
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (delete 'configure-fixup)
+            (add-before 'configure 'setenv
+              (lambda _
+                (setenv "LIBS" "-lc -lnss_files -lnss_dns -lresolv")
+                #t)))))))))
+
+(define gmp-boot
+  (package
+    (inherit gmp)
+    (version "4.3.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/gmp/gmp-" version
+                                  ".tar.gz"))
+              (sha256 (base32
+                       "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv"))))))
+
+(define mpfr-boot
+  (package
+    (inherit mpfr)
+    (version "2.4.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/mpfr/mpfr-" version
+                                  ".tar.gz"))
+              (sha256 (base32
+                       "0dxn4904dra50xa22hi047lj8kkpr41d6vb9sd4grca880c7wv94"))))))
+
+(define mpc-boot
+  (package
+    (inherit mpc)
+    (version "1.0.3")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "mirror://gnu/mpc/mpc-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1"))))))
+
+(define gcc-mesboot1
+  (package-with-bootstrap-guile
+   (package
+     (inherit gcc-mesboot0)
+     (name "gcc-mesboot1")
+     (version "4.7.4")
+     (source (origin (inherit (package-source gcc-4.7))
+                     (patches (search-patches "gcc-boot-4.7.4.patch"))))
+     (inputs `(("gmp-source" ,(package-source gmp-boot))
+               ("mpfr-source" ,(package-source mpfr-boot))
+               ("mpc-source" ,(package-source mpc-boot))))
+     (native-inputs `(("binutils" ,binutils-mesboot)
+                      ("gcc" ,gcc-mesboot0)
+                      ("libc" ,glibc-mesboot0)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("diffutils" ,diffutils-mesboot)
+                      ("kernel-headers" ,%bootstrap-linux-libre-headers)
+                      ("make" ,make-mesboot)))
+     (arguments
+      (substitute-keyword-arguments (package-arguments gcc-core-mesboot)
+        ((#:make-flags make-flags)
+         `(let* ((libc (assoc-ref %build-inputs "libc"))
+                 (ldflags (string-append
+                           "-B" libc "/lib "
+                           "-Wl,-dynamic-linker "
+                           "-Wl," libc
+                           ,(glibc-dynamic-linker "i686-linux"))))
+            (list (string-append "LDFLAGS=" ldflags)
+                  (string-append "LDFLAGS_FOR_TARGET=" ldflags))))
+        ((#:phases phases)
+         `(modify-phases ,phases
+            ;; c&p from commencement.scm:gcc-boot0
+            (add-after 'unpack 'unpack-gmp&co
+              (lambda* (#:key inputs #:allow-other-keys)
+                (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
+                      (mpfr (assoc-ref %build-inputs "mpfr-source"))
+                      (mpc  (assoc-ref %build-inputs "mpc-source")))
+
+                  ;; To reduce the set of pre-built bootstrap inputs, build
+                  ;; GMP & co. from GCC.
+                  (for-each (lambda (source)
+                              (or (invoke "tar" "xvf" source)
+                                  (error "failed to unpack tarball"
+                                         source)))
+                            (list gmp mpfr mpc))
+
+                  ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
+                  ,@(map (lambda (lib)
+                           ;; Drop trailing letters, as gmp-6.0.0a unpacks
+                           ;; into gmp-6.0.0.
+                           `(symlink ,(string-trim-right
+                                       (package-full-name lib "-")
+                                       char-set:letter)
+                                     ,(package-name lib)))
+                         (list gmp-boot mpfr-boot mpc-boot))
+                  #t)))
+            (delete 'remove-info)
+            (replace 'setenv
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let* ((out (assoc-ref outputs "out"))
+                       (binutils (assoc-ref %build-inputs "binutils"))
+                       (bash (assoc-ref %build-inputs "bash"))
+                       (gcc (assoc-ref %build-inputs "gcc"))
+                       (glibc (assoc-ref %build-inputs "libc"))
+                       (kernel-headers (assoc-ref %build-inputs "kernel-headers")))
+                  (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
+                  (setenv "C_INCLUDE_PATH" (string-append
+                                            gcc "/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include"
+                                            ":" kernel-headers "/include"
+                                            ":" glibc "/include"
+                                            ":" (getcwd) "/mpfr/src"))
+                  (setenv "LIBRARY_PATH" (string-append glibc "/lib"
+                                                        ":" gcc "/lib"))
+                  (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH"))
+                  (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv "LIBRARY_PATH"))
+                  #t)))
+            (delete 'install2)))
+        ((#:configure-flags configure-flags)
+         `(let ((out (assoc-ref %outputs "out"))
+                (glibc (assoc-ref %build-inputs "libc")))
+            (list (string-append "--prefix=" out)
+                  "--build=i686-unknown-linux-gnu"
+                  "--host=i686-unknown-linux-gnu"
+
+                  (string-append "--with-native-system-header-dir=" glibc "/include")
+                  (string-append "--with-build-sysroot=" glibc "/include")
+
+                  "--disable-bootstrap"
+                  "--disable-decimal-float"
+                  "--disable-libatomic"
+                  "--disable-libcilkrts"
+                  "--disable-libgomp"
+                  "--disable-libitm"
+                  "--disable-libmudflap"
+                  "--disable-libquadmath"
+                  "--disable-libsanitizer"
+                  "--disable-libssp"
+                  "--disable-libvtv"
+                  "--disable-lto"
+                  "--disable-lto-plugin"
+                  "--disable-multilib"
+                  "--disable-plugin"
+                  "--disable-threads"
+                  "--enable-languages=c,c++"
+
+                  "--enable-static"
+                  ;; libstdc++.so: error: depends on 'libgcc_s.so.1', which cannot be found in RUNPATH ()
+                  "--disable-shared"
+                  "--enable-threads=single"
+
+                  ;; No pre-compiled libstdc++ headers, to save space.
+                  "--disable-libstdcxx-pch"
+
+                  ;; for libcpp ...
+                  "--disable-build-with-cxx"))))))))
+
+(define gcc-mesboot1-wrapper
+  ;; We need this so gcc-mesboot1 can be used to create shared binaries that
+  ;; have the correct interpreter, otherwise configuring gcc-mesboot using
+  ;; --enable-shared will fail.
+  (package-with-bootstrap-guile
+   (package
+     (inherit gcc-mesboot1)
+     (name "gcc-mesboot1-wrapper")
+     (source #f)
+     (inputs '())
+     (native-inputs `(("bash" ,%bootstrap-coreutils&co)
+                      ("libc" ,glibc-mesboot)
+                      ("gcc" ,gcc-mesboot1)))
+     (arguments
+      `(#:implicit-inputs? #f
+        #:guile ,%bootstrap-guile
+        #:phases
+        (modify-phases %standard-phases
+          (delete 'unpack)
+          (delete 'configure)
+          (delete 'install)
+          (replace 'build
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (bash (assoc-ref %build-inputs "bash"))
+                     (libc (assoc-ref %build-inputs "libc"))
+                     (gcc (assoc-ref %build-inputs "gcc"))
+                     (bin (string-append out "/bin")))
+                (mkdir-p bin)
+                (for-each
+                 (lambda (program)
+                   (let ((wrapper (string-append bin "/" program)))
+                     (with-output-to-file wrapper
+                       (lambda _
+                         (display (string-append "#! " bash "/bin/bash
+exec " gcc "/bin/" program
+" -Wl,--dynamic-linker"
+;; also for x86_64-linux, we are still on i686-linux
+" -Wl," libc ,(glibc-dynamic-linker "i686-linux")
+" -Wl,--rpath"
+" -Wl," libc "/lib"
+" \"$@\"
+"))
+                         (chmod wrapper #o555)))))
+                 '(
+                   "gcc"
+                   "g++"
+                   "i686-unknown-linux-gnu-gcc"
+                   "i686-unknown-linux-gnu-g++"
+                   ))
+                #t)))
+          (replace 'check
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (bin (string-append out "/bin"))
+                     (program (string-append bin "/gcc")))
+                (invoke program "--help"))))))))))
+
+(define glibc-headers-mesboot
+  (package-with-bootstrap-guile
+   (package
+     (inherit glibc-mesboot0)
+     (name "glibc-headers-mesboot")
+     (version "2.16.0")
+     (source (origin
+               (method url-fetch)
+               (uri (string-append "mirror://gnu/glibc/glibc-"
+                                   version
+                                   ".tar.gz"))
+               (patches (search-patches "glibc-boot-2.16.0.patch"
+                                        "glibc-bootstrap-system-2.16.0.patch"))
+               (sha256
+                (base32
+                 "0vlz4x6cgz7h54qq4528q526qlhnsjzbsvgc4iizn76cb0bfanx7"))))
+     (native-inputs `(("binutils" ,binutils-mesboot)
+                      ("libc" ,glibc-mesboot0)
+                      ("gcc" ,gcc-mesboot1)
+                      ("headers" ,mesboot-headers)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("diffutils" ,diffutils-mesboot)
+                      ("kernel-headers" ,%bootstrap-linux-libre-headers)
+                      ("make" ,make-mesboot)))
+
+     (arguments
+      (substitute-keyword-arguments (package-arguments glibc-mesboot0)
+        ((#:configure-flags configure-flags)
+         `(let ((out (assoc-ref %outputs "out"))
+                (headers (assoc-ref %build-inputs "headers")))
+            (list
+             (string-append "--prefix=" out)
+             "--disable-obsolete-rpc"
+             "--host=i686-unknown-linux-gnu"
+             (string-append "--with-headers=" headers "/include")
+             "--enable-static-nss"
+             "--with-pthread"
+             "--without-cvs"
+             "--without-gd"
+             "--enable-add-ons=nptl")))
+        ((#:make-flags make-flags)
+         `(let ((bash (assoc-ref %build-inputs "bash")))
+            (list (string-append "SHELL=" bash "/bin/sh")
+                  "install-bootstrap-headers=yes" "install-headers")))
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (replace 'setenv
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let* ((out (assoc-ref outputs "out"))
+                       (headers (assoc-ref %build-inputs "headers"))
+                       (bash (assoc-ref %build-inputs "bash"))
+                       (coreutils (assoc-ref %build-inputs "coreutils"))
+                       (libc (assoc-ref %build-inputs "libc"))
+                       (gcc (assoc-ref %build-inputs "gcc"))
+                       (cppflags (string-append
+                                  " -I " (getcwd) "/nptl/sysdeps/pthread/bits"
+                                  " -D BOOTSTRAP_GLIBC=1"))
+                       (cflags (string-append " -L " (getcwd)
+                                              " -L " libc "/lib")))
+                  (setenv "libc_cv_friendly_stddef" "yes")
+                  (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
+                  (setenv "SHELL" (getenv "CONFIG_SHELL"))
+                  (format (current-error-port) "CONFIG_SHELL=~s\n" (getenv "CONFIG_SHELL"))
+
+                  (setenv "CPP" (string-append gcc "/bin/gcc -E " cppflags))
+                  (setenv "CC" (string-append gcc "/bin/gcc " cppflags cflags))
+
+                  ;; avoid -fstack-protector
+                  (setenv "libc_cv_ssp" "false")
+                  (substitute* "configure"
+                    (("/bin/pwd") (string-append coreutils "/bin/pwd")))
+                  (setenv "C_INCLUDE_PATH" (string-append libc "/include"
+                                                          headers "/include"))
+                  (setenv "LIBRARY_PATH" (string-append libc "/lib")))))
+            (replace 'install
+              (lambda* (#:key outputs make-flags #:allow-other-keys)
+                (let ((kernel-headers (assoc-ref %build-inputs "kernel-headers"))
+                      (out (assoc-ref outputs "out")))
+                  (and (apply invoke "make" make-flags)
+                       (copy-recursively kernel-headers out)
+                       #t))))
+            (replace 'configure
+              (lambda* (#:key configure-flags #:allow-other-keys)
+                (format (current-error-port) "running ../configure ~a\n" (string-join configure-flags))
+                (mkdir-p "build")
+                (chdir "build")
+                (apply invoke "../configure" configure-flags)))
+            (add-after 'configure 'remove-sunrpc
+              (lambda _
+                (invoke "make" (string-append (getcwd) "/sysd-sorted" )
+                        (string-append "SHELL=" (getenv "CONFIG_SHELL")))
+                (substitute* "sysd-sorted"
+                  ((" sunrpc") " ")
+                  ((" nis") " "))
+                ;; 'rpcgen' needs native libc headers to be built.
+                (substitute* "../Makefile"
+                  (("^SHELL := /bin/sh") (string-append "SHELL := " (getenv "CONFIG_SHELL"))))
+                (substitute* "../Makeconfig"
+                  (("^SHELL := /bin/sh") (string-append "SHELL := " (getenv "CONFIG_SHELL"))))
+                (substitute* "../elf/Makefile"
+                  (("^SHELL := /bin/sh") (string-append "SHELL := " (getenv "CONFIG_SHELL")))))))))))))
+
+(define glibc-mesboot
+  (package-with-bootstrap-guile
+   (package
+     (inherit glibc-headers-mesboot)
+     (name "glibc-mesboot")
+     (native-inputs `(("binutils" ,binutils-mesboot)
+                      ("libc" ,glibc-mesboot0)
+                      ("headers" ,glibc-headers-mesboot)
+                      ("gcc" ,gcc-mesboot1)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("diffutils" ,diffutils-mesboot)
+                      ("kernel-headers" ,%bootstrap-linux-libre-headers)
+                      ("make" ,make-mesboot)))
+
+     (arguments
+      `(#:validate-runpath? #f ; fails when using --enable-shared
+        ,@(substitute-keyword-arguments (package-arguments glibc-headers-mesboot)
+            ((#:make-flags make-flags)
+             `(let ((bash (assoc-ref %build-inputs "bash")))
+                (list (string-append "SHELL=" bash "/bin/sh"))))
+            ((#:phases phases)
+             `(modify-phases ,phases
+                (replace 'install
+                  (lambda* (#:key outputs make-flags #:allow-other-keys)
+                    (let* ((kernel-headers (assoc-ref %build-inputs "kernel-headers"))
+                           (out (assoc-ref outputs "out"))
+                           (install-flags (cons "install" make-flags)))
+                      (and (apply invoke "make" install-flags)
+                           (copy-recursively kernel-headers out)
+                           #t)))))))))
+     (native-search-paths ;; FIXME: move to glibc-mesboot0
+      ;; Use the language-specific variables rather than 'CPATH' because they
+      ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
+      ;; The intent is to allow headers that are in the search path to be
+      ;; treated as "system headers" (headers exempt from warnings) just like
+      ;; the typical /usr/include headers on an FHS system.
+      (list (search-path-specification
+             (variable "C_INCLUDE_PATH")
+             (files '("include")))
+            (search-path-specification
+             (variable "CPLUS_INCLUDE_PATH")
+             (files '("include")))
+            (search-path-specification
+             (variable "LIBRARY_PATH")
+             (files '("lib"))))))))
+
+(define gcc-mesboot
+  (package-with-bootstrap-guile
+   (package
+     (inherit gcc-mesboot1)
+     (name "gcc-mesboot")
+     (version "4.9.4")
+     (source (package-source gcc-4.9))
+     (native-inputs `(("binutils" ,binutils-mesboot)
+                      ("gcc-wrapper" ,gcc-mesboot1-wrapper)
+                      ("gcc" ,gcc-mesboot1)
+                      ("libc" ,glibc-mesboot)
+
+                      ("bash" ,%bootstrap-coreutils&co)
+                      ("coreutils" ,%bootstrap-coreutils&co)
+                      ("diffutils" ,diffutils-mesboot)
+                      ("kernel-headers" ,%bootstrap-linux-libre-headers)
+                      ("make" ,make-mesboot)))
+     (arguments
+      `(#:validate-runpath? #f
+        ,@(substitute-keyword-arguments (package-arguments gcc-mesboot1)
+            ((#:configure-flags configure-flags)
+             `(let ((out (assoc-ref %outputs "out"))
+                    (glibc (assoc-ref %build-inputs "libc")))
+                (list (string-append "--prefix=" out)
+                      "--build=i686-unknown-linux-gnu"
+                      "--host=i686-unknown-linux-gnu"
+
+                      "--with-host-libstdcxx=-lsupc++"
+
+                      (string-append "--with-native-system-header-dir=" glibc "/include")
+                      (string-append "--with-build-sysroot=" glibc "/include")
+
+                      "--disable-bootstrap"
+                      "--disable-decimal-float"
+                      "--disable-libatomic"
+                      "--disable-libcilkrts"
+                      "--disable-libgomp"
+                      "--disable-libitm"
+                      "--disable-libmudflap"
+                      "--disable-libquadmath"
+                      "--disable-libsanitizer"
+                      "--disable-libssp"
+                      "--disable-libvtv"
+                      "--disable-lto"
+                      "--disable-lto-plugin"
+                      "--disable-multilib"
+                      "--disable-plugin"
+                      "--disable-threads"
+                      "--enable-languages=c,c++"
+
+                      "--enable-static"
+                      "--enable-shared"
+                      "--enable-threads=single"
+
+                      ;; No pre-compiled libstdc++ headers, to save space.
+                      "--disable-libstdcxx-pch"
+
+                      ;; for libcpp ...
+                      "--disable-build-with-cxx")))
+            ((#:phases phases)
+             `(modify-phases ,phases
+                (replace 'setenv
+                  (lambda* (#:key outputs #:allow-other-keys)
+                    (let* ((out (assoc-ref outputs "out"))
+                           (binutils (assoc-ref %build-inputs "binutils"))
+                           (bash (assoc-ref %build-inputs "bash"))
+                           (gcc (assoc-ref %build-inputs "gcc"))
+                           (glibc (assoc-ref %build-inputs "libc"))
+                           (kernel-headers (assoc-ref %build-inputs "kernel-headers")))
+                      (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
+                      (setenv "C_INCLUDE_PATH" (string-append
+                                                gcc "/lib/gcc-lib/i686-unknown-linux-gnu/4.7.4/include"
+                                                ":" kernel-headers "/include"
+                                                ":" glibc "/include"
+                                                ":" (getcwd) "/mpfr/src"))
+                      (setenv "CPLUS_INCLUDE_PATH" (string-append
+                                                    gcc "/lib/gcc-lib/i686-unknown-linux-gnu/4.7.4/include"
+                                                    ":" kernel-headers "/include"
+                                                    ":" glibc "/include"
+                                                    ":" (getcwd) "/mpfr/src"))
+                      (setenv "LIBRARY_PATH" (string-append glibc "/lib"
+                                                            ":" gcc "/lib"))
+                      (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH"))
+                      (format (current-error-port) "CPLUS_INCLUDE_PATH=~a\n" (getenv "CPLUS_INCLUDE_PATH"))
+                      (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv "LIBRARY_PATH"))
+                      #t)))))))))))
+
+(define gcc-mesboot-wrapper
+  ;; We need this so gcc-mesboot can be used to create shared binaries that
+  ;; have the correct interpreter and runpath to libc.
+  (package-with-bootstrap-guile
+   (package
+     (inherit gcc-mesboot1-wrapper)
+     (name "gcc-mesboot-wrapper")
+     (source #f)
+     (inputs '())
+     (native-inputs `(("bash" ,%bootstrap-coreutils&co)
+                      ("libc" ,glibc-mesboot)
+                      ("gcc" ,gcc-mesboot))))))
+
+(define m4-mesboot
+  (package-with-bootstrap-guile
+   (package
+     (inherit m4)
+     (name "m4-mesboot")
+     (version "1.4")
+     (source (origin
+               (method url-fetch)
+               (uri (string-append "mirror://gnu/m4/m4-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "1f9bxj176kf3pvs350w2dfs8jgwhminywri5pyn01b11yc4yhsjw"))))
+     (supported-systems '("i686-linux" "x86_64-linux"))
+     (native-inputs `(("mes" ,mes-boot)
+                      ("tcc" ,tcc-boot)))
+     (arguments
+      `(#:phases
+        (modify-phases %standard-phases
+          (replace 'configure
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out")))
+                (setenv "CONFIG_SHELL" (string-append
+                                        (assoc-ref %build-inputs "bash")
+                                        "/bin/sh"))
+                (setenv "CC" "tcc -static")
+                (setenv "CPP" "tcc -E")
+                (invoke "./configure" (string-append "--prefix=" out)))))))))))
+
+(define (%bootstrap-inputs+toolchain)
+  ;; The traditional bootstrap-inputs.  For the i686-linux Reduced Binary Seed
+  ;; the actual reduced set with bootstrapped toolchain.
+  (append (match (%current-system)
+            ((or "i686-linux" "x86_64-linux")
+             `(("libc" ,glibc-mesboot)
+               ("binutils" ,binutils-mesboot)
+               ("gcc-wrapper" ,gcc-mesboot-wrapper)
+               ("gcc" ,gcc-mesboot)))
+            (_
+             '()))
+          (%bootstrap-inputs)))
+
 (define gnu-make-boot0
   (package-with-bootstrap-guile
    (package (inherit gnu-make)
@@ -100,16 +1419,18 @@
                       (install-file "make" bin)
                       #t))))))))
      (native-inputs '())                          ; no need for 'pkg-config'
-     (inputs %bootstrap-inputs))))
+     (inputs (%bootstrap-inputs+toolchain)))))
 
 (define diffutils-boot0
   (package-with-bootstrap-guile
    (let ((p (package-with-explicit-inputs diffutils
-                                          `(("make" ,gnu-make-boot0)
-                                            ,@%bootstrap-inputs)
+                                          (lambda _
+                                            `(("make" ,gnu-make-boot0)
+                                              ,@(%bootstrap-inputs+toolchain)))
                                           #:guile %bootstrap-guile)))
      (package (inherit p)
        (name "diffutils-boot0")
+       (native-inputs `())
        (arguments `(#:tests? #f         ; the test suite needs diffutils
                     ,@(package-arguments p)))))))
 
@@ -118,9 +1439,10 @@
    (package-with-explicit-inputs (package
                                    (inherit findutils)
                                    (name "findutils-boot0"))
-                                 `(("make" ,gnu-make-boot0)
-                                   ("diffutils" ,diffutils-boot0) ; for tests
-                                   ,@%bootstrap-inputs)
+                                 (lambda _
+                                   `(("make" ,gnu-make-boot0)
+                                     ("diffutils" ,diffutils-boot0) ; for tests
+                                     ,@(%bootstrap-inputs+toolchain)))
                                  (current-source-location)
                                  #:guile %bootstrap-guile)))
 
@@ -128,19 +1450,22 @@
   (package-with-bootstrap-guile
    (package-with-explicit-inputs (package
                                    (inherit file)
-                                   (name "file-boot0"))
-                                 `(("make" ,gnu-make-boot0)
-                                   ,@%bootstrap-inputs)
+                                   (name "file-boot0")
+                                   (arguments
+                                    '(#:strip-binaries? #f
+                                      #:validate-runpath? #f)))
+                                 (lambda _
+                                   `(("make" ,gnu-make-boot0)
+                                     ,@(%bootstrap-inputs+toolchain)))
                                  (current-source-location)
                                  #:guile %bootstrap-guile)))
 
-
-(define %boot0-inputs
+(define (%boot0-inputs)
   `(("make" ,gnu-make-boot0)
     ("diffutils" ,diffutils-boot0)
     ("findutils" ,findutils-boot0)
     ("file" ,file-boot0)
-    ,@%bootstrap-inputs))
+    ,@(%bootstrap-inputs+toolchain)))
 
 (define* (boot-triplet #:optional (system (%current-system)))
   ;; Return the triplet used to create the cross toolchain needed in the
@@ -149,8 +1474,9 @@
 
 ;; Following Linux From Scratch, build a cross-toolchain in stage 0.  That
 ;; toolchain actually targets the same OS and arch, but it has the advantage
-;; of being independent of the libc and tools in %BOOTSTRAP-INPUTS, since
-;; GCC-BOOT0 (below) is built without any reference to the target libc.
+;; of being independent of the libc and tools in
+;; (%BOOTSTRAP-INPUTS+TOOLCHAIN), since GCC-BOOT0 (below) is built without any
+;; reference to the target libc.
 
 (define binutils-boot0
   (package-with-bootstrap-guile
@@ -184,27 +1510,14 @@
             ((#:configure-flags cf)
              `(cons ,(string-append "--target=" (boot-triplet))
                     ,cf)))))
-     (inputs %boot0-inputs))))
-
-;; Use a "fixed" package source for this early libstdc++ variant so we can
-;; update GCC 4.9 without triggering a full rebuild.
-(define gcc-for-libstdc++
-  (package
-    (inherit gcc-4.9)
-    (source (origin
-              (inherit (package-source gcc-4.9))
-              (patches (search-patches "gcc-4.9-libsanitizer-fix.patch"
-                                       "gcc-arm-bug-71399.patch"
-                                       "gcc-asan-missing-include.patch"
-                                       "gcc-libvtv-runpath.patch"
-                                       "gcc-fix-texi2pod.patch"))))))
+     (inputs (%boot0-inputs)))))
 
 (define libstdc++-boot0
   ;; GCC's libcc1 is always built as a shared library (the top-level
   ;; 'Makefile.def' forcefully adds --enable-shared) and thus needs to refer
   ;; to libstdc++.so.  We cannot build libstdc++-5.3 because it relies on
   ;; C++14 features missing in some of our bootstrap compilers.
-  (let ((lib (package-with-bootstrap-guile (make-libstdc++ gcc-for-libstdc++))))
+  (let ((lib (package-with-bootstrap-guile (make-libstdc++ gcc-4.9))))
     (package
       (inherit lib)
       (name "libstdc++-boot0")
@@ -215,8 +1528,20 @@
          ;; XXX: libstdc++.so NEEDs ld.so for some reason.
          #:validate-runpath? #f
 
-         ,@(package-arguments lib)))
-      (inputs %boot0-inputs)
+         ,@(match (%current-system)
+             ((or "i686-linux" "x86_64-linux")
+              (substitute-keyword-arguments (package-arguments lib)
+                ((#:phases phases)
+                 `(modify-phases ,phases
+                    (add-after 'unpack 'workaround-wrapper-bug
+                      ;; XXX: The crude gcc-cross-wrapper causes "g++ -v" to
+                      ;; fail, which in turn confuses the configure script.
+                      (lambda _
+                        (substitute* "libstdc++-v3/configure"
+                          (("g\\+\\+ -v") "true"))
+                        #t))))))
+             (_ (package-arguments lib)))))
+      (inputs (%boot0-inputs))
       (native-inputs '()))))
 
 (define gcc-boot0
@@ -261,6 +1586,17 @@
                       (remove (cut string-match
                                 "--(with-system-zlib|enable-languages.*)" <>)
                               ,flags)))
+            ((#:make-flags flags)
+             `(let* ((libc        (assoc-ref %build-inputs "libc"))
+                     (libc-native (or (assoc-ref %build-inputs "libc-native")
+                                      libc)))
+                `(,(string-append "LDFLAGS="
+                                  "-Wl,-rpath=" libc-native "/lib "
+                                  "-Wl,-dynamic-linker "
+                                  "-Wl," libc-native ,(glibc-dynamic-linker
+                                                       (match (%current-system)
+                                                         ("x86_64-linux" "i686-linux")
+                                                         (_ (%current-system))))))))
             ((#:phases phases)
              `(modify-phases ,phases
                 (add-after 'unpack 'unpack-gmp&co
@@ -285,6 +1621,22 @@
                                          ,(package-name lib)))
                              (list gmp-6.0 mpfr mpc))
                       #t)))
+                ,(match (%current-system)
+                   ((or "i686-linux" "x86_64-linux")
+                    '(add-before 'configure 'fix-libcc1
+                      (lambda* (#:key inputs #:allow-other-keys)
+                        ;; libcc1.so NEEDs libgcc_s.so, so provide one here
+                        ;; to placate the 'validate-runpath' phase.
+                        (substitute* "libcc1/Makefile.in"
+                          (("la_LDFLAGS =")
+                           (string-append "la_LDFLAGS = -Wl,-rpath="
+                                          (assoc-ref inputs "gcc") "/lib")))
+                        ;; XXX: "g++ -v" is broken (see also libstdc++ above).
+                        (substitute* "libcc1/configure"
+                          (("g\\+\\+ -v") "true"))
+                        #t)))
+                   (_ '(add-before 'configure 'return-true
+                         (lambda _ #t))))
                 (add-after 'install 'symlink-libgcc_eh
                   (lambda* (#:key outputs #:allow-other-keys)
                     (let ((out (assoc-ref outputs "lib")))
@@ -307,8 +1659,8 @@
 
                ;; Call it differently so that the builder can check whether
                ;; the "libc" input is #f.
-               ("libc-native" ,@(assoc-ref %boot0-inputs "libc"))
-               ,@(alist-delete "libc" %boot0-inputs)))
+               ("libc-native" ,@(assoc-ref (%boot0-inputs) "libc"))
+               ,@(alist-delete "libc" (%boot0-inputs))))
 
      ;; No need for the native-inputs to build the documentation at this stage.
      (native-inputs `()))))
@@ -319,47 +1671,62 @@
                 (name "perl-boot0")
                 (arguments
                  ;; At the very least, this must not depend on GCC & co.
-                 (let ((args `(#:disallowed-references
+                 (let ((args `(#:validate-runpath? #f
+                               #:disallowed-references
                                ,(list %bootstrap-binutils))))
-                   (substitute-keyword-arguments (package-arguments perl)
-                     ((#:phases phases)
-                      `(modify-phases ,phases
-                         ;; Pthread support is missing in the bootstrap compiler
-                         ;; (broken spec file), so disable it.
-                         (add-before 'configure 'disable-pthreads
-                           (lambda _
-                             (substitute* "Configure"
-                               (("^libswanted=(.*)pthread" _ before)
-                                (string-append "libswanted=" before)))
-                             #t))))
-                     ;; Do not configure with '-Dusethreads' since pthread
-                     ;; support is missing.
-                     ((#:configure-flags configure-flags)
-                      `(delete "-Dusethreads" ,configure-flags))))))))
+                   `(,@args
+                     ,@(substitute-keyword-arguments (package-arguments perl)
+                         ((#:phases phases)
+                          `(modify-phases ,phases
+                             ;; Pthread support is missing in the bootstrap compiler
+                             ;; (broken spec file), so disable it.
+                             (add-before 'configure 'disable-pthreads
+                               (lambda _
+                                 (substitute* "Configure"
+                                   (("^libswanted=(.*)pthread" _ before)
+                                    (string-append "libswanted=" before)))
+                                 #t))))
+                         ;; Do not configure with '-Dusethreads' since pthread
+                         ;; support is missing.
+                         ((#:configure-flags configure-flags)
+                          `(delete "-Dusethreads" ,configure-flags)))))))))
     (package-with-bootstrap-guile
      (package-with-explicit-inputs perl
                                    %boot0-inputs
                                    (current-source-location)
                                    #:guile %bootstrap-guile))))
 
+(define m4-boot0
+  (package-with-bootstrap-guile
+   (package
+     (inherit m4)
+     (name "m4-boot0")
+     (inputs (%boot0-inputs))
+     (arguments
+      `(#:guile ,%bootstrap-guile
+        #:implicit-inputs? #f
+        ,@(package-arguments m4))))))
+
 (define bison-boot0
   ;; This Bison is needed to build MiG so we need it early in the process.
   ;; It is also needed to rebuild Bash's parser, which is modified by
   ;; its CVE patches.  Remove it when it's no longer needed.
-  (let* ((m4    (package-with-bootstrap-guile
-                 (package-with-explicit-inputs m4 %boot0-inputs
-                                               (current-source-location)
-                                               #:guile %bootstrap-guile)))
-         (bison (package (inherit bison)
+  (let* ((bison (package (inherit bison)
                   (propagated-inputs `(("m4" ,m4)))
                   (inputs '())                    ;remove Flex...
                   (arguments
-                   '(#:tests? #f                  ;... and thus disable tests
+                   `(#:tests? #f                  ;... and thus disable tests
 
                      ;; Zero timestamps in liby.a; this must be done
                      ;; explicitly here because the bootstrap Binutils don't
                      ;; do that (default is "cru".)
-                     #:make-flags '("ARFLAGS=crD" "RANLIB=ranlib -D"
+                     #:make-flags `("ARFLAGS=crD"
+                                    ,,(match (%current-system)
+                                        ;; ranlib: '-D': No such file
+                                        ((or "i686-linux" "x86_64-linux")
+                                         "RANLIB=ranlib")
+                                        (_
+                                         "RANLIB=ranlib -D"))
                                     "V=1"))))))
     (package
       (inherit (package-with-bootstrap-guile
@@ -394,12 +1761,12 @@
                            ,@(package-arguments linux-libre-headers)))
               (native-inputs
                `(("perl" ,perl-boot0)
-                 ,@%boot0-inputs))))))
+                 ,@(%boot0-inputs)))))))
 
 (define gnumach-headers-boot0
   (package-with-bootstrap-guile
    (package-with-explicit-inputs gnumach-headers
-                                 %boot0-inputs
+                                 (%boot0-inputs)
                                  (current-source-location)
                                  #:guile %bootstrap-guile)))
 
@@ -413,7 +1780,7 @@
                     `(,(string-append "LDFLAGS=-Wl,-rpath="
                                       (assoc-ref %build-inputs "flex") "/lib/")))))))
     (package-with-bootstrap-guile
-     (package-with-explicit-inputs mig %boot0-inputs
+     (package-with-explicit-inputs mig (%boot0-inputs)
                                    (current-source-location)
                                    #:guile %bootstrap-guile))))
 
@@ -422,7 +1789,7 @@
                         (native-inputs `(("mig" ,mig-boot0)))
                         (inputs '()))))
     (package-with-bootstrap-guile
-     (package-with-explicit-inputs hurd-headers %boot0-inputs
+     (package-with-explicit-inputs hurd-headers (%boot0-inputs)
                                    (current-source-location)
                                    #:guile %bootstrap-guile))))
 
@@ -431,7 +1798,7 @@
                         (native-inputs `(("mig" ,mig-boot0)))
                         (inputs '()))))
     (package-with-bootstrap-guile
-     (package-with-explicit-inputs hurd-minimal %boot0-inputs
+     (package-with-explicit-inputs hurd-minimal (%boot0-inputs)
                                    (current-source-location)
                                    #:guile %bootstrap-guile))))
 
@@ -447,7 +1814,7 @@ the bootstrap environment."
                `(("gnumach-headers" ,gnumach-headers-boot0)
                  ("hurd-headers" ,hurd-headers-boot0)
                  ("hurd-minimal" ,hurd-minimal-boot0)
-                 ,@%boot0-inputs))))))
+                 ,@(%boot0-inputs)))))))
 
 (define* (kernel-headers-boot0 #:optional (system (%current-system)))
   (match system
@@ -458,7 +1825,7 @@ the bootstrap environment."
   ;; Texinfo used to build libc's manual.
   ;; We build without ncurses because it fails to build at this stage, and
   ;; because we don't need the stand-alone Info reader.
-  ;; Also, use %BOOT0-INPUTS to avoid building Perl once more.
+  ;; Also, use (%BOOT0-INPUTS) to avoid building Perl once more.
   (let ((texinfo (package (inherit texinfo)
                    (native-inputs '())
                    (inputs `(("perl" ,perl-boot0)))
@@ -472,21 +1839,22 @@ the bootstrap environment."
                                    (current-source-location)
                                    #:guile %bootstrap-guile))))
 
-(define ld-wrapper-boot0
+(define (ld-wrapper-boot0)
   ;; We need this so binaries on Hurd will have libmachuser and libhurduser
   ;; in their RUNPATH, otherwise validate-runpath will fail.
   (make-ld-wrapper "ld-wrapper-boot0"
                    #:target boot-triplet
                    #:binutils binutils-boot0
                    #:guile %bootstrap-guile
-                   #:bash (car (assoc-ref %boot0-inputs "bash"))))
+                   #:bash (car (assoc-ref (%boot0-inputs) "bash"))
+                   #:guile-for-build %bootstrap-guile))
 
-(define %boot1-inputs
+(define (%boot1-inputs)
   ;; 2nd stage inputs.
   `(("gcc" ,gcc-boot0)
-    ("ld-wrapper-cross" ,ld-wrapper-boot0)
+    ("ld-wrapper-cross" ,(ld-wrapper-boot0))
     ("binutils-cross" ,binutils-boot0)
-    ,@(alist-delete "binutils" %boot0-inputs)))
+    ,@(alist-delete "binutils" (%boot0-inputs))))
 
 (define glibc-final-with-bootstrap-bash
   ;; The final libc, "cross-built".  If everything went well, the resulting
@@ -542,7 +1910,7 @@ the bootstrap environment."
      (inputs
       `(;; The boot inputs.  That includes the bootstrap libc.  We don't want
         ;; it in $CPATH, hence the 'pre-configure' phase above.
-        ,@%boot1-inputs
+        ,@(%boot1-inputs)
 
         ;; A native MiG is needed to build Glibc on Hurd.
         ,@(if (hurd-triplet? (%current-system))
@@ -550,11 +1918,11 @@ the bootstrap environment."
               '())
 
         ;; A native GCC is needed to build `cross-rpcgen'.
-        ("native-gcc" ,@(assoc-ref %boot0-inputs "gcc"))
+        ("native-gcc" ,@(assoc-ref (%boot0-inputs) "gcc"))
 
         ;; Here, we use the bootstrap Bash, which is not satisfactory
         ;; because we don't want to depend on bootstrap tools.
-        ("static-bash" ,@(assoc-ref %boot0-inputs "bash")))))))
+        ("static-bash" ,@(assoc-ref (%boot0-inputs) "bash")))))))
 
 (define (cross-gcc-wrapper gcc binutils glibc bash)
   "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
@@ -609,35 +1977,41 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
        ("bash" ,bash)))
     (inputs '())))
 
+(define (gcc-boot0-intermediate-wrapped)
+  ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
+  ;; non-cross names.
+  (cross-gcc-wrapper gcc-boot0 binutils-boot0
+                     glibc-final-with-bootstrap-bash
+                     (car (assoc-ref (%boot1-inputs) "bash"))))
+
 (define static-bash-for-glibc
   ;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
-  (let* ((gcc  (cross-gcc-wrapper gcc-boot0 binutils-boot0
-                                  glibc-final-with-bootstrap-bash
-                                  (car (assoc-ref %boot1-inputs "bash"))))
-         (bash (package
-                 (inherit static-bash)
-                 (arguments
-                  (substitute-keyword-arguments
-                      (package-arguments static-bash)
-                    ((#:guile _ #f)
-                     '%bootstrap-guile)
-                    ((#:configure-flags flags '())
-                     ;; Add a '-L' flag so that the pseudo-cross-ld of
-                     ;; BINUTILS-BOOT0 can find libc.a.
-                     `(append ,flags
-                              (list (string-append "LDFLAGS=-static -L"
-                                                   (assoc-ref %build-inputs
-                                                              "libc:static")
-                                                   "/lib"))))))))
-         (inputs `(("gcc" ,gcc)
-                   ("libc" ,glibc-final-with-bootstrap-bash)
-                   ("libc:static" ,glibc-final-with-bootstrap-bash "static")
-                   ,@(fold alist-delete %boot1-inputs
-                           '("gcc" "libc")))))
+  (let ((bash (package
+                (inherit static-bash)
+                (arguments
+                 (substitute-keyword-arguments
+                     (package-arguments static-bash)
+                   ((#:guile _ #f)
+                    '%bootstrap-guile)
+                   ((#:configure-flags flags '())
+                    ;; Add a '-L' flag so that the pseudo-cross-ld of
+                    ;; BINUTILS-BOOT0 can find libc.a.
+                    `(append ,flags
+                             (list (string-append "LDFLAGS=-static -L"
+                                                  (assoc-ref %build-inputs
+                                                             "libc:static")
+                                                  "/lib")))))))))
     (package-with-bootstrap-guile
-     (package-with-explicit-inputs bash inputs
-                                   (current-source-location)
-                                   #:guile %bootstrap-guile))))
+     (package-with-explicit-inputs
+      bash
+      (lambda _
+        `(("gcc" ,(gcc-boot0-intermediate-wrapped))
+          ("libc" ,glibc-final-with-bootstrap-bash)
+          ("libc:static" ,glibc-final-with-bootstrap-bash "static")
+          ,@(fold alist-delete (%boot1-inputs)
+                  '("gcc" "libc"))))
+      (current-source-location)
+      #:guile %bootstrap-guile))))
 
 (define gettext-boot0
   ;; A minimal gettext used during bootstrap.
@@ -703,18 +2077,18 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
 
          ,@(package-arguments glibc-final-with-bootstrap-bash))))))
 
-(define gcc-boot0-wrapped
+(define (gcc-boot0-wrapped)
   ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
   ;; non-cross names.
   (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final
-                     (car (assoc-ref %boot1-inputs "bash"))))
+                     (car (assoc-ref (%boot1-inputs) "bash"))))
 
-(define %boot2-inputs
+(define (%boot2-inputs)
   ;; 3rd stage inputs.
   `(("libc" ,glibc-final)
     ("libc:static" ,glibc-final "static")
-    ("gcc" ,gcc-boot0-wrapped)
-    ,@(fold alist-delete %boot1-inputs '("libc" "gcc"))))
+    ("gcc" ,(gcc-boot0-wrapped))
+    ,@(fold alist-delete (%boot1-inputs) '("libc" "gcc" "linux-libre-headers"))))
 
 (define binutils-final
   (package-with-bootstrap-guile
@@ -724,7 +2098,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
         #:implicit-inputs? #f
         #:allowed-references ("out" ,glibc-final)
         ,@(package-arguments binutils)))
-     (inputs %boot2-inputs))))
+     (inputs (%boot2-inputs)))))
 
 (define libstdc++
   ;; Intermediate libstdc++ that will allow us to build the final GCC
@@ -750,7 +2124,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                                              (assoc-ref %outputs "out")
                                              "/include"))))
       (outputs '("out"))
-      (inputs %boot2-inputs)
+      (inputs (%boot2-inputs))
       (synopsis "GNU C++ standard library (intermediate)"))))
 
 (define zlib-final
@@ -763,14 +2137,15 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
         #:implicit-inputs? #f
         #:allowed-references ("out" ,glibc-final)
         ,@(package-arguments zlib)))
-     (inputs %boot2-inputs))))
+     (inputs (%boot2-inputs)))))
 
-(define ld-wrapper-boot3
+(define (ld-wrapper-boot3)
   ;; A linker wrapper that uses the bootstrap Guile.
   (make-ld-wrapper "ld-wrapper-boot3"
                    #:binutils binutils-final
                    #:guile %bootstrap-guile
-                   #:bash (car (assoc-ref %boot2-inputs "bash"))))
+                   #:bash (car (assoc-ref (%boot2-inputs) "bash"))
+                   #:guile-for-build %bootstrap-guile))
 
 (define gcc-final
   ;; The final GCC.
@@ -794,17 +2169,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
        ;; positive, so turn it off.
        #:validate-runpath? #f
 
-       ;; Build again GMP & co. within GCC's build process, because it's hard
-       ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
-       ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
-       ,@(substitute-keyword-arguments (package-arguments gcc-boot0)
-           ((#:configure-flags boot-flags)
-            (let loop ((args (package-arguments gcc)))
-              (match args
-                ((#:configure-flags normal-flags _ ...)
-                 normal-flags)
-                ((_ rest ...)
-                 (loop rest)))))
+       ,@(substitute-keyword-arguments (package-arguments gcc)
            ((#:make-flags flags)
             ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
             `(let ((zlib (assoc-ref %build-inputs "zlib")))
@@ -816,8 +2181,33 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                                          zlib "/lib")
                           flag))
                     ,flags)))
+           ;; Build again GMP & co. within GCC's build process, because it's hard
+           ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
+           ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
            ((#:phases phases)
-            `(alist-delete 'symlink-libgcc_eh ,phases)))))
+            `(modify-phases ,phases
+                (add-after 'unpack 'unpack-gmp&co
+                  (lambda* (#:key inputs #:allow-other-keys)
+                    (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
+                          (mpfr (assoc-ref %build-inputs "mpfr-source"))
+                          (mpc  (assoc-ref %build-inputs "mpc-source")))
+
+                      ;; To reduce the set of pre-built bootstrap inputs, build
+                      ;; GMP & co. from GCC.
+                      (for-each (lambda (source)
+                                  (invoke "tar" "xvf" source))
+                                (list gmp mpfr mpc))
+
+                      ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
+                      ,@(map (lambda (lib)
+                               ;; Drop trailing letters, as gmp-6.0.0a unpacks
+                               ;; into gmp-6.0.0.
+                               `(symlink ,(string-trim-right
+                                           (package-full-name lib "-")
+                                           char-set:letter)
+                                         ,(package-name lib)))
+                             (list gmp-6.0 mpfr mpc))
+                      #t))))))))
 
     ;; This time we want Texinfo, so we get the manual.  Add
     ;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of
@@ -831,17 +2221,17 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
     (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
               ("mpfr-source" ,(package-source mpfr))
               ("mpc-source" ,(package-source mpc))
-              ("ld-wrapper" ,ld-wrapper-boot3)
+              ("ld-wrapper" ,(ld-wrapper-boot3))
               ("binutils" ,binutils-final)
               ("libstdc++" ,libstdc++)
               ("zlib" ,zlib-final)
-              ,@%boot2-inputs))))
+              ,@(%boot2-inputs)))))
 
-(define %boot3-inputs
+(define (%boot3-inputs)
   ;; 4th stage inputs.
   `(("gcc" ,gcc-final)
-    ("ld-wrapper" ,ld-wrapper-boot3)
-    ,@(alist-delete "gcc" %boot2-inputs)))
+    ("ld-wrapper" ,(ld-wrapper-boot3))
+    ,@(alist-delete "gcc" (%boot2-inputs))))
 
 (define bash-final
   ;; Link with `-static-libgcc' to make sure we don't retain a reference
@@ -851,7 +2241,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                 (inherit bash-minimal)
                 (arguments
                  `(#:disallowed-references
-                   ,(assoc-ref %boot3-inputs "coreutils&co")
+                   ,(assoc-ref (%boot3-inputs) "coreutils&co")
                    ,@(package-arguments bash-minimal))))))
     (package-with-bootstrap-guile
      (package-with-explicit-inputs (static-libgcc-package bash)
@@ -859,10 +2249,10 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                                    (current-source-location)
                                    #:guile %bootstrap-guile))))
 
-(define %boot4-inputs
+(define (%boot4-inputs)
   ;; Now use the final Bash.
   `(("bash" ,bash-final)
-    ,@(alist-delete "bash" %boot3-inputs)))
+    ,@(alist-delete "bash" (%boot3-inputs))))
 
 (define-public guile-final
   ;; This package must be public because other modules refer to it.  However,
@@ -894,19 +2284,20 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                    #:guile guile-final
                    #:bash bash-final))
 
-(define %boot5-inputs
+(define (%boot5-inputs)
   ;; Now with UTF-8 locales.  Remember that the bootstrap binaries were built
   ;; with an older libc, which cannot load the new locale format.  See
   ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
   `(("locales" ,glibc-utf8-locales-final)
-    ,@%boot4-inputs))
+    ,@(%boot4-inputs)))
 
 (define gnu-make-final
   ;; The final GNU Make, which uses the final Guile.
   (package-with-bootstrap-guile
    (package-with-explicit-inputs gnu-make
-                                 `(("guile" ,guile-final)
-                                   ,@%boot5-inputs)
+                                 (lambda _
+                                   `(("guile" ,guile-final)
+                                     ,@(%boot5-inputs)))
                                  (current-source-location))))
 
 (define coreutils-final
@@ -934,11 +2325,11 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                      (inputs (alist-delete "pcre" (package-inputs grep)))
                      (native-inputs `(("perl" ,perl-boot0))))))
 
-(define %boot6-inputs
+(define (%boot6-inputs)
   ;; Now use the final Coreutils.
   `(("coreutils" ,coreutils-final)
     ("grep" ,grep-final)
-    ,@%boot5-inputs))
+    ,@(%boot5-inputs)))
 
 (define sed-final
   ;; The final sed.
diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index b6f07dfa9a..6314546667 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -197,14 +197,14 @@ adding and extracting files to/from a tar archive.")
 (define-public gzip
   (package
    (name "gzip")
-   (version "1.9")
+   (version "1.10")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/gzip/gzip-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "16h8g4acy7fgfxcjacr3wijjsnixwsfd2jhz3zwdi2qrzi262l5f"))))
+              "1h6p374d3j8d4cdfydzls021xa2yby8myc0h8d6m8bc7k6ncq9c4"))))
    (build-system gnu-build-system)
    (synopsis "General file (de)compression (using lzw)")
    (arguments
@@ -420,6 +420,23 @@ compressed with pbzip2 can be decompressed with bzip2).")
              (base32
               "0ibi2zsfaz6l756spjwc5rayf4ckgc9hwmy8qinppcyk4svz64mm"))))
    (build-system gnu-build-system)
+   (arguments
+    `(#:phases
+      (modify-phases %standard-phases
+        (add-after 'install 'move-static-lib
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let ((out    (assoc-ref outputs "out"))
+                  (static (assoc-ref outputs "static")))
+              (mkdir-p (string-append static "/lib"))
+              (rename-file (string-append out "/lib/liblzma.a")
+                           (string-append static "/lib/liblzma.a"))
+              ;; Remove reference to the static library from the .la file
+              ;; so Libtool does the right thing when both the shared and
+              ;; static library is available.
+              (substitute* (string-append out "/lib/liblzma.la")
+                (("^old_library='liblzma.a'") "old_library=''"))
+              #t))))))
+   (outputs '("out" "static"))
    (synopsis "General-purpose data compression")
    (description
     "XZ Utils is free general-purpose data compression software with high
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index bb3d6d916a..2fcb7fb36b 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -454,23 +454,6 @@ XBINUTILS and the cross tool chain."
                           flags)))
              ((#:phases phases)
               `(modify-phases ,phases
-                 ;; XXX: The hack below allows us to make sure the
-                 ;; 'apply-hurd-patch' phase gets added in the first
-                 ;; cross-libc, but does *not* get added twice subsequently
-                 ;; when cross-building another libc.
-                 ,@(if (and (hurd-triplet? target)
-                            (not (hurd-target?)))
-                       `((add-after 'unpack 'apply-hurd-patch
-                           (lambda* (#:key inputs native-inputs
-                                     #:allow-other-keys)
-                             ;; TODO: Move this to 'patches' field.
-                             (let ((patch (or (assoc-ref native-inputs
-                                                         "hurd-magic-pid-patch")
-                                              (assoc-ref inputs
-                                                         "hurd-magic-pid-patch"))))
-                               (invoke "patch" "-p1" "--force" "--input"
-                                       patch)))))
-                       '())
                  (add-before 'configure 'set-cross-kernel-headers-path
                    (lambda* (#:key inputs #:allow-other-keys)
                      (let* ((kernel (assoc-ref inputs "kernel-headers"))
@@ -494,9 +477,7 @@ XBINUTILS and the cross tool chain."
                            ,@(if (hurd-triplet? target)
                                  `(("cross-mig"
                                     ,@(assoc-ref (package-native-inputs xheaders)
-                                                 "cross-mig"))
-                                   ("hurd-magic-pid-patch"
-                                    ,(search-patch "glibc-hurd-magic-pid.patch")))
+                                                 "cross-mig")))
                                  '())
                            ,@(package-inputs libc)     ;FIXME: static-bash
                            ,@(package-native-inputs libc)))))))
diff --git a/gnu/packages/ed.scm b/gnu/packages/ed.scm
index d30d7bcfa8..c2198763ef 100644
--- a/gnu/packages/ed.scm
+++ b/gnu/packages/ed.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,14 +28,14 @@
 (define-public ed
   (package
     (name "ed")
-    (version "1.14.2")
+    (version "1.15")
     (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnu/ed/ed-"
                                  version ".tar.lz"))
              (sha256
               (base32
-               "1nqhk3n1s1p77g2bjnj55acicsrlyb2yasqxqwpx0w0djfx64ygm"))))
+               "0x6ivy5k0d7dy5z9g8q8nipr89m4qbk2ink2898qq43smp08ji5d"))))
     (build-system gnu-build-system)
     (native-inputs `(("lzip" ,lzip)))
     (arguments
diff --git a/gnu/packages/file.scm b/gnu/packages/file.scm
index 4518c8d3dc..24ed37a9d2 100644
--- a/gnu/packages/file.scm
+++ b/gnu/packages/file.scm
@@ -31,11 +31,11 @@
   (package
     (name "file")
     (version "5.33")
-    (replacement file/fixed)
     (source (origin
               (method url-fetch)
               (uri (string-append "ftp://ftp.astron.com/pub/file/file-"
                                   version ".tar.gz"))
+              (patches (search-patches "file-CVE-2018-10360.patch"))
               (sha256
                (base32
                 "1iipnwjkag7q04zjkaqic41r9nlw0ml6mhqian6qkkbisb1whlhw"))))
@@ -53,10 +53,3 @@ extensions to tell you the type of a file, but looks at the actual contents
 of the file.  This package provides the libmagic library.")
    (license bsd-2)
    (home-page "https://www.darwinsys.com/file/")))
-
-(define file/fixed
-  (package
-    (inherit file)
-    (source
-      (origin (inherit (package-source file))
-              (patches (search-patches "file-CVE-2018-10360.patch"))))))
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index 5148a6aec3..5d2df5442f 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2017 Petter <petter@mykolab.ch>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
+;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -33,6 +34,8 @@
   #:use-module (gnu packages bison)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages docbook)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages enlightenment)
   #:use-module (gnu packages file)
   #:use-module (gnu packages flex)
@@ -118,14 +121,21 @@
                             "sysconfdir=/tmp/dummy"
                             "install"))))))
     (native-inputs
-     `(("pkg-config" ,pkg-config)))
+     `(("pkg-config" ,pkg-config)
+       ;; Dependencies to generate the doc.
+       ("docbook-xml" ,docbook-xml-4.4)
+       ("docbook-xsl" ,docbook-xsl)
+       ("doxygen" ,doxygen)
+       ("xmlto" ,xmlto)
+       ("libxml2" ,libxml2)             ;for XML_CATALOG_FILES
+       ("libxslt" ,libxslt)
+       ("yelp-tools" ,yelp-tools)))
     (inputs
      `(("expat" ,expat)
-
        ;; Add a dependency on libx11 so that 'dbus-launch' has support for
        ;; '--autolaunch'.
        ("libx11" ,libx11)))
-
+    (outputs '("out" "doc"))            ;22 MiB of HTML doc
     (home-page "https://www.freedesktop.org/wiki/Software/dbus/")
     (synopsis "Message bus for inter-process communication (IPC)")
     (description
diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index 2b3ee89d35..2ef165946e 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2017 Petter <petter@mykolab.ch>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -100,16 +101,14 @@ Daemon and possibly more in the future.")
 (define-public libgcrypt
   (package
     (name "libgcrypt")
-    (version "1.8.3")
+    (version "1.8.4")
     (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnupg/libgcrypt/libgcrypt-"
                                  version ".tar.bz2"))
              (sha256
               (base32
-               "0z5gs1khzyknyfjr19k8gk4q148s6q987ya85cpn0iv70fz91v36"))
-             (patches
-              (search-patches "libgcrypt-make-yat2m-reproducible.patch"))))
+               "09r27ywj9zplq6n9qw3mn7zmvf6y2jdmwx5d1kg8yqkj0qx18f7n"))))
     (build-system gnu-build-system)
     (propagated-inputs
      `(("libgpg-error-host" ,libgpg-error)))
diff --git a/gnu/packages/groff.scm b/gnu/packages/groff.scm
index cf392f5468..dd679f1582 100644
--- a/gnu/packages/groff.scm
+++ b/gnu/packages/groff.scm
@@ -3,6 +3,8 @@
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2019 Eric Bavier <bavier@member.fsf.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -36,14 +38,13 @@
 (define-public groff
   (package
    (name "groff")
-   (version "1.22.3")
+   (version "1.22.4")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/groff/groff-" version
                                 ".tar.gz"))
             (sha256 (base32
-                     "1998v2kcs288d3y7kfxpvl369nqi06zbbvjzafyvyl3pr7bajj1s"))
-            (patches (search-patches "groff-source-date-epoch.patch"))))
+                     "14q2mldnr1vx0l9lqp9v2f6iww24gj28iyh4j2211hyynx67p3p7"))))
    (build-system gnu-build-system)
    (outputs '("out"
               "doc"))                    ;12MiB of PS, PDF, HTML, and examples
@@ -65,7 +66,11 @@
         (add-after 'unpack 'setenv
           (lambda _
             (setenv "GS_GENERATE_UUIDS" "0")
-            #t)))))
+            #t))
+        (add-after 'unpack 'fix-docdir
+          (lambda _         ;see https://savannah.gnu.org/bugs/index.php?55461
+            (substitute* "Makefile.in"
+              (("^docdir =.*") "docdir = @docdir@\n")))))))
    (synopsis "Typesetting from plain text mixed with formatting commands")
    (description
     "Groff is a typesetting package that reads plain text and produces
@@ -91,7 +96,7 @@ is usually the formatter of \"man\" documentation pages.")
     (arguments
      `(#:disallowed-references (,perl)
 
-       #:configure-flags '("--docdir=/tmp/trash/doc")
+       #:configure-flags '("--with-doc=no")
 
        ,@(substitute-keyword-arguments (package-arguments groff)
            ((#:phases phases)
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 6457127520..1f1c8433d1 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -86,7 +86,7 @@
 (define-public libpng
   (package
    (name "libpng")
-   (version "1.6.34")
+   (version "1.6.36")
    (source (origin
             (method url-fetch)
             (uri (list (string-append "mirror://sourceforge/libpng/libpng16/"
@@ -99,7 +99,7 @@
                         "/libpng16/libpng-" version ".tar.xz")))
             (sha256
              (base32
-              "1xjr0v34fyjgnhvaa1zixcpx5yvxcg4zwvfh0fyklfyfj86rc7ig"))))
+              "06d35a3xz2a0kph82r56hqm1fn8fbwrqs07xzmr93dx63x695szc"))))
    (build-system gnu-build-system)
 
    ;; libpng.la says "-lz", so propagate it.
diff --git a/gnu/packages/kerberos.scm b/gnu/packages/kerberos.scm
index 873f5d8a37..7cf61c8d0f 100644
--- a/gnu/packages/kerberos.scm
+++ b/gnu/packages/kerberos.scm
@@ -49,7 +49,7 @@
 (define-public mit-krb5
   (package
     (name "mit-krb5")
-    (version "1.16.2")
+    (version "1.17")
     (source (origin
               (method url-fetch)
               (uri (list
@@ -61,7 +61,7 @@
                                    "/krb5-" version ".tar.gz")))
               (sha256
                (base32
-                "09zhhzj19bmjjxsvxdrysabql8n72kjivis08wbikhlkwlgiwwlz"))))
+                "1xc1ly09697b7g2vngvx76szjqy9769kpgn27lnp1r9xln224vjs"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("bison" ,bison)
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index c6002eb63a..86e331b34d 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,14 +38,18 @@
   #:use-module (gnu packages libunistring)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages hurd)
+  #:use-module (gnu packages mes)
   #:use-module (gnu packages multiprecision)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
   #:export (%bootstrap-binaries-tarball
+            %linux-libre-headers-bootstrap-tarball
             %binutils-bootstrap-tarball
             %glibc-bootstrap-tarball
             %gcc-bootstrap-tarball
             %guile-bootstrap-tarball
+            %mescc-tools-bootstrap-tarball
+            %mes-bootstrap-tarball
             %bootstrap-tarballs
 
             %guile-static-stripped))
@@ -154,6 +159,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                                "LDFLAGS = -static"))
                             #t))))))))
         (xz (package (inherit xz)
+              (outputs '("out"))
               (arguments
                `(#:strip-flags '("--strip-all")
                  #:phases (modify-phases %standard-phases
@@ -300,6 +306,26 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
     (license gpl3+)
     (home-page #f)))
 
+(define %linux-libre-headers-stripped
+  ;; The subset of Linux-Libre-Headers that we need.
+  (package (inherit linux-libre-headers)
+    (name (string-append (package-name linux-libre-headers) "-stripped"))
+    (build-system trivial-build-system)
+    (outputs '("out"))
+    (arguments
+     `(#:modules ((guix build utils)
+                  (guix build make-bootstrap))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (guix build make-bootstrap))
+
+         (let* ((in  (assoc-ref %build-inputs "linux-libre-headers"))
+                (out (assoc-ref %outputs "out")))
+           (copy-linux-headers out in)
+           #t))))
+    (inputs `(("linux-libre-headers" ,linux-libre-headers)))))
+
 (define %binutils-static
   ;; Statically-linked Binutils.
   (package (inherit binutils)
@@ -513,6 +539,43 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
            #t))))
     (inputs `(("gcc" ,%gcc-static)))))
 
+(define %mescc-tools-static
+  ;; A statically linked MesCC Tools for bootstrap.
+  (package
+    (inherit mescc-tools)
+    (name "mescc-tools-static")
+    (arguments
+     `(#:system "i686-linux"
+       ,@(substitute-keyword-arguments (package-arguments mescc-tools)
+           ((#:make-flags flags)
+            `(cons "CC=gcc -static" ,flags)))))))
+
+(define-public %mes-minimal-stripped
+  ;; A minimal Mes without documentation dependencies, for bootstrap.
+  (let ((triplet "i686-unknown-linux-gnu"))
+    (package
+      (inherit mes)
+      (name "mes-minimal-stripped")
+      (native-inputs
+       `(("guile" ,guile-2.2)))
+      (arguments
+       `(#:system "i686-linux"
+         #:strip-binaries? #f
+         #:configure-flags '("--mes")
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'install 'strip-install
+             (lambda _
+               (let* ((out (assoc-ref %outputs "out"))
+                      (share (string-append out "/share")))
+                 (delete-file-recursively (string-append out "/lib/guile"))
+                 (delete-file-recursively (string-append share "/guile"))
+                 (delete-file-recursively (string-append share "/mes/scaffold"))
+                 (for-each
+                  delete-file
+                  (find-files (string-append share  "/mes/lib")
+                              "\\.(h|c)")))))))))))
+
 (define %guile-static
   ;; A statically-linked Guile that is relocatable--i.e., it can search
   ;; .scm and .go files relative to its installation directory, rather
@@ -660,6 +723,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
   ;; A tarball with the statically-linked bootstrap binaries.
   (tarball-package %static-binaries))
 
+(define %linux-libre-headers-bootstrap-tarball
+  ;; A tarball with the statically-linked Linux-Libre-Headers programs.
+  (tarball-package %linux-libre-headers-stripped))
+
 (define %binutils-bootstrap-tarball
   ;; A tarball with the statically-linked Binutils programs.
   (tarball-package %binutils-static-stripped))
@@ -676,6 +743,14 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
   ;; A tarball with the statically-linked, relocatable Guile.
   (tarball-package %guile-static-stripped))
 
+(define %mescc-tools-bootstrap-tarball
+  ;; A tarball with MesCC binary seed.
+  (tarball-package %mescc-tools-static))
+
+(define %mes-bootstrap-tarball
+  ;; A tarball with Mes ASCII Seed and binary Mes C Library.
+  (tarball-package %mes-minimal-stripped))
+
 (define %bootstrap-tarballs
   ;; A single derivation containing all the bootstrap tarballs, for
   ;; convenience.
@@ -704,9 +779,15 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                    %build-inputs)
          #t)))
     (inputs `(("guile-tarball" ,%guile-bootstrap-tarball)
-              ("gcc-tarball" ,%gcc-bootstrap-tarball)
-              ("binutils-tarball" ,%binutils-bootstrap-tarball)
-              ("glibc-tarball" ,(%glibc-bootstrap-tarball))
+              ,@(match (%current-system)
+                  ((or "i686-linux" "x86_64-linux")
+                   `(("bootstrap-mescc-tools" ,%mescc-tools-bootstrap-tarball)
+                     ("bootstrap-mes" ,%mes-bootstrap-tarball)
+                     ("bootstrap-linux-libre-headers"
+                      ,%linux-libre-headers-bootstrap-tarball)))
+                  (_ `(("gcc-tarball" ,%gcc-bootstrap-tarball)
+                       ("binutils-tarball" ,%binutils-bootstrap-tarball)
+                       ("glibc-tarball" ,(%glibc-bootstrap-tarball)))))
               ("coreutils&co-tarball" ,%bootstrap-binaries-tarball)))
     (synopsis "Tarballs containing all the bootstrap binaries")
     (description synopsis)
diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm
index c45e267875..9aff59ab1d 100644
--- a/gnu/packages/mes.scm
+++ b/gnu/packages/mes.scm
@@ -21,7 +21,6 @@
 (define-module (gnu packages mes)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
-  #:use-module (gnu packages commencement)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages graphviz)
@@ -102,31 +101,33 @@ Guile.")
       (license gpl3+))))
 
 (define-public mescc-tools
-  (package
-    (name "mescc-tools")
-    (version "0.5.2")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "http://git.savannah.nongnu.org/cgit/mescc-tools.git/snapshot/"
-                    name "-Release_" version
-                    ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
-              (sha256
-               (base32
-                "01x7bhmgwyf6mc2g1hcvibhps98nllacqm4f0j5l51b1mbi18pc2"))))
-    (build-system gnu-build-system)
-    (supported-systems '("i686-linux" "x86_64-linux"))
-    (arguments
-     `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
-       #:test-target "test"
-       #:phases (modify-phases %standard-phases
-                  (delete 'configure))))
-    (synopsis "Tools for the full source bootstrapping process")
-    (description
-     "Mescc-tools is a collection of tools for use in a full source
+  (let ((commit "bb062b0da7bf2724ca40f9002b121579898d4ef7")
+        (revision "0")
+        (version "0.5.2"))
+    (package
+      (name "mescc-tools")
+      (version (string-append version "-" revision "." (string-take commit 7)))
+      (source (origin
+                (method url-fetch)
+                (uri (string-append
+                      "https://git.savannah.nongnu.org/cgit/mescc-tools.git/snapshot/"
+                      name "-" commit
+                      ".tar.gz"))
+                (sha256
+                 (base32
+                  "1h6j57wyf91i42b26f8msbv6451cw3nm4nmpl1fckp9c7vi8mwkh"))))
+      (build-system gnu-build-system)
+      (supported-systems '("i686-linux" "x86_64-linux"))
+      (arguments
+       `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
+         #:test-target "test"
+         #:phases (modify-phases %standard-phases
+                    (delete 'configure))))
+      (synopsis "Tools for the full source bootstrapping process")
+      (description
+       "Mescc-tools is a collection of tools for use in a full source
 bootstrapping process.  It consists of the M1 macro assembler, the hex2
 linker, the blood-elf symbol table generator, the kaem shell, exec_enable and
 get_machine.")
     (home-page "https://savannah.nongnu.org/projects/mescc-tools")
-    (license gpl3+)))
+    (license gpl3+))))
diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm
index c17321a9b3..9f434dabe3 100644
--- a/gnu/packages/multiprecision.scm
+++ b/gnu/packages/multiprecision.scm
@@ -93,13 +93,13 @@ algebra.")
 (define-public mpfr
   (package
    (name "mpfr")
-   (version "4.0.1")
+   (version "4.0.2")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/mpfr/mpfr-" version
                                 ".tar.xz"))
             (sha256 (base32
-                     "0vp1lrc08gcmwdaqck6bpzllkrykvp06vz5gnqpyw0v3h9h4m1v7"))))
+                     "12m3amcavhpqygc499s3fzqlb8f2j2rr7fkqsm10xbjfc04fffqx"))))
    (build-system gnu-build-system)
    (outputs '("out" "debug"))
    (propagated-inputs `(("gmp" ,gmp)))            ; <mpfr.h> refers to <gmp.h>
diff --git a/gnu/packages/patches/binutils-boot-2.20.1a.patch b/gnu/packages/patches/binutils-boot-2.20.1a.patch
new file mode 100644
index 0000000000..7e5762ceb4
--- /dev/null
+++ b/gnu/packages/patches/binutils-boot-2.20.1a.patch
@@ -0,0 +1,157 @@
+This patch enables building binutils using TCC and Mes C Library
+
+  * disable building DOC
+  * remove signed int trickery that does not work with TCC
+  * fixe the malloc prototype to use size_t
+  * add missing includes
+  * remove C99'isms to avoid of mixing code and variable declaration
+  * [MES_BOOTSTRAP]: remove strncmp to avoid duplicat symbol
+
+Upstream status: Not presented upstream.
+
+diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/bfd/elf32-i386.c binutils-2.20.1a/bfd/elf32-i386.c
+--- ../binutils-2.20.1a/bfd/elf32-i386.c	2009-09-10 13:47:12.000000000 +0200
++++ binutils-2.20.1a/bfd/elf32-i386.c	2018-06-23 19:33:20.068134411 +0200
+@@ -4254,6 +4254,7 @@ elf_i386_finish_dynamic_symbol (bfd *out
+ 	      if (!h->pointer_equality_needed)
+ 		abort ();
+ 
++              {
+ 	      /* For non-shared object, we can't use .got.plt, which
+ 		 contains the real function addres if we need pointer
+ 		 equality.  We load the GOT entry with the PLT entry.  */
+@@ -4262,6 +4263,7 @@ elf_i386_finish_dynamic_symbol (bfd *out
+ 			  (plt->output_section->vma
+ 			   + plt->output_offset + h->plt.offset),
+ 			  htab->elf.sgot->contents + h->got.offset);
++              }
+ 	      return TRUE;
+ 	    }
+ 	}
+diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/bfd/elfcode.h binutils-2.20.1a/bfd/elfcode.h
+--- ../binutils-2.20.1a/bfd/elfcode.h	2009-09-10 13:47:12.000000000 +0200
++++ binutils-2.20.1a/bfd/elfcode.h	2018-06-19 19:07:16.647627075 +0200
+@@ -73,6 +73,7 @@
+ #include "bfdlink.h"
+ #include "libbfd.h"
+ #include "elf-bfd.h"
++#include <limits.h>
+ 
+ /* Renaming structures, typedefs, macros and functions to be size-specific.  */
+ #define Elf_External_Ehdr	NAME(Elf,External_Ehdr)
+@@ -706,8 +707,8 @@ elf_object_p (bfd *abfd)
+       if (i_ehdrp->e_shnum != 1)
+ 	{
+ 	  /* Check that we don't have a totally silly number of sections.  */
+-	  if (i_ehdrp->e_shnum > (unsigned int) -1 / sizeof (x_shdr)
+-	      || i_ehdrp->e_shnum > (unsigned int) -1 / sizeof (i_shdr))
++	  if (i_ehdrp->e_shnum > INT_MAX / sizeof (x_shdr)
++	      || i_ehdrp->e_shnum > INT_MAX / sizeof (i_shdr))
+ 	    goto got_wrong_format_error;
+ 
+ 	  where += (i_ehdrp->e_shnum - 1) * sizeof (x_shdr);
+diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/bfd/Makefile.in binutils-2.20.1a/bfd/Makefile.in
+--- ../binutils-2.20.1a/bfd/Makefile.in	2010-03-03 14:59:15.000000000 +0100
++++ binutils-2.20.1a/bfd/Makefile.in	2018-06-16 14:00:46.297724081 +0200
+@@ -320,7 +320,7 @@ ACLOCAL_AMFLAGS = -I . -I .. -I ../confi
+ # RELEASE=y
+ INCDIR = $(srcdir)/../include
+ CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
+-SUBDIRS = doc po
++SUBDIRS = # these fail to build: doc po
+ bfddocdir = doc
+ libbfd_la_LDFLAGS = $(am__append_1) -release `cat libtool-soversion` \
+ 	@SHARED_LDFLAGS@ $(am__empty)
+diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/binutils/arparse.c binutils-2.20.1a/binutils/arparse.c
+--- ../binutils-2.20.1a/binutils/arparse.c	2009-10-16 13:52:16.000000000 +0200
++++ binutils-2.20.1a/binutils/arparse.c	2018-06-19 01:30:00.576219981 +0200
+@@ -330,7 +330,7 @@ YYID (i)
+ #   define YYMALLOC malloc
+ #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+      || defined __cplusplus || defined _MSC_VER)
+-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
++void *malloc (size_t); /* INFRINGES ON USER NAME SPACE */
+ #   endif
+ #  endif
+ #  ifndef YYFREE
+diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/binutils/dwarf.c binutils-2.20.1a/binutils/dwarf.c
+--- ../binutils-2.20.1a/binutils/dwarf.c	2009-09-14 13:43:26.000000000 +0200
++++ binutils-2.20.1a/binutils/dwarf.c	2018-06-16 14:01:45.162684662 +0200
+@@ -27,6 +27,10 @@
+ #include "dwarf2.h"
+ #include "dwarf.h"
+ 
++#if MES_BOOTSTRAP
++#include "getopt.h"
++#endif
++
+ static int have_frame_base;
+ static int need_base_address;
+ 
+diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/binutils/sysinfo.c binutils-2.20.1a/binutils/sysinfo.c
+--- ../binutils-2.20.1a/binutils/sysinfo.c	2009-10-16 13:52:17.000000000 +0200
++++ binutils-2.20.1a/binutils/sysinfo.c	2018-06-19 01:29:23.823612807 +0200
+@@ -286,7 +286,7 @@ YYID (i)
+ #   define YYMALLOC malloc
+ #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+      || defined __cplusplus || defined _MSC_VER)
+-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
++void *malloc (size_t); /* INFRINGES ON USER NAME SPACE */
+ #   endif
+ #  endif
+ #  ifndef YYFREE
+diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/gas/config/tc-i386.c binutils-2.20.1a/gas/config/tc-i386.c
+--- ../binutils-2.20.1a/gas/config/tc-i386.c	2009-09-14 13:43:27.000000000 +0200
++++ binutils-2.20.1a/gas/config/tc-i386.c	2018-06-23 19:39:37.546254752 +0200
+@@ -4869,6 +4869,7 @@ build_modrm_byte (void)
+   if (vex_3_sources)
+     {
+       unsigned int nds, reg;
++      expressionS *exp; 
+ 
+       if (i.tm.opcode_modifier.veximmext
+ 	  && i.tm.opcode_modifier.immext)
+@@ -4892,7 +4893,7 @@ build_modrm_byte (void)
+ 
+       /* Generate an 8bit immediate operand to encode the register
+ 	 operand.  */
+-      expressionS *exp = &im_expressions[i.imm_operands++];
++      exp = &im_expressions[i.imm_operands++];
+       i.op[i.operands].imms = exp;
+       i.types[i.operands] = imm8;
+       i.operands++;
+diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/ld/ldgram.c binutils-2.20.1a/ld/ldgram.c
+--- ../binutils-2.20.1a/ld/ldgram.c	2009-10-16 13:52:15.000000000 +0200
++++ binutils-2.20.1a/ld/ldgram.c	2018-06-19 01:30:57.809165437 +0200
+@@ -561,7 +561,7 @@ YYID (i)
+ #   define YYMALLOC malloc
+ #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+      || defined __cplusplus || defined _MSC_VER)
+-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
++void *malloc (size_t); /* INFRINGES ON USER NAME SPACE */
+ #   endif
+ #  endif
+ #  ifndef YYFREE
+diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/libiberty/strncmp.c binutils-2.20.1a/libiberty/strncmp.c
+--- ../binutils-2.20.1a/libiberty/strncmp.c	2005-03-28 04:09:01.000000000 +0200
++++ binutils-2.20.1a/libiberty/strncmp.c	2018-06-23 19:19:50.038992482 +0200
+@@ -15,6 +15,13 @@ Compares the first @var{n} bytes of two
+ #include <ansidecl.h>
+ #include <stddef.h>
+ 
++#if !MES_BOOTSTRAP
++
++/*
++   libtool: link: /gnu/store/rgwjixk5zl7s2d3xsb2ws2z2q3m0xjm4-tcc-boot-0.9.26-0.97196ce/bin/tcc -D __GLIBC_MINOR__=6 -D MES_BOOTSTRAP=1 -g -o size size.o bucomm.o version.o filemode.o  ../bfd/.libs/libbfd.a ../libiberty/libiberty.a ./../intl/libintl.a
++   /gnu/store/rgwjixk5zl7s2d3xsb2ws2z2q3m0xjm4-tcc-boot-0.9.26-0.97196ce/lib/libc.a: error: 'strncmp' defined twice
++*/
++
+ int
+ strncmp(const char *s1, const char *s2, register size_t n)
+ {
+@@ -31,3 +38,5 @@ strncmp(const char *s1, const char *s2,
+     }
+   return 0;
+ }
++
++#endif // !MES_BOOTSTRAP
diff --git a/gnu/packages/patches/diffutils-getopt.patch b/gnu/packages/patches/diffutils-getopt.patch
deleted file mode 100644
index 05c2504adf..0000000000
--- a/gnu/packages/patches/diffutils-getopt.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-commit e3461d1c21a99bcef1b8826f710434e0ffb5adea
-Author: Paul Eggert <eggert@cs.ucla.edu>
-Date:   Sun Jun 11 15:53:09 2017 -0700
-
-    getopt-posix: port to glibc 2.25.90
-    
-    Problem reported by Daniel P. Berrange in:
-    http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00003.html
-    * lib/getopt-pfx-core.h (_GETOPT_CORE_H):
-    * lib/getopt-pfx-ext.h (_GETOPT_EXT_H):
-    #undef if __GETOPT_PREFIX is defined.
-
-diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h
-index 155c11612..6ad0da683 100644
---- a/lib/getopt-pfx-core.h
-+++ b/lib/getopt-pfx-core.h
-@@ -47,6 +47,11 @@
- # define opterr __GETOPT_ID (opterr)
- # define optind __GETOPT_ID (optind)
- # define optopt __GETOPT_ID (optopt)
-+
-+/* The system's getopt.h may have already included getopt-core.h to
-+   declare the unprefixed identifiers.  Undef _GETOPT_CORE_H so that
-+   getopt-core.h declares them with prefixes.  */
-+# undef _GETOPT_CORE_H
- #endif
- 
- #include <getopt-core.h>
-diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h
-index d960bb34e..c5ac52202 100644
---- a/lib/getopt-pfx-ext.h
-+++ b/lib/getopt-pfx-ext.h
-@@ -45,6 +45,11 @@
- # define getopt_long_only __GETOPT_ID (getopt_long_only)
- # define option __GETOPT_ID (option)
- # define _getopt_internal __GETOPT_ID (getopt_internal)
-+
-+/* The system's getopt.h may have already included getopt-ext.h to
-+   declare the unprefixed identifiers.  Undef _GETOPT_EXT_H so that
-+   getopt-ext.h declares them with prefixes.  */
-+# undef _GETOPT_EXT_H
- #endif
- 
- /* Standalone applications get correct prototypes for getopt_long and
diff --git a/gnu/packages/patches/gcc-boot-2.95.3.patch b/gnu/packages/patches/gcc-boot-2.95.3.patch
new file mode 100644
index 0000000000..fd167ae052
--- /dev/null
+++ b/gnu/packages/patches/gcc-boot-2.95.3.patch
@@ -0,0 +1,137 @@
+This patch enables building gcc-2.95.3 using TCC and Mes C Library.
+
+  * Disable building DOC
+  * Avoid running `fixproto'.
+  * Force running `fixinc'.
+  * Replace Makefile trickery of creating an libgcc1.a archive, then
+    extracting the .o files later to create a new libgcc2.a archive.
+    Instead, keep temporary .o files.
+
+Upstream status: Not presented upstream.
+
+diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/Makefile.in gcc-2.95.3/gcc/Makefile.in
+--- ../gcc-2.95.3/gcc/Makefile.in	2001-01-25 15:02:58.000000000 +0100
++++ gcc-2.95.3/gcc/Makefile.in	2018-06-23 11:46:03.525159181 +0200
+@@ -221,7 +221,7 @@ RANLIB_TEST_FOR_TARGET = \
+ SYSTEM_HEADER_DIR = /usr/include
+ 
+ # Control whether to run fixproto.
+-STMP_FIXPROTO = stmp-fixproto
++# STMP_FIXPROTO = stmp-fixproto
+ 
+ # Test to see whether <limits.h> exists in the system header files.
+ LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
+@@ -958,6 +958,7 @@ libgcc1.cross:
+ # fragments.
+ libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
+ 	-rm -f tmplibgcc1.a
++	mkdir -p libgcc1-o
+ # Actually build it in tmplibgcc1.a, then rename at end,
+ # so that libgcc1.a itself remains nonexistent if compilation is aborted.
+ # -e causes any failing command to make this rule fail.
+@@ -974,6 +975,7 @@ libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1F
+ 	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ 	  mv libgcc1$(objext) $${name}$(objext); \
+ 	  $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
++	  mv $${name}$(objext) libgcc1-o; \
+ 	  rm -f $${name}$(objext); \
+ 	done
+ # Some shells crash when a loop has no items.
+@@ -994,6 +996,7 @@ libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1F
+ 	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ 	    $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
+ 	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
++	    mv $${name}$(objext) libgcc1-o; \
+ 	    rm -f $${name}.s $${name}$(objext); \
+ 	  else true; \
+ 	  fi; \
+@@ -1024,6 +1027,7 @@ libgcc1-asm.a: libgcc2.ready config.stat
+ 	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ 	  mv libgcc1$(objext) $${name}$(objext); \
+ 	  $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc1.a $${name}$(objext); \
++	  mv $${name}$(objext) libgcc1-o; \
+ 	  rm -f $${name}$(objext); \
+ 	done
+ 	-rm -f libgcc1.S
+@@ -1062,6 +1066,7 @@ libgcc2.a: libgcc2.c libgcc2.ready $(CON
+ # Actually build it in tmplibgcc2.a, then rename at end,
+ # so that libgcc2.a itself remains nonexistent if compilation is aborted.
+ 	-rm -f tmplibgcc2.a
++	mkdir -p libgcc2-o
+ # -e causes any failing command to make this rule fail.
+ # -e doesn't work in certain shells, so we test $$? as well.
+ # lynx has a broken ar, it always complains when the initial library is
+@@ -1139,6 +1144,7 @@ libgcc2.a: libgcc2.c libgcc2.ready $(CON
+ 	    $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
+ 	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ 	    $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${oname}$(objext); \
++	    mv $${oname}$(objext) libgcc2-o;\
+ 	    rm -f $${name}.s $${oname}$(objext); \
+ 	  fi; \
+ 	done
+@@ -1156,7 +1162,7 @@ libgcc.a: $(LIBGCC1) $(LIBGCC2)
+ 	-rm -rf tmplibgcc.a libgcc.a tmpcopy
+ 	mkdir tmpcopy
+ 	-if [ x$(LIBGCC1) != x ];			\
+-	then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1));	\
++	then cp -v libgcc1-o/*.o tmpcopy;		\
+ 	else true;					\
+ 	fi
+ # Some versions of ar (specifically the one in RISC/os 5.x), create an
+@@ -1164,7 +1170,7 @@ libgcc.a: $(LIBGCC1) $(LIBGCC2)
+ # the second ar command tries to overwrite this file.  To avoid the error
+ # message from ar, we make sure all files are writable.
+ 	-(cd tmpcopy; chmod +w * > /dev/null 2>&1)
+-	(cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2))
++	cp -v libgcc2-o/*.o tmpcopy
+ 	(cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext))
+ 	rm -rf tmpcopy
+ 	-if $(RANLIB_TEST_FOR_TARGET) ; then \
+@@ -2093,14 +2099,18 @@ gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS)
+ # s-* so that mostlyclean does not force the include directory to
+ # be rebuilt.
+ 
++# STMP_FIXINC = @STMP_FIXINC@
++STMP_FIXINC = stmp-fixinc
++
+ # Build the include directory including float.h (which no longer depends upon
+ # enquire).
+-stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h
++stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) xlimits.h
+ # Copy in the headers provided with gcc.
+ # The sed command gets just the last file name component;
+ # this is necessary because VPATH could add a dirname.
+ # Using basename would be simpler, but some systems don't have it.
+ # The touch command is here to workaround an AIX/Linux NFS bug.
++	-if [ -d include ] ; then true; else mkdir include; chmod a+rx include; fi
+ 	for file in .. $(USER_H); do \
+ 	  if [ X$$file != X.. ]; then \
+ 	    realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
+@@ -2265,16 +2275,17 @@ stmp-fixproto: fixhdr.ready fixproto stm
+ #
+ # Remake the info files.
+ 
+-doc: info
+-info: cpp.info gcc.info lang.info
+-
+-cpp.info: $(srcdir)/cpp.texi
+-	$(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi
+-
+-gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
+-	  $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
+-	  $(srcdir)/tm.texi $(srcdir)/gcov.texi
+-	$(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi
++doc:
++# doc: info
++# info: cpp.info gcc.info lang.info
++
++# cpp.info: $(srcdir)/cpp.texi
++# 	$(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi
++
++# gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
++# 	  $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
++# 	  $(srcdir)/tm.texi $(srcdir)/gcov.texi
++# 	$(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi
+ 
+ dvi: gcc.dvi cpp.dvi lang.dvi
+ 
diff --git a/gnu/packages/patches/gcc-boot-4.7.4.patch b/gnu/packages/patches/gcc-boot-4.7.4.patch
new file mode 100644
index 0000000000..3e51e31fdf
--- /dev/null
+++ b/gnu/packages/patches/gcc-boot-4.7.4.patch
@@ -0,0 +1,68 @@
+This patch enables building gcc-4.7.4 using gcc-2.95.3 and glibc-2.2.5
+
+  * Tweak Makefile to allow overriding NATIVE_SYSTEM_HEADER_DIR using #:makeflags
+  * Add missing limits.h include.
+  * Add SSIZE_MAX define.  The SSIZE_MAX define has been added to Mes
+    upstream and can be removed with the next Mes release.
+  * Remove -fbuilding-libgcc flag, it assumes features being present from a
+    newer gcc or glibc.
+  * [MES_BOOTSTRAP_GCC]: Disable threads harder.
+
+Upstream status: not presented upstream.
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index f3cc49fdb18..bc5718fc9a6 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -458,7 +458,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
+ LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h
+ 
+ # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
+-NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
++# NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
+ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
+ CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+ 
+diff --git a/gcc/config/host-linux.c b/gcc/config/host-linux.c
+index 94b7a0b89a7..ab2baab55ca 100644
+--- a/gcc/config/host-linux.c
++++ b/gcc/config/host-linux.c
+@@ -23,6 +23,12 @@
+ #include "hosthooks.h"
+ #include "hosthooks-def.h"
+ 
++// ../.././gcc/config/host-linux.c:213: `SSIZE_MAX' undeclared (first
++// use in this function)
++#include <limits.h>
++#ifndef	SSIZE_MAX
++# define SSIZE_MAX	LONG_MAX
++#endif
+ 
+ /* Linux has a feature called exec-shield-randomize that perturbs the
+    address of non-fixed mapped segments by a (relatively) small amount.
+diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
+index c301ff03cae..f86318c3bd5 100644
+--- a/libgcc/Makefile.in
++++ b/libgcc/Makefile.in
+@@ -225,7 +225,7 @@ endif
+ LIBGCC2_DEBUG_CFLAGS = -g
+ LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
+ 		 $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
+-		 -fbuilding-libgcc -fno-stack-protector \
++		 -fno-stack-protector \
+ 		 $(INHIBIT_LIBC_CFLAGS)
+ 
+ # Additional options to use when compiling libgcc2.a.
+diff --git a/libgcc/generic-morestack-thread.c b/libgcc/generic-morestack-thread.c
+index bbe6dd12b5a..1d1d48223d7 100644
+--- a/libgcc/generic-morestack-thread.c
++++ b/libgcc/generic-morestack-thread.c
+@@ -35,7 +35,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+    will want to define inhibit_libc while building a compiler which
+    can build glibc.  */
+ 
+-#ifndef inhibit_libc
++#if 0 //!defined (inhibit_libc) && !MES_BOOTSTRAP_GCC
+ 
+ #include <errno.h>
+ #include <pthread.h>
diff --git a/gnu/packages/patches/glibc-boot-2.16.0.patch b/gnu/packages/patches/glibc-boot-2.16.0.patch
new file mode 100644
index 0000000000..5cb29bc271
--- /dev/null
+++ b/gnu/packages/patches/glibc-boot-2.16.0.patch
@@ -0,0 +1,352 @@
+This patch enables building glibc-2.2.5 using TCC and GNU Make 4.x and Mes C Library.
+
+  * Makefile: Do not link with (non-existent) libgc_eh.
+  * Makefile: Add SHELL variable, ready for substitution, export it.
+  * Makefile: Do not build or assume librpc_compat_pic.
+  * Makefile: Do not build libmesusage.
+  * gen-as-const: Always add preamble.
+  * [BOOTSTRAP_GLIBC]: Really disable rpc.
+
+Upstream status: Not presented upstream.
+
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/elf/Makefile glibc-2.16.0/elf/Makefile
+--- /home/janneke/src/glibc-2.16.0/elf/Makefile	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/elf/Makefile	2018-09-02 12:54:44.616962543 +0200
+@@ -17,6 +17,8 @@
+ 
+ # Makefile for elf subdirectory of GNU C Library.
+ 
++SHELL := /bin/sh
++
+ subdir		:= elf
+ 
+ headers		= elf.h bits/elfclass.h link.h bits/link.h
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/include/libc-symbols.h glibc-2.16.0/include/libc-symbols.h
+--- /home/janneke/src/glibc-2.16.0/include/libc-symbols.h	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/include/libc-symbols.h	2018-09-02 22:41:00.798467803 +0200
+@@ -558,9 +558,9 @@ for linking")
+ # define libc_hidden_weak(name) hidden_weak (name)
+ # ifdef LINK_OBSOLETE_RPC
+    /* libc_hidden_nolink_sunrpc should only get used in sunrpc code.  */
+-#  define libc_hidden_nolink_sunrpc(name, version) hidden_def (name)
++#  define libc_hidden_nolink_sunrpc(name, version)
+ # else
+-#  define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
++#  define libc_hidden_nolink_sunrpc(name, version)
+ # endif
+ # define libc_hidden_ver(local, name) hidden_ver (local, name)
+ # define libc_hidden_data_def(name) hidden_data_def (name)
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Makeconfig glibc-2.16.0/Makeconfig
+--- /home/janneke/src/glibc-2.16.0/Makeconfig	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/Makeconfig	2018-09-03 00:00:25.290357414 +0200
+@@ -23,6 +23,9 @@ ifneq (,)
+ This makefile requires GNU Make.
+ endif
+ 
++SHELL := /bin/sh
++export SHELL
++
+ all: # Make this the default goal
+ 
+ ifneq "$(origin +included-Makeconfig)" "file"
+@@ -521,9 +524,9 @@ ifneq ($(have-cc-with-libunwind),yes)
+ else
+   libunwind = -lunwind
+ endif
+-libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
++libgcc_eh := #-Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
+ gnulib := -lgcc $(libgcc_eh)
+-static-gnulib := -lgcc -lgcc_eh $(libunwind)
++static-gnulib := -lgcc $(libunwind)
+ libc.so-gnulib := -lgcc
+ endif
+ +preinit = $(addprefix $(csu-objpfx),crti.o)
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Makefile glibc-2.16.0/Makefile
+--- /home/janneke/src/glibc-2.16.0/Makefile	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/Makefile	2018-09-02 23:01:10.485803965 +0200
+@@ -22,6 +22,9 @@ ifneq (,)
+ This makefile requires GNU Make.
+ endif
+ 
++SHELL := /bin/sh
++export SHELL
++
+ include Makeconfig
+ 
+ 
+@@ -135,13 +138,10 @@ $(common-objpfx)linkobj/libc.so: $(elfob
+ 				 $(shlib-lds)
+ 	$(build-shlib)
+ 
+-$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \
+-				    $(common-objpfx)sunrpc/librpc_compat_pic.a
++$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a
+ 	$(..)./scripts/mkinstalldirs $(common-objpfx)linkobj
+ 	(cd $(common-objpfx)linkobj; \
+ 	 $(AR) x ../libc_pic.a; \
+-	 rm $$($(AR) t ../sunrpc/librpc_compat_pic.a | sed 's/^compat-//'); \
+-	 $(AR) x ../sunrpc/librpc_compat_pic.a; \
+ 	 $(AR) cr libc_pic.a *.os; \
+ 	 rm *.os)
+ endif
+@@ -151,7 +151,7 @@ endif
+ # the current libc build for testing.
+ $(common-objpfx)testrun.sh: $(common-objpfx)config.make \
+ 			    $(..)Makeconfig $(..)Makefile
+-	(echo '#!/bin/sh'; \
++	(echo '#! $(SHELL)'; \
+ 	 echo 'builddir=`dirname "$$0"`'; \
+ 	 echo 'GCONV_PATH="$${builddir}/iconvdata" \'; \
+ 	 echo 'exec $(subst $(common-objdir),"$${builddir}",\
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Makefile.in glibc-2.16.0/Makefile.in
+--- /home/janneke/src/glibc-2.16.0/Makefile.in	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/Makefile.in	2018-09-02 13:03:01.892962551 +0200
+@@ -9,3 +9,6 @@ all .DEFAULT:
+ install:
+ 	LANGUAGE=C LC_ALL=C; export LANGUAGE LC_ALL; \
+ 	$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
++
++export SHELL
++export BASH
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/malloc/Makefile glibc-2.16.0/malloc/Makefile
+--- /home/janneke/src/glibc-2.16.0/malloc/Makefile	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/malloc/Makefile	2018-09-02 17:11:33.461547394 +0200
+@@ -35,7 +35,7 @@ install-lib := libmcheck.a
+ non-lib.a := libmcheck.a
+ 
+ # Additional library.
+-extra-libs = libmemusage
++extra-libs = #libmemusage
+ extra-libs-others = $(extra-libs)
+ 
+ libmemusage-routines = memusage
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nscd/cache.c glibc-2.16.0/nscd/cache.c
+--- /home/janneke/src/glibc-2.16.0/nscd/cache.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/nscd/cache.c	2018-09-02 23:38:31.757616750 +0200
+@@ -74,7 +74,11 @@ struct datahead *
+ cache_search (request_type type, const void *key, size_t len,
+ 	      struct database_dyn *table, uid_t owner)
+ {
++#if !BOOTSTRAP_GLIBC
+   unsigned long int hash = __nis_hash (key, len) % table->head->module;
++#else
++  unsigned long int hash = 0;
++#endif
+ 
+   unsigned long int nsearched = 0;
+   struct datahead *result = NULL;
+@@ -153,7 +153,11 @@ cache_add (int type, const void *key, si
+ 	       first ? _(" (first)") : "");
+     }
+ 
++#if !BOOTSTRAP_GLIBC
+   unsigned long int hash = __nis_hash (key, len) % table->head->module;
++#else
++  unsigned long int hash = 0;
++#endif
+   struct hashentry *newp;
+ 
+   newp = mempool_alloc (table, sizeof (struct hashentry), 0);
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nscd/Makefile glibc-2.16.0/nscd/Makefile
+--- /home/janneke/src/glibc-2.16.0/nscd/Makefile	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/nscd/Makefile	2018-09-02 23:49:29.948031787 +0200
+@@ -126,9 +126,7 @@ include $(patsubst %,$(..)cppflags-itera
+ $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
+ 
+ ifeq ($(build-shared),yes)
+-$(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library) \
+-	       $(common-objpfx)nis/libnsl.so
++$(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library)
+ else
+-$(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library) \
+-	       $(common-objpfx)nis/libnsl.a
++$(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library)
+ endif
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nscd/nscd_helper.c glibc-2.16.0/nscd/nscd_helper.c
+--- /home/janneke/src/glibc-2.16.0/nscd/nscd_helper.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/nscd/nscd_helper.c	2018-09-02 23:38:04.941189464 +0200
+@@ -474,7 +474,7 @@ struct datahead *
+ __nscd_cache_search (request_type type, const char *key, size_t keylen,
+ 		     const struct mapped_database *mapped, size_t datalen)
+ {
+-  unsigned long int hash = __nis_hash (key, keylen) % mapped->head->module;
++  unsigned long int hash = 0;
+   size_t datasize = mapped->datasize;
+ 
+   ref_t trail = mapped->head->array[hash];
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nss/getent.c glibc-2.16.0/nss/getent.c
+--- /home/janneke/src/glibc-2.16.0/nss/function.def	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/nss/function.def	2018-09-18 13:54:49.582060539 +0200
+@@ -63,10 +63,12 @@
+ DEFINE_GET (files, pwnam)
+ DEFINE_GET (files, pwuid)
+ 
++#if !BOOTSTRAP_GLIBC
+ /* rpc */
+ DEFINE_ENT (files, rpc)
+ DEFINE_GETBY (files, rpc, name)
+ DEFINE_GETBY (files, rpc, number)
++#endif
+ 
+ /* services */
+ DEFINE_ENT (files, serv)
+diff -u ~/src/glibc-2.16.0/nss/getent.c glibc-2.16.0/nss/getent.c
+--- /home/janneke/src/glibc-2.16.0/nss/getent.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/nss/getent.c	2018-09-18 13:57:41.856849140 +0200
+@@ -700,6 +700,7 @@
+   return result;
+ }
+ 
++#if !BOOTSTRAP_GLIBC
+ /* Now is all for rpc */
+ static inline void
+ print_rpc (struct rpcent *rpc)
+@@ -745,6 +746,7 @@
+ 
+   return result;
+ }
++#endif //rpc
+ 
+ /* for services */
+ static void
+@@ -880,7 +882,9 @@
+ D(networks)
+ D(passwd)
+ D(protocols)
++#if !BOOTSTRAP_GLIBC
+ D(rpc)
++#endif
+ D(services)
+ D(shadow)
+ #undef D
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/resolv/netdb.h glibc-2.16.0/resolv/netdb.h
+--- /home/janneke/src/glibc-2.16.0/resolv/netdb.h	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/resolv/netdb.h	2018-09-08 08:49:30.537811219 +0200
+@@ -26,11 +26,13 @@
+ 
+ #include <netinet/in.h>
+ #include <stdint.h>
++#if 0 //!BOOTSTRAP_GLIBC
+ #ifdef __USE_MISC
+ /* This is necessary to make this include file properly replace the
+    Sun version.  */
+ # include <rpc/netdb.h>
+ #endif
++#endif
+ 
+ #ifdef __USE_GNU
+ # define __need_sigevent_t
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Rules glibc-2.16.0/Rules
+--- /home/janneke/src/glibc-2.16.0/Rules	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/Rules	2018-09-02 10:52:06.927362861 +0200
+@@ -24,6 +24,9 @@ ifneq (,)
+ This makefile requires GNU Make.
+ endif
+ 
++export SHELL
++export BASH
++
+ all: # Don't let the default goal come from Makeconfig.
+ 
+ include $(firstword $(..) ../)Makeconfig
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/scripts/gen-as-const.awk glibc-2.16.0/scripts/gen-as-const.awk
+--- /home/janneke/src/glibc-2.16.0/scripts/gen-as-const.awk	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/scripts/gen-as-const.awk	2018-09-01 18:08:37.266516330 +0200
+@@ -14,6 +14,12 @@ BEGIN { started = 0 }
+ 
+ NF >= 1 && !started {
+   if (test) {
++    print "\n#include <stddef.h>";
++    print "\n#include <stdint.h>";
++#    print "\ntypedef unsigned long size_t;";
++    print "\n#ifndef offsetof";
++    print "\n#define offsetof(type, field) ((size_t)&((type *)0)->field)";
++    print "\n#endif";
+     print "\n#include <inttypes.h>";
+     print "\n#include <stdio.h>";
+     print "\n#include <bits/wordsize.h>";
+@@ -33,8 +39,15 @@ NF >= 1 && !started {
+       " source, #name, U (asconst_##name), #expr, (c_t) (expr));" \
+       " } else ++good;\n";
+   }
+-  else
++  else {
++    print "\n#include <stddef.h>";
++    print "\n#include <stdint.h>";
++#    print "\ntypedef unsigned long size_t;";
++    print "\n#ifndef offsetof";
++    print "\n#define offsetof(type, field) ((size_t)&((type *)0)->field)";
++    print "\n#endif";
+     print "void dummy(void) {";
++  }
+   started = 1;
+ }
+ 
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/auth_none.c glibc-2.16.0/sunrpc/auth_none.c
+--- /home/janneke/src/glibc-2.16.0/sunrpc/auth_none.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/sunrpc/auth_none.c	2018-09-02 22:09:21.629007932 +0200
+@@ -95,7 +95,9 @@ authnone_create (void)
+   __libc_once (authnone_private_guard, authnone_create_once);
+   return &authnone_private.no_client;
+ }
++#if !BOOTSTRAP_GLIBC
+ libc_hidden_nolink_sunrpc (authnone_create, GLIBC_2_0)
++#endif
+ 
+ static bool_t
+ authnone_marshal (AUTH *client, XDR *xdrs)
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/authuxprot.c glibc-2.16.0/sunrpc/authuxprot.c
+--- /home/janneke/src/glibc-2.16.0/sunrpc/authuxprot.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/sunrpc/authuxprot.c	2018-09-02 22:15:51.927158451 +0200
+@@ -63,4 +63,6 @@ xdr_authunix_parms (XDR * xdrs, struct a
+     }
+   return FALSE;
+ }
++#if !BOOTSTRAP_GLIBC
+ libc_hidden_nolink_sunrpc (xdr_authunix_parms, GLIBC_2_0)
++#endif
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/bindrsvprt.c glibc-2.16.0/sunrpc/bindrsvprt.c
+--- /home/janneke/src/glibc-2.16.0/sunrpc/bindrsvprt.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/sunrpc/bindrsvprt.c	2018-09-02 22:24:32.687187675 +0200
+@@ -96,4 +96,7 @@ bindresvport (int sd, struct sockaddr_in
+ 
+   return res;
+ }
++#if !BOOTSTRAP_GLIBC
+ libc_hidden_def (bindresvport)
++#endif
++
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/clnt_raw.c glibc-2.16.0/sunrpc/clnt_raw.c
+--- /home/janneke/src/glibc-2.16.0/sunrpc/clnt_raw.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/sunrpc/clnt_raw.c	2018-09-02 22:33:21.151343826 +0200
+@@ -40,6 +40,7 @@
+ #include <rpc/svc.h>
+ #include <rpc/xdr.h>
+ #include <libintl.h>
++#include <stddef.h>
+ 
+ #define MCALL_MSG_SIZE 24
+ 
+@@ -129,7 +130,9 @@ clntraw_create (u_long prog, u_long vers
+   client->cl_auth = authnone_create ();
+   return client;
+ }
++#if !BOOTSTRAP_GLIBC
+ libc_hidden_nolink_sunrpc (clntraw_create, GLIBC_2_0)
++#endif
+ 
+ static enum clnt_stat
+ clntraw_call (h, proc, xargs, argsp, xresults, resultsp, timeout)
+diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/clnt_simp.c glibc-2.16.0/sunrpc/clnt_simp.c
+--- /home/janneke/src/glibc-2.16.0/sunrpc/clnt_simp.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/sunrpc/clnt_simp.c	2018-09-02 22:34:14.884175251 +0200
+@@ -139,7 +139,9 @@ callrpc (const char *host, u_long prognu
+     crp->valid = 0;
+   return (int) clnt_stat;
+ }
++#if !BOOTSTRAP_GLIBC
+ libc_hidden_nolink_sunrpc (callrpc, GLIBC_2_0)
++#endif
+ 
+ #ifdef _RPC_THREAD_SAFE_
+ void
diff --git a/gnu/packages/patches/glibc-boot-2.2.5.patch b/gnu/packages/patches/glibc-boot-2.2.5.patch
new file mode 100644
index 0000000000..26bc92a6bb
--- /dev/null
+++ b/gnu/packages/patches/glibc-boot-2.2.5.patch
@@ -0,0 +1,251 @@
+This patch enables building glibc-2.2.5 using TCC and GNU Make 4.x and Mes C Library.
+
+  * Makefile: Do not assemble from stdin, use file indirection.
+  * Makefile: Add new target: install-lib-all.
+  * Makefile: Avoid building stub DOC.
+  * [_LIBC_REENTRANT]: Add missing guarding.
+  * [MES_BOOTSTRAP]: Disable some GCC extensions.
+  * [MES_BOOTSTRAP]: Add missing GCC div/mod defines.
+
+Upstream status: Not presented upstream.
+
+diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/config.h.in glibc-2.2.5/config.h.in
+--- ../glibc-2.2.5/config.h.in	2001-11-16 02:02:56.000000000 +0100
++++ glibc-2.2.5/config.h.in	2018-06-17 21:30:02.313029074 +0200
+@@ -1,3 +1,10 @@
++#if MES_BOOTSTRAP && BOOTSTRAP_GLIBC
++#undef __umoddi3
++#define __umoddi3(a,b) ((a)%(b))
++#undef __udivdi3
++#define __udivdi3(a,b) ((a)/(b))
++#endif
++
+ #if !defined ASSEMBLER && !defined _ISOMAC && !defined __OPTIMIZE__
+ # error "glibc cannot be compiled without optimization"
+ #endif
+diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/configure glibc-2.2.5/configure
+--- ../glibc-2.2.5/configure	2002-01-08 23:16:44.000000000 +0100
++++ glibc-2.2.5/configure	2018-06-07 20:47:26.608895319 +0200
+@@ -1530,7 +1530,7 @@ echo "configure:1530: checking version o
+   ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+   case $ac_prog_version in
+     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+-    3.79* | 3.[89]*)
++    3.79* | 3.[89]* | 4.*)
+        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+ 
+diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/Makeconfig glibc-2.2.5/Makeconfig
+--- ../glibc-2.2.5/Makeconfig	2001-09-12 20:49:45.000000000 +0200
++++ glibc-2.2.5/Makeconfig	2018-06-20 16:33:35.472167202 +0200
+@@ -400,7 +400,7 @@ ifndef +link
+ 						     $(start-installed-name))\
+ 			   $(+preinit) $(link-extra-libs) \
+ 			   $(common-objpfx)libc% $(+postinit),$^) \
+-	      $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
++	      $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit) -lc -lgcc2
+ endif
+ # Command for statically linking programs with the C library.
+ ifndef +link-static
+@@ -412,7 +412,7 @@ ifndef +link-static
+ 						     $(start-installed-name))\
+ 			   $(+preinit) $(link-extra-libs-static) \
+ 			   $(common-objpfx)libc% $(+postinit),$^) \
+-	      $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
++	      $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit) -lc -lgcc2
+ endif
+ # Command for statically linking bounded-pointer programs with the C library.
+ ifndef +link-bounded
+@@ -424,7 +424,7 @@ ifndef +link-bounded
+ 						     $(start-installed-name))\
+ 			   $(+preinit) $(link-extra-libs-bounded) \
+ 			   $(common-objpfx)libc% $(+postinit),$^) \
+-	      $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
++	      $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit) -lc -lgcc2
+ endif
+ ifndef config-LDFLAGS
+ ifeq (yesyes,$(build-shared)$(elf))
+diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/Makerules glibc-2.2.5/Makerules
+--- ../glibc-2.2.5/Makerules	2001-11-16 02:02:19.000000000 +0100
++++ glibc-2.2.5/Makerules	2018-06-10 15:03:42.390329860 +0200
+@@ -748,6 +748,18 @@ endef
+ installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
+ 			     $(inst_libdir)/$(patsubst %,$(libtype$o),\
+ 						     $(libprefix)$(libc-name)))
++
++ifeq (yes,$(build-shared))
++install-lib-all: $(inst_libdir)/libc.a \
++                $(inst_slibdir)/libc.so$(libc.so-version) \
++		$(inst_slibdir)/libc-$(version).so \
++		$(inst_libdir)/libc.so \
++	install-lib
++else
++install-lib-all: $(inst_libdir)/libc.a \
++	install-lib
++endif
++
+ install: $(installed-libcs)
+ $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
+ 	$(make-target-directory)
+diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/misc/syslog.c glibc-2.2.5/misc/syslog.c
+--- ../glibc-2.2.5/misc/syslog.c	2001-08-31 01:13:49.000000000 +0200
++++ glibc-2.2.5/misc/syslog.c	2018-06-09 09:01:20.008918690 +0200
+@@ -216,9 +216,11 @@ vsyslog(pri, fmt, ap)
+ 
+ 	/* Prepare for multiple users.  We have to take care: open and
+ 	   write are cancellation points.  */
++#if _LIBC_REENTRANT
+ 	__libc_cleanup_region_start (1, (void (*) (void *)) cancel_handler,
+ 				     &oldaction_ptr);
+ 	__libc_lock_lock (syslog_lock);
++#endif
+ 
+ 	/* Prepare for a broken connection.  */
+  	memset (&action, 0, sizeof (action));
+@@ -268,9 +270,11 @@ vsyslog(pri, fmt, ap)
+ 	if (sigpipe == 0)
+ 		__sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL);
+ 
++#if _LIBC_REENTRANT
+ 	/* End of critical section.  */
+ 	__libc_cleanup_region_end (0);
+ 	__libc_lock_unlock (syslog_lock);
++#endif
+ 
+ 	free (buf);
+ }
+@@ -326,16 +330,20 @@ openlog_internal(const char *ident, int
+ void
+ openlog (const char *ident, int logstat, int logfac)
+ {
++#if _LIBC_REENTRANT
+   /* Protect against multiple users.  */
+   __libc_cleanup_region_start (1,
+ 			       (void (*) __P ((void *))) __libc_mutex_unlock,
+ 			       &syslog_lock);
+   __libc_lock_lock (syslog_lock);
++#endif
+ 
+   openlog_internal (ident, logstat, logfac);
+ 
++#if _LIBC_REENTRANT
+   /* Free the lock.  */
+   __libc_cleanup_region_end (1);
++#endif
+ }
+ 
+ static void
+@@ -358,18 +366,22 @@ closelog_internal()
+ void
+ closelog ()
+ {
++#if _LIBC_REENTRANT
+   /* Protect against multiple users.  */
+   __libc_cleanup_region_start (1,
+ 			       (void (*) __P ((void *))) __libc_mutex_unlock,
+ 			       &syslog_lock);
+   __libc_lock_lock (syslog_lock);
++#endif
+ 
+   closelog_internal ();
+   LogTag = NULL;
+   LogType = SOCK_DGRAM; /* this is the default */
+ 
++#if _LIBC_REENTRANT
+   /* Free the lock.  */
+   __libc_cleanup_region_end (1);
++#endif
+ }
+ 
+ #ifdef _LIBC_REENTRANT
+diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/Rules glibc-2.2.5/Rules
+--- ../glibc-2.2.5/Rules	2001-08-30 00:44:35.000000000 +0200
++++ glibc-2.2.5/Rules	2018-06-09 08:15:54.880683675 +0200
+@@ -218,7 +218,7 @@ endif
+ 	fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; 	\
+ 	filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`;	\
+ 	iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`;	\
+-	fopen_max=$${fopen_max:-16};					\
++	fopen_max=$${fu_fopen_max:-16};					\
+ 	filename_max=$${filename_max:-1024};				\
+ 	if [ -z $$iov_max ]; then					\
+ 	  define_iov_max="# undef IOV_MAX";				\
+diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/stdio-common/perror.c glibc-2.2.5/stdio-common/perror.c
+--- ../glibc-2.2.5/stdio-common/perror.c	2001-09-01 07:33:01.000000000 +0200
++++ glibc-2.2.5/stdio-common/perror.c	2018-06-09 10:42:25.909899529 +0200
+@@ -48,6 +48,9 @@ perror_internal (FILE *fp, const char *s
+ }
+ 
+ 
++#if MES_BOOTSTRAP
++#define fileno_unlocked(x) 1
++#endif
+ /* Print a line on stderr consisting of the text in S, a colon, a space,
+    a message describing the meaning of the contents of `errno' and a newline.
+    If S is NULL or "", the colon and space are omitted.  */
+diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/sysdeps/i386/fpu/ftestexcept.c glibc-2.2.5/sysdeps/i386/fpu/ftestexcept.c
+--- ../glibc-2.2.5/sysdeps/i386/fpu/ftestexcept.c	2001-07-06 06:55:53.000000000 +0200
++++ glibc-2.2.5/sysdeps/i386/fpu/ftestexcept.c	2018-06-09 09:45:13.363031424 +0200
+@@ -25,8 +25,10 @@ fetestexcept (int excepts)
+ {
+   int temp;
+ 
++#if !MES_BOOTSTRAP
+   /* Get current exceptions.  */
+   __asm__ ("fnstsw %0" : "=a" (temp));
++#endif
+ 
+   return temp & excepts & FE_ALL_EXCEPT;
+ }
+diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/sysdeps/unix/make-syscalls.sh glibc-2.2.5/sysdeps/unix/make-syscalls.sh
+--- ../glibc-2.2.5/sysdeps/unix/make-syscalls.sh	2001-09-13 00:19:30.000000000 +0200
++++ glibc-2.2.5/sysdeps/unix/make-syscalls.sh	2018-06-20 15:16:01.813004453 +0200
+@@ -173,7 +173,7 @@ shared-only-routines += $file
+   done
+ 
+   # And finally, pipe this all into the compiler.
+-  echo '	) | $(COMPILE.S) -x assembler-with-cpp -o $@ -'
++  echo '	) > stdin.c; $(COMPILE.S) -x assembler-with-cpp -o $@ stdin.c'
+ 
+   case $weak in
+   *@*)
+@@ -284,7 +284,7 @@ shared-only-routines += $file
+     echo "\
+ 	 echo ''; \\
+ 	 echo '#include <bp-thunks.h>'; \\
+-	) | \$(COMPILE.c) -x c -o \$@ -"
++	) > stdin.c; \$(COMPILE.c) -x c -o \$@ stdin.c"
+ ### Use this for debugging intermediate output:
+ ### 	) >\$(@:.ob=.c)
+ ### 	\$(subst -c,-E,\$(COMPILE.c)) -o \$(@:.ob=.ib) \$(@:.ob=.c)
+diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/sysdeps/unix/sysv/linux/sys/timex.h glibc-2.2.5/sysdeps/unix/sysv/linux/sys/timex.h
+--- ../glibc-2.2.5/sysdeps/unix/sysv/linux/sys/timex.h	2001-07-06 06:56:21.000000000 +0200
++++ glibc-2.2.5/sysdeps/unix/sysv/linux/sys/timex.h	2018-06-09 20:09:07.713806647 +0200
+@@ -54,10 +54,12 @@ struct timex
+   long int errcnt;	/* calibration errors (ro) */
+   long int stbcnt;	/* stability limit exceeded (ro) */
+ 
++#if !MES_BOOTSTRAP
+   /* ??? */
+   int  :32; int  :32; int  :32; int  :32;
+   int  :32; int  :32; int  :32; int  :32;
+   int  :32; int  :32; int  :32; int  :32;
++#endif
+ };
+ 
+ /* Mode codes (timex.mode) */
+--- ../glibc-2.2.5/manual/Makefile	2001-08-28 10:05:40.000000000 +0200
++++ glibc-2.2.5/manual/Makefile	2018-06-09 10:13:03.093633660 +0200
+@@ -247,7 +247,11 @@
+ .PHONY: stubs
+ stubs: $(objpfx)stubs
+ endif
+-$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
++po/manual.pot $(objpfx)stubs:
++	$(make-target-directory)
++	touch $@
++
++$(objpfx)stamp%:
+ 	$(make-target-directory)
+ 	touch $@
+ 
diff --git a/gnu/packages/patches/glibc-bootstrap-system-2.16.0.patch b/gnu/packages/patches/glibc-bootstrap-system-2.16.0.patch
new file mode 100644
index 0000000000..936d592f1a
--- /dev/null
+++ b/gnu/packages/patches/glibc-bootstrap-system-2.16.0.patch
@@ -0,0 +1,30 @@
+We want to allow builds in chroots that lack /bin/sh.  Thus, system(3)
+and popen(3) need to be tweaked to use the right shell.  For the bootstrap
+glibc, we just use whatever `sh' can be found in $PATH.  The final glibc
+instead uses the hard-coded absolute file name of `bash'.
+
+--- a/sysdeps/posix/system.c
++++ b/sysdeps/posix/system.c
+@@ -134,7 +134,7 @@ do_system (const char *line)
+       INIT_LOCK ();
+ 
+       /* Exec the shell.  */
+-      (void) __execve (SHELL_PATH, (char *const *) new_argv, __environ);
++      (void) __execvpe (SHELL_NAME, (char *const *) new_argv, __environ);
+       _exit (127);
+     }
+   else if (pid < (pid_t) 0)
+
+--- a/libio/iopopen.c
++++ b/libio/iopopen.c
+@@ -145,7 +145,7 @@ _IO_new_proc_open (fp, command, mode)
+ 	    _IO_close (fd);
+ 	}
+ 
+-      _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0);
++      execlp ("sh", "sh", "-c", command, (char *) 0);
+       _IO__exit (127);
+     }
+   _IO_close (child_end);
+
+
diff --git a/gnu/packages/patches/glibc-supported-locales.patch b/gnu/packages/patches/glibc-supported-locales.patch
new file mode 100644
index 0000000000..2888052bb8
--- /dev/null
+++ b/gnu/packages/patches/glibc-supported-locales.patch
@@ -0,0 +1,33 @@
+This patch is taken from debian's glibc package (generate-supported.mk).
+It install the localedata/SUPPORTED file of the glibc. This file lists
+all the supported locales of the glibc.
+
+diff --git a/localedata/Makefile.old b/localedata/Makefile
+index 34877c0..a61d9b9 100644
+--- a/localedata/Makefile.old
++++ b/localedata/Makefile
+@@ -91,7 +91,8 @@ endif
+ # Files to install.
+ install-others := $(addprefix $(inst_i18ndir)/, \
+ 			      $(addsuffix .gz, $(charmaps)) \
+-			      $(locales))
++			      $(locales)) \
++                   $(inst_i18ndir)/SUPPORTED
+ 
+ tests: $(objdir)/iconvdata/gconv-modules
+ 
+@@ -195,6 +196,14 @@ endif
+ 
+ include SUPPORTED
+ 
++$(inst_i18ndir)/SUPPORTED: SUPPORTED $(+force)
++	for locale in $(SUPPORTED-LOCALES); do \
++		[ $$locale = true ] && continue; \
++		echo $$locale | sed 's,/, ,' >> LOCALES; \
++	done
++	$(make-target-directory)
++	$(INSTALL_DATA) LOCALES $@
++
+ INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
+ 
+ # Sometimes the whole collection of locale files should be installed.
diff --git a/gnu/packages/patches/groff-source-date-epoch.patch b/gnu/packages/patches/groff-source-date-epoch.patch
deleted file mode 100644
index 53c590b049..0000000000
--- a/gnu/packages/patches/groff-source-date-epoch.patch
+++ /dev/null
@@ -1,299 +0,0 @@
-Adds support for the environment variable SOURCE_DATE_EPOCH.
-
-See: https://sources.debian.net/patches/groff/1.22.3-9/source-date-epoch.patch/
-
-From abc23bc9245e18468817f2838361c3a08f7521e2 Mon Sep 17 00:00:00 2001
-From: Colin Watson <cjwatson@debian.org>
-Date: Thu, 5 Nov 2015 11:47:34 +0000
-Subject: Implement `SOURCE_DATE_EPOCH' for reproducible builds.
-
-Author: Colin Watson <cjwatson@debian.org>
-Forwarded: yes
-Last-Update: 2015-11-05
-
-Patch-Name: source-date-epoch.patch
----
- doc/groff.texinfo                 |  6 +++++
- src/devices/grohtml/grohtml.man   |  7 ++++++
- src/devices/grohtml/post-html.cpp |  5 ++--
- src/devices/gropdf/gropdf.man     |  7 ++++++
- src/devices/gropdf/gropdf.pl      |  3 ++-
- src/devices/grops/grops.man       |  7 ++++++
- src/devices/grops/ps.cpp          |  3 ++-
- src/include/curtime.h             | 23 ++++++++++++++++++
- src/libs/libgroff/Makefile.sub    |  2 ++
- src/libs/libgroff/curtime.cpp     | 51 +++++++++++++++++++++++++++++++++++++++
- src/roff/troff/input.cpp          |  3 ++-
- 11 files changed, 112 insertions(+), 5 deletions(-)
- create mode 100644 src/include/curtime.h
- create mode 100644 src/libs/libgroff/curtime.cpp
-
-diff --git a/doc/groff.texinfo b/doc/groff.texinfo
-index 066b5274..1d3c7a9f 100644
---- a/doc/groff.texinfo
-+++ b/doc/groff.texinfo
-@@ -1453,6 +1453,12 @@ default directory (on Unix and GNU/Linux systems, this is usually
- @item GROFF_TYPESETTER
- @tindex GROFF_TYPESETTER@r{, environment variable}
- The default output device.
-+
-+@item SOURCE_DATE_EPOCH
-+@tindex SOURCE_DATE_EPOCH@r{, environment variable}
-+A timestamp (expressed as seconds since the Unix epoch) to use in place of
-+the current time when initializing time-based built-in registers such as
-+@code{\n[seconds]}.
- @end table
- 
- Note that MS-DOS and MS-Windows ports of @code{groff} use semi-colons,
-diff --git a/src/devices/grohtml/grohtml.man b/src/devices/grohtml/grohtml.man
-index 51eae224..4be4abbc 100644
---- a/src/devices/grohtml/grohtml.man
-+++ b/src/devices/grohtml/grohtml.man
-@@ -419,6 +419,13 @@ and
- for more details.
- .
- .
-+.TP
-+.SM
-+.B SOURCE_DATE_EPOCH
-+A timestamp (expressed as seconds since the Unix epoch) to use as the
-+creation timestamp in place of the current time.
-+.
-+.
- .\" --------------------------------------------------------------------
- .SH BUGS
- .\" --------------------------------------------------------------------
-diff --git a/src/devices/grohtml/post-html.cpp b/src/devices/grohtml/post-html.cpp
-index fefbf014..b5fc5167 100644
---- a/src/devices/grohtml/post-html.cpp
-+++ b/src/devices/grohtml/post-html.cpp
-@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
- #include "html.h"
- #include "html-text.h"
- #include "html-table.h"
-+#include "curtime.h"
- 
- #include <time.h>
- 
-@@ -5013,7 +5014,7 @@ void html_printer::do_file_components (void)
- 	.put_string(Version_string)
- 	.end_comment();
- 
--      t = time(0);
-+      t = current_time();
-       html.begin_comment("CreationDate: ")
- 	.put_string(ctime(&t), strlen(ctime(&t))-1)
- 	.end_comment();
-@@ -5126,7 +5127,7 @@ html_printer::~html_printer()
-     .put_string(Version_string)
-     .end_comment();
- 
--  t = time(0);
-+  t = current_time();
-   html.begin_comment("CreationDate: ")
-     .put_string(ctime(&t), strlen(ctime(&t))-1)
-     .end_comment();
-diff --git a/src/devices/gropdf/gropdf.man b/src/devices/gropdf/gropdf.man
-index 3bbace6a..cc0c82f1 100644
---- a/src/devices/gropdf/gropdf.man
-+++ b/src/devices/gropdf/gropdf.man
-@@ -1029,6 +1029,13 @@ and
- for more details.
- .
- .
-+.TP
-+.SM
-+.B SOURCE_DATE_EPOCH
-+A timestamp (expressed as seconds since the Unix epoch) to use as the
-+creation timestamp in place of the current time.
-+.
-+.
- .\" --------------------------------------------------------------------
- .SH FILES
- .\" --------------------------------------------------------------------
-diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
-index 035d1238..c25c4c67 100644
---- a/src/devices/gropdf/gropdf.pl
-+++ b/src/devices/gropdf/gropdf.pl
-@@ -239,13 +239,14 @@ elsif (exists($ppsz{$papersz}))
-     @defaultmb=@mediabox=(0,0,$ppsz{$papersz}->[0],$ppsz{$papersz}->[1]);
- }
- 
--my (@dt)=localtime(time);
-+my (@dt)=localtime($ENV{SOURCE_DATE_EPOCH} || time);
- my $dt=PDFDate(\@dt);
- 
- my %info=('Creator' => "(groff version $cfg{GROFF_VERSION})",
- 				'Producer' => "(gropdf version $cfg{GROFF_VERSION})",
- 				'ModDate' => "($dt)",
- 				'CreationDate' => "($dt)");
-+
- while (<>)
- {
-     chomp;
-diff --git a/src/devices/grops/grops.man b/src/devices/grops/grops.man
-index 99fb7486..272c2d18 100644
---- a/src/devices/grops/grops.man
-+++ b/src/devices/grops/grops.man
-@@ -1419,6 +1419,13 @@ and
- for more details.
- .
- .
-+.TP
-+.SM
-+.B SOURCE_DATE_EPOCH
-+A timestamp (expressed as seconds since the Unix epoch) to use as the
-+creation timestamp in place of the current time.
-+.
-+.
- .\" --------------------------------------------------------------------
- .SH FILES
- .\" --------------------------------------------------------------------
-diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
-index 745a503b..03e65372 100644
---- a/src/devices/grops/ps.cpp
-+++ b/src/devices/grops/ps.cpp
-@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
- #include "cset.h"
- #include "nonposix.h"
- #include "paper.h"
-+#include "curtime.h"
- 
- #include "ps.h"
- #include <time.h>
-@@ -1390,7 +1391,7 @@ ps_printer::~ps_printer()
- #else
-     time_t
- #endif
--    t = time(0);
-+    t = current_time();
-     fputs(ctime(&t), out.get_file());
-   }
-   for (font_pointer_list *f = font_list; f; f = f->next) {
-diff --git a/src/include/curtime.h b/src/include/curtime.h
-new file mode 100644
-index 00000000..a4105196
---- /dev/null
-+++ b/src/include/curtime.h
-@@ -0,0 +1,23 @@
-+/* Copyright (C) 2015  Free Software Foundation, Inc.
-+
-+This file is part of groff.
-+
-+groff 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 2 of the License, or
-+(at your option) any later version.
-+
-+groff 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.
-+
-+The GNU General Public License version 2 (GPL2) is available in the
-+internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
-+
-+#ifdef LONG_FOR_TIME_T
-+long
-+#else
-+time_t
-+#endif
-+current_time();
-diff --git a/src/libs/libgroff/Makefile.sub b/src/libs/libgroff/Makefile.sub
-index 840d9934..4cb4937a 100644
---- a/src/libs/libgroff/Makefile.sub
-+++ b/src/libs/libgroff/Makefile.sub
-@@ -32,6 +32,7 @@ OBJS=\
-   cmap.$(OBJEXT) \
-   color.$(OBJEXT) \
-   cset.$(OBJEXT) \
-+  curtime.$(OBJEXT) \
-   device.$(OBJEXT) \
-   errarg.$(OBJEXT) \
-   error.$(OBJEXT) \
-@@ -82,6 +83,7 @@ CCSRCS=\
-   $(srcdir)/cmap.cpp \
-   $(srcdir)/color.cpp \
-   $(srcdir)/cset.cpp \
-+  $(srcdir)/curtime.cpp \
-   $(srcdir)/device.cpp \
-   $(srcdir)/errarg.cpp \
-   $(srcdir)/error.cpp \
-diff --git a/src/libs/libgroff/curtime.cpp b/src/libs/libgroff/curtime.cpp
-new file mode 100644
-index 00000000..00821b7f
---- /dev/null
-+++ b/src/libs/libgroff/curtime.cpp
-@@ -0,0 +1,51 @@
-+/* Copyright (C) 2015  Free Software Foundation, Inc.
-+
-+This file is part of groff.
-+
-+groff 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 2 of the License, or
-+(at your option) any later version.
-+
-+groff 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.
-+
-+The GNU General Public License version 2 (GPL2) is available in the
-+internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
-+
-+#include <errno.h>
-+#include <limits.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <time.h>
-+
-+#include "errarg.h"
-+#include "error.h"
-+
-+#ifdef LONG_FOR_TIME_T
-+long
-+#else
-+time_t
-+#endif
-+current_time()
-+{
-+  char *source_date_epoch = getenv("SOURCE_DATE_EPOCH");
-+
-+  if (source_date_epoch) {
-+    errno = 0;
-+    char *endptr;
-+    long epoch = strtol(source_date_epoch, &endptr, 10);
-+
-+    if ((errno == ERANGE && (epoch == LONG_MAX || epoch == LONG_MIN)) ||
-+	(errno != 0 && epoch == 0))
-+      fatal("$SOURCE_DATE_EPOCH: strtol: %1", strerror(errno));
-+    if (endptr == source_date_epoch)
-+      fatal("$SOURCE_DATE_EPOCH: no digits found: %1", endptr);
-+    if (*endptr != '\0')
-+      fatal("$SOURCE_DATE_EPOCH: trailing garbage: %1", endptr);
-+    return epoch;
-+  } else
-+    return time(0);
-+}
-diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
-index 9594f074..f7d2c18a 100644
---- a/src/roff/troff/input.cpp
-+++ b/src/roff/troff/input.cpp
-@@ -36,6 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
- #include "input.h"
- #include "defs.h"
- #include "unicode.h"
-+#include "curtime.h"
- 
- // Needed for getpid() and isatty()
- #include "posix.h"
-@@ -8138,7 +8139,7 @@ static void init_registers()
- #else /* not LONG_FOR_TIME_T */
-   time_t
- #endif /* not LONG_FOR_TIME_T */
--    t = time(0);
-+    t = current_time();
-   // Use struct here to work around misfeature in old versions of g++.
-   struct tm *tt = localtime(&t);
-   set_number_reg("seconds", int(tt->tm_sec));
diff --git a/gnu/packages/patches/handbrake-opt-in-nvenc.patch b/gnu/packages/patches/handbrake-opt-in-nvenc.patch
new file mode 100644
index 0000000000..2b34aaa427
--- /dev/null
+++ b/gnu/packages/patches/handbrake-opt-in-nvenc.patch
@@ -0,0 +1,14 @@
+Require opt-in for NVEnc support.  Otherwise the default is true with no way
+to disable it.
+
+--- HandBrake-1.2.0/make/configure.py.orig	1969-12-31 18:00:00.000000000 -0600
++++ HandBrake-1.2.0/make/configure.py	2019-01-22 23:22:46.186959060 -0600
+@@ -1320,7 +1320,7 @@
+     grp.add_option( '--disable-ffmpeg-aac', dest="enable_ffmpeg_aac", action='store_false' )
+ 
+     h = IfHost( 'enable Nvidia NVEnc video encoder', '*-*-*', none=optparse.SUPPRESS_HELP ).value
+-    grp.add_option( '--enable-nvenc', dest="enable_nvenc", default=not (host.match( '*-*-darwin*' ) or host.match( '*-*-freebsd*' )), action='store_true', help=h )
++    grp.add_option( '--enable-nvenc', dest="enable_nvenc", default=False, action='store_true', help=h )
+ 
+ 
+     cli.add_option_group( grp )
diff --git a/gnu/packages/patches/libarchive-CVE-2017-14166.patch b/gnu/packages/patches/libarchive-CVE-2017-14166.patch
deleted file mode 100644
index a122848440..0000000000
--- a/gnu/packages/patches/libarchive-CVE-2017-14166.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-Fix CVE-2017-14166:
-
-https://github.com/libarchive/libarchive/issues/935
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14166
-
-Patch copied from upstream source repository:
-
-https://github.com/libarchive/libarchive/commit/fa7438a0ff4033e4741c807394a9af6207940d71
-
-From fa7438a0ff4033e4741c807394a9af6207940d71 Mon Sep 17 00:00:00 2001
-From: Joerg Sonnenberger <joerg@bec.de>
-Date: Tue, 5 Sep 2017 18:12:19 +0200
-Subject: [PATCH] Do something sensible for empty strings to make fuzzers
- happy.
-
----
- libarchive/archive_read_support_format_xar.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c
-index 7a22beb9d..93eeacc5e 100644
---- a/libarchive/archive_read_support_format_xar.c
-+++ b/libarchive/archive_read_support_format_xar.c
-@@ -1040,6 +1040,9 @@ atol10(const char *p, size_t char_cnt)
- 	uint64_t l;
- 	int digit;
- 
-+	if (char_cnt == 0)
-+		return (0);
-+
- 	l = 0;
- 	digit = *p - '0';
- 	while (digit >= 0 && digit < 10  && char_cnt-- > 0) {
-@@ -1054,7 +1057,10 @@ atol8(const char *p, size_t char_cnt)
- {
- 	int64_t l;
- 	int digit;
--        
-+
-+	if (char_cnt == 0)
-+		return (0);
-+
- 	l = 0;
- 	while (char_cnt-- > 0) {
- 		if (*p >= '0' && *p <= '7')
diff --git a/gnu/packages/patches/libarchive-CVE-2017-14502.patch b/gnu/packages/patches/libarchive-CVE-2017-14502.patch
deleted file mode 100644
index 8e0508afb5..0000000000
--- a/gnu/packages/patches/libarchive-CVE-2017-14502.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-Fix CVE-2017-14502:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14502
-https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=573
-
-Patch copied from upstream source repository:
-
-https://github.com/libarchive/libarchive/commit/5562545b5562f6d12a4ef991fae158bf4ccf92b6
-
-From 5562545b5562f6d12a4ef991fae158bf4ccf92b6 Mon Sep 17 00:00:00 2001
-From: Joerg Sonnenberger <joerg@bec.de>
-Date: Sat, 9 Sep 2017 17:47:32 +0200
-Subject: [PATCH] Avoid a read off-by-one error for UTF16 names in RAR
- archives.
-
-Reported-By: OSS-Fuzz issue 573
----
- libarchive/archive_read_support_format_rar.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c
-index cbb14c32..751de697 100644
---- a/libarchive/archive_read_support_format_rar.c
-+++ b/libarchive/archive_read_support_format_rar.c
-@@ -1496,7 +1496,11 @@ read_header(struct archive_read *a, struct archive_entry *entry,
-         return (ARCHIVE_FATAL);
-       }
-       filename[filename_size++] = '\0';
--      filename[filename_size++] = '\0';
-+      /*
-+       * Do not increment filename_size here as the computations below
-+       * add the space for the terminating NUL explicitly.
-+       */
-+      filename[filename_size] = '\0';
- 
-       /* Decoded unicode form is UTF-16BE, so we have to update a string
-        * conversion object for it. */
--- 
-2.15.1
-
diff --git a/gnu/packages/patches/libgcrypt-make-yat2m-reproducible.patch b/gnu/packages/patches/libgcrypt-make-yat2m-reproducible.patch
deleted file mode 100644
index 3056f0baad..0000000000
--- a/gnu/packages/patches/libgcrypt-make-yat2m-reproducible.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-Make yat2m in libgcrypt respect SOURCE_DATE_EPOCH, making
-the build reproducible.
-
-This was already fixed upstream in GnuPG:
-https://dev.gnupg.org/rG139de02b93773615bdd95e04a7f0c1ad73b4f6fb
-
-and in libgpg-error:
-https://dev.gnupg.org/rE5494a5728418938d2e42158bb646b07124184e64
-
-
---- a/doc/yat2m.c 2017-11-23 19:16:58.000000000 +0100
-+++ b/doc/yat2m.c 2017-08-28 12:22:54.000000000 +0200
-@@ -1475,6 +1484,7 @@
- main (int argc, char **argv)
- {
-   int last_argc = -1;
-+  const char *s;
- 
-   opt_source = "GNU";
-   opt_release = "";
-@@ -1608,6 +1618,11 @@
-   if (argc > 1)
-     die ("usage: " PGM " [OPTION] [FILE] (try --help for more information)\n");
- 
-+  /* Take care of supplied timestamp for reproducible builds.  See
-+   * https://reproducible-builds.org/specs/source-date-epoch/  */
-+  if (!opt_date && (s = getenv ("SOURCE_DATE_EPOCH")) && *s)
-+    opt_date = s;
-+
-   /* Start processing. */
-   if (argc && strcmp (*argv, "-"))
-     {
diff --git a/gnu/packages/patches/mescc-tools-boot.patch b/gnu/packages/patches/mescc-tools-boot.patch
new file mode 100644
index 0000000000..2bce8a49c2
--- /dev/null
+++ b/gnu/packages/patches/mescc-tools-boot.patch
@@ -0,0 +1,222 @@
+From c184e95096881a13f29ebd7fc507fe305d3d8de5 Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Date: Thu, 4 Oct 2018 22:03:31 +0200
+Subject: [PATCH] build.sh: Update for mes 0.18.
+
+---
+ build.sh   | 92 +++++++++++++++++++++++++++++++++++++-----------------
+ install.sh |  6 ++--
+ 2 files changed, 66 insertions(+), 32 deletions(-)
+
+diff --git a/build.sh b/build.sh
+index 335a7bb..19a0029 100755
+--- a/build.sh
++++ b/build.sh
+@@ -18,7 +18,8 @@
+ # along with mescc-tools.  If not, see <http://www.gnu.org/licenses/>.
+ 
+ set -eux
+-MES_SEED=${MES_SEED-../mescc-tools-seed/libs}
++MES_PREFIX=${MES_PREFIX-../mes}
++MES_SEED=${MES_SEED-../mes-seed}
+ MESCC_TOOLS_SEED=${MESCC_TOOLS_SEED-../mescc-tools-seed}
+ 
+ #########################################
+@@ -32,15 +33,23 @@ MESCC_TOOLS_SEED=${MESCC_TOOLS_SEED-../mescc-tools-seed}
+ # blood-elf
+ # Create proper debug segment
+ $MESCC_TOOLS_SEED/blood-elf\
++    -f $MESCC_TOOLS_SEED/file_print.M1\
++    -f $MESCC_TOOLS_SEED/match.M1\
++    -f $MESCC_TOOLS_SEED/numerate_number.M1\
++    -f $MESCC_TOOLS_SEED/string.M1\
+     -f $MESCC_TOOLS_SEED/blood-elf.M1\
+     -o blood-elf-blood-elf-footer.M1
+ 
+ # Build
+ # M1-macro phase
+ $MESCC_TOOLS_SEED/M1 --LittleEndian --Architecture 1\
+-    -f $MES_SEED/x86.M1\
+-    -f $MES_SEED/crt1.M1\
+-    -f $MES_SEED/libc+tcc-mes.M1\
++    -f $MES_PREFIX/lib/x86-mes/x86.M1\
++    -f $MES_SEED/x86-mes/crt1.S\
++    -f $MES_SEED/x86-mes/libc+tcc.S\
++    -f $MESCC_TOOLS_SEED/file_print.M1\
++    -f $MESCC_TOOLS_SEED/match.M1\
++    -f $MESCC_TOOLS_SEED/numerate_number.M1\
++    -f $MESCC_TOOLS_SEED/string.M1\
+     -f $MESCC_TOOLS_SEED/blood-elf.M1\
+     -f blood-elf-blood-elf-footer.M1\
+     -o blood-elf.hex2
+@@ -49,7 +58,7 @@ $MESCC_TOOLS_SEED/hex2\
+     --LittleEndian\
+     --Architecture 1\
+     --BaseAddress 0x1000000\
+-    -f $MES_SEED/elf32-header.hex2\
++    -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
+     -f blood-elf.hex2\
+     --exec_enable\
+     -o bin/blood-elf
+@@ -65,9 +74,13 @@ $MESCC_TOOLS_SEED/hex2\
+ $MESCC_TOOLS_SEED/M1 \
+     --LittleEndian\
+     --Architecture 1\
+-    -f $MES_SEED/x86.M1\
+-    -f $MES_SEED/crt1.M1\
+-    -f $MES_SEED/libc+tcc-mes.M1\
++    -f $MES_PREFIX/lib/x86-mes/x86.M1\
++    -f $MES_SEED/x86-mes/crt1.S\
++    -f $MES_SEED/x86-mes/libc+tcc.S\
++    -f $MESCC_TOOLS_SEED/file_print.M1\
++    -f $MESCC_TOOLS_SEED/match.M1\
++    -f $MESCC_TOOLS_SEED/numerate_number.M1\
++    -f $MESCC_TOOLS_SEED/string.M1\
+     -f $MESCC_TOOLS_SEED/M1.M1\
+     -f M1-footer.M1\
+     -o M1.hex2
+@@ -76,7 +89,7 @@ $MESCC_TOOLS_SEED/hex2 \
+     --LittleEndian\
+     --Architecture 1\
+     --BaseAddress 0x1000000\
+-    -f $MES_SEED/elf32-header.hex2\
++    -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
+     -f M1.hex2\
+     --exec_enable\
+     -o bin/M1
+@@ -92,9 +105,13 @@ $MESCC_TOOLS_SEED/hex2 \
+ ./bin/M1 \
+     --LittleEndian\
+     --Architecture 1\
+-    -f $MES_SEED/x86.M1\
+-    -f $MES_SEED/crt1.M1\
+-    -f $MES_SEED/libc+tcc-mes.M1\
++    -f $MES_PREFIX/lib/x86-mes/x86.M1\
++    -f $MES_SEED/x86-mes/crt1.S\
++    -f $MES_SEED/x86-mes/libc+tcc.S\
++    -f $MESCC_TOOLS_SEED/file_print.M1\
++    -f $MESCC_TOOLS_SEED/match.M1\
++    -f $MESCC_TOOLS_SEED/numerate_number.M1\
++    -f $MESCC_TOOLS_SEED/string.M1\
+     -f $MESCC_TOOLS_SEED/hex2.M1\
+     -f hex2-footer.M1\
+     -o hex2.hex2
+@@ -103,10 +120,10 @@ $MESCC_TOOLS_SEED/hex2 \
+       --LittleEndian\
+       --Architecture 1\
+       --BaseAddress 0x1000000\
+-      -f $MES_SEED/elf32-header.hex2\
++      -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
+       -f hex2.hex2\
+       --exec_enable\
+-      -o bin/hex2
++      -o bin/hex2-0
+ 
+ #########################
+ # Phase-1 Self-host     #
+@@ -123,18 +140,22 @@ $MESCC_TOOLS_SEED/hex2 \
+ ./bin/M1 \
+     --LittleEndian\
+     --Architecture 1\
+-    -f $MES_SEED/x86.M1\
+-    -f $MES_SEED/crt1.M1\
+-    -f $MES_SEED/libc+tcc-mes.M1\
++    -f $MES_PREFIX/lib/x86-mes/x86.M1\
++    -f $MES_SEED/x86-mes/crt1.S\
++    -f $MES_SEED/x86-mes/libc+tcc.S\
++    -f $MESCC_TOOLS_SEED/file_print.M1\
++    -f $MESCC_TOOLS_SEED/match.M1\
++    -f $MESCC_TOOLS_SEED/numerate_number.M1\
++    -f $MESCC_TOOLS_SEED/string.M1\
+     -f $MESCC_TOOLS_SEED/blood-elf.M1\
+     -f blood-elf-blood-elf-footer.M1\
+     -o blood-elf.hex2
+ # Hex2-linker phase
+-./bin/hex2 \
++./bin/hex2-0 \
+     --LittleEndian\
+     --Architecture 1\
+     --BaseAddress 0x1000000\
+-    -f $MES_SEED/elf32-header.hex2\
++    -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
+     -f blood-elf.hex2\
+     --exec_enable\
+     -o blood-elf
+@@ -150,18 +171,22 @@ $MESCC_TOOLS_SEED/hex2 \
+ ./bin/M1 \
+     --LittleEndian\
+     --Architecture 1\
+-    -f $MES_SEED/x86.M1\
+-    -f $MES_SEED/crt1.M1\
+-    -f $MES_SEED/libc+tcc-mes.M1\
++    -f $MES_PREFIX/lib/x86-mes/x86.M1\
++    -f $MES_SEED/x86-mes/crt1.S\
++    -f $MES_SEED/x86-mes/libc+tcc.S\
++    -f $MESCC_TOOLS_SEED/file_print.M1\
++    -f $MESCC_TOOLS_SEED/match.M1\
++    -f $MESCC_TOOLS_SEED/numerate_number.M1\
++    -f $MESCC_TOOLS_SEED/string.M1\
+     -f $MESCC_TOOLS_SEED/M1.M1\
+     -f M1-footer.M1\
+     -o M1.hex2
+ # Hex2-linker phase
+-./bin/hex2 \
++./bin/hex2-0 \
+     --LittleEndian\
+     --Architecture 1\
+     --BaseAddress 0x1000000\
+-    -f $MES_SEED/elf32-header.hex2\
++    -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
+     -f M1.hex2\
+     --exec_enable\
+     -o bin/M1
+@@ -177,18 +202,27 @@ $MESCC_TOOLS_SEED/hex2 \
+ ./bin/M1 \
+     --LittleEndian\
+     --Architecture 1\
+-    -f $MES_SEED/x86.M1\
+-    -f $MES_SEED/crt1.M1\
+-    -f $MES_SEED/libc+tcc-mes.M1\
++    -f $MES_PREFIX/lib/x86-mes/x86.M1\
++    -f $MES_SEED/x86-mes/crt1.S\
++    -f $MES_SEED/x86-mes/libc+tcc.S\
++    -f $MESCC_TOOLS_SEED/file_print.M1\
++    -f $MESCC_TOOLS_SEED/match.M1\
++    -f $MESCC_TOOLS_SEED/numerate_number.M1\
++    -f $MESCC_TOOLS_SEED/string.M1\
+     -f $MESCC_TOOLS_SEED/hex2.M1\
+     -f hex2-footer.M1\
+     -o hex2.hex2
+ # Hex2-linker phase
+-./bin/hex2 \
++./bin/hex2-0 \
+       --LittleEndian\
+       --Architecture 1\
+       --BaseAddress 0x1000000\
+-      -f $MES_SEED/elf32-header.hex2\
++      -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
+       -f hex2.hex2\
+       --exec_enable\
+       -o bin/hex2
++
++# TODO
++touch bin/exec_enable
++touch bin/get_machine
++touch bin/kaem
+diff --git a/install.sh b/install.sh
+index e4dccff..29e58d6 100644
+--- a/install.sh
++++ b/install.sh
+@@ -18,6 +18,6 @@
+ PREFIX=${PREFIX-usr}
+ 
+ mkdir -p "$PREFIX/bin"
+-cp blood-elf "$PREFIX/bin/blood-elf"
+-cp hex2 "$PREFIX/bin/hex2"
+-cp M1 "$PREFIX/bin/M1"
++cp bin/blood-elf "$PREFIX/bin/blood-elf"
++cp bin/hex2 "$PREFIX/bin/hex2"
++cp bin/M1 "$PREFIX/bin/M1"
+-- 
+2.18.0
+
diff --git a/gnu/packages/patches/python-pycodestyle-stdlib-tokenize-fix.patch b/gnu/packages/patches/python-pycodestyle-stdlib-tokenize-fix.patch
new file mode 100644
index 0000000000..16388c8dba
--- /dev/null
+++ b/gnu/packages/patches/python-pycodestyle-stdlib-tokenize-fix.patch
@@ -0,0 +1,35 @@
+From 397463014fda3cdefe8d6c9d117ae16d878dc494 Mon Sep 17 00:00:00 2001
+From: Michael Hudson-Doyle <michael.hudson@canonical.com>
+Date: Tue, 25 Sep 2018 14:58:57 +1200
+Subject: [PATCH] Keep compability with stdlib tokenize.py changes
+
+https://github.com/python/cpython/commit/c4ef4896eac86a6759901c8546e26de4695a1389
+is not yet part of any release of Python but has been backported to all
+versions in Git (includeing 2.7!). It causes the tokenize.py module to
+emit a synthetic NEWLINE token for files that do not in fact end with a
+newline, which confuses pycodestyle's checks for blank lines at the end
+of a file. Fortunately the synthetic NEWLINE tokens are easy to detect
+(the token text is "").
+
+Fixes #786
+---
+ pycodestyle.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pycodestyle.py b/pycodestyle.py
+index 0d725d27..fbc3dca3 100755
+--- a/pycodestyle.py
++++ b/pycodestyle.py
+@@ -258,10 +258,10 @@ def trailing_blank_lines(physical_line, lines, line_number, total_lines):
+     """
+     if line_number == total_lines:
+         stripped_last_line = physical_line.rstrip()
+-        if not stripped_last_line:
++        if physical_line and not stripped_last_line:
+             return 0, "W391 blank line at end of file"
+         if stripped_last_line == physical_line:
+-            return len(physical_line), "W292 no newline at end of file"
++            return len(lines[-1]), "W292 no newline at end of file"
+ 
+ 
+ @register_check
diff --git a/gnu/packages/patches/tcc-boot-0.9.27.patch b/gnu/packages/patches/tcc-boot-0.9.27.patch
new file mode 100644
index 0000000000..6f9d365788
--- /dev/null
+++ b/gnu/packages/patches/tcc-boot-0.9.27.patch
@@ -0,0 +1,26 @@
+From 1431ba3a99582e4c3d2693ac37e57f361858affd Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Date: Mon, 11 Jun 2018 18:39:44 +0200
+Subject: [PATCH] bootstrappable: Force static link.
+
+---
+ libtcc.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/libtcc.c b/libtcc.c
+index 3448f44..02ab850 100644
+--- a/libtcc.c
++++ b/libtcc.c
+@@ -735,6 +735,9 @@ LIBTCCAPI TCCState *tcc_new(void)
+     tcc_state = s;
+     ++nb_states;
+ 
++#if BOOTSTRAP
++    s->static_link = 1;
++#endif
+     s->alacarte_link = 1;
+     s->nocommon = 1;
+     s->warn_implicit_function_declaration = 1;
+-- 
+2.16.2
+
diff --git a/gnu/packages/pcre.scm b/gnu/packages/pcre.scm
index 564a23d012..f46f7e3775 100644
--- a/gnu/packages/pcre.scm
+++ b/gnu/packages/pcre.scm
@@ -89,7 +89,7 @@ POSIX regular expression API.")
 (define-public pcre2
   (package
     (name "pcre2")
-    (version "10.31")
+    (version "10.32")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/pcre/pcre2/"
@@ -97,7 +97,7 @@ POSIX regular expression API.")
 
               (sha256
                (base32
-                "1b389pzw91k1hzydsh4smdsxyppwz4pv74m3nrvy8rda0j3m6zg0"))))
+                "0bkwp2czcckvvbdls7b331cad11rxsm020aqhrbz84z8bp68k7pj"))))
    (build-system gnu-build-system)
    (inputs `(("bzip2" ,bzip2)
              ("readline" ,readline)
diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index 073cdbf482..6a51a92ec8 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -63,14 +63,14 @@
   ;; Yeah, Perl...  It is required early in the bootstrap process by Linux.
   (package
     (name "perl")
-    (version "5.28.0")
+    (version "5.28.1")
     (source (origin
              (method url-fetch)
              (uri (string-append "mirror://cpan/src/5.0/perl-"
                                  version ".tar.gz"))
              (sha256
               (base32
-               "1a3f822lcl8dr8v0hk80yyhpzqlljg49z9flb48rs3nbsij9z4ky"))
+               "0iy3as4hnbjfyws4in3j9d6zhhjxgl5m95i5n9jy2bnzcpz8bgry"))
              (patches (search-patches
                        "perl-no-sys-dirs.patch"
                        "perl-autosplit-default-time.patch"
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index f047a5c316..34126c1fe1 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -3595,12 +3595,13 @@ as the original project seems to have been abandoned circa 2007.")
     (name "python-pycodestyle")
     (version "2.4.0")
     (source
-      (origin
-        (method url-fetch)
-        (uri (pypi-uri "pycodestyle" version))
-        (sha256
-          (base32
-            "0fhy4vnlgpjq4qd1wdnl6pvdw7rah0ypmn8c9mkhz8clsndskz6b"))))
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "pycodestyle" version))
+       (sha256
+        (base32
+         "0fhy4vnlgpjq4qd1wdnl6pvdw7rah0ypmn8c9mkhz8clsndskz6b"))
+       (patches (search-patches "python-pycodestyle-stdlib-tokenize-fix.patch"))))
     (build-system python-build-system)
     (home-page "https://pycodestyle.readthedocs.io/")
     (synopsis "Python style guide checker")
@@ -7551,11 +7552,14 @@ otherwise matches 3.2’s API.")
          (base32
           "0rdjmmsab550kxsssdq49jcniz77zlkpw4pvi9hvib3lsskjmh4y"))))
     (build-system python-build-system)
-    (arguments `(#:python ,python-2
-                 ;; FIXME: Python 2.7.14 moved the test.support library,
-                 ;; but our package has not yet been adjusted.  Enable
-                 ;; tests when the python2 package has been fixed.
-                 #:tests? #f))
+    (arguments
+     `(#:python ,python-2
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (invoke "python" "test_futures.py")
+             #t)))))
     (home-page "https://github.com/agronholm/pythonfutures")
     (synopsis
      "Backport of the concurrent.futures package from Python 3.2")
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 1c4ea720f1..ce2e344880 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -3,7 +3,7 @@
 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2014, 2017 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2017, 2019 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2014, 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2015 Omar Radwan <toxemicsquire4@gmail.com>
 ;;; Copyright © 2015 Pierre-Antoine Rault <par@rigelk.eu>
@@ -95,7 +95,6 @@
   (package
     (name "python2")
     (version "2.7.15")
-    (replacement python-2/fixed)
     (source
      (origin
       (method url-fetch)
@@ -108,7 +107,9 @@
                                "python-2-deterministic-build-info.patch"
                                "python-2.7-site-prefixes.patch"
                                "python-2.7-source-date-epoch.patch"
-                               "python-2.7-adjust-tests.patch"))
+                               "python-2.7-adjust-tests.patch"
+                               "python2-CVE-2018-14647.patch"
+                               "python2-CVE-2018-1000802.patch"))
       (modules '((guix build utils)))
       ;; suboptimal to delete failing tests here, but if we delete them in the
       ;; arguments then we need to make sure to strip out that phase when it
@@ -136,6 +137,9 @@
              "--enable-unicode=ucs4"
              (string-append "LDFLAGS=-Wl,-rpath="
                             (assoc-ref %outputs "out") "/lib"))
+       ;; With no -j argument tests use all available cpus, so provide one.
+       #:make-flags
+       (list (format #f "TESTOPTS=-j~d" (parallel-job-count)))
 
         #:modules ((ice-9 ftw) (ice-9 match)
                    (guix build utils) (guix build gnu-build-system))
@@ -204,16 +208,35 @@
                                  (scandir testdir
                                           (match-lambda
                                             ((or "." "..") #f)
+                                            ("support" #f)
                                             (file
                                              (not
-                                              ;; FIXME: Add the 'support' directory
-                                              ;; in the next rebuild cycle, since it
-                                              ;; moved in 2.7.14.  See also
-                                              ;; python2-futures below.
                                               (string-prefix? "test_support."
                                                               file))))))
                        (call-with-output-file "__init__.py" (const #t))
                        #t)))))))
+          (add-after 'remove-tests 'rebuild-bytecode
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out")))
+                ;; Disable hash randomization to ensure the generated .pycs
+                ;; are reproducible.
+                (setenv "PYTHONHASHSEED" "0")
+                (for-each
+                 (lambda (opt)
+                   (format #t "Compiling with optimization level: ~a\n"
+                           (if (null? opt) "none" (car opt)))
+                   (for-each (lambda (file)
+                               (apply invoke
+                                      `(,(string-append out "/bin/python")
+                                        ,@opt
+                                        "-m" "compileall"
+                                        "-f" ; force rebuild
+                                        ;; Don't build lib2to3, because it contains Python 3 code.
+                                        "-x" "lib2to3/.*"
+                                        ,file)))
+                             (find-files out "\\.py$")))
+                 (list '() '("-O") '("-OO")))
+                #t)))
           (add-after 'install 'move-tk-inter
             (lambda* (#:key outputs #:allow-other-keys)
               ;; When Tkinter support is built move it to a separate output so
@@ -266,16 +289,6 @@ data types.")
 ;; Current 2.x version.
 (define-public python-2 python-2.7)
 
-(define python-2/fixed
-  (package
-    (inherit python-2)
-    (source (origin
-              (inherit (package-source python-2))
-              (patches (append
-                        (origin-patches (package-source python-2))
-                        (search-patches "python2-CVE-2018-14647.patch"
-                                        "python2-CVE-2018-1000802.patch")))))))
-
 (define-public python2-called-python
   ;; Both 2.x and 3.x used to be called "python".  In commit
   ;; a7714d42de2c3082f3609d1e63c83d703fb39cf9 (March 2018), we renamed the
@@ -288,8 +301,7 @@ data types.")
 (define-public python-3.7
   (package (inherit python-2)
     (name "python")
-    (version "3.7.0")
-    (replacement python-3/fixed)
+    (version "3.7.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.python.org/ftp/python/"
@@ -302,7 +314,7 @@ data types.")
               (patch-flags '("-p0"))
               (sha256
                (base32
-                "0j9mic5c9lbd2b20wka7hily7szz740wy9ilfrczxap63rnrk0h3"))
+                "1fzi9d2gibh0wzwidyckzbywsxcsbckgsl05ryxlifxia77fhgyq"))
               (snippet
                '(begin
                   (for-each delete-file
@@ -326,10 +338,7 @@ data types.")
             (lambda _ (unsetenv "SOURCE_DATE_EPOCH") #t))
           (add-after 'check 'reset-SOURCE_DATE_EPOCH
             (lambda _ (setenv "SOURCE_DATE_EPOCH" "1") #t))
-           ;; FIXME: Without this phase we have close to 400 files that
-           ;; differ across different builds of this package.  With this phase
-           ;; there are 44 files left that differ.
-           (add-after 'remove-tests 'rebuild-bytecode
+           (replace 'rebuild-bytecode
              (lambda* (#:key outputs #:allow-other-keys)
                (let ((out (assoc-ref outputs "out")))
                  ;; Disable hash randomization to ensure the generated .pycs
@@ -361,14 +370,6 @@ data types.")
 ;; Current 3.x version.
 (define-public python-3 python-3.7)
 
-(define python-3/fixed
-  (package
-    (inherit python-3)
-    (source (origin
-              (inherit (package-source python-3))
-              (patches (append (origin-patches (package-source python-3))
-                               (search-patches "python-CVE-2018-14647.patch")))))))
-
 ;; Current major version.
 (define-public python python-3)
 
diff --git a/gnu/packages/readline.scm b/gnu/packages/readline.scm
index 59fa8af8af..57d550d67f 100644
--- a/gnu/packages/readline.scm
+++ b/gnu/packages/readline.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
@@ -55,18 +55,15 @@
 (define-public readline
   (package
     (name "readline")
-    (version (string-append "7.0."
-                            (number->string (length %patch-series-7.0))))
+    (version "8.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnu/readline/readline-"
                                   (version-major+minor version) ".tar.gz"))
               (sha256
                (base32
-                "0d13sg9ksf982rrrmv5mb6a2p4ys9rvg9r71d6il0vr8hmql63bm"))
-              (patches (append
-                        %patch-series-7.0
-                        (search-patches "readline-link-ncurses.patch")))
+                "0qg4924hf4hg0r0wbx2chswsr08734536fh5iagkd3a7f4czafg3"))
+              (patches (search-patches "readline-link-ncurses.patch"))
               (patch-flags '("-p0"))))
     (build-system gnu-build-system)
     (propagated-inputs `(("ncurses" ,ncurses)))
@@ -101,6 +98,23 @@ comfortable for anyone.")
     (license gpl3+)
     (home-page "https://savannah.gnu.org/projects/readline/")))
 
+(define-public readline-7
+  (package (inherit readline)
+    (name "readline")
+    (version (string-append "7.0."
+                            (number->string (length %patch-series-7.0))))
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/readline/readline-"
+                                  (version-major+minor version) ".tar.gz"))
+              (sha256
+               (base32
+                "0d13sg9ksf982rrrmv5mb6a2p4ys9rvg9r71d6il0vr8hmql63bm"))
+              (patches (append
+                        %patch-series-7.0
+                        (search-patches "readline-link-ncurses.patch")))
+              (patch-flags '("-p0"))))))
+
 (define-public readline-6.2
   (package (inherit readline)
     (version "6.2")
diff --git a/gnu/packages/sqlite.scm b/gnu/packages/sqlite.scm
index 05d7ce6b92..794c030385 100644
--- a/gnu/packages/sqlite.scm
+++ b/gnu/packages/sqlite.scm
@@ -46,8 +46,7 @@
 (define-public sqlite
   (package
    (name "sqlite")
-   (replacement sqlite-3.26.0)
-   (version "3.24.0")
+   (version "3.26.0")
    (source (origin
             (method url-fetch)
             (uri (let ((numeric-version
@@ -63,7 +62,7 @@
                                   numeric-version ".tar.gz")))
             (sha256
              (base32
-              "0jmprv2vpggzhy7ma4ynmv1jzn3pfiwzkld0kkg6hvgvqs44xlfr"))))
+              "0pdzszb4sp73hl36siiv3p300jvfvbcdxi2rrmkwgs6inwznmajx"))))
    (build-system gnu-build-system)
    (inputs `(("readline" ,readline)))
    (arguments
@@ -83,26 +82,6 @@ widely deployed SQL database engine in the world.  The source code for SQLite
 is in the public domain.")
    (license license:public-domain)))
 
-(define-public sqlite-3.26.0
-  (package (inherit sqlite)
-    (version "3.26.0")
-    (source (origin
-              (method url-fetch)
-              (uri (let ((numeric-version
-                          (match (string-split version #\.)
-                            ((first-digit other-digits ...)
-                             (string-append first-digit
-                                            (string-pad-right
-                                             (string-concatenate
-                                              (map (cut string-pad <> 2 #\0)
-                                                   other-digits))
-                                             6 #\0))))))
-                     (string-append "https://sqlite.org/2018/sqlite-autoconf-"
-                                    numeric-version ".tar.gz")))
-              (sha256
-               (base32
-                "0pdzszb4sp73hl36siiv3p300jvfvbcdxi2rrmkwgs6inwznmajx"))))))
-
 ;; This is used by Qt.
 (define-public sqlite-with-column-metadata
   (package/inherit sqlite
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index fab0e72278..c025bfc56f 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -271,7 +271,7 @@ required structures.")
 (define-public openssl
   (package
    (name "openssl")
-   (version "1.0.2p")
+   (version "1.0.2q")
    (source (origin
              (method url-fetch)
              (uri (list (string-append "https://www.openssl.org/source/openssl-"
@@ -283,7 +283,7 @@ required structures.")
                                        "/" name "-" version ".tar.gz")))
              (sha256
               (base32
-               "003xh9f898i56344vpvpxxxzmikivxig4xwlm7vbi7m8n43qxaah"))
+               "115nisqy7kazbg6br2wrcra9nphyph1l4dgp563b9cf2rv5wyi2p"))
              (patches (search-patches "openssl-runpath.patch"
                                       "openssl-c-rehash-in.patch"))))
    (build-system gnu-build-system)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index b8e967bf69..0b5699a894 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -5,7 +5,7 @@
 ;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
 ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2014, 2016 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2016, 2019 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2015, 2018 Kyle Meyer <kyle@kyleam.com>
 ;;; Copyright © 2015, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
@@ -1384,6 +1384,15 @@ projects, from individuals to large-scale enterprise operations.")
              (patches (search-patches "rcs-5.9.4-noreturn.patch"))))
     (build-system gnu-build-system)
     (native-inputs `(("ed" ,ed)))
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-before 'check 'disable-t810
+                    ;; See https://savannah.gnu.org/bugs/index.php?52288
+                    ;; Back-porting the fix is non-trivial, so disable for now.
+                    (lambda _
+                      (substitute* "tests/Makefile"
+                        ((" t810 \\\\\n") ""))
+                     #t)))))
     (home-page "https://www.gnu.org/software/rcs/")
     (synopsis "Per-file local revision control system")
     (description
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index c0f439ea93..5aab6bc396 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2461,14 +2461,14 @@ supported players in addition to this package.")
 (define-public handbrake
   (package
     (name "handbrake")
-    (version "1.1.2")
+    (version "1.2.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://download.handbrake.fr/releases/"
                                   version "/HandBrake-" version "-source.tar.bz2"))
               (sha256
                (base32
-                "0bny0hwlr55g2c69rsamv0xvwmfh1s4a582b9vq20xv5ly84m6ms"))
+                "03clkknaq3mz84p85cvr21gsy9b8vv2g4vvyfz44hz8la253jfqi"))
               (modules '((guix build utils)))
               (snippet
                ;; Remove "contrib" and source not necessary for
@@ -2482,11 +2482,13 @@ supported players in addition to this package.")
                     ;; which would lead to fetching and building of these
                     ;; libraries.  Use our own instead.
                     (("MODULES \\+= contrib") "# MODULES += contrib"))
-                  #t))))
+                  #t))
+              (patches (search-patches "handbrake-opt-in-nvenc.patch"))))
     (build-system  glib-or-gtk-build-system)
     (native-inputs
      `(("automake" ,automake)           ;gui subpackage must be bootstrapped
        ("autoconf" ,autoconf)
+       ("cmake" ,cmake) ;TODO: could probably strip check from make/configure.py
        ("curl" ,curl)                   ;not actually used, but tested for
        ("intltool" ,intltool)
        ("libtool" ,libtool)
@@ -2519,12 +2521,14 @@ supported players in addition to this package.")
        ("libvpx" ,libvpx)
        ("libxml2" ,libxml2)
        ("libx264" ,libx264)
+       ("speex" ,speex)
        ("x265" ,x265)
        ("zlib" ,zlib)))
     (arguments
      `(#:tests? #f             ;tests require Ruby and claim to be unsupported
        #:configure-flags
-       (list (string-append "CPPFLAGS=-I"
+       (list "--disable-gtk-update-checks"
+             (string-append "CPPFLAGS=-I"
                             (assoc-ref %build-inputs "libxml2")
                             "/include/libxml2")
              "LDFLAGS=-lx265")
diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index 05bc8aa13e..322fc4ec3e 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -123,14 +123,14 @@ hierarchical form with variable field lengths.")
 (define-public libxml2
   (package
     (name "libxml2")
-    (version "2.9.8")
+    (version "2.9.9")
     (source (origin
              (method url-fetch)
              (uri (string-append "ftp://xmlsoft.org/libxml2/libxml2-"
                                  version ".tar.gz"))
              (sha256
               (base32
-               "0ci7is75bwqqw2p32vxvrk6ds51ik7qgx73m920rakv5jlayax0b"))))
+               "0wd881jzvqayx0ihzba29jl80k06xj9ywp16kxacdqs3064p1ywl"))))
     (build-system gnu-build-system)
     (outputs '("out" "static"))
     (arguments
@@ -145,6 +145,12 @@ hierarchical form with variable field lengths.")
                                     (rename-file ar (string-append dst "/"
                                                                    (basename ar))))
                                   (find-files src "\\.a$"))
+
+                        ;; Remove reference to the static library from the .la
+                        ;; file such that Libtool does the right thing when both
+                        ;; the shared and static variants are available.
+                        (substitute* (string-append src "/libxml2.la")
+                          (("^old_library='libxml2.a'") "old_library=''"))
                         #t))))))
     (home-page "http://www.xmlsoft.org/")
     (synopsis "C parser for XML")
@@ -199,14 +205,14 @@ project (but it is usable outside of the Gnome platform).")
 (define-public libxslt
   (package
     (name "libxslt")
-    (version "1.1.32")
+    (version "1.1.33")
     (source (origin
              (method url-fetch)
              (uri (string-append "ftp://xmlsoft.org/libxslt/libxslt-"
                                  version ".tar.gz"))
              (sha256
               (base32
-               "0q2l6m56iv3ysxgm2walhg4c9wp7q183jb328687i9zlp85csvjj"))
+               "1j1q1swnsy8jgi9x7mclvkrqhfgn09886gdlr9wzk7a08i8n0dlf"))
              (patches (search-patches "libxslt-generated-ids.patch"))))
     (build-system gnu-build-system)
     (home-page "http://xmlsoft.org/XSLT/index.html")
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index e5f3197b0a..3f68ad52ed 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -784,34 +784,37 @@ in order.  Return #t if all the PHASES succeeded, #f otherwise."
       (+ (time-second diff)
          (/ (time-nanosecond diff) 1e9))))
 
-  (setvbuf (current-output-port) _IOLBF)
-  (setvbuf (current-error-port) _IOLBF)
+  (setvbuf (current-output-port) 'line)
+  (setvbuf (current-error-port) 'line)
 
   ;; Encoding/decoding errors shouldn't be silent.
   (fluid-set! %default-port-conversion-strategy 'error)
 
-  ;; The trick is to #:allow-other-keys everywhere, so that each procedure in
-  ;; PHASES can pick the keyword arguments it's interested in.
-  (every (match-lambda
-           ((name . proc)
-            (let ((start (current-time time-monotonic)))
-              (format #t "starting phase `~a'~%" name)
-              (let ((result (apply proc args))
-                    (end    (current-time time-monotonic)))
-                (format #t "phase `~a' ~:[failed~;succeeded~] after ~,1f seconds~%"
-                        name result
-                        (elapsed-time end start))
-
-                ;; Issue a warning unless the result is #t.
-                (unless (eqv? result #t)
-                  (format (current-error-port) "\
+  (guard (c ((invoke-error? c)
+             (report-invoke-error c)
+             (exit 1)))
+    ;; The trick is to #:allow-other-keys everywhere, so that each procedure in
+    ;; PHASES can pick the keyword arguments it's interested in.
+    (every (match-lambda
+             ((name . proc)
+              (let ((start (current-time time-monotonic)))
+                (format #t "starting phase `~a'~%" name)
+                (let ((result (apply proc args))
+                      (end    (current-time time-monotonic)))
+                  (format #t "phase `~a' ~:[failed~;succeeded~] after ~,1f seconds~%"
+                          name result
+                          (elapsed-time end start))
+
+                  ;; Issue a warning unless the result is #t.
+                  (unless (eqv? result #t)
+                    (format (current-error-port) "\
 ## WARNING: phase `~a' returned `~s'.  Return values other than #t
 ## are deprecated.  Please migrate this package so that its phase
 ## procedures report errors by raising an exception, and otherwise
 ## always return #t.~%"
-                          name result))
+                            name result))
 
-                ;; Dump the environment variables as a shell script, for handy debugging.
-                (system "export > $NIX_BUILD_TOP/environment-variables")
-                result))))
-         phases))
+                  ;; Dump the environment variables as a shell script, for handy debugging.
+                  (system "export > $NIX_BUILD_TOP/environment-variables")
+                  result))))
+           phases)))
diff --git a/guix/build/make-bootstrap.scm b/guix/build/make-bootstrap.scm
index 48799f7e90..e5ef1d6d2b 100644
--- a/guix/build/make-bootstrap.scm
+++ b/guix/build/make-bootstrap.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015, 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;; Copyright © 2015, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -23,7 +24,8 @@
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
   #:use-module (guix build utils)
-  #:export (make-stripped-libc))
+  #:export (copy-linux-headers
+            make-stripped-libc))
 
 ;; Commentary:
 ;;
@@ -31,6 +33,53 @@
 ;;
 ;; Code:
 
+(define (copy-linux-headers output kernel-headers)
+  "Copy to OUTPUT the subset of KERNEL-HEADERS that is needed when producing a
+bootstrap libc."
+
+  (let* ((incdir (string-append output "/include")))
+    (mkdir-p incdir)
+
+    ;; Copy some of the Linux-Libre headers that glibc headers
+    ;; refer to.
+    (mkdir (string-append incdir "/linux"))
+    (for-each (lambda (file)
+                (install-file (pk 'src (string-append kernel-headers "/include/linux/" file))
+                              (pk 'dest (string-append incdir "/linux"))))
+              '(
+                "a.out.h"               ; for 2.2.5
+                "atalk.h"               ; for 2.2.5
+                "errno.h"
+                "falloc.h"
+                "if_addr.h"             ; for 2.16.0
+                "if_ether.h"            ; for 2.2.5
+                "if_link.h"             ; for 2.16.0
+                "ioctl.h"
+                "kernel.h"
+                "limits.h"
+                "neighbour.h"           ; for 2.16.0
+                "netlink.h"             ; for 2.16.0
+                "param.h"
+                "prctl.h"               ; for 2.16.0
+                "posix_types.h"
+                "rtnetlink.h"           ; for 2.16.0
+                "socket.h"
+                "stddef.h"
+                "swab.h"                ; for 2.2.5
+                "sysctl.h"
+                "sysinfo.h"             ; for 2.2.5
+                "types.h"
+                "version.h"             ; for 2.2.5
+                ))
+
+    (copy-recursively (string-append kernel-headers "/include/asm")
+                      (string-append incdir "/asm"))
+    (copy-recursively (string-append kernel-headers "/include/asm-generic")
+                      (string-append incdir "/asm-generic"))
+    (copy-recursively (string-append kernel-headers "/include/linux/byteorder")
+                      (string-append incdir "/linux/byteorder"))
+    #t))
+
 (define (make-stripped-libc output libc kernel-headers)
   "Copy to OUTPUT the subset of LIBC and KERNEL-HEADERS that is needed
 when producing a bootstrap libc."
@@ -43,25 +92,10 @@ when producing a bootstrap libc."
                         (string-append incdir "/mach"))
       #t))
   
-  (define (copy-linux-headers output kernel-headers)
+  (define (copy-libc+linux-headers output kernel-headers)
     (let* ((incdir (string-append output "/include")))
       (copy-recursively (string-append libc "/include") incdir)
-
-      ;; Copy some of the Linux-Libre headers that glibc headers
-      ;; refer to.
-      (mkdir (string-append incdir "/linux"))
-      (for-each (lambda (file)
-                  (install-file (string-append kernel-headers "/include/linux/" file)
-                                (string-append incdir "/linux")))
-                '("limits.h" "errno.h" "socket.h" "kernel.h"
-                  "sysctl.h" "param.h" "ioctl.h" "types.h"
-                  "posix_types.h" "stddef.h" "falloc.h"))
-
-      (copy-recursively (string-append kernel-headers "/include/asm")
-                        (string-append incdir "/asm"))
-      (copy-recursively (string-append kernel-headers "/include/asm-generic")
-                        (string-append incdir "/asm-generic"))
-      #t))
+      (copy-linux-headers output kernel-headers)))
 
   (define %libc-object-files-rx "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|\
 util).*\\.so(\\..*)?|lib(machuser|hurduser).so.*|(libc(rt|)|libpthread)\
@@ -80,6 +114,6 @@ _nonshared\\.a)$")
 
     (if (directory-exists? (string-append kernel-headers "/include/mach"))
         (copy-mach-headers output kernel-headers)
-        (copy-linux-headers output kernel-headers)))
+        (copy-libc+linux-headers output kernel-headers)))
 
 
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index 5bb0ba49d5..73b554c766 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -186,11 +187,9 @@ when running checks after installing the package."
 
 (define* (wrap #:key inputs outputs #:allow-other-keys)
   (define (list-of-files dir)
-    (map (cut string-append dir "/" <>)
-         (or (scandir dir (lambda (f)
-                            (let ((s (stat (string-append dir "/" f))))
-                              (eq? 'regular (stat:type s)))))
-             '())))
+    (find-files dir (lambda (file stat)
+                      (and (eq? 'regular (stat:type stat))
+                           (not (wrapper? file))))))
 
   (define bindirs
     (append-map (match-lambda
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 5fe3286843..b7cd748d81 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -1,8 +1,10 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -87,7 +89,13 @@
             patch-/usr/bin/file
             fold-port-matches
             remove-store-references
+            wrapper?
             wrap-program
+            wrap-script
+
+            wrap-error?
+            wrap-error-program
+            wrap-error-type
 
             invoke
             invoke-error?
@@ -96,10 +104,31 @@
             invoke-error-exit-status
             invoke-error-term-signal
             invoke-error-stop-signal
+            report-invoke-error
 
             locale-category->string))
 
+
+;;;
+;;; Guile 2.0 compatibility later.
+;;;
+
+;; The bootstrap Guile is Guile 2.0, so provide a compatibility layer.
+(cond-expand
+  ((and guile-2 (not guile-2.2))
+   (define (setvbuf port mode . rest)
+     (apply (@ (guile) setvbuf) port
+            (match mode
+              ('line _IOLBF)
+              ('block _IOFBF)
+              ('none _IONBF)
+              (_ mode))                           ;an _IO* integer
+            rest))
+
+   (module-replace! (current-module) '(setvbuf)))
+  (else #f))
 
+
 ;;;
 ;;; Directories.
 ;;;
@@ -600,6 +629,11 @@ Where every <*-phase-name> is an expression evaluating to a symbol, and
     ((_ phases (add-after old-phase-name new-phase-name new-phase))
      (alist-cons-after old-phase-name new-phase-name new-phase phases))))
 
+
+;;;
+;;; Program invocation.
+;;;
+
 (define-condition-type &invoke-error &error
   invoke-error?
   (program      invoke-error-program)
@@ -621,6 +655,17 @@ if the exit code is non-zero; otherwise return #t."
                          (stop-signal (status:stop-sig code))))))
     #t))
 
+(define* (report-invoke-error c #:optional (port (current-error-port)))
+  "Report to PORT about C, an '&invoke-error' condition, in a human-friendly
+way."
+  (format port "command~{ ~s~} failed with ~:[signal~;status~] ~a~%"
+          (cons (invoke-error-program c)
+                (invoke-error-arguments c))
+          (invoke-error-exit-status c)
+          (or (invoke-error-exit-status c)
+              (invoke-error-term-signal c)
+              (invoke-error-stop-signal c))))
+
 
 ;;;
 ;;; Text substitution (aka. sed).
@@ -987,8 +1032,8 @@ known as `nuke-refs' in Nixpkgs."
         ;; We cannot use `regexp-exec' here because it cannot deal with
         ;; strings containing NUL characters.
         (format #t "removing store references from `~a'...~%" file)
-        (setvbuf in _IOFBF 65536)
-        (setvbuf out _IOFBF 65536)
+        (setvbuf in 'block 65536)
+        (setvbuf out 'block 65536)
         (fold-port-matches (lambda (match result)
                              (put-bytevector out (string->utf8 store))
                              (put-u8 out (char->integer #\/))
@@ -1003,6 +1048,18 @@ known as `nuke-refs' in Nixpkgs."
                              (put-u8 out (char->integer char))
                              result))))))
 
+(define-condition-type &wrap-error &error
+  wrap-error?
+  (program    wrap-error-program)
+  (type       wrap-error-type))
+
+(define (wrapper? prog)
+  "Return #t if PROG is a wrapper as produced by 'wrap-program'."
+  (and (file-exists? prog)
+       (let ((base (basename prog)))
+         (and (string-prefix? "." base)
+              (string-suffix? "-real" base)))))
+
 (define* (wrap-program prog #:rest vars)
   "Make a wrapper for PROG.  VARS should look like this:
 
@@ -1100,6 +1157,120 @@ with definitions for VARS."
         (chmod prog-tmp #o755)
         (rename-file prog-tmp prog))))
 
+(define wrap-script
+  (let ((interpreter-regex
+         (make-regexp
+          (string-append "^#! ?(/[^ ]+/bin/("
+                         (string-join '("python[^ ]*"
+                                        "Rscript"
+                                        "perl"
+                                        "ruby"
+                                        "bash"
+                                        "sh") "|")
+                         "))( ?.*)")))
+        (coding-line-regex
+         (make-regexp
+          ".*#.*coding[=:][[:space:]]*([-a-zA-Z_0-9.]+)")))
+    (lambda* (prog #:key (guile (which "guile")) #:rest vars)
+      "Wrap the script PROG such that VARS are set first.  The format of VARS
+is the same as in the WRAP-PROGRAM procedure.  This procedure differs from
+WRAP-PROGRAM in that it does not create a separate shell script.  Instead,
+PROG is modified directly by prepending a Guile script, which is interpreted
+as a comment in the script's language.
+
+Special encoding comments as supported by Python are recreated on the second
+line.
+
+Note that this procedure can only be used once per file as Guile scripts are
+not supported."
+      (define update-env
+        (match-lambda
+          ((var sep '= rest)
+           `(setenv ,var ,(string-join rest sep)))
+          ((var sep 'prefix rest)
+           `(let ((current (getenv ,var)))
+              (setenv ,var (if current
+                               (string-append ,(string-join rest sep)
+                                              ,sep current)
+                               ,(string-join rest sep)))))
+          ((var sep 'suffix rest)
+           `(let ((current (getenv ,var)))
+              (setenv ,var (if current
+                               (string-append current ,sep
+                                              ,(string-join rest sep))
+                               ,(string-join rest sep)))))
+          ((var '= rest)
+           `(setenv ,var ,(string-join rest ":")))
+          ((var 'prefix rest)
+           `(let ((current (getenv ,var)))
+              (setenv ,var (if current
+                               (string-append ,(string-join rest ":")
+                                              ":" current)
+                               ,(string-join rest ":")))))
+          ((var 'suffix rest)
+           `(let ((current (getenv ,var)))
+              (setenv ,var (if current
+                               (string-append current ":"
+                                              ,(string-join rest ":"))
+                               ,(string-join rest ":")))))))
+      (let-values (((interpreter args coding-line)
+                    (call-with-ascii-input-file prog
+                      (lambda (p)
+                        (let ((first-match
+                               (false-if-exception
+                                (regexp-exec interpreter-regex (read-line p)))))
+                          (values (and first-match (match:substring first-match 1))
+                                  (and first-match (match:substring first-match 3))
+                                  (false-if-exception
+                                   (and=> (regexp-exec coding-line-regex (read-line p))
+                                          (lambda (m) (match:substring m 0))))))))))
+        (if interpreter
+            (let* ((header (format #f "\
+#!~a --no-auto-compile
+#!#; ~a
+#\\-~s
+#\\-~s
+"
+                                   guile
+                                   (or coding-line "Guix wrapper")
+                                   (cons 'begin (map update-env
+                                                     (match vars
+                                                       ((#:guile _ . vars) vars)
+                                                       (_ vars))))
+                                   `(let ((cl (command-line)))
+                                      (apply execl ,interpreter
+                                             (car cl)
+                                             (cons (car cl)
+                                                   (append
+                                                    ',(string-split args #\space)
+                                                    cl))))))
+                   (template (string-append prog ".XXXXXX"))
+                   (out      (mkstemp! template))
+                   (st       (stat prog))
+                   (mode     (stat:mode st)))
+              (with-throw-handler #t
+                (lambda ()
+                  (call-with-ascii-input-file prog
+                    (lambda (p)
+                      (format out header)
+                      (dump-port p out)
+                      (close out)
+                      (chmod template mode)
+                      (rename-file template prog)
+                      (set-file-time prog st))))
+                (lambda (key . args)
+                  (format (current-error-port)
+                          "wrap-script: ~a: error: ~a ~s~%"
+                          prog key args)
+                  (false-if-exception (delete-file template))
+                  (raise (condition
+                          (&wrap-error (program prog)
+                                       (type key))))
+                  #f)))
+            (raise (condition
+                    (&wrap-error (program prog)
+                                 (type 'no-interpreter-found)))))))))
+
 
 ;;;
 ;;; Locales.
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index b19a4ae1b1..40e59a6101 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -446,9 +446,9 @@ the image."
   "Return the C compiler that uses the bootstrap toolchain.  This is used only
 by '--bootstrap', for testing purposes."
   (define bootstrap-toolchain
-    (list (first (assoc-ref %bootstrap-inputs "gcc"))
-          (first (assoc-ref %bootstrap-inputs "binutils"))
-          (first (assoc-ref %bootstrap-inputs "libc"))))
+    (list (first (assoc-ref (%bootstrap-inputs) "gcc"))
+          (first (assoc-ref (%bootstrap-inputs) "binutils"))
+          (first (assoc-ref (%bootstrap-inputs) "libc"))))
 
   (c-compiler bootstrap-toolchain
               #:guile %bootstrap-guile))
diff --git a/tests/build-utils.scm b/tests/build-utils.scm
index 7d49446f66..1c9084514d 100644
--- a/tests/build-utils.scm
+++ b/tests/build-utils.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -122,4 +123,105 @@
          (and (zero? (close-pipe pipe))
               str))))))
 
+(let ((script-contents "\
+#!/anything/cabbage-bash-1.2.3/bin/sh
+
+echo hello world"))
+
+  (test-equal "wrap-script, simple case"
+    (string-append
+     (format #f "\
+#!GUILE --no-auto-compile
+#!#; Guix wrapper
+#\\-~s
+#\\-~s
+"
+             '(begin (let ((current (getenv "GUIX_FOO")))
+                       (setenv "GUIX_FOO"
+                               (if current
+                                   (string-append "/some/path:/some/other/path"
+                                                  ":" current)
+                                   "/some/path:/some/other/path"))))
+             '(let ((cl (command-line)))
+                (apply execl "/anything/cabbage-bash-1.2.3/bin/sh"
+                       (car cl)
+                       (cons (car cl)
+                             (append '("") cl)))))
+     script-contents)
+    (call-with-temporary-directory
+     (lambda (directory)
+       (let ((script-file-name (string-append directory "/foo")))
+         (call-with-output-file script-file-name
+           (lambda (port)
+             (format port script-contents)))
+         (chmod script-file-name #o777)
+
+         (mock ((guix build utils) which (const "GUILE"))
+               (wrap-script script-file-name
+                            `("GUIX_FOO" prefix ("/some/path"
+                                                 "/some/other/path"))))
+         (let ((str (call-with-input-file script-file-name get-string-all)))
+           (with-directory-excursion directory
+             (delete-file "foo"))
+           str))))))
+
+(let ((script-contents "\
+#!/anything/cabbage-bash-1.2.3/bin/python3 -and -args
+# vim:fileencoding=utf-8
+print('hello world')"))
+
+  (test-equal "wrap-script, with encoding declaration"
+    (string-append
+     (format #f "\
+#!MYGUILE --no-auto-compile
+#!#; # vim:fileencoding=utf-8
+#\\-~s
+#\\-~s
+"
+             '(begin (let ((current (getenv "GUIX_FOO")))
+                       (setenv "GUIX_FOO"
+                               (if current
+                                   (string-append "/some/path:/some/other/path"
+                                                  ":" current)
+                                   "/some/path:/some/other/path"))))
+             `(let ((cl (command-line)))
+                (apply execl "/anything/cabbage-bash-1.2.3/bin/python3"
+                       (car cl)
+                       (cons (car cl)
+                             (append '("" "-and" "-args") cl)))))
+     script-contents)
+    (call-with-temporary-directory
+     (lambda (directory)
+       (let ((script-file-name (string-append directory "/foo")))
+         (call-with-output-file script-file-name
+           (lambda (port)
+             (format port script-contents)))
+         (chmod script-file-name #o777)
+
+         (wrap-script script-file-name
+                      #:guile "MYGUILE"
+                      `("GUIX_FOO" prefix ("/some/path"
+                                           "/some/other/path")))
+         (let ((str (call-with-input-file script-file-name get-string-all)))
+           (with-directory-excursion directory
+             (delete-file "foo"))
+           str))))))
+
+(test-assert "wrap-script, raises condition"
+  (call-with-temporary-directory
+   (lambda (directory)
+     (let ((script-file-name (string-append directory "/foo")))
+       (call-with-output-file script-file-name
+         (lambda (port)
+           (format port "This is not a script")))
+       (chmod script-file-name #o777)
+       (catch 'srfi-34
+         (lambda ()
+           (wrap-script script-file-name
+                        #:guile "MYGUILE"
+                        `("GUIX_FOO" prefix ("/some/path"
+                                             "/some/other/path"))))
+         (lambda (type obj)
+           (wrap-error? obj)))))))
+
 (test-end)
diff --git a/tests/builders.scm b/tests/builders.scm
index 8b8ef013e7..b2d8a7c6b2 100644
--- a/tests/builders.scm
+++ b/tests/builders.scm
@@ -28,7 +28,8 @@
   #:use-module (gcrypt hash)
   #:use-module (guix tests)
   #:use-module ((guix packages)
-                #:select (package-derivation package-native-search-paths))
+                #:select (package?
+                          package-derivation package-native-search-paths))
   #:use-module (gnu packages bootstrap)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
@@ -39,7 +40,7 @@
 (define %store
   (open-connection-for-tests))
 
-(define %bootstrap-inputs
+(define (%bootstrap-inputs)
   ;; Use the bootstrap inputs so it doesn't take ages to run these tests.
   ;; This still involves building Make, Diffutils, and Findutils.
   ;; XXX: We're relying on the higher-level `package-derivations' here.
@@ -47,14 +48,18 @@
        (map (match-lambda
              ((name package)
               (list name (package-derivation %store package))))
-            (@@ (gnu packages commencement) %boot0-inputs))))
+            (filter
+             (compose package? cadr)
+             ((@@ (gnu packages commencement) %boot0-inputs))))))
 
-(define %bootstrap-search-paths
+(define (%bootstrap-search-paths)
   ;; Search path specifications that go with %BOOTSTRAP-INPUTS.
   (append-map (match-lambda
-               ((name package _ ...)
-                (package-native-search-paths package)))
-              (@@ (gnu packages commencement) %boot0-inputs)))
+                ((name package _ ...)
+                 (package-native-search-paths package)))
+              (filter
+               (compose package? cadr)
+               ((@@ (gnu packages commencement) %boot0-inputs)))))
 
 (define url-fetch*
   (store-lower url-fetch))
@@ -104,9 +109,9 @@
                                #:guile %bootstrap-guile))
          (build    (gnu-build %store "hello-2.8"
                               `(("source" ,tarball)
-                                ,@%bootstrap-inputs)
+                                ,@(%bootstrap-inputs))
                               #:guile %bootstrap-guile
-                              #:search-paths %bootstrap-search-paths))
+                              #:search-paths (%bootstrap-search-paths)))
          (out      (derivation->output-path build)))
     (and (build-derivations %store (list (pk 'hello-drv build)))
          (valid-path? %store out)
diff --git a/tests/graph.scm b/tests/graph.scm
index 4799d3bd0c..2a0f675717 100644
--- a/tests/graph.scm
+++ b/tests/graph.scm
@@ -153,9 +153,9 @@ edges."
                        (match nodes
                          (((labels names) ...)
                           names))))
-               (match %bootstrap-inputs
+               (match (%bootstrap-inputs)
                  (((labels packages) ...)
-                  (map package-full-name packages))))))))
+                  (map package-full-name (filter package? packages)))))))))
 
 (test-assert "bag DAG, including origins"
   (let-values (((backend nodes+edges) (make-recording-backend)))
diff --git a/tests/packages.scm b/tests/packages.scm
index e5704ae4b9..dd93328db6 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -36,6 +37,7 @@
   #:use-module (guix build-system)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system gnu)
+  #:use-module (guix memoization)
   #:use-module (guix profiles)
   #:use-module (guix scripts package)
   #:use-module (gnu packages)
@@ -336,10 +338,25 @@
   ;; Here GNU-BUILD-SYSTEM adds implicit inputs that build only on
   ;; %SUPPORTED-SYSTEMS.  Thus the others must be ignored.
   (let ((p (dummy-package "foo"
+               (build-system gnu-build-system)
+               (supported-systems
+                `("does-not-exist" "foobar" ,@%supported-systems)))))
+    (invalidate-memoization! package-transitive-supported-systems)
+    (parameterize ((%current-system "armhf-linux")) ; a traditionally-bootstrapped architecture
+      (package-transitive-supported-systems p))))
+
+(test-equal "package-transitive-supported-systems: reduced binary seed, implicit inputs"
+  '("x86_64-linux" "i686-linux")
+
+  ;; Here GNU-BUILD-SYSTEM adds implicit inputs that build only on
+  ;; %SUPPORTED-SYSTEMS.  Thus the others must be ignored.
+  (let ((p (dummy-package "foo"
              (build-system gnu-build-system)
              (supported-systems
               `("does-not-exist" "foobar" ,@%supported-systems)))))
-    (package-transitive-supported-systems p)))
+    (invalidate-memoization! package-transitive-supported-systems)
+    (parameterize ((%current-system "x86_64-linux"))
+      (package-transitive-supported-systems p))))
 
 (test-assert "supported-package?"
   (let ((p (dummy-package "foo"
diff --git a/tests/union.scm b/tests/union.scm
index 5a6a4033fc..091895ff8e 100644
--- a/tests/union.scm
+++ b/tests/union.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,9 @@
   #:use-module (rnrs io ports)
   #:use-module (ice-9 match))
 
+(define %bootstrap-inputs
+  (@@ (gnu packages commencement) %bootstrap-inputs+toolchain))
+
 ;; Exercise the (guix build union) module.
 
 (define %store
@@ -94,8 +98,9 @@
                          `(,name ,(package-derivation %store package))))
 
                        ;; Purposefully leave duplicate entries.
-                       (append %bootstrap-inputs
-                               (take %bootstrap-inputs 3))))
+                       (filter (compose package? cadr)
+                               (append (%bootstrap-inputs)
+                                (take (%bootstrap-inputs) 3)))))
          (builder `(begin
                      (use-modules (guix build union))
                      (union-build (assoc-ref %outputs "out")