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.dot126
-rw-r--r--doc/local.mk1
-rw-r--r--gnu/local.mk9
-rw-r--r--gnu/packages/base.scm6
-rw-r--r--gnu/packages/bootstrap.scm334
-rw-r--r--gnu/packages/commencement.scm1765
-rw-r--r--gnu/packages/gnupg.scm7
-rw-r--r--gnu/packages/make-bootstrap.scm108
-rw-r--r--gnu/packages/mes.scm75
-rw-r--r--gnu/packages/patches/binutils-boot-2.20.1a.patch157
-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/libgcrypt-make-yat2m-reproducible.patch32
-rw-r--r--gnu/packages/patches/mescc-tools-boot.patch222
-rw-r--r--gnu/packages/patches/tcc-boot-0.9.27.patch26
-rw-r--r--gnu/packages/python.scm16
-rw-r--r--guix/build/make-bootstrap.scm72
-rw-r--r--guix/build/python-build-system.scm9
-rw-r--r--guix/build/utils.scm9
-rw-r--r--guix/scripts/pack.scm6
-rw-r--r--tests/builders.scm23
-rw-r--r--tests/graph.scm4
-rw-r--r--tests/packages.scm19
-rw-r--r--tests/union.scm9
29 files changed, 3660 insertions, 374 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 20b5013fd9..2376cedc68 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -24191,7 +24191,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).
 
-@unnumberedsubsec 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
+@subsection 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
+@subsection 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.
@@ -24205,7 +24278,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
@@ -24237,10 +24318,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.
 
 @unnumberedsubsec Building the Build Tools
 
@@ -24305,9 +24386,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
@@ -24325,12 +24408,12 @@ know.
 
 @unnumberedsubsec 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
@@ -24342,8 +24425,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
 @section 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..a49f5070ed
--- /dev/null
+++ b/doc/images/gcc-mesboot-bag-graph.dot
@@ -0,0 +1,126 @@
+digraph "Guix bag" {
+  "/gnu/store/szgq0x7gm43xafbvg2ps1vp63zlzbj59-gcc-mesboot-4.9.4.drv" [label = "gcc-mesboot@4.9.4", shape = box, fontname = Helvetica];
+  "/gnu/store/szgq0x7gm43xafbvg2ps1vp63zlzbj59-gcc-mesboot-4.9.4.drv" -> "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" [color = blue];
+  "/gnu/store/szgq0x7gm43xafbvg2ps1vp63zlzbj59-gcc-mesboot-4.9.4.drv" -> "/gnu/store/gjzjhr6h3lq58kb2dv989pl4y1bbk2wg-gcc-mesboot1-wrapper-4.7.4.drv" [color = blue];
+  "/gnu/store/szgq0x7gm43xafbvg2ps1vp63zlzbj59-gcc-mesboot-4.9.4.drv" -> "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" [color = blue];
+  "/gnu/store/szgq0x7gm43xafbvg2ps1vp63zlzbj59-gcc-mesboot-4.9.4.drv" -> "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" [color = blue];
+  "/gnu/store/szgq0x7gm43xafbvg2ps1vp63zlzbj59-gcc-mesboot-4.9.4.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = blue];
+  "/gnu/store/szgq0x7gm43xafbvg2ps1vp63zlzbj59-gcc-mesboot-4.9.4.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = blue];
+  "/gnu/store/szgq0x7gm43xafbvg2ps1vp63zlzbj59-gcc-mesboot-4.9.4.drv" -> "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" [color = blue];
+  "/gnu/store/szgq0x7gm43xafbvg2ps1vp63zlzbj59-gcc-mesboot-4.9.4.drv" -> "/gnu/store/3hmp33npkfndjpikabxxcv2qb5pv9qwj-linux-libre-headers-bootstrap-0.drv" [color = blue];
+  "/gnu/store/szgq0x7gm43xafbvg2ps1vp63zlzbj59-gcc-mesboot-4.9.4.drv" -> "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" [color = blue];
+  "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" [label = "binutils-mesboot@2.20.1a", shape = box, fontname = Helvetica];
+  "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" [color = darkseagreen];
+  "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" [color = darkseagreen];
+  "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" [color = darkseagreen];
+  "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" [color = darkseagreen];
+  "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/3hmp33npkfndjpikabxxcv2qb5pv9qwj-linux-libre-headers-bootstrap-0.drv" [color = darkseagreen];
+  "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" -> "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" [color = darkseagreen];
+  "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" [label = "binutils-mesboot0@2.20.1a", shape = box, fontname = Helvetica];
+  "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/b2hc3h7h61yaaifk8w4iapvx3s0w8yk6-tcc-boot-0.9.27.drv" [color = red];
+  "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = red];
+  "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = red];
+  "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" [color = red];
+  "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" [color = red];
+  "/gnu/store/b2hc3h7h61yaaifk8w4iapvx3s0w8yk6-tcc-boot-0.9.27.drv" [label = "tcc-boot@0.9.27", shape = box, fontname = Helvetica];
+  "/gnu/store/b2hc3h7h61yaaifk8w4iapvx3s0w8yk6-tcc-boot-0.9.27.drv" -> "/gnu/store/fr8h0pkfnvk4yhx5i9k8alfc86yhmhri-mes-boot-0.18-0.08f04f5.drv" [color = darkseagreen];
+  "/gnu/store/b2hc3h7h61yaaifk8w4iapvx3s0w8yk6-tcc-boot-0.9.27.drv" -> "/gnu/store/vv6vl6l8y60vjbby6mwk41zkfc4x7mcr-tcc-boot0-0.9.26-5.c7b3f59.drv" [color = darkseagreen];
+  "/gnu/store/b2hc3h7h61yaaifk8w4iapvx3s0w8yk6-tcc-boot-0.9.27.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/fr8h0pkfnvk4yhx5i9k8alfc86yhmhri-mes-boot-0.18-0.08f04f5.drv" [label = "mes-boot@0.18-0.08f04f5", shape = box, fontname = Helvetica];
+  "/gnu/store/fr8h0pkfnvk4yhx5i9k8alfc86yhmhri-mes-boot-0.18-0.08f04f5.drv" -> "/gnu/store/pn5wxcxg4bgmyzidc519kyfd609m9kw3-bootstrap-mescc-tools-0.5.2.drv" [color = dimgrey];
+  "/gnu/store/fr8h0pkfnvk4yhx5i9k8alfc86yhmhri-mes-boot-0.18-0.08f04f5.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = dimgrey];
+  "/gnu/store/fr8h0pkfnvk4yhx5i9k8alfc86yhmhri-mes-boot-0.18-0.08f04f5.drv" -> "/gnu/store/9qw55y8fgq9q0h3wz47lih78cwd0zz0q-bootstrap-mes-0.drv" [color = dimgrey];
+  "/gnu/store/fr8h0pkfnvk4yhx5i9k8alfc86yhmhri-mes-boot-0.18-0.08f04f5.drv" -> "/gnu/store/gz3agxnnlgkafw2c8jnvk2hqmlh85pkc-guile-bootstrap-2.0.drv" [color = dimgrey];
+  "/gnu/store/pn5wxcxg4bgmyzidc519kyfd609m9kw3-bootstrap-mescc-tools-0.5.2.drv" [label = "bootstrap-mescc-tools@0.5.2", shape = box, fontname = Helvetica];
+  "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [label = "bootstrap-binaries@0", shape = box, fontname = Helvetica];
+  "/gnu/store/9qw55y8fgq9q0h3wz47lih78cwd0zz0q-bootstrap-mes-0.drv" [label = "bootstrap-mes@0", shape = box, fontname = Helvetica];
+  "/gnu/store/gz3agxnnlgkafw2c8jnvk2hqmlh85pkc-guile-bootstrap-2.0.drv" [label = "guile-bootstrap@2.0", shape = box, fontname = Helvetica];
+  "/gnu/store/vv6vl6l8y60vjbby6mwk41zkfc4x7mcr-tcc-boot0-0.9.26-5.c7b3f59.drv" [label = "tcc-boot0@0.9.26-5.c7b3f59", shape = box, fontname = Helvetica];
+  "/gnu/store/vv6vl6l8y60vjbby6mwk41zkfc4x7mcr-tcc-boot0-0.9.26-5.c7b3f59.drv" -> "/gnu/store/fr8h0pkfnvk4yhx5i9k8alfc86yhmhri-mes-boot-0.18-0.08f04f5.drv" [color = peachpuff4];
+  "/gnu/store/vv6vl6l8y60vjbby6mwk41zkfc4x7mcr-tcc-boot0-0.9.26-5.c7b3f59.drv" -> "/gnu/store/pn5wxcxg4bgmyzidc519kyfd609m9kw3-bootstrap-mescc-tools-0.5.2.drv" [color = peachpuff4];
+  "/gnu/store/vv6vl6l8y60vjbby6mwk41zkfc4x7mcr-tcc-boot0-0.9.26-5.c7b3f59.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = peachpuff4];
+  "/gnu/store/vv6vl6l8y60vjbby6mwk41zkfc4x7mcr-tcc-boot0-0.9.26-5.c7b3f59.drv" -> "/gnu/store/9qw55y8fgq9q0h3wz47lih78cwd0zz0q-bootstrap-mes-0.drv" [color = peachpuff4];
+  "/gnu/store/vv6vl6l8y60vjbby6mwk41zkfc4x7mcr-tcc-boot0-0.9.26-5.c7b3f59.drv" -> "/gnu/store/gz3agxnnlgkafw2c8jnvk2hqmlh85pkc-guile-bootstrap-2.0.drv" [color = peachpuff4];
+  "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" [label = "diffutils-mesboot@2.7", shape = box, fontname = Helvetica];
+  "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" -> "/gnu/store/fr8h0pkfnvk4yhx5i9k8alfc86yhmhri-mes-boot-0.18-0.08f04f5.drv" [color = darkgoldenrod];
+  "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" -> "/gnu/store/b2hc3h7h61yaaifk8w4iapvx3s0w8yk6-tcc-boot-0.9.27.drv" [color = darkgoldenrod];
+  "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkgoldenrod];
+  "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkgoldenrod];
+  "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" -> "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" [color = darkgoldenrod];
+  "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" [label = "make-mesboot0@3.80", shape = box, fontname = Helvetica];
+  "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" -> "/gnu/store/b2hc3h7h61yaaifk8w4iapvx3s0w8yk6-tcc-boot-0.9.27.drv" [color = darkviolet];
+  "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkviolet];
+  "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkviolet];
+  "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" [label = "glibc-mesboot0@2.2.5", shape = box, fontname = Helvetica];
+  "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" [color = magenta];
+  "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/mkb8vw25b18nw49afj21w4c9v1f7ik1f-gcc-core-mesboot-2.95.3.drv" [color = magenta];
+  "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = magenta];
+  "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = magenta];
+  "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" [color = magenta];
+  "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/s03mkbbgz3zvqw0mgadrj4rj52kaliy3-mesboot-headers-0.18-0.08f04f5.drv" [color = magenta];
+  "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" -> "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" [color = magenta];
+  "/gnu/store/mkb8vw25b18nw49afj21w4c9v1f7ik1f-gcc-core-mesboot-2.95.3.drv" [label = "gcc-core-mesboot@2.95.3", shape = box, fontname = Helvetica];
+  "/gnu/store/mkb8vw25b18nw49afj21w4c9v1f7ik1f-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" [color = cyan3];
+  "/gnu/store/mkb8vw25b18nw49afj21w4c9v1f7ik1f-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/b2hc3h7h61yaaifk8w4iapvx3s0w8yk6-tcc-boot-0.9.27.drv" [color = cyan3];
+  "/gnu/store/mkb8vw25b18nw49afj21w4c9v1f7ik1f-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = cyan3];
+  "/gnu/store/mkb8vw25b18nw49afj21w4c9v1f7ik1f-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = cyan3];
+  "/gnu/store/mkb8vw25b18nw49afj21w4c9v1f7ik1f-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" [color = cyan3];
+  "/gnu/store/mkb8vw25b18nw49afj21w4c9v1f7ik1f-gcc-core-mesboot-2.95.3.drv" -> "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" [color = cyan3];
+  "/gnu/store/s03mkbbgz3zvqw0mgadrj4rj52kaliy3-mesboot-headers-0.18-0.08f04f5.drv" [label = "mesboot-headers@0.18-0.08f04f5", shape = box, fontname = Helvetica];
+  "/gnu/store/s03mkbbgz3zvqw0mgadrj4rj52kaliy3-mesboot-headers-0.18-0.08f04f5.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = dimgrey];
+  "/gnu/store/s03mkbbgz3zvqw0mgadrj4rj52kaliy3-mesboot-headers-0.18-0.08f04f5.drv" -> "/gnu/store/3hmp33npkfndjpikabxxcv2qb5pv9qwj-linux-libre-headers-bootstrap-0.drv" [color = dimgrey];
+  "/gnu/store/3hmp33npkfndjpikabxxcv2qb5pv9qwj-linux-libre-headers-bootstrap-0.drv" [label = "linux-libre-headers-bootstrap@0", shape = box, fontname = Helvetica];
+  "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" [label = "gcc-mesboot0@2.95.3", shape = box, fontname = Helvetica];
+  "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" [color = darkgoldenrod];
+  "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/mkb8vw25b18nw49afj21w4c9v1f7ik1f-gcc-core-mesboot-2.95.3.drv" [color = darkgoldenrod];
+  "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" [color = darkgoldenrod];
+  "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkgoldenrod];
+  "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkgoldenrod];
+  "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" [color = darkgoldenrod];
+  "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/3hmp33npkfndjpikabxxcv2qb5pv9qwj-linux-libre-headers-bootstrap-0.drv" [color = darkgoldenrod];
+  "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" -> "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" [color = darkgoldenrod];
+  "/gnu/store/gjzjhr6h3lq58kb2dv989pl4y1bbk2wg-gcc-mesboot1-wrapper-4.7.4.drv" [label = "gcc-mesboot1-wrapper@4.7.4", shape = box, fontname = Helvetica];
+  "/gnu/store/gjzjhr6h3lq58kb2dv989pl4y1bbk2wg-gcc-mesboot1-wrapper-4.7.4.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = cyan3];
+  "/gnu/store/gjzjhr6h3lq58kb2dv989pl4y1bbk2wg-gcc-mesboot1-wrapper-4.7.4.drv" -> "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" [color = cyan3];
+  "/gnu/store/gjzjhr6h3lq58kb2dv989pl4y1bbk2wg-gcc-mesboot1-wrapper-4.7.4.drv" -> "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" [color = cyan3];
+  "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" [label = "glibc-mesboot@2.16.0", shape = box, fontname = Helvetica];
+  "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" -> "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" [color = darkseagreen];
+  "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" -> "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" [color = darkseagreen];
+  "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" -> "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" [color = darkseagreen];
+  "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" -> "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" [color = darkseagreen];
+  "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = darkseagreen];
+  "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" -> "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" [color = darkseagreen];
+  "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" -> "/gnu/store/3hmp33npkfndjpikabxxcv2qb5pv9qwj-linux-libre-headers-bootstrap-0.drv" [color = darkseagreen];
+  "/gnu/store/mk9p60ajavjha1ybrgh3wm47k5fqmi2c-glibc-mesboot-2.16.0.drv" -> "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" [color = darkseagreen];
+  "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" [label = "glibc-headers-mesboot@2.16.0", shape = box, fontname = Helvetica];
+  "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" [color = blue];
+  "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" [color = blue];
+  "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" [color = blue];
+  "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/s03mkbbgz3zvqw0mgadrj4rj52kaliy3-mesboot-headers-0.18-0.08f04f5.drv" [color = blue];
+  "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = blue];
+  "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = blue];
+  "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" [color = blue];
+  "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/3hmp33npkfndjpikabxxcv2qb5pv9qwj-linux-libre-headers-bootstrap-0.drv" [color = blue];
+  "/gnu/store/9hxjjd75ck45v1lq07mlari4j65yzpal-glibc-headers-mesboot-2.16.0.drv" -> "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" [color = blue];
+  "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" [label = "gcc-mesboot1@4.7.4", shape = box, fontname = Helvetica];
+  "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/9anasaq20q8rlq036lswazs8k8h3b3bz-binutils-mesboot-2.20.1a.drv" [color = magenta];
+  "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" [color = magenta];
+  "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" [color = magenta];
+  "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = magenta];
+  "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = magenta];
+  "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/9k08vfps0s8hjdrgag1vvaainr3vbs2i-diffutils-mesboot-2.7.drv" [color = magenta];
+  "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/3hmp33npkfndjpikabxxcv2qb5pv9qwj-linux-libre-headers-bootstrap-0.drv" [color = magenta];
+  "/gnu/store/dbdm0njsi3dvwa63d97dl5bhc3l5lqnq-gcc-mesboot1-4.7.4.drv" -> "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" [color = magenta];
+  "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" [label = "make-mesboot@3.82", shape = box, fontname = Helvetica];
+  "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" -> "/gnu/store/gvh9xfc5cl5d4s256pvm7w7rhw413piv-binutils-mesboot0-2.20.1a.drv" [color = magenta];
+  "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" -> "/gnu/store/sr7l7m4q6g5anghww1klqx3q38wywp8v-glibc-mesboot0-2.2.5.drv" [color = magenta];
+  "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" -> "/gnu/store/kfw0qp3885yd2blygsfsml7rr8vn1k77-gcc-mesboot0-2.95.3.drv" [color = magenta];
+  "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" -> "/gnu/store/iskgf1pd99455dfxnkqbb6ibj06jihhl-make-mesboot0-3.80.drv" [color = magenta];
+  "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = magenta];
+  "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" -> "/gnu/store/9l87r75n3rgsxc9230r4bxhd8dljfx6x-bootstrap-binaries-0.drv" [color = magenta];
+  "/gnu/store/bdl4qbzwsx7mwhi4zsbim2jnrqlzyl07-make-mesboot-3.82.drv" -> "/gnu/store/3hmp33npkfndjpikabxxcv2qb5pv9qwj-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 4f2437befa..0c324cd7d6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -603,6 +603,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/binutils-loongson-workaround.patch	\
   %D%/packages/patches/blast+-fix-makefile.patch		\
   %D%/packages/patches/blender-newer-ffmpeg.patch		\
@@ -710,6 +711,7 @@ 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-cross-environment-variables.patch	\
   %D%/packages/patches/gcc-fix-texi2pod.patch			\
   %D%/packages/patches/gcc-4.8-libsanitizer-fix.patch		\
@@ -757,6 +759,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-ldd-x86_64.patch			\
@@ -768,6 +773,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		\
@@ -888,7 +894,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/libevent-2.1-skip-failing-test.patch	\
   %D%/packages/patches/libexif-CVE-2016-6328.patch		\
   %D%/packages/patches/libexif-CVE-2017-7544.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			\
@@ -967,6 +972,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/mcrypt-CVE-2012-4527.patch			\
   %D%/packages/patches/meandmyshadow-define-paths-earlier.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		\
@@ -1181,6 +1187,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	\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 60f8051dc6..156399adbb 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -606,7 +606,8 @@ 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-supported-locales.patch"))))
    (build-system gnu-build-system)
 
    ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
@@ -847,7 +848,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/bootstrap.scm b/gnu/packages/bootstrap.scm
index 936d6c1a2a..eac729f785 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,14 @@
 
             %bootstrap-guile
             %bootstrap-coreutils&co
+            %bootstrap-linux-libre-headers
             %bootstrap-binutils
             %bootstrap-gcc
             %bootstrap-glibc
-            %bootstrap-inputs))
+            %bootstrap-inputs
+            %bootstrap-mescc-tools
+            %bootstrap-mes
+            %srfi-43))
 
 ;;; Commentary:
 ;;;
@@ -97,10 +102,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 +114,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)))
@@ -391,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)
@@ -436,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)))
@@ -507,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)))
@@ -547,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")
@@ -586,12 +614,126 @@ 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)
+    (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.18-0.08f04f5-i686-linux.tar.xz")
+                 %bootstrap-base-urls))
+            (sha256
+             (match (%current-system)
+               ((or "i686-linux" "x86_64-linux")
+                (base32
+                 "0qwpby91hp6afmg5ibdrrk3fw85zxdazfk7rhrdsihsfzqwmfhfx")))))))))
+    (synopsis "Bootstrap binaries of Mes")
+    (description synopsis)
+    (home-page #f)
+    (license gpl3+)))
+
+(define %srfi-43
+  (origin
+    (method url-fetch)
+    (uri "http://git.savannah.gnu.org/cgit/guile.git/plain/module/srfi/srfi-43.scm?h=stable-2.0")
+    (file-name "srfi-43.scm")
+    (sha256
+     (base32
+      "0rnkppwdkxbzkgp9s9ccmby9f7p3ijxjlmvj0pzqxwmrmpy7jwmb"))))
+
+(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)
+           ("srfi-43" ,%srfi-43 )))
+        (_
+         `(("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/commencement.scm b/gnu/packages/commencement.scm
index 0aa65fe638..c46aeed04a 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2014, 2015, 2017 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2017, 2018 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,1432 @@
 ;;;
 ;;; Code:
 
+(define %fake-bootstrap? #t)  ; cheat using Guile (instead of Mes) in MesCC
+                              ; for speed-up?
+
+(define mes-boot0
+  (let ((version "0.18")
+        (revision "0")
+        (commit #f))
+    (package
+      (inherit mes)
+      (name "mes-boot0")
+      (version (if commit (string-append version "-" revision "." (string-take commit 7))
+                   version))
+      (source (if commit
+                  (origin
+                    (method url-fetch)
+                    (uri (string-append "https://gitlab.com/janneke/mes"
+                                        "/-/archive/" commit
+                                        "/mes-" commit ".tar.gz"))
+                    (sha256
+                     (base32
+                      "1whbzahv16bwhavr2azqli0dcbk29p9rsqfbjl69la135z8vgdhx")))
+                  (package-source mes)))
+      (native-inputs '())
+      (propagated-inputs '()))))
+
+(define nyacc-boot
+  (let ((version "0.86.0")
+        (revision "0")
+        (commit #f))
+    (package
+      (inherit nyacc)
+      (name "nyacc-boot")
+      (version
+       (if commit
+           (string-append version "-" revision "." (string-take commit 7))
+           version))
+      (source
+       (if commit
+           (origin
+             (method url-fetch)
+             (uri (string-append "https://gitlab.com/janneke/nyacc"
+                                 "/-/archive/" commit
+                                 "/nyacc-" commit ".tar.gz"))
+             (sha256
+              (base32
+               "0dlcqmchhl57nh7f0v6qb1kkbi7zbs3b185hcqv57fhb60b7rgcq")))
+           (package-source nyacc))))))
+
+(define mes-boot
+  (package-with-bootstrap-guile
+   (package
+     (inherit mes)
+     (version (package-version mes-boot0))
+     (source (package-source mes-boot0))
+     (name "mes-boot")
+     (inputs '())
+     (propagated-inputs '())
+     (native-inputs
+      `(("mescc-tools" ,%bootstrap-mescc-tools)
+        ("nyacc-source" ,(package-source nyacc-boot))
+
+        ("coreutils" , %bootstrap-coreutils&co)
+        ("bootstrap-mes" ,%bootstrap-mes)
+        ,@(if %fake-bootstrap?  ; cheat: fast non-bootstrap testing with Guile
+              `(("guile" ,%bootstrap-guile)
+                ("srfi-43" ,%srfi-43)) ; guile-2.0.9 lacks srfi-43; cherry-pick
+              '())))
+     (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"))
+                    (srfi-43 (assoc-ref %build-inputs "srfi-43"))
+                    (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 "/lib") "mes-seed")
+                   (or (not srfi-43)
+                       (and (mkdir-p "srfi")
+                            (copy-file srfi-43 "srfi/srfi-43.scm")
+                            #t)))))))
+          (replace 'configure
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref %outputs "out")))
+                (symlink (string-append "../nyacc-source/module") "nyacc")
+                (setenv "GUILE_LOAD_PATH" "nyacc")
+                (setenv "GUILE_TOOLS" "true") ; no tools in bootstrap-guile
+                (substitute* "configure.sh"
+                  (("^arch=.*") "arch=i686\n"))
+                (invoke "bash" "configure.sh"
+                        (string-append "--prefix=" out))
+                (setenv "MES" "src/mes")
+                (setenv "MESCC" "scripts/mescc")
+                (when ,%fake-bootstrap? ; Cheat using Guile+Nyacc+MesCC; ~30 times faster
+                  (let ((dir (with-directory-excursion ".." (getcwd)))
+                        (guile (assoc-ref %build-inputs "guile"))
+                        (srfi-43 (assoc-ref %build-inputs "srfi-43")))
+                    (setenv "MES" "guile")
+                    (setenv "GUILE_AUTO_COMPILE" "1")
+                    (setenv "GUILE_LOAD_COMPILED_PATH"
+                            (string-append guile "/lib/guile/2.0/ccache"))
+                    (setenv "GUILE_LOAD_PATH"
+                            (string-append (string-append dir "/nyacc-source/module")
+                                           ":" dir
+                                           ":" guile "/share/guile/2.0/"))
+                    ;; these fail with guile-2.0
+                    (when srfi-43
+                      (delete-file "tests/srfi-9.test")
+                      (delete-file "tests/srfi-43.test"))
+                    ;; give auto-compile a home -- massive speed-up
+                    (mkdir-p "/tmp/home")
+                    (setenv "HOME" "/tmp/home")))
+                #t)))
+          (replace 'build
+            (lambda _
+              (invoke "sh" "build.sh")))
+          (replace 'check
+            (lambda _
+              (when ,%fake-bootstrap?
+                ;; break with guile-2.0
+                (delete-file "scaffold/boot/50-primitive-load.scm")
+                (delete-file "scaffold/boot/51-module.scm"))
+              (and
+               (setenv "MES_ARENA" "100000000")
+               (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 "5")
+        (commit "c7b3f59d1a71e71b470f859b20f0cfe840f3954d"))
+    (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
+                   "1agz5w5q6dm51n63hsxii33hxdghmdiacbb5zzxzac3aarfxjb2m"))))
+       (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-boot))
+
+          ("coreutils" , %bootstrap-coreutils&co)
+          ("bootstrap-mes" ,%bootstrap-mes)
+          ,@(if %fake-bootstrap? ; cheat: fast non-bootstrap testing with Guile
+                `(("guile" ,%bootstrap-guile)
+                  ("srfi-43" ,%srfi-43)) ; guile-2.0.9 lacks srfi-43; cherry-pick
+                '())))
+       (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"))
+                       (srfi-43 (assoc-ref %build-inputs "srfi-43"))
+                       (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 "/lib") "mes-seed")
+                     (or (not srfi-43)
+                         (and (mkdir-p "srfi")
+                              (copy-file srfi-43 "srfi/srfi-43.scm")
+                              #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"))
+                       (guile (assoc-ref %build-inputs "guile"))
+                       (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"
+                                  (if guile (string-append ":" guile "/bin")
+                                      "")
+                                  ":" mescc-tools "/bin"))
+
+                  (setenv "PREFIX" out)
+                  (setenv "MESCC" (string-append mes "/bin/mescc"))
+                  (symlink (string-append mes "/share/mes") "mes")
+                  (setenv "MES_PREFIX" "mes")
+                  (setenv "OBJDUMP" "true")
+                  (setenv "ONE_SOURCE" "1")
+                  (setenv "PREPROCESS" "1")
+                  (setenv "MES_ARENA" "70000000")
+                  (setenv "MES_MAX_ARENA" "70000000")
+
+                  (if ,%fake-bootstrap?
+                      (begin ; Cheat using Guile+Nyacc+MesCC; ~30 times faster
+                        (setenv "MES" "guile")
+                        (setenv "GUILE_AUTO_COMPILE" "1")
+                        (setenv "GUILE_LOAD_COMPILED_PATH"
+                                (string-append guile "/lib/guile/2.0/ccache"))
+                        (setenv "GUILE_LOAD_PATH"
+                                (string-append dir
+                                               ":" guile "/share/guile/2.0/"
+                                               ":" dir "/nyacc-source/module"
+                                               ":" mes "/share/mes/guile"))
+
+                        ;; give auto-compile a home -- massive speed-up
+                        (mkdir-p "/tmp/home")
+                        (setenv "HOME" "/tmp/home"))
+
+                      (begin       ; True bootstrap build with Mes+Nyacc+MesCC
+                        (setenv "MES" "mes")
+                        (setenv "GUILE_LOAD_PATH" "nyacc")
+                        (symlink (string-append "../nyacc-source/module") "nyacc")))
+                  (invoke "sh" "configure"
+                          "--prefix=$PREFIX"
+                          (string-append "--elfinterp=" interpreter)
+                          "--crtprefix=."
+                          "--tccdir=."))))
+            (replace 'build
+              (lambda _
+                (invoke "sh" "build.sh")))
+            (replace 'check
+              (lambda _
+                (setenv "DIFF" "diff.scm")
+                ;; 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,13 +1529,14 @@
                       (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")
@@ -118,9 +1548,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 +1559,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 +1583,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 +1619,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 +1637,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 +1695,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 +1730,21 @@
                                          ,(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)))
+                   (_ identity))
                 (add-after 'install 'symlink-libgcc_eh
                   (lambda* (#:key outputs #:allow-other-keys)
                     (let ((out (assoc-ref outputs "lib")))
@@ -307,8 +1767,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 +1779,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 +1869,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 +1888,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 +1897,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 +1906,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 +1922,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 +1933,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 +1947,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 +2018,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 +2026,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 +2085,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 +2185,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 +2206,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 +2232,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 +2245,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 +2277,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 +2289,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 +2329,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 +2349,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 +2357,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 +2392,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 +2433,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/gnupg.scm b/gnu/packages/gnupg.scm
index 53fdc8200c..360f28a1bf 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.
 ;;;
@@ -99,16 +100,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/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 65d632f64e..761420af67 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))
@@ -300,6 +305,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)
@@ -511,6 +536,65 @@ 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 %mes-minimal
+  ;; A minimal Mes without documentation dependencies, for bootstrap.
+  (let ((triplet "i686-unknown-linux-gnu"))
+    (package
+      (inherit mes)
+      (name "mes-minimal")
+      (native-inputs
+       `(("guile" ,guile-2.2)))
+      (arguments
+       `(#:system "i686-linux"
+         #:strip-binaries? #f
+         #:phases
+         (modify-phases %standard-phases
+           (add-before 'configure 'optional-dot
+             (lambda _
+               (substitute* "configure"
+                 (("#:version-option \"-V\"" all)
+                  (string-append all "#:optional? #t")))))))))))
+
+(define-public %mes-minimal-stripped
+  ;; The subset of Mes files needed for bootstrap.
+  (package
+    (inherit %mes-minimal)
+    (name "mes-minimal-stripped")
+    (build-system trivial-build-system)
+    (source #f)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (srfi srfi-1)
+                      (srfi srfi-26)
+                      (guix build utils))
+
+         (setvbuf (current-output-port) _IOLBF)
+         (let* ((out        (assoc-ref %outputs "out"))
+                (libdir     (string-append out "/lib"))
+                (mes        (assoc-ref %build-inputs "mes")))
+
+           (copy-recursively (string-append mes "/lib") libdir)
+           (copy-recursively (string-append mes "/share/mes/lib") libdir)
+           (for-each remove-store-references
+                     (remove (lambda (file) (or (string-suffix? ".h" file)
+                                                (string-suffix? ".c" file)))
+                             (find-files out ".*")))
+           #t))))
+    (inputs `(("mes" ,%mes-minimal)))))
+
 (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
@@ -658,6 +742,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))
@@ -674,6 +762,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.
@@ -702,9 +798,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 6dc6dfb4cb..7f7caa7a6d 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)
@@ -60,17 +59,22 @@ extensive examples, including parsers for the Javascript and C99 languages.")
     (license (list gpl3+ lgpl3+))))
 
 (define-public mes
-  (let ((triplet "i686-unknown-linux-gnu"))
+  (let ((triplet "i686-unknown-linux-gnu")
+        (version "0.18")
+        (revision "0")
+        (commit "08f04f559670d9e8f57eb03bb9b13f4d0b81cedf"))
     (package
       (name "mes")
-      (version "0.18")
+      (version (string-append version "-" revision "." (string-take commit 7)))
       (source (origin
                 (method url-fetch)
-                (uri (string-append "mirror://gnu/mes/"
-                                    "mes-" version ".tar.gz"))
+                (uri (string-append
+                      "https://git.savannah.gnu.org/cgit/mes.git/snapshot/"
+                      name "-" commit
+                      ".tar.gz"))
                 (sha256
                  (base32
-                  "1dsaaqyanzsq9m5wrcd2bjhb3qd6928c9q97rg5r730pyqjwxyxf"))))
+                  "1b7wz9k38pfrz707pd4p8s54q903jr167q73ya7qkna89sxj3wna"))))
       (build-system gnu-build-system)
       (supported-systems '("i686-linux" "x86_64-linux"))
       (propagated-inputs
@@ -93,39 +97,42 @@ extensive examples, including parsers for the Javascript and C99 languages.")
        `(#:strip-binaries? #f))  ; binutil's strip b0rkes MesCC/M1/hex2 binaries
       (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
       (description
-       "GNU Mes [Maxwell Equations of Software] aims to create full source
-bootstrapping for GuixSD.  It consists of a mutual self-hosting [close to
-Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in
-[Guile] Scheme.")
+       "GNU Mes--Maxwell Equations of Software--brings the Reduced
+Binary Seed bootstrap to GuixSD and aims to help create full source
+bootstrapping for GNU/Linux distributions.  It consists of a mutual
+self-hosting Scheme interpreter in C and a Nyacc-based C compiler in
+Scheme and is compatible with Guile.")
       (home-page "https://gnu.org/software/mes")
       (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/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/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/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/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/python.scm b/gnu/packages/python.scm
index 20b07d3e27..22b87eba69 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -191,6 +191,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 "EXTRATESTOPTS=-j~d" (parallel-job-count)))
 
         #:modules ((ice-9 ftw) (ice-9 match)
                    (guix build utils) (guix build gnu-build-system))
@@ -343,8 +346,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.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.python.org/ftp/python/"
@@ -357,7 +359,7 @@ data types.")
               (patch-flags '("-p0"))
               (sha256
                (base32
-                "0j9mic5c9lbd2b20wka7hily7szz740wy9ilfrczxap63rnrk0h3"))
+                "0v9x4h22rh5cwpsq1mwpdi3c9lc9820lzp2nmn9g20llij72nzps"))
               (snippet
                '(begin
                   (for-each delete-file
@@ -416,14 +418,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/guix/build/make-bootstrap.scm b/guix/build/make-bootstrap.scm
index 43b136248f..0c7b4ac6fd 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 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..cb5621a5a9 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -3,6 +3,7 @@
 ;;; 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>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -87,6 +88,7 @@
             patch-/usr/bin/file
             fold-port-matches
             remove-store-references
+            wrapper?
             wrap-program
 
             invoke
@@ -1003,6 +1005,13 @@ known as `nuke-refs' in Nixpkgs."
                              (put-u8 out (char->integer char))
                              result))))))
 
+(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:
 
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 98b06971bd..6c6680ab58 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/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 237feb7aba..85c3ebe8b2 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 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)
@@ -314,10 +316,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")