1
0
forked from tribes/guix

Compare commits

...

12 Commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen 89a8bd9257 gnu: commencement: mes-boot: Use new package style.
* gnu/packages/commencement.scm (mes-boot)[arguments]: Use gexp for modify
phases.
2022-05-14 21:39:06 +02:00
Jan (janneke) Nieuwenhuizen f99f4a2257 gnu: commencement: stage0-posix: Use new package style.
* gnu/packages/commencement.scm (stage0-posix)[arguments]: Also use gexps for
inputs and output.
2022-05-14 21:35:00 +02:00
Jan (janneke) Nieuwenhuizen 02874b2a43 gnu: commencement: bootstrap-seeds: Use new package style.
* gnu/packages/commencement.scm (bootstrap-seeds)[arguments]: Also use gexps
for inputs and output.
2022-05-14 21:33:33 +02:00
Jan (janneke) Nieuwenhuizen 33253b562a doc: Fix "Full-Source Bootstrap" title case.
* doc/guix.texi (Full-source Bootstrap): Rename to...
(Full-Source Bootstrap): ...this.
2022-05-14 19:02:03 +02:00
Jan (janneke) Nieuwenhuizen eeba993f57 doc: Add the "Full-source Bootstrap".
* doc/guix.texi (Reduced Binary Seed Bootstrap): Update and rename to...
(Full-Source Bootstrap): ...this.
* doc/images/gcc-core-mesboot0-graph.dot: Regenerate.
2022-05-12 19:27:59 +02:00
Jan (janneke) Nieuwenhuizen 454bb06e83 gnu: commencement: Remove %bootstrap-mes-rewired.
* gnu/packages/commencement.scm (%bootstrap-mes-rewired): Remove.
2022-05-12 19:27:59 +02:00
Jan (janneke) Nieuwenhuizen 76f7602b9f gnu: bootstrap: Remove %bootstrap-mescc-tools, %bootstrap-mes.
* gnu/packages/bootstrap.scm (%bootstrap-inputs): Remove
%bootstrap-mescc-tools, %bootstrap-mes.
2022-05-12 19:27:59 +02:00
Jan (janneke) Nieuwenhuizen a68d1d47ee gnu: commencement: tcc-boot0: Update to 0.9.26-1136-g0fbeb2dd.
* gnu/packages/commencement.scm (tcc-boot0)[source]: Update to
0.9.26-1136-g0fbeb2dd.
[native-inputs]: Add stage0-posix and mes-boot, remove
%bootstrap-mescc-tools and %bootstrap-mes-rewired.
2022-05-12 19:27:59 +02:00
Jan (janneke) Nieuwenhuizen d79c103e11 gnu: commencement: tcc-boot0: Use nyacc-1.00.2.
* gnu/packages/commencement.scm (tcc-boot0): Use https source URL with
mirror://.  Update NYACC to 1.00.2 and call 'bootstrap-origin' on the source.
2022-05-12 19:27:58 +02:00
Jan (janneke) Nieuwenhuizen 2cebf680c7 gnu: commencement: mes-boot: Update to 0.24, build with M2-Planet.
* gnu/packages/commencement.scm (mes-boot)[source]: Update to
0.24.
[native-inputs]: Add stage0-posix, remove %bootstrap-mescc-tools and
%bootstrap-mes-rewired, and update nyacc to 1.00.2.
2022-05-12 19:27:58 +02:00
Jan (janneke) Nieuwenhuizen dc7da2c9ed gnu: commencement: Add stage0-posix.
Stage0-posix is a skeleton for bootstrapping all of Stage0 for POSIX systems.
On x86-linux, from the 357-byte hex0-seed binary from the bootstrap-seeds, it
builds hex0, kaem, hex1, catm, hex2, M0, cc_x86, M1, M2,
get_machine, (mescc-tools), and M2-Planet.

* gnu/packages/commencement.scm (stage0-posix): New variable.
2022-05-12 19:27:58 +02:00
Jan (janneke) Nieuwenhuizen 5324be85a7 gnu: commencement: Add bootstrap-seeds.
* gnu/packages/commencement.scm (bootstrap-seeds): New variable.
2022-05-12 19:27:57 +02:00
4 changed files with 349 additions and 329 deletions
+41 -34
View File
@@ -36,7 +36,7 @@ Copyright @copyright{} 2016, 2017, 2018, 2021 Chris Marusich@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021, 2022 Efraim Flashner@*
Copyright @copyright{} 2016 John Darrington@*
Copyright @copyright{} 2016, 2017 Nikita Gillmann@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020 Jan Nieuwenhuizen@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2021, 2022 Jan Nieuwenhuizen@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Julien Lepiller@*
Copyright @copyright{} 2016 Alex ter Weele@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Christopher Baines@*
@@ -394,7 +394,7 @@ Installing Debugging Files
Bootstrapping
* Reduced Binary Seed Bootstrap:: A Bootstrap worthy of GNU.
* Full-Source Bootstrap:: A Bootstrap worthy of GNU.
* Preparing to Use the Bootstrap Binaries:: Building that what matters most.
@end detailmenu
@@ -39491,12 +39491,12 @@ re-create them if needed (@pxref{Preparing to Use the Bootstrap
Binaries}).
@menu
* Reduced Binary Seed Bootstrap:: A Bootstrap worthy of GNU.
* Full-Source Bootstrap:: A Bootstrap worthy of GNU.
* Preparing to Use the Bootstrap Binaries:: Building that what matters most.
@end menu
@node Reduced Binary Seed Bootstrap
@section The Reduced Binary Seed Bootstrap
@node Full-Source Bootstrap
@section The Full-Source Bootstrap
Guix---like other GNU/Linux distributions---is traditionally bootstrapped from
a set of bootstrap binaries: Bourne shell, command-line tools provided by GNU
@@ -39511,28 +39511,47 @@ 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.}.
@dfn{full-source bootstrap}. This bootstrap is rooted in
@file{hex0-seed} from the @url{https://savannah.gnu.org/projects/stage0,
Stage0} package. The hex0 program is minimalist assembler: it reads
space-separated hexadecimal digits (nibbles) from a file, possibly
including comments, and emits on standard output the bytes corresponding
to those hexadecimal numbers. The source code of this initial hex0
program is a file called
@c XXX TODO: udpate to savannah url, once accepted there
@url{https://github.com/oriansj/bootstrap-seeds/blob/master/POSIX/x86/hex0_x86.hex0,@file{hex0_x86.hex0}}
and is written in the @code{hex0} language.
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).
Hex0 is self-hosting, which means that it can build itself:
Using these new binary seeds 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 145MB in Guix v1.1.
@example
./hex0-seed hex0_x86.hex0 hex0
@end example
The next step that Guix has taken is to replace the shell and all its
Hex0 it is the ASCII-equivalent of the binary program and can be
produced by doing something much like:
@example
sed 's/[;#].*$//g' hex0_x86.hex0 | xxd -r -p > hex0
chmod +x hex0
@end example
It is because of this ASCII-binary equivalence that we can bless this
initial 357-byte binary as source, and hence `full-source bootstrap''.
The bootstrap then continues: @code{hex0} builds @code{hex1} and then on
to @code{M0}, @code{hex2}, @code{M1}, @code{mescc-tools} and finally
@code{M2-Planet}. Then, using @code{mescc-tools}, @code{M2-Planet} we
build Mes (@pxref{Top, GNU Mes Reference Manual,, mes, GNU Mes}, a
Scheme interpreter and C compiler in Scheme). Frome here on starts
the more traditional @code{C}-based bootstrap of the GNU System.
Another step that Guix has taken is to replace the shell and all its
utilities with implementations in Guile Scheme, the @emph{Scheme-only
bootstrap}. Gash (@pxref{Gash,,, gash, The Gash manual}) is a
POSIX-compatible shell that replaces Bash, and it comes with Gash Utils
which has minimalist replacements for Awk, the GNU Core Utilities, Grep,
Gzip, Sed, and Tar. The rest of the bootstrap binary seeds that were
removed are now built from source.
Gzip, Sed, and Tar.
Building the GNU System from source is currently only possible by adding
some historical GNU packages as intermediate steps@footnote{Packages
@@ -39548,22 +39567,10 @@ The graph below shows the resulting dependency graph for
@code{gcc-core-mesboot0}, the bootstrap compiler used for the
traditional bootstrap of the rest of the Guix System.
@c ./pre-inst-env guix graph -e '(@@ (gnu packages commencement) gcc-core-mesboot0)' | sed -re 's,((bootstrap-mescc-tools|bootstrap-mes|guile-bootstrap).*shape =) box,\1 ellipse,' > doc/images/gcc-core-mesboot0-graph.dot
@c ./pre-inst-env guix graph -e '(@@ (gnu packages commencement) gcc-core-mesboot0)' | sed -re 's,((bootstrap-seeds|guile-bootstrap).*shape =) box,\1 ellipse,' > doc/images/gcc-core-mesboot0-graph.dot
@image{images/gcc-core-mesboot0-graph,6in,,Dependency graph of gcc-core-mesboot0}
The only significant binary bootstrap seeds that remain@footnote{
Ignoring the 68KB @code{mescc-tools}; that will be removed later,
together with @code{mes}.} are a Scheme interpreter and a Scheme
compiler: GNU Mes and GNU Guile@footnote{Not shown in this graph are the
static binaries for @file{bash}, @code{tar}, and @code{xz} that are used
to get Guile running.}.
This further reduction has brought down the size of the binary seed to
about 60MB for @code{i686-linux} and @code{x86_64-linux}.
Work is ongoing to remove all binary blobs from our free software
bootstrap stack, working towards a Full Source Bootstrap. Also ongoing
is work to bring these bootstraps to the @code{arm-linux} and
Work is ongoing to to bring these bootstraps to the @code{arm-linux} and
@code{aarch64-linux} architectures and to the Hurd.
If you are interested, join us on @samp{#bootstrappable} on the Freenode
+76 -111
View File
@@ -1,114 +1,79 @@
digraph "Guix package" {
"139781154519456" [label = "gcc-core-mesboot0@2.95.3", shape = box, fontname = Helvetica];
"139781154519456" -> "139781154519632" [color = darkgoldenrod];
"139781154519456" -> "139781154520688" [color = darkgoldenrod];
"139781154519456" -> "139781034971312" [color = darkgoldenrod];
"139781154519456" -> "139781154520160" [color = darkgoldenrod];
"139781154519456" -> "139781034971664" [color = darkgoldenrod];
"139781154519456" -> "139781154519984" [color = darkgoldenrod];
"139781154519456" -> "139781154519808" [color = darkgoldenrod];
"139781154519456" -> "139781154520512" [color = darkgoldenrod];
"139781154519456" -> "139781034971488" [color = darkgoldenrod];
"139781154519456" -> "139781034972896" [color = darkgoldenrod];
"139781154519456" -> "139781034972368" [color = darkgoldenrod];
"139781154519456" -> "139781034973072" [color = darkgoldenrod];
"139781154519456" -> "139781131267872" [color = darkgoldenrod];
"139781154519632" [label = "binutils-mesboot0@2.14", shape = box, fontname = Helvetica];
"139781154519632" -> "139781154520688" [color = peachpuff4];
"139781154519632" -> "139781034971312" [color = peachpuff4];
"139781154519632" -> "139781154520160" [color = peachpuff4];
"139781154519632" -> "139781034971664" [color = peachpuff4];
"139781154519632" -> "139781154519984" [color = peachpuff4];
"139781154519632" -> "139781154519808" [color = peachpuff4];
"139781154519632" -> "139781154520512" [color = peachpuff4];
"139781154519632" -> "139781034971488" [color = peachpuff4];
"139781154519632" -> "139781034972896" [color = peachpuff4];
"139781154519632" -> "139781034972368" [color = peachpuff4];
"139781154519632" -> "139781034973072" [color = peachpuff4];
"139781154519632" -> "139781131267872" [color = peachpuff4];
"139781154520688" [label = "bash-mesboot0@2.05b", shape = box, fontname = Helvetica];
"139781154520688" -> "139781034971488" [color = magenta];
"139781154520688" -> "139781034971840" [color = magenta];
"139781154520688" -> "139781034972896" [color = magenta];
"139781154520688" -> "139781034972368" [color = magenta];
"139781154520688" -> "139781034973072" [color = magenta];
"139781154520688" -> "139781131267872" [color = magenta];
"139781034971488" [label = "make-mesboot0@3.80", shape = box, fontname = Helvetica];
"139781034971488" -> "139781034971840" [color = dimgrey];
"139781034971488" -> "139781034972896" [color = dimgrey];
"139781034971488" -> "139781034972368" [color = dimgrey];
"139781034971488" -> "139781034973072" [color = dimgrey];
"139781034971488" -> "139781131267872" [color = dimgrey];
"139781034971840" [label = "tcc-boot0@0.9.26-1103-g6e62e0e", shape = box, fontname = Helvetica];
"139781034971840" -> "139781034972016" [color = magenta];
"139781034971840" -> "139781131266816" [color = magenta];
"139781034971840" -> "139781034972896" [color = magenta];
"139781034971840" -> "139781034972368" [color = magenta];
"139781034971840" -> "139781034973072" [color = magenta];
"139781034971840" -> "139781131267872" [color = magenta];
"139781034972016" [label = "mes-boot@0.22", shape = box, fontname = Helvetica];
"139781034972016" -> "139781034972192" [color = cyan3];
"139781034972016" -> "139781131266816" [color = cyan3];
"139781034972016" -> "139781034972896" [color = cyan3];
"139781034972016" -> "139781034972368" [color = cyan3];
"139781034972016" -> "139781034973072" [color = cyan3];
"139781034972016" -> "139781131267872" [color = cyan3];
"139781034972192" [label = "bootstrap-mes-rewired@0.19", shape = ellipse, fontname = Helvetica];
"139781034972192" -> "139781131266640" [color = darkseagreen];
"139781034972192" -> "139781034972896" [color = darkseagreen];
"139781131266640" [label = "bootstrap-mes@0", shape = ellipse, fontname = Helvetica];
"139781034972896" [label = "gash-boot@0.2.0", shape = box, fontname = Helvetica];
"139781034972896" -> "139781034973072" [color = darkviolet];
"139781034972896" -> "139781131267872" [color = darkviolet];
"139781034973072" [label = "bootar@1", shape = box, fontname = Helvetica];
"139781034973072" -> "139781131267872" [color = darkviolet];
"139781131267872" [label = "guile-bootstrap@2.0", shape = ellipse, fontname = Helvetica];
"139781131266816" [label = "bootstrap-mescc-tools@0.5.2", shape = ellipse, fontname = Helvetica];
"139781034972368" [label = "gash-utils-boot@0.1.0", shape = box, fontname = Helvetica];
"139781034972368" -> "139781034973072" [color = darkseagreen];
"139781034972368" -> "139781034972896" [color = darkseagreen];
"139781034972368" -> "139781131267872" [color = darkseagreen];
"139781034971312" [label = "bzip2-mesboot@1.0.8", shape = box, fontname = Helvetica];
"139781034971312" -> "139781034971488" [color = cyan3];
"139781034971312" -> "139781034971840" [color = cyan3];
"139781034971312" -> "139781034972896" [color = cyan3];
"139781034971312" -> "139781034972368" [color = cyan3];
"139781034971312" -> "139781034973072" [color = cyan3];
"139781034971312" -> "139781131267872" [color = cyan3];
"139781154520160" [label = "diffutils-mesboot@2.7", shape = box, fontname = Helvetica];
"139781154520160" -> "139781034971488" [color = red];
"139781154520160" -> "139781034971840" [color = red];
"139781154520160" -> "139781034972896" [color = red];
"139781154520160" -> "139781034972368" [color = red];
"139781154520160" -> "139781034973072" [color = red];
"139781154520160" -> "139781131267872" [color = red];
"139781034971664" [label = "gzip-mesboot@1.2.4", shape = box, fontname = Helvetica];
"139781034971664" -> "139781034971840" [color = red];
"139781034971664" -> "139781034972896" [color = red];
"139781034971664" -> "139781034972368" [color = red];
"139781034971664" -> "139781034973072" [color = red];
"139781034971664" -> "139781131267872" [color = red];
"139781154519984" [label = "patch-mesboot@2.5.9", shape = box, fontname = Helvetica];
"139781154519984" -> "139781034971488" [color = blue];
"139781154519984" -> "139781034971840" [color = blue];
"139781154519984" -> "139781034972896" [color = blue];
"139781154519984" -> "139781034972368" [color = blue];
"139781154519984" -> "139781034973072" [color = blue];
"139781154519984" -> "139781131267872" [color = blue];
"139781154519808" [label = "sed-mesboot0@1.18", shape = box, fontname = Helvetica];
"139781154519808" -> "139781034971488" [color = red];
"139781154519808" -> "139781034971840" [color = red];
"139781154519808" -> "139781034972896" [color = red];
"139781154519808" -> "139781034972368" [color = red];
"139781154519808" -> "139781034973072" [color = red];
"139781154519808" -> "139781131267872" [color = red];
"139781154520512" [label = "tcc-boot@0.9.27", shape = box, fontname = Helvetica];
"139781154520512" -> "139781034971312" [color = darkviolet];
"139781154520512" -> "139781034971488" [color = darkviolet];
"139781154520512" -> "139781034971840" [color = darkviolet];
"139781154520512" -> "139781034972896" [color = darkviolet];
"139781154520512" -> "139781034972368" [color = darkviolet];
"139781154520512" -> "139781034973072" [color = darkviolet];
"139781154520512" -> "139781131267872" [color = darkviolet];
"139803511371136" [label = "gcc-core-mesboot0@2.95.3", shape = box, fontname = sans];
"139803511371136" -> "139803511371312" [color = red];
"139803511371136" -> "139803511372016" [color = red];
"139803511371136" -> "139803511371488" [color = red];
"139803511371136" -> "139803511371664" [color = red];
"139803511371136" -> "139803511371840" [color = red];
"139803511371136" -> "139803507105792" [color = red];
"139803511371136" -> "139803511373600" [color = red];
"139803511371136" -> "139803507105968" [color = red];
"139803511371136" -> "139803749199472" [color = red];
"139803511371312" [label = "binutils-mesboot0@2.20.1a", shape = box, fontname = sans];
"139803511371312" -> "139803511372016" [color = dimgrey];
"139803511371312" -> "139803511371488" [color = dimgrey];
"139803511371312" -> "139803511371664" [color = dimgrey];
"139803511371312" -> "139803511371840" [color = dimgrey];
"139803511371312" -> "139803507105792" [color = dimgrey];
"139803511371312" -> "139803511373600" [color = dimgrey];
"139803511371312" -> "139803507105968" [color = dimgrey];
"139803511371312" -> "139803749199472" [color = dimgrey];
"139803511372016" [label = "gzip-mesboot@1.2.4", shape = box, fontname = sans];
"139803511372016" -> "139803511372192" [color = magenta];
"139803511372016" -> "139803507105792" [color = magenta];
"139803511372016" -> "139803511373600" [color = magenta];
"139803511372016" -> "139803507105968" [color = magenta];
"139803511372016" -> "139803749199472" [color = magenta];
"139803511372192" [label = "tcc-boot0@0.9.26-1136-g5bba73cc", shape = box, fontname = sans];
"139803511372192" -> "139803511372368" [color = magenta];
"139803511372192" -> "139803511372544" [color = magenta];
"139803511372192" -> "139803507105792" [color = magenta];
"139803511372192" -> "139803511373600" [color = magenta];
"139803511372192" -> "139803507105968" [color = magenta];
"139803511372192" -> "139803749199472" [color = magenta];
"139803511372368" [label = "mes-boot@0.24", shape = box, fontname = sans];
"139803511372368" -> "139803511372544" [color = darkviolet];
"139803511372368" -> "139803507105792" [color = darkviolet];
"139803511372368" -> "139803511373600" [color = darkviolet];
"139803511372368" -> "139803507105968" [color = darkviolet];
"139803511372368" -> "139803749199472" [color = darkviolet];
"139803511372544" [label = "stage0-posix@1.4", shape = box, fontname = sans];
"139803511372544" -> "139803511373072" [color = peachpuff4];
"139803511372544" -> "139803507105792" [color = peachpuff4];
"139803511372544" -> "139803511373600" [color = peachpuff4];
"139803511372544" -> "139803507105968" [color = peachpuff4];
"139803511372544" -> "139803749199472" [color = peachpuff4];
"139803511373072" [label = "bootstrap-seeds@1.0.0", shape = ellipse, fontname = sans];
"139803511373072" -> "139803507105968" [color = cyan3];
"139803507105968" [label = "bootar@1b", shape = box, fontname = sans];
"139803507105968" -> "139803749199472" [color = dimgrey];
"139803749199472" [label = "guile-bootstrap@2.0", shape = ellipse, fontname = sans];
"139803507105792" [label = "gash-boot@0.3.0", shape = box, fontname = sans];
"139803507105792" -> "139803507105968" [color = darkviolet];
"139803507105792" -> "139803749199472" [color = darkviolet];
"139803511373600" [label = "gash-utils-boot@0.2.0", shape = box, fontname = sans];
"139803511373600" -> "139803507105968" [color = red];
"139803511373600" -> "139803507105792" [color = red];
"139803511373600" -> "139803749199472" [color = red];
"139803511371488" [label = "patch-mesboot@2.5.9", shape = box, fontname = sans];
"139803511371488" -> "139803511371840" [color = darkseagreen];
"139803511371488" -> "139803511372192" [color = darkseagreen];
"139803511371488" -> "139803507105792" [color = darkseagreen];
"139803511371488" -> "139803511373600" [color = darkseagreen];
"139803511371488" -> "139803507105968" [color = darkseagreen];
"139803511371488" -> "139803749199472" [color = darkseagreen];
"139803511371840" [label = "make-mesboot0@3.80", shape = box, fontname = sans];
"139803511371840" -> "139803511372192" [color = blue];
"139803511371840" -> "139803507105792" [color = blue];
"139803511371840" -> "139803511373600" [color = blue];
"139803511371840" -> "139803507105968" [color = blue];
"139803511371840" -> "139803749199472" [color = blue];
"139803511371664" [label = "tcc-boot@0.9.27", shape = box, fontname = sans];
"139803511371664" -> "139803511371840" [color = peachpuff4];
"139803511371664" -> "139803511372192" [color = peachpuff4];
"139803511371664" -> "139803507105792" [color = peachpuff4];
"139803511371664" -> "139803511373600" [color = peachpuff4];
"139803511371664" -> "139803507105968" [color = peachpuff4];
"139803511371664" -> "139803749199472" [color = peachpuff4];
}
+1 -3
View File
@@ -1035,9 +1035,7 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
;; own packages.
(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)))
`(("linux-libre-headers" ,%bootstrap-linux-libre-headers)))
(_
`(("libc" ,%bootstrap-glibc)
("gcc" ,%bootstrap-gcc)
+231 -181
View File
@@ -5,7 +5,7 @@
;;; Copyright © 2014, 2015, 2017 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2017, 2018, 2019, 2021, 2022 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2018, 2019, 2020, 2021, 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2019, 2020, 2021 Marius Bakke <marius@gnu.org>
;;; Copyright © 2020, 2022 Timothy Sample <samplet@ngyro.com>
;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
@@ -266,186 +266,234 @@ pure Scheme to Tar and decompression in one easy step.")
("bootar" ,bootar)
("guile" ,%bootstrap-guile)))
(define %bootstrap-mes-rewired
(define bootstrap-seeds
(package
(inherit mes)
(name "bootstrap-mes-rewired")
(version "0.19")
(source #f)
(native-inputs `(("mes" ,%bootstrap-mes)
("gash" ,gash-boot)))
(inputs '())
(propagated-inputs '())
(outputs '("out"))
(name "bootstrap-seeds")
(version "1.0.0")
(source (origin
(method url-fetch)
(uri (list
(string-append "mirror://gnu/guix/mirror/"
"bootstrap-seeds-" version ".tar.gz")
(string-append
"https://lilypond.org/janneke/guix/20220501/"
"bootstrap-seeds-" version ".tar.gz")))
(sha256
(base32
"0scz2bx8fd8c821h6y1j3x6ywgxxns7iinyn9z32dnkiacfdcpfn"))))
(native-inputs (list bootar))
(build-system trivial-build-system)
(arguments
`(#:guile ,%bootstrap-guile
#:modules ((guix build utils))
(list #:guile %bootstrap-guile
#:modules '((guix build utils))
#:builder
#~(begin
(use-modules (guix build utils))
(let ((source #$(package-source this-package))
(tar #$(this-package-native-input "bootar"))
(out #$output))
(setenv "PATH" (string-append tar "/bin:"))
(invoke "tar" "xvf" source)
(mkdir-p out)
(copy-recursively "bootstrap-seeds" out)))))
(home-page "https://github.com/oriansj/bootstrap-seeds")
(synopsis "The initial bootstrap seeds: 357-byte hex0 and kaem shell")
(description
"This package provides pre-built binaries of the bootstrap seeds. It
contains a hex0-seed and an optional kaem-minimal shell. The size of the hex0
seeds are for knight: 250 bytes, x86-linux: 357 bytes, x86_64-linux: 431
bytes, and aarch64-linux 526 bytes. These can be used to build stage0: hex0,
hex1, hex2, M1, and M2-Planet.")
(license license:gpl3+)))
#:builder (begin
(use-modules (guix build utils)
(srfi srfi-26))
(let* ((mes (assoc-ref %build-inputs "mes"))
(gash (assoc-ref %build-inputs "gash"))
(mes-bin (string-append mes "/bin"))
(guile (string-append mes-bin "/mes"))
(mes-module (string-append mes "/share/mes/module"))
(out (assoc-ref %outputs "out"))
(bin (string-append out "/bin"))
(mescc (string-append bin "/mescc"))
(module (string-append out "/share/mes/module")))
(define (rewire file)
(substitute* file
((mes) out)
(("/gnu/store[^ ]+mes-minimal-[^/)}\"]*") out)
(("/gnu/store[^ ]+guile-[^/]*/bin/guile") guile)
(("/gnu/store[^ ]+bash-[^/)}\"]*") gash)))
(mkdir-p bin)
(for-each (lambda (file) (install-file file bin))
(find-files mes-bin))
(mkdir-p module)
(copy-recursively (string-append mes-module "/mes")
(string-append module "/mes"))
(copy-recursively (string-append mes-module "/srfi")
(string-append module "/srfi"))
(for-each rewire
;; Cannot easily rewire "mes" because it
;; contains NUL characters; would require
;; remove-store-references alike trick
(filter (negate (cut string-suffix? "/mes" <>))
(find-files bin)))
(rewire (string-append module "/mes/boot-0.scm"))
(delete-file mescc)
(with-output-to-file mescc
(lambda _
(display (string-append
"\
#! " gash "/bin/sh
LANG=C
LC_ALL=C
export LANG LC_ALL
MES_PREFIX=${MES_REWIRED_PREFIX-" out "/share/mes}
MES=" bin "/mes
export MES MES_PREFIX
MES_ARENA=${MES_REWIRED_ARENA-10000000}
MES_MAX_ARENA=${MES_REWIRED_ARENA-10000000}
MES_STACK=${MES_REWIRED_STACK-1000000}
export MES_ARENA MES_MAX_ARENA MES_STACK
$MES -e '(mescc)' module/mescc.scm -- \"$@\"
"))))
(chmod mescc #o555)
(with-directory-excursion module
(chmod "mes/base.mes" #o644)
(copy-file "mes/base.mes" "mes/base.mes.orig")
(let ((base.mes (open-file "mes/base.mes" "a")))
(display "
;; A fixed map, from Mes 0.21, required to bootstrap Mes 0.21
(define (map f h . t)
(if (or (null? h)
(and (pair? t) (null? (car t)))
(and (pair? t) (pair? (cdr t)) (null? (cadr t)))) '()
(if (null? t) (cons (f (car h)) (map f (cdr h)))
(if (null? (cdr t))
(cons (f (car h) (caar t)) (map f (cdr h) (cdar t)))
(if (null? (cddr t))
(cons (f (car h) (caar t) (caadr t)) (map f (cdr h) (cdar t) (cdadr t)))
(error 'unsupported (cons* 'map-4: f h t))b )))))
" base.mes)
(close base.mes))
(chmod "mes/guile.mes" #o644)
(copy-file "mes/guile.mes" "mes/guile.mes.orig")
(let ((guile.mes (open-file "mes/guile.mes" "a")))
(display "
;; After booting guile.scm; use Mes 0.21; especially: MesCC 0.21
(let* ((self (car (command-line)))
(prefix (dirname (dirname self))))
(set! %moduledir (string-append prefix \"/mes/module/\"))
(setenv \"%numbered_arch\" \"true\"))
" guile.mes)
(close guile.mes)))
#t))))))
(define stage0-posix
;; The initial bootstrap package: no binary inputs except those from
;; `bootstrap-seeds, for x86 a 357 byte binary seed: `x86/hex0-seed'.
(let* ((mescc-tools-version "1.4.0")
(m2-planet-version "1.9.0")
(mescc-tools
(origin
(method url-fetch)
(uri (list
(string-append
"mirror://gnu/guix/mirror/"
"mescc-tools-" mescc-tools-version ".tar.gz")
(string-append
"https://lilypond.org/janneke/guix/20220502/"
"mescc-tools-" mescc-tools-version ".tar.gz")))
(sha256
(base32
"1xi6f48pf5bhajhfis189gpizxij7nbp1vzvsb1aafhz4skkiqvg"))))
(m2-planet
(origin
(method url-fetch)
(uri (list
(string-append
"mirror://gnu/guix/mirror/"
"M2-Planet-" m2-planet-version ".tar.gz")
(string-append
"https://lilypond.org/janneke/guix/20220502/"
"M2-Planet-" m2-planet-version ".tar.gz")))
(sha256
(base32
"1xrn69sc5nz4hwaishqyrcidp1ncxwib9zswl45x378ddz3mmk7g")))))
(package
(name "stage0-posix")
(version "1.4")
(source (origin
(method url-fetch)
(uri (list
(string-append "mirror://gnu/guix/mirror/"
"stage0-posix-" version ".tar.gz")
(string-append
"https://lilypond.org/janneke/guix/20220502/"
"stage0-posix-" version ".tar.gz")))
(sha256
(base32
"1ammifkj33205qrpfm84yb1c99lwgbn4jsl1hd08aab8c9ffz6p4"))))
(supported-systems '("i686-linux" "x86_64-linux"
"armhf-linux" "aarch64-linux"
"riscv64-linux"))
(native-inputs
`(("bootstrap-seeds" ,bootstrap-seeds)
,@(%boot-gash-inputs)))
(build-system trivial-build-system)
(arguments
(list
#:guile %bootstrap-guile
#:modules '((guix build utils))
#:builder
#~(begin
(use-modules (guix build utils))
(let* ((bootstrap-seeds #$(this-package-native-input
"bootstrap-seeds"))
(source #$(package-source this-package))
(tar #$(this-package-native-input "bootar"))
(bash #$(this-package-native-input "bash"))
(coreutils #$(this-package-native-input "coreutils"))
(guile #$(this-package-input "guile"))
(out #$output)
(bindir (string-append out "/bin"))
(target (or #$(%current-target-system)
#$(%current-system)))
(stage0-cpu
(cond
((or #$(target-x86-64?) #$(target-x86-32?))
"x86")
(#$(target-arm?)
"armv7l")
(else
(error "stage0-posix: system not supported" target))))
(kaem (string-append "../bootstrap-seeds/POSIX/"
stage0-cpu "/kaem-optional-seed")))
(setenv "PATH" (string-append tar "/bin:"
coreutils "/bin:"
bash "/bin"))
(invoke "tar" "xvf" source)
(chdir (string-append "stage0-posix-" #$version))
(copy-recursively bootstrap-seeds "bootstrap-seeds")
(invoke "tar" "xvf" #$mescc-tools)
(rmdir "mescc-tools")
(symlink (string-append "mescc-tools-" #$mescc-tools-version)
"mescc-tools")
(invoke "tar" "xvf" #$m2-planet)
(rmdir "M2-Planet")
(symlink (string-append "M2-Planet-" #$m2-planet-version)
"M2-Planet")
(rmdir "M2libc")
(symlink "M2-Planet/M2libc" "M2libc")
(mkdir-p bindir)
(with-directory-excursion stage0-cpu
(with-output-to-file "mes-m2.kaem"
(lambda _ (display "")))
(with-output-to-file "mescc-tools-extra.kaem"
(lambda _ (display "")))
(invoke kaem "kaem.run"))
(with-directory-excursion "bin"
(install-file "hex2" bindir)
(install-file "M1" bindir)
(install-file "blood-elf" bindir)
(install-file "kaem" bindir)
(install-file "get_machine" bindir)
(install-file "M2-Planet" bindir))))))
(home-page "https://github.com/oriansj/stage0-posix/")
(synopsis "The initial bootstrap package, builds stage0 up to M2-Planet")
(description "Starting from the 357-byte hex0-seed binary provided by
the bootstrap-seeds, the stage0-posix package first builds hex0 and then all
the way up: hex1, catm, hex2, M0, cc_x86, M1, M2, get_machine (that's all of
MesCC-Tools), and finally M2-Planet.")
(license license:gpl3+))))
(define mes-boot
(package
(inherit mes)
(name "mes-boot")
(version "0.22")
(version "0.24")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/mes/"
"mes-" version ".tar.gz"))
(sha256
(base32
"0p1jsrrmcbc0zrvbvnjbb6iyxr0in71km293q8qj6gnar6bw09av"))))
"00lrpm4x5qg0l840zhbf9mr67mqhp8gljcl24j5dy0y109gf32w2"))))
(inputs '())
(propagated-inputs '())
(native-inputs
`(("nyacc-source" ,(origin (inherit (package-source nyacc-0.99))
(snippet #f)))
("mes" ,%bootstrap-mes-rewired)
("mescc-tools" ,%bootstrap-mescc-tools)
`(("m2-planet" ,stage0-posix)
("nyacc-source" ,(bootstrap-origin
(origin (inherit (package-source nyacc-1.00.2))
(snippet #f))))
,@(%boot-gash-inputs)))
(arguments
`(#:implicit-inputs? #f
#:tests? #f
#:guile ,%bootstrap-guile
#:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'unpack-seeds
(lambda _
(let ((nyacc-source (assoc-ref %build-inputs "nyacc-source")))
(with-directory-excursion ".."
(invoke "tar" "-xvf" nyacc-source)))))
(replace 'configure
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref %outputs "out"))
(gash (assoc-ref %build-inputs "bash"))
(mes (assoc-ref %build-inputs "mes"))
(dir (with-directory-excursion ".." (getcwd))))
(setenv "AR" (string-append "gash " (getcwd) "/scripts/mesar"))
(setenv "BASH" (string-append gash "/bin/bash"))
(setenv "CC" (string-append mes "/bin/mescc"))
(setenv "GUILE_LOAD_PATH"
(string-append
mes "/share/mes/module"
":" dir "/nyacc-0.99.0/module"))
(invoke "gash" "configure.sh"
(string-append "--prefix=" out)
(string-append "--host=i686-linux-gnu")))))
(replace 'build
(lambda _
(invoke "sh" "bootstrap.sh")))
(delete 'check)
(replace 'install
(lambda _
(substitute* "install.sh" ; show some progress
((" -xf") " -xvf")
(("^( *)((cp|mkdir|tar) [^']*[^\\])\n" all space cmd)
(string-append space "echo '" cmd "'\n"
space cmd "\n")))
(invoke "sh" "install.sh")
;; Keep ASCII output, for friendlier comparison and bisection
(let* ((out (assoc-ref %outputs "out"))
(cache (string-append out "/lib/cache")))
(define (objects-in-dir dir)
(find-files dir
(lambda (name stat)
(and (equal? (dirname name) dir)
(or (string-suffix? ".o" name)
(string-suffix? ".s" name))))))
(for-each (lambda (x) (install-file x cache))
(append (objects-in-dir ".")
(objects-in-dir "mescc-lib")))))))))
(list
#:implicit-inputs? #f
#:tests? #f
#:guile %bootstrap-guile
#:strip-binaries? #f ;no strip yet
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'unpack-seeds
(lambda _
(let ((nyacc-source #$(this-package-native-input "nyacc-source")))
(with-directory-excursion ".."
(invoke "tar" "-xvf" nyacc-source)))))
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out #$output)
(gash #$(this-package-native-input "bash"))
(dir (with-directory-excursion ".." (getcwd))))
(setenv "GUILE_LOAD_PATH" (string-append
dir "/nyacc-1.00.2/module"))
(invoke "gash" "configure.sh"
(string-append "--prefix=" out)
"--host=i686-linux-gnu"))))
(replace 'build
(lambda _
(invoke "gash" "bootstrap.sh")))
(delete 'check)
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(substitute* "install.sh" ; show some progress
((" -xf") " -xvf")
(("^( *)((cp|mkdir|tar) [^']*[^\\])\n" all space cmd)
(string-append space "echo '" cmd "'\n"
space cmd "\n")))
(invoke "gash" "install.sh")
;; Keep ASCII output, for friendlier comparison and bisection
(let* ((out #$output)
(cache (string-append out "/lib/cache")))
(define (objects-in-dir dir)
(find-files dir
(lambda (name stat)
(and (equal? (dirname name) dir)
(or (string-suffix? ".M1" name)
(string-suffix? ".hex2" name)
(string-suffix? ".o" name)
(string-suffix? ".s" name))))))
(for-each (lambda (x) (install-file x cache))
(append (objects-in-dir "m2")
(objects-in-dir ".")
(objects-in-dir "mescc-lib")))))))))
(native-search-paths
(list (search-path-specification
(variable "C_INCLUDE_PATH")
@@ -460,7 +508,7 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
(define tcc-boot0
;; Pristine tcc cannot be built by MesCC, we are keeping a delta of 11
;; Pristine tcc cannot be built by MesCC, we are keeping a delta of 30
;; 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
@@ -469,24 +517,27 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
(package
(inherit tcc)
(name "tcc-boot0")
(version "0.9.26-1103-g6e62e0e")
(version "0.9.26-1136-g5bba73cc")
(source (origin
(method url-fetch)
(uri (string-append
"http://lilypond.org/janneke/mes/20191117/"
"/tcc-" version ".tar.gz"))
(uri (list
(string-append "mirror://gnu/guix/mirror/"
"tcc-" version ".tar.gz")
(string-append "https://lilypond.org/janneke/tcc/"
"tcc-" version ".tar.gz")))
(sha256
(base32
"1qbybw7mxbgkv3sazvz1v7c8byq998vk8f1h25ik8w3d2l63lxng"))))
"1y2f04qwdqg7dgxiscbf0ibybx2gclniwbbcsxpayazzii2cvji3"))))
(build-system gnu-build-system)
(supported-systems '("i686-linux" "x86_64-linux"))
(inputs '())
(propagated-inputs '())
(native-inputs
`(("mes" ,mes-boot)
("nyacc-source" ,(origin (inherit (package-source nyacc-0.99))
(snippet #f)))
("mescc-tools" ,%bootstrap-mescc-tools)
("mescc-tools" ,stage0-posix)
("nyacc-source" ,(bootstrap-origin
(origin (inherit (package-source nyacc-1.00.2))
(snippet #f))))
,@(%boot-gash-inputs)))
(arguments
`(#:implicit-inputs? #f
@@ -501,18 +552,17 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
(with-directory-excursion ".."
(invoke "tar" "-xvf" nyacc-source)))))
(replace 'configure
(lambda* (#:key outputs #:allow-other-keys)
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref %outputs "out"))
(dir (with-directory-excursion ".." (getcwd)))
(interpreter "/lib/mes-loader"))
(setenv "prefix" out)
(setenv "GUILE_LOAD_PATH"
(string-append dir "/nyacc-0.99.0/module"))
(interpreter "/lib/mes-loader")
(mes (assoc-ref inputs "mes"))
(mescc (string-append mes "/bin/mescc")))
(substitute* "conftest.c"
(("volatile") ""))
(setenv "prefix" out)
(setenv "GUILE_LOAD_PATH"
(string-append dir "/nyacc-1.00.2/module"))
(invoke "sh" "configure"
"--cc=mescc"
(string-append "--prefix=" out)
@@ -522,7 +572,7 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
(replace 'build
(lambda _
(substitute* "bootstrap.sh" ; Show some progress
(("^( *)((cp|ls|mkdir|rm|[.]/tcc|[.]/[$][{PROGRAM_PREFIX[}]tcc) [^\"]*[^\\])\n" all space cmd)
(("^( *)((cp|ls|mkdir|rm|[.]/tcc|[.]/[$][{program_prefix[}]tcc) [^\"]*[^\\])\n" all space cmd)
(string-append space "echo \"" cmd "\"\n"
space cmd "\n")))
(invoke "sh" "bootstrap.sh")))
@@ -742,8 +792,8 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
(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")
(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"