[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
145/160: bootstrap: Integrate mes bootstrap for i686-linux.
From: |
Jan Nieuwenhuizen |
Subject: |
145/160: bootstrap: Integrate mes bootstrap for i686-linux. |
Date: |
Tue, 28 Aug 2018 15:56:39 -0400 (EDT) |
janneke pushed a commit to branch wip-bootstrap
in repository guix.
commit dd025a6879d0243f0f4c99faeeb54a8ff30ad70f
Author: Jan Nieuwenhuizen <address@hidden>
Date: Thu Aug 23 17:34:05 2018 +0200
bootstrap: Integrate mes bootstrap for i686-linux.
* gnu/packages/commencement.scm (mescc-tools-boot nyacc-boot, mes-boot,
tcc-boot0, tcc-boot, binutils-mesboot0, gcc-core-mesboot, glibc-mesboot,
gcc-mesboot0, binutils-mesboot, gmp-boot, mpfr-boot, gcc-mesboot,
m4-mesboot): Move from gnu/packages/mes.scm, use
package-with-explicit-inputs.
(%bootstrap-inputs+toolchain): New variable. Update users of
%bootstrap-inputs.
* gnu/packages/mes.scm: Remove bootstrap packages.
---
gnu/packages/bootstrap.scm | 1 +
gnu/packages/commencement.scm | 1167 ++++++++++++++++++++++++++++++++++++++++-
gnu/packages/mes.scm | 1103 +-------------------------------------
3 files changed, 1160 insertions(+), 1111 deletions(-)
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 1786b8d..12e0a3b 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
<address@hidden>
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <address@hidden>
;;; Copyright © 2017 Efraim Flashner <address@hidden>
+;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index dde000a..211dddf 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2014, 2015, 2017 Mark H Weaver <address@hidden>
;;; Copyright © 2017, 2018 Efraim Flashner <address@hidden>
;;; Copyright © 2018 Tobias Geerinckx-Rice <address@hidden>
+;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <address@hidden>
;;;
;;; 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,14 +81,1160 @@
;;;
;;; Code:
-(define gnu-make-boot0
+(define %fake-bootstrap? #t) ; cheat using Guile (instead of Mes) in MesCC
+ ; for speed-up?
+
+(define mes-boot0
+ (let ((version "0.17")
+ (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
+ "02nakd20pnpgc1fq23r76ys23h150lg4fwjv5sqzza5dn66s60a6")))
+ (origin
+ (method url-fetch)
+ (uri (string-append "http://alpha.gnu.org/gnu/mes/"
+ "mes-" version ".tar.gz"))
+ (sha256
+ (base32
+
"1j32x4zqy2cqjlg9m35f2411mwac2b0p5ch4hm99gddmfbxzgyhg")))))
+ (native-inputs '())
+ (propagated-inputs '()))))
+
+(define-public mescc-tools-boot
+ (let ((version "0.4")
+ (revision "1")
+ (commit "f02b8f4fda8d0c5c11a1d63a02b2bfdfab55abc5"))
+ (package-with-bootstrap-guile
+ (package
+ (inherit mescc-tools)
+ (name "mescc-tools-boot")
+ (version (string-append version "-" revision "." (string-take commit
7)))
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://gitlab.com/janneke/mescc-tools"
+ "/-/archive/" commit
+ "/mescc-tools-" commit ".tar.gz"))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (sha256
+ (base32
+ "14xw954ad4lnnyflgnwvzfhd3kqimniilzzyf4x23vljky2npkbf"))))
+ (inputs '())
+ (propagated-inputs '())
+ (native-inputs
+ `(("mescc-tools-seed" ,%mescc-tools-seed)
+ ("mes-source" ,(package-source mes-boot0))
+
+ ("coreutils" ,%bootstrap-coreutils&co)
+ ("mes-seed" ,%mes-seed)))
+ (build-system gnu-build-system)
+ (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"))
+ (mescc-tools-seed (assoc-ref %build-inputs
"mescc-tools-seed"))
+ (mes-seed (assoc-ref %build-inputs "mes-seed"))
+ (mes-source (assoc-ref %build-inputs "mes-source"))
+ (out (assoc-ref %outputs "out")))
+ (setenv "PATH" (string-append coreutils "/bin"))
+ (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+ (with-directory-excursion ".."
+ (and
+ (mkdir-p "mescc-tools-seed")
+ (zero? (system* "tar" "--strip=1" "-C" "mescc-tools-seed"
+ "-xvf" mescc-tools-seed))
+ (mkdir-p "mes-source")
+ (zero? (system* "tar" "--strip=1" "-C" "mes-source"
+ "-xvf" mes-source))
+ (mkdir-p "mes-seed")
+ (zero? (system* "tar" "--strip=1" "-C" "mes-seed"
+ "-xvf" mes-seed)))))))
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ ;;(use-modules (guix build utils))
+ (let ((coreutils (assoc-ref %build-inputs "coreutils"))
+ (out (assoc-ref %outputs "out")))
+ (setenv "PATH" (string-append coreutils "/bin"
+ ":" "../mescc-tools-seed"))
+ (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+ (setenv "PREFIX" out)
+ (setenv "MES_PREFIX" "../mes-source")
+ (setenv "MESCC_TOOLS_SEED" "../mescc-tools-seed")
+ (setenv "MES_SEED" "../mes-seed"))))
+ (replace 'build
+ (lambda* (#:key outputs #:allow-other-keys)
+ (zero? (system* "sh" "build.sh"))))
+ (replace 'check
+ (lambda* (#:key outputs #:allow-other-keys)
+ (zero? (system* "sh" "check.sh"))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (zero? (system* "sh" "install.sh")))))))))))
+
+(define-public nyacc-boot
+ (let ((version "0.80.42")
+ (revision "0")
+ (commit "2839661e344c1c709579e690063bc6a74adfb914"))
+ (package
+ (inherit nyacc)
+ (name "nyacc-boot")
+ (version (string-append version "-" revision "." (string-take commit 7)))
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://gitlab.com/janneke/nyacc"
+ "/-/archive/" commit
+ "/nyacc-" commit ".tar.gz"))
+ (sha256
+ (base32
+ "0dlcqmchhl57nh7f0v6qb1kkbi7zbs3b185hcqv57fhb60b7rgcq")))))))
+
+(define-public mes-boot
+ (let ((version "0.17")
+ (revision "0")
+ (commit #f))
+ (package-with-bootstrap-guile
+ (package
+ (inherit mes)
+ (source (package-source mes-boot0))
+ (name "mes-boot")
+ (inputs '())
+ (propagated-inputs '())
+ (native-inputs
+ `(("mescc-tools" ,mescc-tools-boot)
+ ("nyacc-source" ,(package-source nyacc-boot))
+
+ ("coreutils" , %bootstrap-coreutils&co)
+ ("mes-seed" ,%mes-seed)
+ ,@(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"))
+ (mes-seed (assoc-ref %build-inputs "mes-seed")))
+ (setenv "PATH" (string-append
+ coreutils "/bin"))
+ (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+ (with-directory-excursion ".."
+ (and
+ (mkdir-p "nyacc-source")
+ (zero? (system* "tar" "--strip=1" "-C" "nyacc-source"
"-xvf" nyacc-source))
+ (mkdir-p "mes-seed")
+ (zero? (system* "tar" "--strip=1" "-C" "mes-seed" "-xvf"
mes-seed))
+ (or (not srfi-43)
+ (and (mkdir-p "srfi")
+ (zero? (system* "cp" srfi-43
"srfi/srfi-43.scm")))))))))
+ (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"))
+ (mescc-tools (assoc-ref %build-inputs "mescc-tools"))
+ (srfi-43 (assoc-ref %build-inputs "srfi-43")))
+ (setenv "PATH" (string-append
+ coreutils "/bin"
+ (if guile (string-append ":" guile "/bin")
"")
+ ":" mescc-tools "/bin"))
+ (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+ (setenv "SHELL" (string-append coreutils "/bin/bash"))
+ (setenv "srcdir" ".")
+ (zero? (system* "bash" "-x" "configure.sh"
+ (string-append "--prefix=" out)))
+ (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 (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"))
+ (begin ; True bootstrap build Mes+Nyacc+MesCC
+ (symlink (string-append "../nyacc-source/module")
"nyacc")
+ (setenv "GUILE_LOAD_PATH" "nyacc")
+ (setenv "MES" "src/mes")))
+ (setenv "GUILE_TOOLS" "true") ; no tools in bootstrap-guile
+ (setenv "MESCC" "scripts/mescc")
+ (setenv "MES_MODULEDIR" "module"))))
+ (replace 'build
+ (lambda* (#:key outputs #:allow-other-keys)
+ (zero? (system* "sh" "build.sh"))))
+ (replace 'check
+ (lambda* (#:key outputs #:allow-other-keys)
+ (or ,%fake-bootstrap? ; check takes ~15min, skip when faking
+ (and
+ (setenv "MES_ARENA" "100000000")
+ (setenv "DIFF" "sh scripts/diff.scm")
+ (zero? (system* "sh" "-x" "build-aux/test.sh"
"scaffold/tests/t"))
+ (zero? (system* "sh" "-x" "build-aux/test.sh"
"scaffold/tests/63-struct-cell"))
+ (zero? (system* "sh" "-x" "check.sh"))))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (zero? (system* "sh" "install.sh")))))))))))
+
+(define-public tcc-boot0
+ (let ((version "0.9.26")
+ (revision "2")
+ (commit "1f518eab9a5409006b356a5395bba35ea13d0140"))
+ (package-with-bootstrap-guile
+ (package
+ (inherit tcc)
+ (name "tcc-boot0")
+ (version (string-append version "-" revision "." (string-take commit
7)))
+ (synopsis "Tiny and fast C compiler")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://gitlab.com/janneke/tinycc"
+ "/-/archive/" commit
+ "/tinycc-" commit ".tar.gz"))
+ (sha256
+ (base32
+ "0jkv9shhn5s4zqsvnjwwp2np2wg5v8ypsj5s4hb8yr1cjqqv2z9s"))))
+ (build-system gnu-build-system)
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (inputs '())
+ (propagated-inputs '())
+ (native-inputs
+ `(("mes" ,mes-boot)
+ ("mes-seed" ,%mes-seed)
+ ("mescc-tools" ,mescc-tools-boot)
+ ("nyacc-source" ,(package-source nyacc-boot))
+
+ ("coreutils" , %bootstrap-coreutils&co)
+ ("tinycc-seed" ,%tinycc-seed)
+ ,@(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"))
+ (mes-seed (assoc-ref %build-inputs "mes-seed"))
+ (tinycc-seed (assoc-ref %build-inputs "tinycc-seed")))
+ (setenv "PATH" (string-append
+ coreutils "/bin"))
+ (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+ (with-directory-excursion ".."
+ (and
+ (mkdir-p "nyacc-source")
+ (zero? (system* "tar" "--strip=1" "-C" "nyacc-source"
+ "-xvf" nyacc-source))
+ (mkdir-p "mes-seed")
+ (zero? (system* "tar" "--strip=1" "-C" "mes-seed"
+ "-xvf" mes-seed))
+ (mkdir-p "tinycc-seed")
+ (zero? (system* "tar" "--strip=1" "-C" "tinycc-seed"
+ "-xvf" tinycc-seed))
+ (or (not srfi-43)
+ (and (mkdir-p "srfi")
+ (zero? (system* "cp" srfi-43
"srfi/srfi-43.scm")))))))))
+ (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
+ (string-append libc
,(glibc-dynamic-linker))
+ (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_DEBUG" "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")))
+ (and
+ (zero? (system* "sh" "configure"
+ "--prefix=$PREFIX"
+ (string-append "--elfinterp=" interpreter)
+ "--crtprefix=."
+ "--tccdir=."))))))
+ (replace 'build
+ (lambda* (#:key outputs #:allow-other-keys)
+ (zero? (system* "sh" "build.sh"))))
+ (replace 'check
+ (lambda* (#:key outputs #:allow-other-keys)
+ (setenv "DIFF" "diff.scm")
+ ;; fail fast tests
+ ;;(zero? (system* "sh" "test.sh"
"mes/scaffold/tests/30-strlen"))
+ ;;(zero? (system* "sh" "-x" "test.sh"
"mes/scaffold/tinycc/00_assignment"))
+ (setenv "TCC" "./tcc")
+ (zero? (system* "sh" "check.sh"))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (zero? (system* "sh" "install.sh")))))))))))
+
+(define-public tcc-boot
+ (package-with-bootstrap-guile
+ (package
+ (inherit tcc-boot0)
+ (name "tcc-boot")
+ (version "0.9.27")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://savannah/tinycc/tcc-"
+ version ".tar.bz2"))
+ (patches (search-patches "tcc-boot-0.9.27.patch"))
+ (sha256
+ (base32
+ "177bdhwzrnqgyrdv1dwvpd04fcxj68s5pm1dzwny6359ziway8yy"))))
+ (build-system gnu-build-system)
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (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
+ (string-append libc
,(glibc-dynamic-linker))
+ (string-append mes "/lib/mes-loader"))))
+ ;; unpack
+ (setenv "PATH" (string-append
+ coreutils "/bin"
+ ":" tcc "/bin"))
+ (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+ (zero? (system* "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
+ (string-append libc
,(glibc-dynamic-linker))
+ (string-append mes "/lib/mes-loader"))))
+ (zero? (system* "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\"")
+ "-I" (string-append tcc "/out")
+ "-L" (string-append tcc "/lib")
+ "-o" "tcc"
+ "tcc.c")))))
+ (replace 'check
+ (lambda* (#:key outputs #:allow-other-keys)
+ ;; 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"))
+ (zero? (system* "tcc" "-D" "TCC_TARGET_I386=1" "-c" "-o"
"libtcc1.o" "lib/libtcc1.c"))
+ (zero? (system* "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"))))))))))))
+
+
+(define-public binutils-mesboot0
(package-with-bootstrap-guile
- (package (inherit gnu-make)
+ (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)
+
+ ("coreutils" ,%bootstrap-coreutils&co)
+ ("diffutils" ,%bootstrap-diffutils)
+ ("make" ,%bootstrap-make)))
+ (supported-systems '("i686-linux"))
+ (arguments
+ `(#:implicit-inputs? #f
+ #:guile ,%bootstrap-guile
+ #:tests? #f ; runtest: command not found
+ #:parallel-build? #f
+ #:strip-binaries? #f
+ #:make-flags '("AR=tcc -ar" "RANLIB=true")
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (cppflags (string-append
+ " -D __STDC__=1 "
+ " -D __GLIBC_MINOR__=6"
+ " -D MES_BOOTSTRAP=1")))
+ ;; who sets these?
+ (unsetenv "C_INCLUDE_PATH")
+ (unsetenv "CPLUS_INCLUDE_PATH")
+ (unsetenv "CPATH")
+ (unsetenv "LIBRARY_PATH")
+ (setenv "PATH"
+ (string-append
+ (assoc-ref %build-inputs "coreutils") "/bin"
+ ":" (assoc-ref %build-inputs "make") "/bin"
+ ":" (assoc-ref %build-inputs "tcc") "/bin"))
+
+ (format (current-error-port) "PATH=~a\n" (getenv "PATH"))
+ (setenv "CONFIG_SHELL" (string-append
+ (assoc-ref %build-inputs "coreutils")
+ "/bin/sh"))
+ (format (current-error-port) "CONFIG_SHELL=~a\n" (getenv
"CONFIG_SHELL"))
+ (setenv "CPPFLAGS" cppflags)
+ (setenv "AR" "tcc -ar")
+ (setenv "CXX" "false")
+ (setenv "RANLIB" "true")
+ (setenv "CC" (string-append "tcc -static" " " cppflags))
+ (setenv "LD" (string-append "tcc -static" " " cppflags))
+ (setenv "CC_FOR_BUILD" (string-append "tcc -static" " "
cppflags))
+ (setenv "CPP" (string-append "tcc -E" " " cppflags))
+ (setenv "CC_FOR_BUILD" (string-append "tcc -static" " "
cppflags))
+ (setenv "OBJC" (string-append "tcc -static" " " cppflags))
+ (and (zero?
+ (system* "./configure"
+ "--disable-nls"
+ "--disable-shared"
+ "--disable-werror"
+ "--build=i686-unknown-linux-gnu"
+ "--host=i686-unknown-linux-gnu"
+ "--with-sysroot=/"
+ (string-append "--prefix=" out)))))))))))))
+
+(define-public gcc-core-mesboot
+ (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-core-boot-2.95.3.patch"))
+ (sha256
+ (base32
+ "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an"))))
+ (supported-systems '("i686-linux"))
+ (inputs '())
+ (propagated-inputs '())
+ (native-inputs `(("binutils" ,binutils-mesboot0)
+ ("tcc" ,tcc-boot)
+
+ ("coreutils" ,%bootstrap-coreutils&co)
+ ("diffutils" ,%bootstrap-diffutils)
+ ("make" ,%bootstrap-make)))
+ (outputs '("out"))
+ (arguments
+ `(#:implicit-inputs? #f
+ #:guile ,%bootstrap-guile
+ #:tests? #f
+ #:parallel-build? #f
+ #:strip-binaries? #f
+ #: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
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (tcc (assoc-ref %build-inputs "tcc"))
+ (cppflags (string-append
+ " -D __STDC__=1"
+ " -D __GLIBC_MINOR__=6")))
+ (setenv "PATH"
+ (string-append
+ (assoc-ref %build-inputs "binutils") "/bin"
+ ":" (assoc-ref %build-inputs "tcc") "/bin"
+
+ ":" (assoc-ref %build-inputs "coreutils") "/bin"
+ ":" (assoc-ref %build-inputs "diffutils") "/bin"
+ ":" (assoc-ref %build-inputs "make") "/bin"))
+
+ ;; no info at this stage
+ (delete-file-recursively "texinfo")
+ (system "touch gcc/cpp.info gcc/gcc.info")
+
+ (setenv "CONFIG_SHELL" (string-append
+ (assoc-ref %build-inputs "coreutils")
+ "/bin/sh"))
+ (unsetenv "LANG")
+ (unsetenv "C_INCLUDE_PATH") ; flex
+ (unsetenv "LIBRARY_PATH")
+ (setenv "CPPFLAGS" cppflags)
+ (setenv "C_INCLUDE_PATH" (string-append tcc "/include"))
+ (setenv "CC" (string-append "tcc -static" " " cppflags))
+ (setenv "CC_FOR_BUILD" (string-append "tcc -static" " "
cppflags))
+ (setenv "CPP" (string-append "tcc -E" " " cppflags))
+
+ (format (current-error-port) "PATH=~a\n" (getenv "PATH"))
+ (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv
"C_INCLUDE_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)'
+")))
+ (and
+ (zero?
+ (system* "./configure"
+ "--disable-shared"
+ "--enable-static"
+ "--build=i686-unknown-linux-gnu"
+ "--host=i686-unknown-linux-gnu"
+ (string-append "--prefix=" out)))))))
+ (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"))
+ (zero? (system* "ar" "r" (string-append gcc-dir "/libc.a")
+ (string-append tcc-lib "/libc+gnu.o")
+ (string-append tcc-lib "/libtcc1.o")))
+ (zero? (system* "ar" "r" (string-append out "/lib/libc.a")
+ (string-append tcc-lib "/libc+gnu.o")
+ (string-append tcc-lib "/libtcc1.o")))
+ (system* "ls" "-ltrF" gcc-dir)
+ (copy-recursively (string-append tcc "/include")
+ (string-append out "/include"))))))))))))
+
+(define-public glibc-mesboot
+ (package-with-bootstrap-guile
+ (package
+ (inherit glibc)
+ (name "glibc-mesboot")
+ (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"))
+ (inputs '())
+ (propagated-inputs '())
+ (native-inputs `(("binutils" ,binutils-mesboot0)
+ ("gcc" ,gcc-core-mesboot)
+
+ ("coreutils" ,%bootstrap-coreutils&co)
+ ("diffutils" ,%bootstrap-diffutils)
+ ("kernel-headers" ,%bootstrap-linux-libre-headers)
+ ("make" ,%bootstrap-make)))
+ (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 "coreutils")
+ "/bin/sh"))
+ #:configure-flags
+ (let ((out (assoc-ref %outputs "out"))
+ (headers (assoc-ref %build-inputs "kernel-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"))
+ (headers (assoc-ref %build-inputs "kernel-headers"))
+ (gcc (assoc-ref %build-inputs "gcc"))
+ (cppflags (string-append
+ " -D __STDC__=1"
+ " -D MES_BOOTSTRAP=1"
+ " -D BOOTSTRAP_GLIBC=1"))
+ (cflags (string-append " -L " (getcwd))))
+ (setenv "CONFIG_SHELL" (string-append
+ (assoc-ref %build-inputs "coreutils")
+ "/bin/sh"))
+ (setenv "SHELL" (getenv "CONFIG_SHELL"))
+ (format (current-error-port) "CONFIG_SHELL=~s\n" (getenv
"CONFIG_SHELL"))
+
+ (setenv "PATH"
+ (string-append
+ (assoc-ref %build-inputs "coreutils") "/bin"
+ ":" (assoc-ref %build-inputs "binutils") "/bin"
+ ":" (assoc-ref %build-inputs "gcc") "/bin"
+ ":" (assoc-ref %build-inputs "diffutils") "/bin"
+ ":" (assoc-ref %build-inputs "make") "/bin"))
+
+ (setenv "CPP" (string-append gcc "/bin/gcc -E " cppflags))
+ (setenv "CC" (string-append gcc "/bin/gcc " cppflags cflags))
+ (unsetenv "C_INCLUDE_PATH")
+ (unsetenv "LIBRARY_PATH"))))
+ ;; glibc-2.2.5 needs a slightly more classical 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))
+ (zero?
+ (apply system* "./configure" configure-flags))))))))))
+
+(define-public gcc-mesboot0
+ (package-with-bootstrap-guile
+ (package
+ (inherit gcc-core-mesboot)
+ (name "gcc-mesboot0")
+ (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"))
+ (inputs '())
+ (propagated-inputs '())
+ (native-inputs `(("binutils" ,binutils-mesboot0)
+ ("gcc" ,gcc-core-mesboot)
+ ("libc" ,glibc-mesboot)
+
+ ("coreutils" ,%bootstrap-coreutils&co)
+ ("diffutils" ,%bootstrap-diffutils)
+ ("kernel-headers" ,%bootstrap-linux-libre-headers)
+ ("make" ,%bootstrap-make)))
+ (outputs '("out"))
+ (arguments
+ `(#:implicit-inputs? #f
+ #:guile ,%bootstrap-guile
+ #:tests? #f ; runtest: command not found
+ #:parallel-build? #f
+ #:strip-binaries? #f
+ #:make-flags (list "RANLIB=true"
+ (string-append "LIBGCC2_INCLUDES=-I "
+ (assoc-ref %build-inputs "gcc")
+ "/include")
+ "LANGUAGES=c")
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-1))
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (binutils (assoc-ref %build-inputs "binutils"))
+ (gcc (assoc-ref %build-inputs "gcc"))
+ (glibc (assoc-ref %build-inputs "libc"))
+ (headers (assoc-ref %build-inputs "kernel-headers")))
+ (when #t ;; no info
+ (delete-file-recursively "texinfo")
+ (system "touch gcc/cpp.info gcc/gcc.info"))
+
+ (setenv "PATH"
+ (string-append
+ (assoc-ref %build-inputs "binutils") "/bin"
+ ":" (assoc-ref %build-inputs "gcc") "/bin"
+
+ ;; more bootstrap cheats
+ ":" (assoc-ref %build-inputs "coreutils") "/bin"
+ ":" (assoc-ref %build-inputs "diffutils") "/bin"
+ ":" (assoc-ref %build-inputs "make") "/bin"))
+
+ (format (current-error-port) "PATH=~a\n" (getenv "PATH"))
+ (setenv "CONFIG_SHELL" (string-append
+ (assoc-ref %build-inputs "coreutils")
+ "/bin/sh"))
+ (setenv "C_INCLUDE_PATH" (string-append
+ ;;gcc "/include" this is MES
+ ;;":/"
+ gcc
"/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include"
+ ":" headers "/include"
+ ":" glibc "/include"))
+ (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"))
+
+ (setenv "CC" "gcc")
+ (setenv "LD" "gcc")
+ (setenv "CPP" "gcc -E")
+ (setenv "RANLIB" "true")
+
+ (with-output-to-file "config.cache"
+ (lambda _
+ (display "
+ac_cv_c_float_format='IEEE (little-endian)'
+")))
+ (and
+ (zero?
+ (system* "./configure"
+ "--disable-shared"
+ "--build=i686-unknown-linux-gnu"
+ "--host=i686-unknown-linux-gnu"
+ (string-append "--prefix=" out)))))))
+ (add-after 'install '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"))))))))))))
+
+(define-public binutils-mesboot
+ (package-with-bootstrap-guile
+ (package
+ (inherit binutils-mesboot0)
+ (name "binutils-mesboot")
+ (inputs '())
+ (propagated-inputs '())
+ (native-inputs `(("binutils" ,binutils-mesboot0)
+ ("libc" ,glibc-mesboot)
+ ("gcc" ,gcc-mesboot0)
+
+ ("coreutils" ,%bootstrap-coreutils&co)
+ ("diffutils" ,%bootstrap-diffutils)
+ ("kernel-headers" ,%bootstrap-linux-libre-headers)
+ ("make" ,%bootstrap-make)))
+ (arguments
+ `(#:implicit-inputs? #f
+ #:guile ,%bootstrap-guile
+ #:parallel-build? #f
+ #:configure-flags '("--enable-deterministic-archives"
+ "--disable-nls"
+ "--disable-shared"
+ "--disable-werror"
+ "--build=i686-unknown-linux-gnu"
+ "--host=i686-unknown-linux-gnu"
+ "--enable-static"
+ "--enable-compressed-debug-sections=no"
+ "--disable-gold"
+ "--disable-plugins"
+ "--disable-x86-relax-relocations"
+ "--with-system-libz"
+ "--with-sysroot=/"
+ )
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (gcc (assoc-ref %build-inputs "gcc"))
+ (glibc (assoc-ref %build-inputs "libc"))
+ (kernel-headers (assoc-ref %build-inputs
"kernel-headers")))
+ (setenv "C_INCLUDE_PATH"
+ (string-append glibc "/include"
+ ":" kernel-headers "/include"
+ ":" gcc "/include"))
+ (setenv "LIBRARY_PATH"
+ (string-append glibc "/lib"
+ ":" gcc "/lib"))
+ (setenv "CPP" (string-append "gcc -E"))
+ (setenv "AR" "ar")
+ (setenv "RANLIB" "true")
+ (setenv "PATH"
+ (string-append
+ (assoc-ref %build-inputs "binutils") "/bin"
+ ":" (assoc-ref %build-inputs "gcc") "/bin"
+
+ ;; more bootstrap cheats
+ ":" (assoc-ref %build-inputs "coreutils") "/bin"
+ ":" (assoc-ref %build-inputs "diffutils") "/bin"
+ ":" (assoc-ref %build-inputs "make") "/bin"))
+ (setenv "CONFIG_SHELL" (string-append
+ (assoc-ref %build-inputs "coreutils")
+ "/bin/sh"))
+ (format (current-error-port) "PATH=~a\n" (getenv "PATH"))
+ (format (current-error-port) "CONFIG_SHELL=~a\n" (getenv
"CONFIG_SHELL"))
+ (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv
"C_INCLUDE_PATH"))
+ (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv
"LIBRARY_PATH"))
+ (zero?
+ (system* "./configure"
+ "--disable-nls"
+ "--disable-shared"
+ "--disable-werror"
+ "--build=i686-unknown-linux-gnu"
+ "--host=i686-unknown-linux-gnu"
+ "--with-sysroot=/"
+ (string-append "--prefix=" out))))))))))))
+
+(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-public gcc-mesboot
+ (package-with-bootstrap-guile
+ (package
+ (inherit gcc-mesboot0)
+ (name "gcc-mesboot")
+ (version "4.7.4")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnu/gcc/gcc-4.7.4/gcc-"
+ version
+ ".tar.gz"))
+ (patches (search-patches "gcc-boot-4.7.4.patch"))
+ (sha256
+ (base32
+ "06bqygv17f71f7g7pi7ddvhljcr8dimrypgiif9g1r6lqn1sbfnx"))))
+ (inputs `(("gmp-source" ,(package-source gmp-boot))
+ ("mpfr-source" ,(package-source mpfr-boot))
+ ("mpc-source" ,(package-source mpc))))
+ (propagated-inputs '())
+ (native-inputs `(("binutils" ,binutils-mesboot)
+ ("gcc" ,gcc-mesboot0)
+ ("libc" ,glibc-mesboot)
+
+ ("coreutils" ,%bootstrap-coreutils&co)
+ ("diffutils" ,%bootstrap-diffutils)
+ ("kernel-headers" ,%bootstrap-linux-libre-headers)
+ ("make" ,%bootstrap-make)))
+ (arguments
+ `(#:implicit-inputs? #f
+ #:guile ,%bootstrap-guile
+ #:tests? #f
+ #:parallel-build? #f
+ #:strip-binaries? #f
+ #:configure-flags
+ (let ((out (assoc-ref %outputs "out"))
+ (glibc (assoc-ref %build-inputs "libc")))
+ (list "--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")
+ (string-append "--prefix=" out)
+
+ "--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-shared"
+ "--disable-threads"
+ "--enable-languages=c"
+
+ "--enable-static"
+ "--enable-threads=single"
+
+ ;; libstdc++ cannot be built at this stage
+ ;; ("Link tests are not allowed after
+ ;; GCC_NO_EXECUTABLES.").
+ '"--disable-libstdc__-v3"
+
+ ;; No pre-compiled libstdc++ headers, to save space.
+ "--disable-libstdcxx-pch"
+
+ ;; for libcpp ...
+ "--disable-build-with-cxx"))
+
+ #:phases
+ (modify-phases %standard-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 (zero? (system* "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)))))
+
+ (add-before 'configure 'setenv
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (binutils (assoc-ref %build-inputs "binutils"))
+ (gcc (assoc-ref %build-inputs "gcc"))
+ (glibc (assoc-ref %build-inputs "libc"))
+ (headers (assoc-ref %build-inputs "kernel-headers")))
+
+ (setenv "CPP" (string-append "gcc -E"))
+ (setenv "AR" "ar")
+ (setenv "RANLIB" "true")
+ (setenv "PATH"
+ (string-append
+ (assoc-ref %build-inputs "binutils") "/bin"
+ ":" (assoc-ref %build-inputs "gcc") "/bin"
+
+ ;; more bootstrap cheats
+ ":" (assoc-ref %build-inputs "coreutils") "/bin"
+ ":" (assoc-ref %build-inputs "diffutils") "/bin"
+ ":" (assoc-ref %build-inputs "make") "/bin"))
+
+ (format (current-error-port) "PATH=~a\n" (getenv "PATH"))
+ (setenv "CONFIG_SHELL" (string-append
+ (assoc-ref %build-inputs "coreutils")
+ "/bin/sh"))
+ (setenv "C_INCLUDE_PATH" (string-append
+ gcc
"/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include"
+ ":" 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")))))
+
+ (replace 'configure
+ (lambda* (#:key configure-flags #:allow-other-keys)
+ (mkdir-p "build")
+ (chdir "build")
+ (format (current-error-port) "running: ../build/configure ~a\n"
(string-join configure-flags))
+ (zero?
+ (apply system* "../configure" configure-flags))))))))))
+
+(define-public 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"))
+ (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")
+ (zero?
+ (system* "./configure"
+ (string-append "--prefix=" out))))))))))))
+
+(define %bootstrap-inputs+toolchain
+ (append (match (%current-system)
+ ("i686-linux" `(("libc" ,glibc-mesboot)
+ ("binutils" ,binutils-mesboot)
+ ("gcc" ,gcc-mesboot)))
+ (_ '()))
+ %bootstrap-inputs))
+
+(define-public gnu-make-boot0
+ (package-with-bootstrap-guile
+ (package
+ (inherit gnu-make)
(name "make-boot0")
(arguments
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
- #:tests? #f ; cannot run "make check"
+ #:tests? #f ; cannot run "make check"
,@(substitute-keyword-arguments (package-arguments gnu-make)
((#:phases phases)
`(modify-phases ,phases
@@ -99,14 +1248,14 @@
(bin (string-append out "/bin")))
(install-file "make" bin)
#t))))))))
- (native-inputs '()) ; no need for 'pkg-config'
- (inputs %bootstrap-inputs))))
+ (native-inputs '()) ; no need for 'pkg-config'
+ (inputs %bootstrap-inputs+toolchain))))
(define diffutils-boot0
(package-with-bootstrap-guile
(let ((p (package-with-explicit-inputs diffutils
`(("make" ,gnu-make-boot0)
- ,@%bootstrap-inputs)
+ ,@%bootstrap-inputs+toolchain)
#:guile %bootstrap-guile)))
(package (inherit p)
(name "diffutils-boot0")
@@ -120,7 +1269,7 @@
(name "findutils-boot0"))
`(("make" ,gnu-make-boot0)
("diffutils" ,diffutils-boot0) ; for tests
- ,@%bootstrap-inputs)
+ ,@%bootstrap-inputs+toolchain)
(current-source-location)
#:guile %bootstrap-guile)))
@@ -130,7 +1279,7 @@
(inherit file)
(name "file-boot0"))
`(("make" ,gnu-make-boot0)
- ,@%bootstrap-inputs)
+ ,@%bootstrap-inputs+toolchain)
(current-source-location)
#:guile %bootstrap-guile)))
@@ -140,7 +1289,7 @@
("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
diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm
index ddddd4b..e691ed4 100644
--- a/gnu/packages/mes.scm
+++ b/gnu/packages/mes.scm
@@ -22,14 +22,12 @@
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages bootstrap)
- #:use-module (gnu packages commencement)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages flex)
#:use-module (gnu packages gcc)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages guile)
#:use-module (gnu packages m4)
- #:use-module (gnu packages make-bootstrap)
#:use-module (gnu packages man)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages package-management)
@@ -44,8 +42,6 @@
#:use-module (guix utils)
#:use-module (guix gexp))
-(define %fake-bootstrap? #t) ; cheat using Guile instead of Mes for speed-up?
-
(define-public stage0-boot
(let ((version "0.0.8")
(revision "0")
@@ -63,7 +59,7 @@
(base32
"0svmdz4ayv1lcqm49n4wn6wcfa7msvrjqg2h50hpx1kywg0rwqdr"))))
(native-inputs
- `(("static-bash" ,@(assoc-ref %bootstrap-inputs "bash"))
+ `(("static-bash" ,@(assoc-ref (@ (gnu packages bootstrap)
%bootstrap-inputs) "bash"))
("bash" ,(search-bootstrap-binary "bash" (%current-system)))
("tar" ,(search-bootstrap-binary "tar" (%current-system)))
("xz" ,(search-bootstrap-binary "xz" (%current-system)))
@@ -117,1103 +113,6 @@ with a Knight VM that runs Forth and Lisp.")
(home-page "https://savannah.nongnu.org/projects/stage0/")
(license gpl3+))))
-(define-public mescc-tools-boot
- (let ((version "0.4")
- (revision "1")
- (commit "f02b8f4fda8d0c5c11a1d63a02b2bfdfab55abc5"))
- (package-with-bootstrap-guile
- (package
- (name "mescc-tools-boot")
- (version (string-append version "-" revision "." (string-take commit
7)))
- (synopsis "Tools for the full source bootstrapping process")
- (source (origin
- (method url-fetch)
- (uri (string-append "https://gitlab.com/janneke/mescc-tools"
- "/-/archive/" commit
- "/mescc-tools-" commit ".tar.gz"))
- (file-name (string-append name "-" version ".tar.gz"))
- (sha256
- (base32
- "14xw954ad4lnnyflgnwvzfhd3kqimniilzzyf4x23vljky2npkbf"))))
- (native-inputs
- `(("coreutils" , %bootstrap-coreutils&co)
- ("mescc-tools-seed" ,%mescc-tools-seed)
- ("mes-source" ,(package-source mes-boot))
- ("mes-seed" ,%mes-seed)))
- (supported-systems '("i686-linux" "x86_64-linux"))
- (build-system gnu-build-system)
- (arguments
- `(#: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"))
- (mescc-tools-seed (assoc-ref %build-inputs
"mescc-tools-seed"))
- (mes-seed (assoc-ref %build-inputs "mes-seed"))
- (mes-source (assoc-ref %build-inputs "mes-source"))
- (out (assoc-ref %outputs "out")))
- (setenv "PATH" (string-append coreutils "/bin"))
- (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
- (with-directory-excursion ".."
- (and
- (mkdir-p "mescc-tools-seed")
- (zero? (system* "tar" "--strip=1" "-C" "mescc-tools-seed"
- "-xvf" mescc-tools-seed))
- (mkdir-p "mes-source")
- (zero? (system* "tar" "--strip=1" "-C" "mes-source"
- "-xvf" mes-source))
- (mkdir-p "mes-seed")
- (zero? (system* "tar" "--strip=1" "-C" "mes-seed"
- "-xvf" mes-seed)))))))
- (replace 'configure
- (lambda* (#:key outputs #:allow-other-keys)
- ;;(use-modules (guix build utils))
- (let ((coreutils (assoc-ref %build-inputs "coreutils"))
- (out (assoc-ref %outputs "out")))
- (setenv "PATH" (string-append coreutils "/bin"
- ":" "../mescc-tools-seed"))
- (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
- (setenv "PREFIX" out)
- (setenv "MES_PREFIX" "../mes-source")
- (setenv "MESCC_TOOLS_SEED" "../mescc-tools-seed")
- (setenv "MES_SEED" "../mes-seed"))))
- (replace 'build
- (lambda* (#:key outputs #:allow-other-keys)
- (zero? (system* "sh" "build.sh"))))
- (replace 'check
- (lambda* (#:key outputs #:allow-other-keys)
- (zero? (system* "sh" "check.sh"))))
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (zero? (system* "sh" "install.sh")))))))
- (description
- "Mescc-tools is a collection of tools for use in a full source
-bootstrapping process. Currently consists of the M1 macro assembler and the
-hex2 linker.")
- (home-page "https://github.com/oriansj/mescc-tools")
- (license gpl3+)))))
-
-(define-public mes-boot
- (let ((version "0.17")
- (revision "0")
- (commit #f))
- (package-with-bootstrap-guile
- (package
- (name "mes-boot")
- (version (if commit (string-append version "-" revision "."
(string-take commit 7))
- version))
- (synopsis "Scheme interpreter and C compiler for full source
bootstrapping")
- (source (if commit
- (origin
- (method url-fetch)
- (uri (string-append "https://gitlab.com/janneke/mes"
- "/-/archive/" commit
- "/mes-" commit ".tar.gz"))
- (sha256
- (base32
-
"02nakd20pnpgc1fq23r76ys23h150lg4fwjv5sqzza5dn66s60a6")))
- (origin
- (method url-fetch)
- (uri (string-append "http://alpha.gnu.org/gnu/mes/"
- "mes-" version ".tar.gz"))
- (sha256
- (base32
-
"1j32x4zqy2cqjlg9m35f2411mwac2b0p5ch4hm99gddmfbxzgyhg")))))
- (build-system gnu-build-system)
- (supported-systems '("i686-linux" "x86_64-linux"))
- (native-inputs
- `(("coreutils" , %bootstrap-coreutils&co)
- ("mescc-tools" ,mescc-tools-boot)
- ("nyacc-source" ,(package-source nyacc-boot))
- ("mes-seed" ,%mes-seed)
- ,@(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
- `(#: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"))
- (mes-seed (assoc-ref %build-inputs "mes-seed")))
- (setenv "PATH" (string-append
- coreutils "/bin"))
- (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
- (with-directory-excursion ".."
- (and
- (mkdir-p "nyacc-source")
- (zero? (system* "tar" "--strip=1" "-C" "nyacc-source"
"-xvf" nyacc-source))
- (mkdir-p "mes-seed")
- (zero? (system* "tar" "--strip=1" "-C" "mes-seed" "-xvf"
mes-seed))
- (or (not srfi-43)
- (and (mkdir-p "srfi")
- (zero? (system* "cp" srfi-43
"srfi/srfi-43.scm")))))))))
- (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"))
- (mescc-tools (assoc-ref %build-inputs "mescc-tools"))
- (srfi-43 (assoc-ref %build-inputs "srfi-43")))
- (setenv "PATH" (string-append
- coreutils "/bin"
- (if guile (string-append ":" guile "/bin")
"")
- ":" mescc-tools "/bin"))
- (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
- (setenv "SHELL" (string-append coreutils "/bin/bash"))
- (setenv "srcdir" ".")
- (zero? (system* "bash" "-x" "configure.sh"
- (string-append "--prefix=" out)))
- (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 (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"))
- (begin ; True bootstrap build Mes+Nyacc+MesCC
- (symlink (string-append "../nyacc-source/module")
"nyacc")
- (setenv "GUILE_LOAD_PATH" "nyacc")
- (setenv "MES" "src/mes")))
- (setenv "GUILE_TOOLS" "true") ; no tools in bootstrap-guile
- (setenv "MESCC" "scripts/mescc")
- (setenv "MES_MODULEDIR" "module"))))
- (replace 'build
- (lambda* (#:key outputs #:allow-other-keys)
- (zero? (system* "sh" "build.sh"))))
- (replace 'check
- (lambda* (#:key outputs #:allow-other-keys)
- (or ,%fake-bootstrap? ; check takes ~15min, skip when faking
- (and
- (setenv "MES_ARENA" "100000000")
- (setenv "DIFF" "sh scripts/diff.scm")
- (zero? (system* "sh" "-x" "build-aux/test.sh"
"scaffold/tests/t"))
- (zero? (system* "sh" "-x" "build-aux/test.sh"
"scaffold/tests/63-struct-cell"))
- (zero? (system* "sh" "-x" "check.sh"))))))
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (zero? (system* "sh" "install.sh")))))))
- (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.")
- (home-page "https://gnu.org/software/mes")
- (license gpl3+)))))
-
-(define-public nyacc-boot
- (let ((version "0.80.42")
- (revision "0")
- (commit "2839661e344c1c709579e690063bc6a74adfb914"))
- (package
- (name "nyacc")
- (version (string-append version "-" revision "." (string-take commit 7)))
- (source (origin
- (method url-fetch)
- (uri (string-append "https://gitlab.com/janneke/nyacc"
- "/-/archive/" commit
- "/nyacc-" commit ".tar.gz"))
- (sha256
- (base32
- "0dlcqmchhl57nh7f0v6qb1kkbi7zbs3b185hcqv57fhb60b7rgcq"))))
- (build-system gnu-build-system)
- (native-inputs
- `(("guile" ,guile-2.2)))
- (synopsis "LALR(1) Parser Generator in Guile")
- (description
- "NYACC is an LALR(1) parser generator implemented in Guile.
-The syntax and nomenclature should be considered not stable. It comes with
-extensive examples, including parsers for the Javascript and C99 languages.")
- (home-page "https://savannah.nongnu.org/projects/nyacc")
- (license (list gpl3+ lgpl3+)))))
-
-(define-public tcc-boot0
- (let ((version "0.9.26")
- (revision "2")
- (commit "1f518eab9a5409006b356a5395bba35ea13d0140"))
- (package-with-bootstrap-guile
- (package
- (name "tcc-boot0")
- (version (string-append version "-" revision "." (string-take commit
7)))
- (synopsis "Tiny and fast C compiler")
- (source (origin
- (method url-fetch)
- (uri (string-append "https://gitlab.com/janneke/tinycc"
- "/-/archive/" commit
- "/tinycc-" commit ".tar.gz"))
- (sha256
- (base32
- "0jkv9shhn5s4zqsvnjwwp2np2wg5v8ypsj5s4hb8yr1cjqqv2z9s"))))
- (build-system gnu-build-system)
- (supported-systems '("i686-linux" "x86_64-linux"))
- (native-inputs
- `(("coreutils" , %bootstrap-coreutils&co)
- ("mes" ,mes-boot)
- ("mes-seed" ,%mes-seed)
- ("mescc-tools" ,mescc-tools-boot)
- ("nyacc-source" ,(package-source nyacc-boot))
- ("tinycc-seed" ,%tinycc-seed)
- ,@(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
- `(#: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"))
- (mes-seed (assoc-ref %build-inputs "mes-seed"))
- (tinycc-seed (assoc-ref %build-inputs "tinycc-seed")))
- (setenv "PATH" (string-append
- coreutils "/bin"))
- (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
- (with-directory-excursion ".."
- (and
- (mkdir-p "nyacc-source")
- (zero? (system* "tar" "--strip=1" "-C" "nyacc-source"
- "-xvf" nyacc-source))
- (mkdir-p "mes-seed")
- (zero? (system* "tar" "--strip=1" "-C" "mes-seed"
- "-xvf" mes-seed))
- (mkdir-p "tinycc-seed")
- (zero? (system* "tar" "--strip=1" "-C" "tinycc-seed"
- "-xvf" tinycc-seed))
- (or (not srfi-43)
- (and (mkdir-p "srfi")
- (zero? (system* "cp" srfi-43
"srfi/srfi-43.scm")))))))))
- (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
- (string-append libc
,(glibc-dynamic-linker))
- (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_DEBUG" "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")))
- (and
- (zero? (system* "sh" "configure"
- "--prefix=$PREFIX"
- (string-append "--elfinterp=" interpreter)
- "--crtprefix=."
- "--tccdir=."))))))
- (replace 'build
- (lambda* (#:key outputs #:allow-other-keys)
- (zero? (system* "sh" "build.sh"))))
- (replace 'check
- (lambda* (#:key outputs #:allow-other-keys)
- (setenv "DIFF" "diff.scm")
- ;; fail fast tests
- ;;(zero? (system* "sh" "test.sh"
"mes/scaffold/tests/30-strlen"))
- ;;(zero? (system* "sh" "-x" "test.sh"
"mes/scaffold/tinycc/00_assignment"))
- (setenv "TCC" "./tcc")
- (zero? (system* "sh" "check.sh"))))
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (zero? (system* "sh" "install.sh")))))))
- (description
- "TCC, also referred to as \"TinyCC\", is a small and fast C compiler
-written in C. It supports ANSI C with GNU and extensions and most of the C99
-standard.")
- (home-page "http://www.tinycc.org/")
- (license lgpl2.1+)))))
-
-(define-public tcc-boot
- (package-with-bootstrap-guile
- (package
- (inherit tcc-boot0)
- (name "tcc-boot")
- (version "0.9.27")
- (source (origin
- (method url-fetch)
- (uri (string-append "mirror://savannah/tinycc/tcc-"
- version ".tar.bz2"))
- (patches (search-patches "tcc-boot-0.9.27.patch"))
- (sha256
- (base32
- "177bdhwzrnqgyrdv1dwvpd04fcxj68s5pm1dzwny6359ziway8yy"))))
- (build-system gnu-build-system)
- (supported-systems '("i686-linux" "x86_64-linux"))
- (native-inputs
- `(("coreutils" , %bootstrap-coreutils&co)
- ("mes" ,mes-boot)
- ("tcc" ,tcc-boot0)))
- (arguments
- `(#: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
- (string-append libc
,(glibc-dynamic-linker))
- (string-append mes "/lib/mes-loader"))))
- ;; unpack
- (setenv "PATH" (string-append
- coreutils "/bin"
- ":" tcc "/bin"))
- (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
- (zero? (system* "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
- (string-append libc
,(glibc-dynamic-linker))
- (string-append mes "/lib/mes-loader"))))
- (zero? (system* "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\"")
- "-I" (string-append tcc "/out")
- "-L" (string-append tcc "/lib")
- "-o" "tcc"
- "tcc.c")))))
- (replace 'check
- (lambda* (#:key outputs #:allow-other-keys)
- ;; 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"))
- (zero? (system* "tcc" "-D" "TCC_TARGET_I386=1" "-c" "-o"
"libtcc1.o" "lib/libtcc1.c"))
- (zero? (system* "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"))))))))))))
-
-(define-public 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"))
- (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")
- (zero?
- (system* "./configure"
- (string-append "--prefix=" out))))))))))))
-
-(define-public binutils-mesboot0
- (package-with-bootstrap-guile
- (let ((p (package-with-explicit-inputs
- binutils
- `(("bootstrap-coreutils" ,%bootstrap-coreutils&co)
- ("make" ,(@@ (gnu packages commencement) gnu-make-boot0))
- ("mes" ,mes-boot)
- ("tcc" ,tcc-boot))
- #:guile %bootstrap-guile)))
- (package
- (inherit p)
- (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"))))
- (native-inputs '())
- (supported-systems '("i686-linux"))
- (arguments
- `(#:tests? #f ; runtest: command not found
- #:parallel-build? #f
- #:strip-binaries? #f
- #:make-flags '("AR=tcc -ar" "RANLIB=true")
- #:phases
- (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (cppflags (string-append
- " -D __STDC__=1 "
- " -D __GLIBC_MINOR__=6"
- " -D MES_BOOTSTRAP=1")))
- ;; who sets these?
- (unsetenv "C_INCLUDE_PATH")
- (unsetenv "CPLUS_INCLUDE_PATH")
- (unsetenv "CPATH")
- (unsetenv "LIBRARY_PATH")
- (setenv "PATH"
- (string-append
- (assoc-ref %build-inputs "bootstrap-coreutils")
"/bin"
- ":" (assoc-ref %build-inputs "make") "/bin"
- ":" (assoc-ref %build-inputs "tcc") "/bin"))
-
- (format (current-error-port) "PATH=~a\n" (getenv "PATH"))
- (setenv "CONFIG_SHELL" (string-append
- (assoc-ref %build-inputs
"bootstrap-coreutils")
- "/bin/sh"))
- (format (current-error-port) "CONFIG_SHELL=~a\n" (getenv
"CONFIG_SHELL"))
- (setenv "CPPFLAGS" cppflags)
- (setenv "AR" "tcc -ar")
- (setenv "CXX" "false")
- (setenv "RANLIB" "true")
- (setenv "CC" (string-append "tcc -static" " " cppflags))
- (setenv "LD" (string-append "tcc -static" " " cppflags))
- (setenv "CC_FOR_BUILD" (string-append "tcc -static" " "
cppflags))
- (setenv "CPP" (string-append "tcc -E" " " cppflags))
- (setenv "CC_FOR_BUILD" (string-append "tcc -static" " "
cppflags))
- (setenv "OBJC" (string-append "tcc -static" " " cppflags))
- (and
- (zero?
- (system* "./configure"
- "--disable-nls"
- "--disable-shared"
- "--disable-werror"
- "--build=i686-unknown-linux-gnu"
- "--host=i686-unknown-linux-gnu"
- "--with-sysroot=/"
- (string-append "--prefix=" out))))))))))))))
-
-(define-public gcc-core-mesboot
- (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-core-boot-2.95.3.patch"))
- (sha256
- (base32
- "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an"))))
- (supported-systems '("i686-linux"))
- (inputs '())
- (native-inputs `(("bootstrap-coreutils" ,%bootstrap-coreutils&co)
- ("binutils" ,binutils-mesboot0)
- ("diffutils-boot0" ,(@@ (gnu packages commencement)
diffutils-boot0))
- ("make-boot0" ,(@@ (gnu packages commencement)
gnu-make-boot0))
- ("tcc" ,tcc-boot)))
- (outputs '("out"))
- (arguments
- `(#:tests? #f
- #:parallel-build? #f
- #:strip-binaries? #f
- #: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
- (replace 'configure
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (tcc (assoc-ref %build-inputs "tcc"))
- (cppflags (string-append
- " -D __STDC__=1"
- " -D __GLIBC_MINOR__=6")))
- (setenv "PATH"
- (string-append
- (assoc-ref %build-inputs "binutils") "/bin"
- ":" (assoc-ref %build-inputs "tcc") "/bin"
-
- ":" (assoc-ref %build-inputs "bootstrap-coreutils")
"/bin"
- ":" (assoc-ref %build-inputs "diffutils-boot0") "/bin"
- ":" (assoc-ref %build-inputs "make-boot0") "/bin"))
-
- ;; no info at this stage
- (delete-file-recursively "texinfo")
- (system "touch gcc/cpp.info gcc/gcc.info")
-
- (setenv "CONFIG_SHELL" (string-append
- (assoc-ref %build-inputs
"bootstrap-coreutils")
- "/bin/sh"))
- (unsetenv "LANG")
- (unsetenv "C_INCLUDE_PATH") ; flex
- (unsetenv "LIBRARY_PATH")
- (setenv "CPPFLAGS" cppflags)
- (setenv "C_INCLUDE_PATH" (string-append tcc "/include"))
- (setenv "CC" (string-append "tcc -static" " " cppflags))
- (setenv "CC_FOR_BUILD" (string-append "tcc -static" " "
cppflags))
- (setenv "CPP" (string-append "tcc -E" " " cppflags))
-
- (format (current-error-port) "PATH=~a\n" (getenv "PATH"))
- (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv
"C_INCLUDE_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)'
-")))
- (and
- (zero?
- (system* "./configure"
- "--disable-shared"
- "--enable-static"
- "--build=i686-unknown-linux-gnu"
- "--host=i686-unknown-linux-gnu"
- (string-append "--prefix=" out)))))))
- (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"))
- (zero? (system* "ar" "r" (string-append gcc-dir "/libc.a")
- (string-append tcc-lib "/libc+gnu.o")
- (string-append tcc-lib "/libtcc1.o")))
- (zero? (system* "ar" "r" (string-append out "/lib/libc.a")
- (string-append tcc-lib "/libc+gnu.o")
- (string-append tcc-lib "/libtcc1.o")))
- (system* "ls" "-ltrF" gcc-dir)
- (copy-recursively (string-append tcc "/include")
- (string-append out "/include"))))))))))))
-
-(define-public glibc-mesboot
- (package-with-bootstrap-guile
- (package
- (inherit glibc)
- (name "glibc-mesboot")
- (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"))
- (inputs '())
- (native-inputs `(("binutils" ,binutils-mesboot0)
- ("gcc" ,gcc-core-mesboot)
-
- ("bootstrap-coreutils" ,%bootstrap-coreutils&co)
- ("diffutils-boot0" ,(@@ (gnu packages commencement)
diffutils-boot0))
- ("kernel-headers" ,(linux-libre-headers-boot0))
- ("make-boot0" ,(@@ (gnu packages commencement)
gnu-make-boot0))))
- (outputs '("out"))
- (arguments
- `(#:tests? #f
- #:strip-binaries? #f
- #:parallel-build? #f ; gcc-2.95.3 ICEs on massively parallel builds
- #:configure-flags
- (let ((out (assoc-ref %outputs "out"))
- (headers (assoc-ref %build-inputs "kernel-headers")))
- #:configure-flags
- (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"))
- (headers (assoc-ref %build-inputs "kernel-headers"))
- (gcc (assoc-ref %build-inputs "gcc"))
- (cppflags (string-append
- " -D __STDC__=1"
- " -D MES_BOOTSTRAP=1"
- " -D BOOTSTRAP_GLIBC=1"))
- (cflags (string-append " -L " (getcwd))))
- (setenv "CONFIG_SHELL" (string-append
- (assoc-ref %build-inputs
"bootstrap-coreutils")
- "/bin/sh"))
-
- (setenv "PATH"
- (string-append
- (assoc-ref %build-inputs "bootstrap-coreutils") "/bin"
- ":" (assoc-ref %build-inputs "binutils") "/bin"
- ":" (assoc-ref %build-inputs "gcc") "/bin"
- ":" (assoc-ref %build-inputs "diffutils-boot0") "/bin"
- ":" (assoc-ref %build-inputs "make-boot0") "/bin"))
-
- (setenv "CPP" (string-append gcc "/bin/gcc -E " cppflags))
- (setenv "CC" (string-append gcc "/bin/gcc " cppflags cflags))
- (unsetenv "C_INCLUDE_PATH")
- (unsetenv "LIBRARY_PATH"))))
- ;; glibc-2.2.5 needs a slightly more classical 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)
- (zero?
- (apply system* "./configure" configure-flags))))))))))
-
-(define-public gcc-mesboot0
- (package-with-bootstrap-guile
- (package
- (inherit gcc-core-mesboot)
- (name "gcc-mesboot0")
- (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"))
- (inputs '())
- (native-inputs `(("binutils" ,binutils-mesboot0)
- ("gcc" ,gcc-core-mesboot)
- ("glibc" ,glibc-mesboot)
-
- ("bootstrap-coreutils" ,%bootstrap-coreutils&co)
- ("diffutils-boot0" ,(@@ (gnu packages commencement)
diffutils-boot0))
- ("make-boot0" ,(@@ (gnu packages commencement)
gnu-make-boot0))
- ("kernel-headers" ,(linux-libre-headers-boot0))))
- (outputs '("out"))
- (arguments
- `(#:tests? #f ; runtest: command not found
- #:parallel-build? #f
- #:strip-binaries? #f
- #:make-flags (list "RANLIB=true"
- (string-append "LIBGCC2_INCLUDES=-I "
- (assoc-ref %build-inputs "gcc")
- "/include")
- "LANGUAGES=c")
- #:modules ((guix build gnu-build-system)
- (guix build utils)
- (srfi srfi-1))
- #:phases
- (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (binutils (assoc-ref %build-inputs "binutils"))
- (gcc (assoc-ref %build-inputs "gcc"))
- (glibc (assoc-ref %build-inputs "glibc"))
- (headers (assoc-ref %build-inputs "kernel-headers")))
- (when #t ;; no info
- (delete-file-recursively "texinfo")
- (system "touch gcc/cpp.info gcc/gcc.info"))
-
- (setenv "PATH"
- (string-append
- (assoc-ref %build-inputs "binutils") "/bin"
- ":" (assoc-ref %build-inputs "gcc") "/bin"
-
- ;; more bootstrap cheats
- ":" (assoc-ref %build-inputs "bootstrap-coreutils")
"/bin"
- ":" (assoc-ref %build-inputs "diffutils-boot0") "/bin"
- ":" (assoc-ref %build-inputs "make-boot0") "/bin"))
-
- (format (current-error-port) "PATH=~a\n" (getenv "PATH"))
- (setenv "CONFIG_SHELL" (string-append
- (assoc-ref %build-inputs
"bootstrap-coreutils")
- "/bin/sh"))
- (setenv "C_INCLUDE_PATH" (string-append
- ;;gcc "/include" this is MES
- ;;":/"
- gcc
"/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include"
- ":" headers "/include"
- ":" glibc "/include"))
- (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"))
-
- (setenv "CC" "gcc")
- (setenv "LD" "gcc")
- (setenv "CPP" "gcc -E")
- (setenv "RANLIB" "true")
-
- (with-output-to-file "config.cache"
- (lambda _
- (display "
-ac_cv_c_float_format='IEEE (little-endian)'
-")))
- (and
- (zero?
- (system* "./configure"
- "--disable-shared"
- "--build=i686-unknown-linux-gnu"
- "--host=i686-unknown-linux-gnu"
- (string-append "--prefix=" out)))))))
- (add-after 'install '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"))))))))))))
-
-
-(define-public binutils-mesboot
- (package-with-bootstrap-guile
- (package
- (inherit binutils-mesboot0)
- (name "binutils-mesboot")
- (native-inputs `(("binutils-mesboot" ,binutils-mesboot0)
- ("glibc-mesboot" ,glibc-mesboot)
- ("gcc-mesboot" ,gcc-mesboot0)
-
- ("bootstrap-coreutils" ,%bootstrap-coreutils&co)
- ("diffutils-boot0" ,(@@ (gnu packages commencement)
diffutils-boot0))
- ("kernel-headers" ,(linux-libre-headers-boot0))
- ("make-boot0" ,(@@ (gnu packages commencement)
gnu-make-boot0))))
- (arguments
- `(#:parallel-build? #f
- #:configure-flags '("--enable-deterministic-archives"
- "--disable-nls"
- "--disable-shared"
- "--disable-werror"
- "--build=i686-unknown-linux-gnu"
- "--host=i686-unknown-linux-gnu"
- "--enable-static"
- "--enable-compressed-debug-sections=no"
- "--disable-gold"
- "--disable-plugins"
- "--disable-x86-relax-relocations"
- "--with-system-libz"
- "--with-sysroot=/"
- )
- #:phases
- (modify-phases %standard-phases
- (add-before 'configure 'setenv
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (gcc (assoc-ref %build-inputs "gcc-mesboot"))
- (glibc (assoc-ref %build-inputs "glibc-mesboot"))
- (kernel-headers (assoc-ref %build-inputs
"kernel-headers")))
- (setenv "C_INCLUDE_PATH"
- (string-append glibc "/include"
- ":" kernel-headers "/include"
- ":" gcc "/include"))
- (setenv "LIBRARY_PATH"
- (string-append glibc "/lib"
- ":" gcc "/lib"))
- (setenv "CPP" (string-append "gcc -E"))
- (setenv "AR" "ar")
- (setenv "RANLIB" "true")
- (setenv "PATH"
- (string-append
- (assoc-ref %build-inputs "binutils-mesboot") "/bin"
- ":" (assoc-ref %build-inputs "gcc-mesboot") "/bin"
-
- ;; more bootstrap cheats
- ":" (assoc-ref %build-inputs "bootstrap-coreutils")
"/bin"
- ":" (assoc-ref %build-inputs "diffutils-boot0") "/bin"
- ":" (assoc-ref %build-inputs "make-boot0") "/bin"))
- (format (current-error-port) "PATH=~a\n" (getenv "PATH"))
- (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv
"C_INCLUDE_PATH"))
- (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv
"LIBRARY_PATH")))))))))))
-
-(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-public gcc-mesboot
- (package-with-bootstrap-guile
- (package
- (inherit gcc-mesboot0)
- (name "gcc-mesboot")
- (version "4.7.4")
- (source (origin
- (method url-fetch)
- (uri (string-append "mirror://gnu/gcc/gcc-4.7.4/gcc-"
- version
- ".tar.gz"))
- (patches (search-patches "gcc-boot-4.7.4.patch"))
- (sha256
- (base32
- "06bqygv17f71f7g7pi7ddvhljcr8dimrypgiif9g1r6lqn1sbfnx"))))
- (native-inputs `(("binutils-boot" ,binutils-mesboot)
- ("gcc-boot" ,gcc-mesboot0)
- ("glibc-boot" ,glibc-mesboot)
-
- ("bootstrap-coreutils" ,%bootstrap-coreutils&co)
- ("diffutils-boot0" ,(@@ (gnu packages commencement)
diffutils-boot0))
- ("kernel-headers" ,(linux-libre-headers-boot0))
- ("make-boot0" ,(@@ (gnu packages commencement)
gnu-make-boot0))))
- (inputs `(("gmp-source" ,(package-source gmp-boot))
- ("mpfr-source" ,(package-source mpfr-boot))
- ("mpc-source" ,(package-source mpc))))
- (arguments
- `(#:tests? #f
- #:parallel-build? #f
- #:strip-binaries? #f
- #:configure-flags
- (let ((out (assoc-ref %outputs "out"))
- (glibc (assoc-ref %build-inputs "glibc-boot")))
- (list "--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")
- (string-append "--prefix=" out)
-
- "--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-shared"
- "--disable-threads"
- "--enable-languages=c"
-
- "--enable-static"
- "--enable-threads=single"
-
- ;; libstdc++ cannot be built at this stage
- ;; ("Link tests are not allowed after
- ;; GCC_NO_EXECUTABLES.").
- '"--disable-libstdc__-v3"
-
- ;; No pre-compiled libstdc++ headers, to save space.
- "--disable-libstdcxx-pch"
-
- ;; for libcpp ...
- "--disable-build-with-cxx"))
-
- #:phases
- (modify-phases %standard-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 (zero? (system* "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)))))
-
- (add-before 'configure 'setenv
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (binutils (assoc-ref %build-inputs "binutils-boot"))
- (gcc (assoc-ref %build-inputs "gcc-boot"))
- (glibc (assoc-ref %build-inputs "glibc-boot"))
- (headers (assoc-ref %build-inputs "kernel-headers")))
-
- (setenv "CPP" (string-append "gcc -E"))
- (setenv "AR" "ar")
- (setenv "RANLIB" "true")
- (setenv "PATH"
- (string-append
- (assoc-ref %build-inputs "binutils-boot") "/bin"
- ":" (assoc-ref %build-inputs "gcc-boot") "/bin"
-
- ;; more bootstrap cheats
- ":" (assoc-ref %build-inputs "bootstrap-coreutils")
"/bin"
- ":" (assoc-ref %build-inputs "diffutils-boot0") "/bin"
- ":" (assoc-ref %build-inputs "make-boot0") "/bin"))
-
- (format (current-error-port) "PATH=~a\n" (getenv "PATH"))
- (setenv "CONFIG_SHELL" (string-append
- (assoc-ref %build-inputs
"bootstrap-coreutils")
- "/bin/sh"))
- (setenv "C_INCLUDE_PATH" (string-append
- gcc
"/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include"
- ":" 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")))))
-
- (replace 'configure
- (lambda* (#:key configure-flags #:allow-other-keys)
- (mkdir-p "build")
- (chdir "build")
- (format (current-error-port) "running: ../build/configure ~a\n"
(string-join configure-flags))
- (zero?
- (apply system* "../configure" configure-flags))))))))))
-
;;;
(define-public nyacc
- branch wip-bootstrap created (now 12433be), Jan Nieuwenhuizen, 2018/08/28
- 62/160: gnu: Add binutils-boot 2.5.1., Jan Nieuwenhuizen, 2018/08/28
- 159/160: gcc-mesboot: use package-full-name "-" :-), Jan Nieuwenhuizen, 2018/08/28
- 160/160: gnu: Add mpc-boot 1.0.3., Jan Nieuwenhuizen, 2018/08/28
- 142/160: gnu: Add %linux-libre-headers-stripped, %linux-libre-headers-bootstrap-tarball., Jan Nieuwenhuizen, 2018/08/28
- 145/160: bootstrap: Integrate mes bootstrap for i686-linux.,
Jan Nieuwenhuizen <=
- 158/160: gnu: Add make-mesboot0 3.80, Jan Nieuwenhuizen, 2018/08/28
- 151/160: gnu: Add diffutils-mesboot 2.7., Jan Nieuwenhuizen, 2018/08/28
- 138/160: gnu: Add %make-static, %make-static-stripped, %make-bootstrap-tarball., Jan Nieuwenhuizen, 2018/08/28
- 143/160: gnu: Add %bootstrap-linux-libre-headers., Jan Nieuwenhuizen, 2018/08/28
- 150/160: gnu: Add make-mesboot 3.79., Jan Nieuwenhuizen, 2018/08/28
- 140/160: gnu: Add %diffutils-static, %diffutils-static-stripped, %diffutils-bootstrap-tarball., Jan Nieuwenhuizen, 2018/08/28
- 154/160: Revert "gnu: Add %bootstrap-diffutils.", Jan Nieuwenhuizen, 2018/08/28
- 137/160: gnu: tcc-boot: Use gnu-build-system., Jan Nieuwenhuizen, 2018/08/28
- 148/160: gnu: mes-boot: Update to 0.18. WIP, Jan Nieuwenhuizen, 2018/08/28
- 149/160: gnu: tcc-boot: Update for mes 0.18. WIP, Jan Nieuwenhuizen, 2018/08/28