[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
12/15: bootstrap: tcc-boot0: Scheme-only bootstrap. WIP
From: |
guix-commits |
Subject: |
12/15: bootstrap: tcc-boot0: Scheme-only bootstrap. WIP |
Date: |
Wed, 5 Dec 2018 16:57:54 -0500 (EST) |
janneke pushed a commit to branch wip-bootstrap
in repository guix.
commit 1a931c617c1e9adf2c545804b6131377a28f2410
Author: Jan Nieuwenhuizen <address@hidden>
Date: Tue Dec 4 23:19:56 2018 +0100
bootstrap: tcc-boot0: Scheme-only bootstrap. WIP
---
gnu/packages/commencement.scm | 139 ++++++++++++++++++++++++++++++------------
1 file changed, 101 insertions(+), 38 deletions(-)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 580d957..3ea9c2e 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -244,7 +244,7 @@
;; mature, this package should use the 0.9.27 sources (or later).
(let ((version "0.9.26")
(revision "5")
- (commit "c7b3f59d1a71e71b470f859b20f0cfe840f3954d"))
+ (commit "9408a31f88dbd8727e99483d7db19ded0ddcfb24"))
(package-with-bootstrap-guile
(package
(inherit tcc)
@@ -252,12 +252,12 @@
(version (string-append version "-" revision "." (string-take commit
7)))
(source (origin
(method url-fetch)
- (uri (string-append "https://gitlab.com/janneke/tinycc"
- "/-/archive/" commit
- "/tinycc-" commit ".tar.gz"))
+ (uri (string-append
+ "http://lilypond.org/janneke/mes/"
+ "tinycc-" commit ".tar"))
(sha256
(base32
- "1agz5w5q6dm51n63hsxii33hxdghmdiacbb5zzxzac3aarfxjb2m"))))
+ "1pf9d2vcdklg2kd3i1bvplh4fc8iagzmwvh8gk2apamyhras2qnw"))))
(build-system gnu-build-system)
(supported-systems '("i686-linux" "x86_64-linux"))
(inputs '())
@@ -267,43 +267,38 @@
("mescc-tools" ,%bootstrap-mescc-tools)
("nyacc-source" ,(package-source nyacc-boot))
- ("coreutils" , %bootstrap-coreutils&co)
- ("bootstrap-mes" ,%bootstrap-mes)
- ,@(if %fake-bootstrap? ; cheat: fast non-bootstrap testing with Guile
- `(("guile" ,%bootstrap-guile)
- ("srfi-43" ,%srfi-43)) ; guile-2.0.9 lacks srfi-43;
cherry-pick
- '())))
+ ("guile" ,%bootstrap-guile)
+ ("gash" , %bootstrap-gash)
+ ("bootstrap-mes" ,%bootstrap-mes)))
(arguments
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
#:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
#:phases
(modify-phases %standard-phases
+ (add-before 'unpack 'setenv
+ (lambda _
+ (let ((gash (assoc-ref %build-inputs "gash")))
+ (setenv "PATH" (string-append gash "/libexec/gash:" (getenv
"PATH")))
+ (format #t "PATH=~s\n" (getenv "PATH"))
+ #t)))
(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"))
+ (let* ((nyacc-source (assoc-ref %build-inputs "nyacc-source"))
(bootstrap-mes (assoc-ref %build-inputs
"bootstrap-mes")))
- (setenv "PATH" (string-append
- coreutils "/bin"))
- (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
(with-directory-excursion ".."
(and
(mkdir-p "nyacc-source")
(invoke "tar" "--strip=1" "-C" "nyacc-source"
"-xvf" nyacc-source)
(symlink (string-append bootstrap-mes "/lib") "mes-seed")
- (or (not srfi-43)
- (and (mkdir-p "srfi")
- (copy-file srfi-43 "srfi/srfi-43.scm")
- #t)))))))
+ #t)))))
(replace 'configure
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref %outputs "out"))
(dir (with-directory-excursion ".." (getcwd)))
- (coreutils (assoc-ref %build-inputs "coreutils"))
(guile (assoc-ref %build-inputs "guile"))
+ (gash (assoc-ref %build-inputs "gash"))
(mes (assoc-ref %build-inputs "mes"))
(mescc-tools (assoc-ref %build-inputs "mescc-tools"))
(libc (assoc-ref %build-inputs "libc"))
@@ -312,16 +307,19 @@
(string-append libc
,(glibc-dynamic-linker "i686-linux"))
(string-append mes
"/lib/mes-loader"))))
(setenv "PATH" (string-append
- coreutils "/bin"
+ gash "/libexec/gash"
":" mes "/bin"
(if guile (string-append ":" guile "/bin")
"")
":" mescc-tools "/bin"))
(setenv "PREFIX" out)
+ (setenv "prefix" out)
(setenv "MESCC" (string-append mes "/bin/mescc"))
(symlink (string-append mes "/share/mes") "mes")
+ ;;(setenv "MES_PREFIX" (string-append mes "/share/mes"))
(setenv "MES_PREFIX" "mes")
+ (setenv "MES_SEED" "../mes-seed")
(setenv "OBJDUMP" "true")
(setenv "ONE_SOURCE" "1")
(setenv "PREPROCESS" "1")
@@ -333,11 +331,12 @@
(setenv "MES" "guile")
(setenv "GUILE_AUTO_COMPILE" "1")
(setenv "GUILE_LOAD_COMPILED_PATH"
- (string-append guile "/lib/guile/2.0/ccache"))
+ (string-append guile "/lib/guile/2.2/ccache"))
(setenv "GUILE_LOAD_PATH"
(string-append dir
- ":" guile "/share/guile/2.0/"
- ":" dir "/nyacc-source/module"
+ ":" guile "/share/guile/2.2/"
+ ;;":" dir "/nyacc-source/module"
+ ":" dir
"/nyacc-source/nyacc-0.86.0/module"
":" mes "/share/mes/guile"))
;; give auto-compile a home -- massive speed-up
@@ -348,24 +347,88 @@
(setenv "MES" "mes")
(setenv "GUILE_LOAD_PATH" "nyacc")
(symlink (string-append "../nyacc-source/module")
"nyacc")))
- (invoke "sh" "configure"
- "--prefix=$PREFIX"
- (string-append "--elfinterp=" interpreter)
- "--crtprefix=."
- "--tccdir=."))))
+
+ ;; (invoke "sh" "configure"
+ ;; "--prefix=$PREFIX"
+ ;; (string-append "--elfinterp=" interpreter)
+ ;; "--crtprefix=."
+ ;; "--tccdir=.")
+
+ (with-output-to-file "config.h"
+ (lambda _
+ (display (string-append "
+#ifndef CONFIG_TCCDIR
+#define CONFIG_TCCDIR \"" out "/lib/tcc\"
+#endif
+#define GCC_MAJOR 0
+#define GCC_MINOR 0
+#define TCC_VERSION \"0.9.26\"
+"))))
+ #t)))
(replace 'build
- (lambda _
- (invoke "sh" "build.sh")))
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref %outputs "out")))
+
+ ;; Show some progress
+ (substitute* "bootstrap.sh"
+ (("^( *)((cp|ls|mkdir|rm|./[$][{PROGRAM_PREFIX[}]tcc)
[^\"]*[^\\])\n" all space cmd)
+ (string-append space "echo \"" cmd "\"\n"
+ space cmd "\n")))
+
+ ;; Show some progress
+ (substitute* "boot.sh"
+ (("^( *)((cp|ls|mkdir|rm|./[$][{PROGRAM_PREFIX[}]tcc)
[^\"]*[^\\])\n" all space cmd)
+ (string-append space "echo \"" cmd "\"\n"
+ space cmd "\n")))
+
+ (setenv "prefix" out)
+ (setenv "V" "1")
+ (format #t "PATH=~a\n" (getenv "PATH"))
+ (format #t "GUILE_LOAD_PATH=~a\n" (getenv "GUILE_LOAD_PATH"))
+ (format #t "GUILE_LOAD_COMPILED_PATH=~a\n" (getenv
"GUILE_LOAD_COMPILED_PATH"))
+ (invoke "gash" "bootstrap.sh")
+
+ ;; Gash does not export; write boot loop here.
+ (format #t "0: boot.sh\n")
+ (setenv "TCC" "./mes-tcc")
+ (invoke "gash" "boot.sh")
+
+ (format #t "1: boot.sh\n")
+ (setenv "TCC" "./boot0-tcc")
+ (invoke "gash" "boot.sh")
+
+ (format #t "2: boot.sh\n")
+ (setenv "TCC" "./boot1-tcc")
+ (invoke "gash" "boot.sh")
+
+ (format #t "3: boot.sh\n")
+ (setenv "TCC" "./boot2-tcc")
+ (invoke "gash" "boot.sh")
+
+ (format #t "4: boot.sh\n")
+ (setenv "TCC" "./boot3-tcc")
+ (invoke "gash" "boot.sh")
+
+ (copy-file "boot4-tcc" "tcc")
+ #t)))
+
(replace 'check
(lambda _
- (setenv "DIFF" "diff.scm")
;; fail fast tests
- ;; (invoke "sh" "test.sh" "mes/scaffold/tests/30-strlen")
- ;; (invoke "sh" "-x" "test.sh"
"mes/scaffold/tinycc/00_assignment")
- (setenv "TCC" "./tcc")
- (invoke "sh" "check.sh")))
+ (system* "./tcc" "--help") ; --help exits 1
+ ;;(invoke "sh" "test.sh" "mes/scaffold/tests/30-strlen")
+ ;;(invoke "sh" "-x" "test.sh"
"mes/scaffold/tinycc/00_assignment")
+ ;;(invoke "sh" "check.sh")
+ #t))
(replace 'install
(lambda _
+
+ ;; Show some progress
+ (substitute* "install.sh"
+ (("^( *)((cp|ls|mkdir|rm|tar|./[$][{PROGRAM_PREFIX[}]tcc)
[^\"]*[^\\])\n" all space cmd)
+ (string-append space "echo \"" cmd "\"\n"
+ space cmd "\n")))
+
(invoke "sh" "install.sh"))))))
(native-search-paths
;; Use the language-specific variables rather than 'CPATH' because they
- branch wip-bootstrap created (now 830a09c), guix-commits, 2018/12/05
- 01/15: bootstrap: mes-boot: Use mes-boot0 version., guix-commits, 2018/12/05
- 04/15: boot, guix-commits, 2018/12/05
- 05/15: mes-minimal-stripped, guix-commits, 2018/12/05
- 03/15: mes: Update to 0.19. WIP, guix-commits, 2018/12/05
- 06/15: bootstrap-mes: Update., guix-commits, 2018/12/05
- 02/15: bootstrap: Use x86_64-linux bootstrap tarballs for x86_64-linux., guix-commits, 2018/12/05
- 09/15: bootstrap: Update %bootstrap-guile to 2.2., guix-commits, 2018/12/05
- 07/15: gnu: Add gash. WIP, guix-commits, 2018/12/05
- 11/15: bootstrap: mes-boot: Scheme-only bootstrap. WIP, guix-commits, 2018/12/05
- 12/15: bootstrap: tcc-boot0: Scheme-only bootstrap. WIP,
guix-commits <=
- 14/15: pieton: HAK, guix-commits, 2018/12/05
- 10/15: bootstrap: Add %bootstrap-gash. WIP, guix-commits, 2018/12/05
- 08/15: bootstrap: Add %gash-bootstrap-guile, %gash-bootstrap-guile-tarball., guix-commits, 2018/12/05
- 13/15: bootstrap: make-mesboot0: Scheme-only bootstrap. WIP, guix-commits, 2018/12/05
- 15/15: doc: update gcc-mesboot-bag-graph.dot, guix-commits, 2018/12/05