[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
137/176: gnu: tcc-boot: Use gnu-build-system.
From: |
Jan Nieuwenhuizen |
Subject: |
137/176: gnu: tcc-boot: Use gnu-build-system. |
Date: |
Fri, 31 Aug 2018 11:20:29 -0400 (EDT) |
janneke pushed a commit to branch wip-bootstrap
in repository guix.
commit 8c502888065865f5ef20134518271cd51a20f661
Author: Jan Nieuwenhuizen <address@hidden>
Date: Thu Aug 23 21:05:26 2018 +0200
gnu: tcc-boot: Use gnu-build-system.
* gnu/packages/mes.scm (tcc-boot): Use gnu-build-system.
---
gnu/packages/mes.scm | 143 ++++++++++++++++++++++++++++-----------------------
1 file changed, 78 insertions(+), 65 deletions(-)
diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm
index c357d47..94f57e0 100644
--- a/gnu/packages/mes.scm
+++ b/gnu/packages/mes.scm
@@ -492,77 +492,90 @@ standard.")
(sha256
(base32
"177bdhwzrnqgyrdv1dwvpd04fcxj68s5pm1dzwny6359ziway8yy"))))
- (build-system trivial-build-system)
+ (build-system gnu-build-system)
(supported-systems '("i686-linux" "x86_64-linux"))
-
(native-inputs
`(("coreutils" , %bootstrap-coreutils&co)
("mes" ,mes-boot)
("tcc" ,tcc-boot0)))
(arguments
- `(#:modules ((guix build utils))
- #:builder
- (begin
- (use-modules (guix build utils))
- (let* ((coreutils (assoc-ref %build-inputs "coreutils"))
- (source (assoc-ref %build-inputs "source"))
- (mes (assoc-ref %build-inputs "mes"))
- (tcc (assoc-ref %build-inputs "tcc"))
- (out (assoc-ref %outputs "out"))
- (libc (assoc-ref %build-inputs "libc"))
- (interpreter (if libc
- (string-append libc ,(glibc-dynamic-linker))
- (string-append mes "/lib/mes-loader"))))
- ;; unpack
- (setenv "PATH" (string-append
- coreutils "/bin"
- ":" tcc "/bin"))
- (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
- (mkdir-p "source")
- (system* "tar" "--strip=1" "-C" "source" "-xvf" source)
- (chdir "source")
-
- ;; configure
- (and
- (zero? (system* "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")))
- ;; make
- (zero? (system* "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\"")
- "-I" (string-append tcc "/out")
- "-L" (string-append tcc "/lib")
- "-o" "tcc"
- "tcc.c"))
- (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"))
- (zero? (system* "tcc" "-D" "TCC_TARGET_I386=1" "-c" "-o"
"libtcc1.o" "lib/libtcc1.c"))
- (zero? (system* "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"))))))))))
+ `(#: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
+ (string-append libc
,(glibc-dynamic-linker))
+ (string-append mes "/lib/mes-loader"))))
+ ;; unpack
+ (setenv "PATH" (string-append
+ coreutils "/bin"
+ ":" tcc "/bin"))
+ (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
+ (zero? (system* "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
+ (string-append libc
,(glibc-dynamic-linker))
+ (string-append mes "/lib/mes-loader"))))
+ (zero? (system* "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\"")
+ "-I" (string-append tcc "/out")
+ "-L" (string-append tcc "/lib")
+ "-o" "tcc"
+ "tcc.c")))))
+ (replace 'check
+ (lambda* (#:key outputs #:allow-other-keys)
+ ;; 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"))
+ (zero? (system* "tcc" "-D" "TCC_TARGET_I386=1" "-c" "-o"
"libtcc1.o" "lib/libtcc1.c"))
+ (zero? (system* "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"))))))))))))
(define-public m4-mesboot
(package-with-bootstrap-guile
- 165/176: Revert "gnu: make-boot0: Set LOADLIBES for i686-linux.", (continued)
- 165/176: Revert "gnu: make-boot0: Set LOADLIBES for i686-linux.", Jan Nieuwenhuizen, 2018/08/31
- 87/176: gnu: %mes-seed: Update for mes 0.16., Jan Nieuwenhuizen, 2018/08/31
- 77/176: Revert "gnu: gcc-boot: Update to 3.0.", Jan Nieuwenhuizen, 2018/08/31
- 102/176: gnu: gcc-core-mesboot: Rename from gcc-core-boot., Jan Nieuwenhuizen, 2018/08/31
- 103/176: gnu: glibc-mesboot: Rename from glibc-boot., Jan Nieuwenhuizen, 2018/08/31
- 107/176: gnu: Add gcc-mesboot 4.1.0., Jan Nieuwenhuizen, 2018/08/31
- 119/176: gnu: %mes-seed: Update for mes 0.16.1., Jan Nieuwenhuizen, 2018/08/31
- 121/176: gnu: tcc-boot0: Revise dependencies., Jan Nieuwenhuizen, 2018/08/31
- 157/176: Revert "gnu: Add %make-static, %make-static-stripped, %make-bootstrap-tarball.", Jan Nieuwenhuizen, 2018/08/31
- 163/176: Add new cheat: use %bootstrap-glibc for x86 for now., Jan Nieuwenhuizen, 2018/08/31
- 137/176: gnu: tcc-boot: Use gnu-build-system.,
Jan Nieuwenhuizen <=
- 148/176: gnu: mes-boot: Update to 0.18. WIP, Jan Nieuwenhuizen, 2018/08/31
- 138/176: gnu: Add %make-static, %make-static-stripped, %make-bootstrap-tarball., Jan Nieuwenhuizen, 2018/08/31
- 167/176: gnu: findutils-boot0: Export (for testing)., Jan Nieuwenhuizen, 2018/08/31
- 172/176: gnu: gcc-mesboot-wrapper: Wrap g++ too., Jan Nieuwenhuizen, 2018/08/31
- 168/176: gnu: file-boot0: Export (for testing)., Jan Nieuwenhuizen, 2018/08/31
- 169/176: gnu: file-boot0: Do not strip binaries or validate-runpath., Jan Nieuwenhuizen, 2018/08/31
- 159/176: gcc-mesboot: use package-full-name "-" :-), Jan Nieuwenhuizen, 2018/08/31
- 162/176: gnu: Add glibc-mesboot 2.3.6. WIP, Jan Nieuwenhuizen, 2018/08/31
- 68/176: Revert "gnu: binutils-boot: Update to 2.25.", Jan Nieuwenhuizen, 2018/08/31
- 65/176: gnu: binutils-boot: Update to 2.25., Jan Nieuwenhuizen, 2018/08/31