guix-commits
[Top][All Lists]
Advanced

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

16/16: DRAFT commencement: tcc-boot: Support ARM.


From: guix-commits
Subject: 16/16: DRAFT commencement: tcc-boot: Support ARM.
Date: Sun, 20 Dec 2020 05:14:56 -0500 (EST)

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

commit 500e3f72d2cf0cf8de27b52fe843cda1a76bb236
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Sun Dec 13 15:00:06 2020 +0100

    DRAFT commencement: tcc-boot: Support ARM.
    
    * gnu/packages/commencement.scm (tcc-boot)[arguments]: Cater for 
armhf-linux,
    aarch64-linux.
---
 gnu/packages/commencement.scm | 99 ++++++++++++++++++++++++++++---------------
 1 file changed, 66 insertions(+), 33 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 7601d79..1d30acd 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -842,45 +842,73 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
                (("s->alacarte_link = 1;" all)
                 (string-append all "
     s->static_link = 1;")))
+             (substitute* "tccelf.c"
+               (("tcc_add_support\\(s1, TCC_LIBTCC1\\);" all)
+                (string-append all "
+#if CONFIG_TCC_LIBTCC1_MES
+        tcc_add_support(s1, TCC_LIBTCC1_MES);
+#endif
+")))
+
              #t))
          (replace 'configure
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref %outputs "out"))
                     (tcc (assoc-ref %build-inputs "tcc"))
                     (libc (assoc-ref %build-inputs "libc"))
-                    (interpreter "/mes/loader"))
-               (invoke "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")))))
+                    (interpreter "/mes/loader")
+                    (configure-flags
+                     (list "--cc=tcc"
+                           ,@(match (%current-system)
+                               ((or "i686-linux" "x86_64-linux") 
'("--cpu=i386"))
+                               ((or "armhf-linux"  "aarch64-linux") 
'("--cpu=arm")))
+                           (string-append "--prefix=" out)
+                           (string-append "--elfinterp=" interpreter)
+                           (string-append "--crtprefix=" tcc "/lib")
+                           (string-append "--sysincludepaths=" tcc "/include")
+                           (string-append "--libpaths=" tcc "/lib"))))
+               (format (current-error-port)
+                       "running ./configure ~a\n" (string-join 
configure-flags))
+               (apply invoke "sh" "configure" configure-flags))))
          (replace 'build
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref %outputs "out"))
                     (tcc (assoc-ref %build-inputs "tcc"))
                     (libc (assoc-ref %build-inputs "libc"))
-                    (interpreter "/mes/loader"))
-               (invoke
-                "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\"")
-                "-o" "tcc"
-                "tcc.c"))))
+                    (interpreter "/mes/loader")
+                    (cppflags
+                     (list
+                      "-D" "BOOTSTRAP=1"
+                      "-D" "ONE_SOURCE=1"
+                      ,@(match (%current-system)
+                          ((or "i686-linux" "x86_64-linux")
+                           '("-D" "TCC_TARGET_I386=1"))
+                          ((or "armhf-linux"  "aarch64-linux")
+                           '("-D" "TCC_TARGET_ARM=1"
+                             "-D" "TCC_ARM_VFP=1"
+                             "-D" "CONFIG_TCC_LIBTCC1_MES=1")))
+                      "-D" "CONFIG_TCCBOOT=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\"")
+                      "-D" (string-append "TCC_LIBTCC1_MES=\"" tcc 
"/lib/libtcc1-mes.a\"")))
+                    (files ',(match "armhf-linux" ;;(%current-system)
+                               ((or "i686-linux" "x86_64-linux")
+                                '("tcc.c"))
+                               ((or "armhf-linux"  "aarch64-linux")
+                                '("tcc.c" "lib/armflush.c"))))
+                    (arguments (cons* "-vvv" "-o" "tcc"
+                                      (append cppflags files))))
+               (format (current-error-port)
+                       "running tcc ~a\n" (string-join arguments))
+               (apply invoke "tcc" arguments))))
          (replace 'check
            (lambda _
              ;; FIXME: add sensible check target (without depending on make)
@@ -898,11 +926,16 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
                                   (string-append out "/include"))
                 (copy-recursively (string-append tcc "/lib")
                                   (string-append out "/lib"))
-                (invoke "tcc" "-D" "TCC_TARGET_I386=1" "-c" "-o" "libtcc1.o" 
"lib/libtcc1.c")
-                (invoke "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"))
+                ;;(invoke "tcc" "-D" "TCC_TARGET_I386=1" "-c" "-o" "libtcc1.o" 
"lib/libtcc1.c")
+                ;;(invoke "tcc" "-ar" "rc" "libtcc1.a" "libtcc1.o")
+                ;;(copy-file "libtcc1.a" (string-append out "/lib/libtcc1.a"))
+                ;; ,@(match "armhf-linux" ;;(%current-system)
+                ;;     ((or "i686-linux" "x86_64-linux")
+                ;;      '())
+                ;;     ((or "armhf-linux"  "aarch64-linux")
+                ;;      '((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"))
                 #t)))))))))
 
 (define diffutils-mesboot



reply via email to

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