[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
13/63: gnu: commencement: tcc-boot: Use Gash instead of coretutils&co.
From: |
guix-commits |
Subject: |
13/63: gnu: commencement: tcc-boot: Use Gash instead of coretutils&co. |
Date: |
Thu, 13 Feb 2020 10:11:16 -0500 (EST) |
janneke pushed a commit to branch wip-bootstrap
in repository guix.
commit 4302b700faea445e5ee93fa7c66fa61d88d903d3
Author: Jan Nieuwenhuizen <address@hidden>
AuthorDate: Sat Sep 21 10:43:18 2019 +0200
gnu: commencement: tcc-boot: Use Gash instead of coretutils&co.
* gnu/packages/commencement.scm (tcc-boot): Use Gash instead of
coretutils&co.
---
gnu/packages/commencement.scm | 208 ++++++++++++++++++++++--------------------
1 file changed, 107 insertions(+), 101 deletions(-)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index bca76a9..2bfb951 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -838,107 +838,6 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
;; FIXME: no compressing gzip yet
(delete 'compress-documentation))))))
-(define tcc-boot
- (package
- (inherit tcc-boot0)
- (name "tcc-boot")
- (version "0.9.27")
- (source (bootstrap-origin
- (origin
- (inherit (package-source tcc))
- (patches (search-patches "tcc-boot-0.9.27.patch")))))
- (build-system gnu-build-system)
- (inputs '())
- (propagated-inputs '())
- (native-inputs
- `(("mes" ,mes-boot)
- ("tcc" ,tcc-boot0)
-
- ("coreutils" , %bootstrap-coreutils&co)))
- (arguments
- `(#:implicit-inputs? #f
- #:guile ,%bootstrap-guile
-
- ;; Binutils' 'strip' b0rkes MesCC/M1/hex2 binaries, tcc-boot also comes
- ;; with MesCC/M1/hex2-built binaries.
- #:strip-binaries? #f
-
- #:phases
- (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref %outputs "out"))
- (coreutils (assoc-ref %build-inputs "coreutils"))
- (mes (assoc-ref %build-inputs "mes"))
- (tcc (assoc-ref %build-inputs "tcc"))
- (libc (assoc-ref %build-inputs "libc"))
- (interpreter (if libc
- ;; also for x86_64-linux, we are still on
i686-linux
- (string-append libc
,(glibc-dynamic-linker "i686-linux"))
- (string-append mes "/lib/mes-loader"))))
- ;; unpack
- (setenv "PATH" (string-append
- coreutils "/bin"
- ":" tcc "/bin"))
- (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
- (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")))))
- (replace 'build
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref %outputs "out"))
- (mes (assoc-ref %build-inputs "mes"))
- (tcc (assoc-ref %build-inputs "tcc"))
- (libc (assoc-ref %build-inputs "libc"))
- (interpreter (if libc
- ;; also for x86_64-linux, we are still on
i686-linux
- (string-append libc
,(glibc-dynamic-linker "i686-linux"))
- (string-append mes "/lib/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"))))
- (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")))
- (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"))
- (delete-file (string-append out "/lib/tcc/libtcc1.a"))
- (copy-file "libtcc1.a" (string-append out "/lib/tcc/libtcc1.a"))
- #t))))))))
-
(define bash-mesboot0
;; The initial Bash
(package
@@ -1041,6 +940,113 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
(copy-file "bash" (string-append bin "/sh"))
#t))))))))
+(define tcc-boot
+ ;; The final tcc.
+ (package
+ (inherit tcc-boot0)
+ (name "tcc-boot")
+ (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;")))
+ #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")))))
+ (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"))))
+ (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"))
+ (delete-file (string-append out "/lib/tcc/libtcc1.a"))
+ (copy-file "libtcc1.a" (string-append out
"/lib/tcc/libtcc1.a"))
+ #t)))))))))
+
(define diffutils-mesboot
(package
(inherit diffutils)
- 10/63: gnu: commencement: make-mesboot0: Use Gash instead of coreutils&co., (continued)
- 10/63: gnu: commencement: make-mesboot0: Use Gash instead of coreutils&co., guix-commits, 2020/02/13
- 08/63: gnu: commencement: tcc-boot0: Use Gash instead of coretutils&co., guix-commits, 2020/02/13
- 12/63: gnu: commencement: Add bash-mesboot0., guix-commits, 2020/02/13
- 09/63: gnu: commencement: Add gzip-mesboot., guix-commits, 2020/02/13
- 07/63: gnu: commencement: mes-boot: Use Gash instead of coretutils&co., guix-commits, 2020/02/13
- 15/63: gnu: commencement: Add patch-mesboot., guix-commits, 2020/02/13
- 03/63: gnu: commencement: Add %bootstrap-guile+guild., guix-commits, 2020/02/13
- 16/63: gnu: commencement: Add sed-mesboot0., guix-commits, 2020/02/13
- 14/63: gnu: commencement: diffutils-mesboot: Use Gash instead of coretutils&co., guix-commits, 2020/02/13
- 17/63: gnu: commencement: binutils-mesboot0: Use Gash instead of coretutils&co., guix-commits, 2020/02/13
- 13/63: gnu: commencement: tcc-boot: Use Gash instead of coretutils&co.,
guix-commits <=
- 18/63: gnu: commencement: gcc-core-mesboot0: Use Gash instead of coretutils&co., guix-commits, 2020/02/13
- 20/63: gnu: commencement: mesboot-headers: Use Gash instead of coretutils&co., guix-commits, 2020/02/13
- 25/63: gnu: commencement: Add binutils-mesboot1., guix-commits, 2020/02/13
- 26/63: gnu: commencement: Add coreutils-mesboot0., guix-commits, 2020/02/13
- 32/63: gnu: commencement: Add gcc-mesboot1: Use Gash instead of coreutils&co., guix-commits, 2020/02/13
- 36/63: gnu: commencement: glibc-headers-mesboot: Use Gash instead of coreutils&co., guix-commits, 2020/02/13
- 41/63: gnu: commencement: Add coreutils-mesboot., guix-commits, 2020/02/13
- 43/63: gnu: commencement: %bootstrap-inputs+toolchain: Use Gash instead of coreutils&co., guix-commits, 2020/02/13
- 45/63: gnu: commencement: Add sed-boot0., guix-commits, 2020/02/13
- 22/63: gnu: commencement: gcc-mesboot0: Use Gash instead of coretutils&co., guix-commits, 2020/02/13