guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

14/15: bootstrap: tcc-boot0: Scheme-only bootstrap. WIP


From: guix-commits
Subject: 14/15: bootstrap: tcc-boot0: Scheme-only bootstrap. WIP
Date: Thu, 10 Jan 2019 17:31:50 -0500 (EST)

janneke pushed a commit to branch wip-bootstrap
in repository guix.

commit edb6d5bb37b15ac10efe55e86c1663e7eef19df3
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 | 86 ++++++++++++++++++++++++++++++-------------
 1 file changed, 61 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 1916125..d015976 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -216,7 +216,7 @@
              (variable "LIBRARY_PATH")
              (files '("share/mes/lib"))))))))
 
-(define tcc-boot0
+(define-public tcc-boot0
   ;; Pristine tcc cannot be built by MesCC, we are keeping a delta of 11
   ;; patches.  In a very early and rough form they were presented to the
   ;; TinyCC developers, who at the time showed no interest in supporting the
@@ -231,11 +231,19 @@
        (inherit tcc)
        (name "tcc-boot0")
        (version (string-append version "-" revision "." (string-take commit 
7)))
+       ;; (source (origin
+       ;;           (method url-fetch)
+       ;;           (uri (string-append "https://gitlab.com/janneke/tinycc";
+       ;;                               "/-/archive/" commit
+       ;;                               "/tinycc-" commit ".tar.gz"))
+       ;;           (sha256
+       ;;            (base32
+       ;;             
"1hmzn1pq0x22ppd80hyrn5qzqq94mxd0ychzj6vrr2vnj2frjv5b"))))
        (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/tinycc/";
+                       "tinycc-" commit ".tar"))
                  (sha256
                   (base32
                    "1hmzn1pq0x22ppd80hyrn5qzqq94mxd0ychzj6vrr2vnj2frjv5b"))))
@@ -246,9 +254,10 @@
        (native-inputs
         `(("mes" ,mes-boot)
           ("mescc-tools" ,%bootstrap-mescc-tools)
-          ("nyacc-source" ,(package-source nyacc))
+          ("nyacc-source" ,(package-source nyacc-boot))
 
-          ("coreutils" , %bootstrap-coreutils&co)
+          ("guile" ,%bootstrap-guile)
+          ("gash" , %bootstrap-gash)
           ("bootstrap-mes" ,%bootstrap-mes)))
        (arguments
         `(#:implicit-inputs? #f
@@ -256,26 +265,32 @@
           #: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"))
-                       (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)
+                   ;; FIXME: tar --strip broken?
+                     ;; (mkdir-p "nyacc-source")
+                     ;; (invoke "tar" "--strip=1" "-C" "nyacc-source"
+                     ;;         "-xvf" nyacc-source)
+                     (invoke "tar" "-xvf" nyacc-source)
+                     (rename-file "nyacc-0.86.0" "nyacc-source")
                      (symlink (string-append bootstrap-mes "/share/mes/lib") 
"mes-seed")
                      #t)))))
             (replace 'configure
               (lambda* (#:key outputs #:allow-other-keys)
                 (let* ((out (assoc-ref %outputs "out"))
                        (dir (with-directory-excursion ".." (getcwd)))
-                       (coreutils (assoc-ref %build-inputs "coreutils"))
+                       (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"))
@@ -284,7 +299,7 @@
                                         (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"
                                   ":" mescc-tools "/bin"))
                   (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
@@ -298,11 +313,24 @@
                   (setenv "MES_STACK" "10000000")
                   (setenv "MES" "mes")
                   (setenv "GUILE_LOAD_PATH" "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\"
+"))))
+                  )))
             (replace 'build
               (lambda _
                 (substitute* "bootstrap.sh"
@@ -313,12 +341,20 @@
                 (setenv "DIFF" "diff.scm")
                 (setenv "OBJDUMP" "true")
                 ;; fail fast tests
-                ;; (invoke "sh" "test.sh" "mes/scaffold/tests/30-strlen")
-                ;; (invoke "sh" "-x" "test.sh" 
"mes/scaffold/tinycc/00_assignment")
-                (setenv "TCC" "./tcc")
-                (invoke "sh" "check.sh")))
+                (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]