guix-commits
[Top][All Lists]
Advanced

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

136/160: gnu: tcc-boot0: Use gnu-build-system.


From: Jan Nieuwenhuizen
Subject: 136/160: gnu: tcc-boot0: Use gnu-build-system.
Date: Tue, 28 Aug 2018 15:56:38 -0400 (EDT)

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

commit 7f4bca3f646d2d67beec6d0f07c623700f68fa19
Author: Jan Nieuwenhuizen <address@hidden>
Date:   Thu Aug 23 20:38:29 2018 +0200

    gnu: tcc-boot0: Use gnu-build-system.
    
    * gnu/packages/mes.scm (tcc-boot0): Use gnu-build-system.
---
 gnu/packages/mes.scm | 193 ++++++++++++++++++++++++++-------------------------
 1 file changed, 98 insertions(+), 95 deletions(-)

diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm
index 5ca693b..c357d47 100644
--- a/gnu/packages/mes.scm
+++ b/gnu/packages/mes.scm
@@ -360,7 +360,7 @@ extensive examples, including parsers for the Javascript 
and C99 languages.")
                  (sha256
                   (base32
                    "0jkv9shhn5s4zqsvnjwwp2np2wg5v8ypsj5s4hb8yr1cjqqv2z9s"))))
-       (build-system trivial-build-system)
+       (build-system gnu-build-system)
        (supported-systems '("i686-linux" "x86_64-linux"))
        (native-inputs
         `(("coreutils" , %bootstrap-coreutils&co)
@@ -374,106 +374,109 @@ extensive examples, including parsers for the 
Javascript and C99 languages.")
                   ("srfi-43" ,%srfi-43)) ; guile-2.0.9 lacks srfi-43; 
cherry-pick
                 '())))
        (arguments
-        `(#:modules ((guix build utils))
-          #:builder
-          (begin
-            (use-modules (guix build utils))
-            (let* ((coreutils (assoc-ref %build-inputs "coreutils"))
-                   (mes (assoc-ref %build-inputs "mes"))
-                   (guile (assoc-ref %build-inputs "guile"))
-                   (srfi-43 (assoc-ref %build-inputs "srfi-43"))
-                   (mescc-tools (assoc-ref %build-inputs "mescc-tools"))
-                   (source (assoc-ref %build-inputs "source"))
-                   (nyacc-source (assoc-ref %build-inputs "nyacc-source"))
-                   (mes-seed (assoc-ref %build-inputs "mes-seed"))
-                   (tinycc-seed (assoc-ref %build-inputs "tinycc-seed"))
-                   (out (assoc-ref %outputs "out"))
-                   (libc (assoc-ref %build-inputs "libc"))
-                   (interpreter (if libc
-                                    (string-append libc 
,(glibc-dynamic-linker))
-                                    (string-append mes "/lib/mes-loader")))
-                   (dir (getcwd)))
-              ;; unpack
-              (setenv "PATH" (string-append
-                              coreutils "/bin"
-                              ":" mes "/bin"
-                              (if guile (string-append ":" guile "/bin")
-                                  "")
-                              ":" mescc-tools "/bin"))
-              (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
-              (mkdir-p "source")
-              (system* "tar" "--strip=1" "-C" "source" "-xvf" source)
-              (mkdir-p "nyacc-source")
-              (system* "tar" "--strip=1" "-C" "nyacc-source" "-xvf" 
nyacc-source)
-              (mkdir-p "mes-seed")
-              (system* "tar" "--strip=1" "-C" "mes-seed" "-xvf" mes-seed)
-              (mkdir-p "tinycc-seed")
-              (system* "tar" "--strip=1" "-C" "tinycc-seed" "-xvf" tinycc-seed)
-              (when srfi-43
-                (mkdir-p "srfi")
-                (system* "cp" srfi-43 "srfi/srfi-43.scm"))
-              (chdir "source")
-
-              ;; configure
-              (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")))
+        `(#: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"))
 
-              (and
-               (zero? (system* "sh" "configure"
-                               "--prefix=$PREFIX"
-                               (string-append "--elfinterp=" interpreter)
-                               "--crtprefix=."
-                               "--tccdir=."))
+                  (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")
 
-               ;; build
-               ;; (setenv "BUILD_DEBUG" "1")
-               (zero? (system* "sh" "build.sh"))
+                  (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"))
 
-               ;; check
-               (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"))
+                        ;; give auto-compile a home -- massive speed-up
+                        (mkdir-p "/tmp/home")
+                        (setenv "HOME" "/tmp/home"))
 
-               ;; install
-               (zero? (system* "sh" "install.sh")))))))
-       (description
-        "TCC, also referred to as \"TinyCC\", is a small and fast C compiler
+                      (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+)))))
+     (home-page "http://www.tinycc.org/";)
+     (license lgpl2.1+)))))
 
 (define-public tcc-boot
   (package-with-bootstrap-guile



reply via email to

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