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

commit e172f8d2a2adba5ce0d64ffe6f7a1caba64104c0
Author: Ekaitz Zarraga <eka...@elenq.tech>
AuthorDate: Wed Oct 2 16:02:18 2024 +0300

    gnu: Add tcc-boot-musl.
    
    * gnu/packages/commencement.scm (tcc-boot-musl): New variable.
    
    Co-authored-by: Efraim Flashner <efr...@flashner.co.il>
    Change-Id: Id658d7cd7c7b7b4051bd8418f57797fbbe426117
---
 gnu/packages/commencement.scm | 51 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index f49ff3d5b0..63deae8810 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1004,6 +1004,57 @@ MesCC-Tools), and finally M2-Planet.")
                                                (#t ""))
                                            ".so.1")))))))))))
 
+(define tcc-boot-musl
+  (package
+    (inherit tcc-boot)
+    (name "tcc-boot-musl")
+    (native-inputs `(("libc" ,musl-boot0)
+                     ,@(modify-inputs (package-native-inputs tcc-boot)
+                                      (replace "tcc" tcc-boot))))
+    (arguments
+      (substitute-keyword-arguments (package-arguments tcc-boot)
+        ((#:phases phases)
+         #~(modify-phases #$phases
+             (delete 'rebuild-libraries)
+             (replace 'build
+               (lambda* (#:key outputs inputs #:allow-other-keys)
+                 (let ((out (assoc-ref outputs "out"))
+                       (libc (assoc-ref inputs "libc"))
+                       (tcc (assoc-ref inputs "tcc"))
+                       (interpreter "/musl/loader"))
+                   (invoke
+                    "tcc"
+                    "-g"
+                    "-vvv"
+                    "-I" (string-append tcc "/include")
+                    "-L" (string-append tcc "/lib")
+                    "-D" "ONE_SOURCE=1"
+                    "-D" "TCC_VERSION=\"0.9.28rc\""
+                    "-D" "CONFIG_TCC_STATIC=1"
+                    "-D" "CONFIG_USE_LIBGCC=1"
+                    "-D" "CONFIG_TCC_SEMLOCK=0"
+                    "-D" (string-append "CONFIG_TCCDIR=\"" out "/lib/tcc\"")
+                    "-D" (string-append "CONFIG_TCC_CRTPREFIX=\"" libc 
"/lib\"")
+                    "-D" (string-append "CONFIG_TCC_ELFINTERP=\"" interpreter 
"\"")
+                    "-D" (string-append "CONFIG_TCC_LIBPATHS=\"" libc "/lib:"
+                                                                 out "/lib:"
+                                                                 "{B}/lib:.\"")
+                    "-D" (string-append "CONFIG_TCC_SYSINCLUDEPATHS=\""
+                                        libc "/include:"
+                                        out "/include:"
+                                        "{B}/include\"")
+                    "-D" (string-append "TCC_LIBGCC=\"" libc "/lib/libc.a\"")
+                    "-o" "tcc"
+                    "tcc.c"))))
+             (replace 'install
+               (lambda* (#:key outputs #:allow-other-keys)
+                 (let ((out (assoc-ref outputs "out")))
+                   (install-file "tcc" (string-append out "/bin"))
+                   (copy-recursively "include"
+                                     (string-append out "/include"))
+                   (install-file "libtcc1.a" (string-append out "/lib"))
+                   (install-file "libtcc1.a" (string-append out 
"/lib/tcc")))))))))))
+
 (define binutils-mesboot0
   ;; The initial Binutils
   (package

Reply via email to