guix-commits
[Top][All Lists]
Advanced

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

93/163: gnu: Add tcc-boot 0.9.27.


From: Jan Nieuwenhuizen
Subject: 93/163: gnu: Add tcc-boot 0.9.27.
Date: Thu, 30 Aug 2018 01:03:29 -0400 (EDT)

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

commit cc98215c3f9a7bbfe30207a1b24250ad000d75ce
Author: Jan Nieuwenhuizen <address@hidden>
Date:   Sun Jun 17 23:32:04 2018 +0200

    gnu: Add tcc-boot 0.9.27.
    
    * gnu/packages/mes.scm (tcc-boot0): Rename from tcc-boot.
      (tcc-boot): New package.
    * gnu/packages/patches/tcc-boot-0.9.27.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                               |   1 +
 gnu/packages/mes.scm                       | 101 +++++++++++++++++++++++++++--
 gnu/packages/patches/tcc-boot-0.9.27.patch |  26 ++++++++
 3 files changed, 123 insertions(+), 5 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 262c300..7554e9b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1154,6 +1154,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/t1lib-CVE-2011-1552+.patch              \
   %D%/packages/patches/tar-remove-wholesparse-check.patch      \
   %D%/packages/patches/tar-skip-unreliable-tests.patch         \
+  %D%/packages/patches/tcc-boot-0.9.27.patch                   \
   %D%/packages/patches/tclxml-3.2-install.patch                        \
   %D%/packages/patches/tcsh-fix-autotest.patch                 \
   %D%/packages/patches/tcsh-fix-out-of-bounds-read.patch       \
diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm
index c003989..ffb32c9 100644
--- a/gnu/packages/mes.scm
+++ b/gnu/packages/mes.scm
@@ -374,13 +374,13 @@ 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-boot
+(define-public tcc-boot0
   (let ((version "0.9.26")
-        (revision "0")
-        (commit "97196cebf6c5c79ec87f1ee4875cc8c188333a3c"))
+        (revision "1")
+        (commit "c73a151c4d0878f387de0c87ec77484626a7a888"))
     (package-with-bootstrap-guile
      (package
-       (name "tcc-boot")
+       (name "tcc-boot0")
        (version (string-append version "-" revision "." (string-take commit 
7)))
        (synopsis "Tiny and fast C compiler")
        (source (origin
@@ -390,7 +390,7 @@ extensive examples, including parsers for the Javascript 
and C99 languages.")
                                      "/tinycc-" commit ".tar.gz"))
                  (sha256
                   (base32
-                   "1z156jfnc0dkdb6i9h0nns4hm11c03k3vakw7qhb7651dm8hqxrk"))))
+                   "0sxvdj06a21a4a305k0pz4nb36vrcdjqv9xsb8dm06a8j1iqjkx9"))))
        (build-system trivial-build-system)
        (supported-systems '("i686-linux" "x86_64-linux"))
        (native-inputs
@@ -512,6 +512,97 @@ standard.")
        (home-page "http://www.tinycc.org/";)
        (license lgpl2.1+)))))
 
+(define-public tcc-boot
+  (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 trivial-build-system)
+       (supported-systems '("i686-linux" "x86_64-linux"))
+
+       (native-inputs
+        `(("static-bash" ,@(assoc-ref %bootstrap-inputs "bash"))
+          ("tar" ,(search-bootstrap-binary "tar" (%current-system)))
+          ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
+          ("mes" ,mes-boot)
+          ("tcc" ,tcc-boot0)))
+       (arguments
+        `(#:modules ((guix build utils))
+          #:builder
+          (begin
+            (use-modules (guix build utils))
+            (let* ((bash (assoc-ref %build-inputs "static-bash"))
+                   (tar (assoc-ref %build-inputs "tar"))
+                   (xz (assoc-ref %build-inputs "xz"))
+                   (source (assoc-ref %build-inputs "source"))
+                   (mes (assoc-ref %build-inputs "mes"))
+                   (tcc (assoc-ref %build-inputs "tcc"))
+                   (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"))))
+              ;; unpack
+              (setenv "PATH" (string-append
+                              bash "/bin:"
+                              tar "/bin:"
+                              tcc "/bin:"
+                              xz "/bin"))
+              (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+              (mkdir-p "source")
+              (system* "tar" "--strip=1" "-C" "source" "-xvf" source)
+              (chdir "source")
+
+              ;; configure
+              (and
+               (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")))
+               ;; make
+               (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"))
+               (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-boot
   (package
     (inherit m4)
diff --git a/gnu/packages/patches/tcc-boot-0.9.27.patch 
b/gnu/packages/patches/tcc-boot-0.9.27.patch
new file mode 100644
index 0000000..6f9d365
--- /dev/null
+++ b/gnu/packages/patches/tcc-boot-0.9.27.patch
@@ -0,0 +1,26 @@
+From 1431ba3a99582e4c3d2693ac37e57f361858affd Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <address@hidden>
+Date: Mon, 11 Jun 2018 18:39:44 +0200
+Subject: [PATCH] bootstrappable: Force static link.
+
+---
+ libtcc.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/libtcc.c b/libtcc.c
+index 3448f44..02ab850 100644
+--- a/libtcc.c
++++ b/libtcc.c
+@@ -735,6 +735,9 @@ LIBTCCAPI TCCState *tcc_new(void)
+     tcc_state = s;
+     ++nb_states;
+ 
++#if BOOTSTRAP
++    s->static_link = 1;
++#endif
+     s->alacarte_link = 1;
+     s->nocommon = 1;
+     s->warn_implicit_function_declaration = 1;
+-- 
+2.16.2
+



reply via email to

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