[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
17/26: commencement: tcc-boot: Support ARM.
From: |
guix-commits |
Subject: |
17/26: commencement: tcc-boot: Support ARM. |
Date: |
Mon, 28 Dec 2020 13:58:11 -0500 (EST) |
janneke pushed a commit to branch wip-arm-bootstrap
in repository guix.
commit f2f060fb34ebfd79bd6f7491911dc176080e3460
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Sun Dec 13 15:00:06 2020 +0100
commencement: tcc-boot: Support ARM.
* gnu/packages/commencement.scm (tcc-boot)[arguments]: Cater for
armhf-linux,
aarch64-linux.
[supported-systems]: Add aarch64-linux, armhf-linux.
---
gnu/packages/commencement.scm | 102 ++++++++++++++++++++++++++++--------------
1 file changed, 69 insertions(+), 33 deletions(-)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index ea8169e..704f4f7 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -855,6 +855,8 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
;; `patches' needs XZ
;; (patches (search-patches "tcc-boot-0.9.27.patch"))
))
+ (supported-systems '("armhf-linux" "aarch64-linux"
+ "i686-linux" "x86_64-linux"))
(build-system gnu-build-system)
(inputs '())
(propagated-inputs '())
@@ -888,45 +890,84 @@ $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
+")))
+ ,@(match (%current-system)
+ ((or "armhf-linux" "aarch64-linux")
+ '((substitute* "tccgen.c"
+ (("\\*\\(double \\*\\)ptr = vtop->c.d;")
+ "*(long long *)ptr = vtop->c.d;"))
+ (substitute* "tccelf.c"
+ ;; This fixes
+ ;; "cannot execute binary file: Exec format error"
+ ;; when building on aarch64-linux for ARM
+ (("#ifdef TCC_ARM_EABI")
+ "#if defined (TCC_ARM_EABI) || BOOTSTRAP"))))
+ ((or "i686-linux" "x86_64-linux")
+ '()))
#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_ELFINTERP=\""
interpreter "\"")
+ "-D" (string-append "CONFIG_TCC_LIBPATHS=\"" tcc
"/lib:{B}/lib:{B}/lib/tcc:.\"")
+ "-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=\"libtcc1-mes.a\"")))
+ (files ',(match (%current-system)
+ ((or "i686-linux" "x86_64-linux")
+ '("tcc.c"))
+ ((or "armhf-linux" "aarch64-linux")
+ '("tcc.c" "lib/armflush.c"))))
+ (arguments (cons* "-vvv" "-g" "-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)
@@ -944,11 +985,6 @@ $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"))
#t)))))))))
(define diffutils-mesboot
- 07/26: DRAFT bootstrap: %bootstrap-mescc-tools: Support ARM., (continued)
- 07/26: DRAFT bootstrap: %bootstrap-mescc-tools: Support ARM., guix-commits, 2020/12/28
- 06/26: DRAFT bootstrap: mes-minimal: Support ARM, update to mes-0.22-118., guix-commits, 2020/12/28
- 13/26: commencement: gzip-mesboot: Support ARM., guix-commits, 2020/12/28
- 14/26: commencement: make-mesboot0: Support ARM., guix-commits, 2020/12/28
- 16/26: commencement: bash-mesboot0: Support ARM., guix-commits, 2020/12/28
- 18/26: commencement: diffutils-mesboot: Support ARM., guix-commits, 2020/12/28
- 22/26: commencement: gcc-core-mesboot0: Support ARM., guix-commits, 2020/12/28
- 23/26: commencement: mesboot-headers: Support ARM., guix-commits, 2020/12/28
- 19/26: commencement: patch-mesboot: Support ARM., guix-commits, 2020/12/28
- 15/26: commencement: bzip2-mesboot: Support ARM., guix-commits, 2020/12/28
- 17/26: commencement: tcc-boot: Support ARM.,
guix-commits <=
- 20/26: commencement: sed-mesboot0: Support ARM., guix-commits, 2020/12/28
- 21/26: commencement: binutils-mesboot0: Support ARM., guix-commits, 2020/12/28
- 24/26: commencement: gawk-mesboot: Support ARM., guix-commits, 2020/12/28
- 25/26: commencement: glibc-mesboot0: Support ARM., guix-commits, 2020/12/28
- 26/26: commencement: gcc-mesboot0: Support ARM., guix-commits, 2020/12/28