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

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

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

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 63deae8810..fda79ac9e3 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1055,6 +1055,46 @@ MesCC-Tools), and finally M2-Planet.")
                    (install-file "libtcc1.a" (string-append out "/lib"))
                    (install-file "libtcc1.a" (string-append out 
"/lib/tcc")))))))))))
 
+(define tcc-musl
+  (package
+    (inherit tcc-boot-musl)
+    (name "tcc-musl")
+    (native-inputs (modify-inputs (package-native-inputs tcc-boot-musl)
+                                  (replace "tcc" tcc-boot-musl)))
+    (arguments
+      (substitute-keyword-arguments (package-arguments tcc-boot-musl)
+        ((#:phases phases)
+         #~(modify-phases #$phases
+             (replace 'build
+               (lambda* (#:key outputs inputs #:allow-other-keys)
+                 (let ((out (assoc-ref outputs "out"))
+                       (libc (assoc-ref inputs "libc"))
+                       (interpreter "/musl/loader"))
+                   (invoke
+                    "tcc"
+                    "-g"
+                    "-vvv"
+                    "-D" "REG_PC=0"
+                    "-D" "REG_S0=8"
+                    "-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"))))))))))
+
 (define binutils-mesboot0
   ;; The initial Binutils
   (package

Reply via email to