[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
137/160: gnu: tcc-boot: Use gnu-build-system.
From: |
Jan Nieuwenhuizen |
Subject: |
137/160: gnu: tcc-boot: Use gnu-build-system. |
Date: |
Tue, 28 Aug 2018 15:56:38 -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
- 160/160: gnu: Add mpc-boot 1.0.3., (continued)
- 160/160: gnu: Add mpc-boot 1.0.3., Jan Nieuwenhuizen, 2018/08/28
- 142/160: gnu: Add %linux-libre-headers-stripped, %linux-libre-headers-bootstrap-tarball., Jan Nieuwenhuizen, 2018/08/28
- 145/160: bootstrap: Integrate mes bootstrap for i686-linux., Jan Nieuwenhuizen, 2018/08/28
- 158/160: gnu: Add make-mesboot0 3.80, Jan Nieuwenhuizen, 2018/08/28
- 151/160: gnu: Add diffutils-mesboot 2.7., Jan Nieuwenhuizen, 2018/08/28
- 138/160: gnu: Add %make-static, %make-static-stripped, %make-bootstrap-tarball., Jan Nieuwenhuizen, 2018/08/28
- 143/160: gnu: Add %bootstrap-linux-libre-headers., Jan Nieuwenhuizen, 2018/08/28
- 150/160: gnu: Add make-mesboot 3.79., Jan Nieuwenhuizen, 2018/08/28
- 140/160: gnu: Add %diffutils-static, %diffutils-static-stripped, %diffutils-bootstrap-tarball., Jan Nieuwenhuizen, 2018/08/28
- 154/160: Revert "gnu: Add %bootstrap-diffutils.", Jan Nieuwenhuizen, 2018/08/28
- 137/160: gnu: tcc-boot: Use gnu-build-system.,
Jan Nieuwenhuizen <=
- 148/160: gnu: mes-boot: Update to 0.18. WIP, Jan Nieuwenhuizen, 2018/08/28
- 149/160: gnu: tcc-boot: Update for mes 0.18. WIP, Jan Nieuwenhuizen, 2018/08/28
- 127/160: gnu: binutils-mesboot: Revise dependencies., Jan Nieuwenhuizen, 2018/08/28
- 156/160: Revert "gnu: Add %bootstrap-make.", Jan Nieuwenhuizen, 2018/08/28
- 155/160: Revert "gnu: Add %diffutils-static, %diffutils-static-stripped, %diffutils-bootstrap-tarball.", Jan Nieuwenhuizen, 2018/08/28
- 147/160: gnu: %tinycc-seed: Update for mes 0.18. WIP, Jan Nieuwenhuizen, 2018/08/28
- 123/160: gnu: binutils-mesboot0: Revise dependencies., Jan Nieuwenhuizen, 2018/08/28
- 146/160: gnu: %mes-seed: Update for mes 0.18. WIP, Jan Nieuwenhuizen, 2018/08/28
- 141/160: gnu: Add %bootstrap-diffutils., Jan Nieuwenhuizen, 2018/08/28
- 157/160: Revert "gnu: Add %make-static, %make-static-stripped, %make-bootstrap-tarball.", Jan Nieuwenhuizen, 2018/08/28