[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
27/35: bootstrap: tcc-boot: Scheme-only bootstrap.
From: |
guix-commits |
Subject: |
27/35: bootstrap: tcc-boot: Scheme-only bootstrap. |
Date: |
Wed, 20 Nov 2019 15:19:40 -0500 (EST) |
janneke pushed a commit to branch wip-bootstrap
in repository guix.
commit 7ac263368fce38b0740c2a0f6e378cd57f545609
Author: Jan Nieuwenhuizen <address@hidden>
Date: Sat Sep 21 10:43:18 2019 +0200
bootstrap: tcc-boot: Scheme-only bootstrap.
* gnu/packages/commencement.scm (tcc-boot): Scheme-only bootstrap.
---
gnu/packages/commencement.scm | 218 +++++++++++++++++++++++-------------------
1 file changed, 120 insertions(+), 98 deletions(-)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index ab91582..6aaf70d 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -537,104 +537,6 @@
(lambda _
(invoke "./bzip2" "--help")))))))))
-(define tcc-boot
- (package-with-bootstrap-guile
- (package
- (inherit tcc-boot0)
- (name "tcc-boot")
- (version "0.9.27")
- (source (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
- #:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2
- ; binaries, tcc-boot also comes with
- ; MesCC/M1/hex2-built binaries
- #: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-with-bootstrap-guile
@@ -742,6 +644,126 @@
(copy-file "bash" (string-append bin "/sh"))
#t)))))))))
+(define tcc-boot
+ (package-with-bootstrap-guile
+ (package
+ (inherit tcc-boot0)
+ (name "tcc-boot")
+ (version "0.9.27")
+ ;; Upstream only provides bz2 -- Look, Ma how many wonderful
+ ;; non-bootstrappable compressors we can choose from!
+ (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"))
+ ("bash" ,bash-mesboot0)
+ ("bzip2" ,bzip2-mesboot0)
+ ("gash" ,%bootstrap-gash)
+ ("guile" ,%bootstrap-guile)
+ ("make" ,make-mesboot0)
+ ("mes" ,mes-boot)
+ ("tcc" ,tcc-boot0)))
+ (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))
+ ;; (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"))
+ (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"))))
+ (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")))
+ (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-with-bootstrap-guile
(package
- 08/35: gnu: mescc-tools: Update to 0.6.1., (continued)
- 08/35: gnu: mescc-tools: Update to 0.6.1., guix-commits, 2019/11/20
- 10/35: gnu: mes: Update to 0.21 WIP, guix-commits, 2019/11/20
- 14/35: bootstrap: bootstrap-mescc-tools: Update for mescc-tools-0.6.1., guix-commits, 2019/11/20
- 17/35: bootstrap-mes, guix-commits, 2019/11/20
- 18/35: gnu: mes: Update to 0.20 WIP, guix-commits, 2019/11/20
- 20/35: bootstrap: mes-boot: Scheme-only bootstrap. WIP, guix-commits, 2019/11/20
- 22/35: bootstrap-gash-rewire? WIP, guix-commits, 2019/11/20
- 24/35: bootstrap: make-mesboot0: Scheme-only bootstrap., guix-commits, 2019/11/20
- 25/35: bootstrap: Add bzip2-mesboot0., guix-commits, 2019/11/20
- 26/35: bootstrap: Add bash-mesboot0., guix-commits, 2019/11/20
- 27/35: bootstrap: tcc-boot: Scheme-only bootstrap.,
guix-commits <=
- 30/35: bootstrap: Add sed-mesboot0., guix-commits, 2019/11/20
- 23/35: bootstrap: Add gzip-mesboot0., guix-commits, 2019/11/20
- 21/35: bootstrap: tcc-boot0: Scheme-only bootstrap. WIP, guix-commits, 2019/11/20
- 28/35: bootstrap: diffuils-mesboot: Scheme-only bootstrap., guix-commits, 2019/11/20
- 32/35: bootstrap: gcc-core-mesboot0: Scheme-only bootstrap., guix-commits, 2019/11/20
- 31/35: bootstrap: binutils-mesboot0: Scheme-only bootstrap., guix-commits, 2019/11/20
- 29/35: bootstrap: Add patch-mesboot0., guix-commits, 2019/11/20
- 33/35: bootstrap: Add gawk-mesboot0., guix-commits, 2019/11/20
- 34/35: bootstrap: Add bash-mesboot1., guix-commits, 2019/11/20
- 35/35: bootstrap: glibc-mesboot0: Scheme-only bootstrap., guix-commits, 2019/11/20