[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
14/20: commencement: Add tcc-boot-next.
From: |
guix-commits |
Subject: |
14/20: commencement: Add tcc-boot-next. |
Date: |
Sun, 20 Dec 2020 04:03:18 -0500 (EST) |
janneke pushed a commit to branch wip-arm-bootstrap
in repository guix.
commit 71fe6cdce75e7a732d44df695887f20afae1cb2c
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Sun Dec 13 15:00:06 2020 +0100
commencement: Add tcc-boot-next.
* gnu/packages/commencement.scm (tcc-boot-next): New variable.
---
gnu/packages/commencement.scm | 140 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 140 insertions(+)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index b059456..e9f77d4 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1189,6 +1189,146 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
(copy-file "libtcc1.a" (string-append out
"/lib/tcc/libtcc1.a"))
#t)))))))))
+(define-public tcc-boot-next
+ ;; The final tcc.
+ (package
+ (inherit tcc-boot0-next)
+ (name "tcc-boot-next")
+ (version "0.9.27")
+ (source (origin
+ (inherit (package-source tcc))
+ ;; `patches' needs XZ
+ ;; (patches (search-patches "tcc-boot-0.9.27.patch"))
+ ))
+ (build-system gnu-build-system)
+ (inputs '())
+ (propagated-inputs '())
+ (native-inputs `( ;;("boot-patch" ,(search-patch "tcc-boot-0.9.27.patch"))
+ ("bzip2" ,bzip2-mesboot)
+ ,@(%boot-tcc0-inputs)))
+ (arguments
+ `(#:implicit-inputs? #f
+ #:guile ,%bootstrap-guile
+ #:validate-runpath? #f ; no dynamic executables
+ #:strip-binaries? #f ; no strip yet
+ #:phases
+ (modify-phases %standard-phases
+ ;; tar xvf ..bz2 gives
+ ;; bzip2: PANIC -- internal consistency error
+ (replace 'unpack
+ (lambda* (#:key source #:allow-other-keys)
+ (copy-file source "tarball.tar.bz2")
+ (invoke "bzip2" "-d" "tarball.tar.bz2")
+ (invoke "tar" "xvf" "tarball.tar")
+ (chdir (string-append "tcc-" ,version))
+ #t))
+ ;; no patch yet
+ ;; (add-after 'unpack 'apply-boot-patch
+ ;; (lambda* (#:key inputs #:allow-other-keys)
+ ;; (let ((patch-file (assoc-ref inputs "boot-patch")))
+ ;; (invoke "patch" "-p1" "-i" patch-file))))
+ (add-after 'unpack 'scripted-patch
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "libtcc.c"
+ (("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")
+ (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")
+ (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)
+ ;; ./check.sh ?
+ (= 1 (status:exit-val (system* "./tcc" "--help")))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref %outputs "out"))
+ (tcc (assoc-ref %build-inputs "tcc")))
+ (and
+ (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"))
+ ;;(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
;; The initial diffutils.
(package
- 13/20: REMOVEME Use %bootstrap-guile for tcc-boot0-next., (continued)
- 13/20: REMOVEME Use %bootstrap-guile for tcc-boot0-next., guix-commits, 2020/12/20
- 15/20: REMOVEME Use mes-next for tcc-boot0-next., guix-commits, 2020/12/20
- 16/20: REMOVEME: Use coreutils&co, bash instead of gash., guix-commits, 2020/12/20
- 17/20: commencement: Add make-mesboot0-next., guix-commits, 2020/12/20
- 03/20: gnu: mes: Update to nyacc-1.00.2., guix-commits, 2020/12/20
- 09/20: commencement: gash-boot: Build fix for ARM., guix-commits, 2020/12/20
- 20/20: Revert "tcc-boot0-next: stop for aarch comparison", guix-commits, 2020/12/20
- 12/20: commencement: Add tcc-boot0-next., guix-commits, 2020/12/20
- 04/20: gnu: Add mes-next., guix-commits, 2020/12/20
- 11/20: commencement: Add mes-boot-next., guix-commits, 2020/12/20
- 14/20: commencement: Add tcc-boot-next.,
guix-commits <=
- 18/20: tcc-boot0-next: stop for aarch comparison, guix-commits, 2020/12/20
- 19/20: tcc-boot-next, guix-commits, 2020/12/20