[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
22/26: commencement: gcc-core-mesboot0: Support ARM.
From: |
guix-commits |
Subject: |
22/26: commencement: gcc-core-mesboot0: Support ARM. |
Date: |
Tue, 12 Jan 2021 13:49:17 -0500 (EST) |
janneke pushed a commit to branch wip-arm-bootstrap
in repository guix.
commit 29500c5b1edcff8ca0cdfead5b8f70ab3bede227
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Wed Dec 23 09:50:05 2020 +0100
commencement: gcc-core-mesboot0: Support ARM.
* gnu/packages/patches/gcc-boot-2.95.3-arm.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/commencement.scm (gcc-core-mesboot0)[arguments]: Use it in
"apply-patches" stage, renamed from "apply-boot-patch". Parameterize
configure-flags' --build,--host,--target.
[supported-systems]: Add aarch64-linux, armhf-linux.
---
gnu/local.mk | 1 +
gnu/packages/commencement.scm | 243 +++++++++++++------------
gnu/packages/patches/gcc-boot-2.95.3-arm.patch | 31 ++++
3 files changed, 160 insertions(+), 115 deletions(-)
diff --git a/gnu/local.mk b/gnu/local.mk
index 67482b8..6bbeceb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1009,6 +1009,7 @@ dist_patch_DATA =
\
%D%/packages/patches/gcc-arm-link-spec-fix.patch \
%D%/packages/patches/gcc-asan-missing-include.patch \
%D%/packages/patches/gcc-boot-2.95.3.patch \
+ %D%/packages/patches/gcc-boot-2.95.3-arm.patch \
%D%/packages/patches/gcc-boot-4.6.4.patch \
%D%/packages/patches/gcc-cross-environment-variables.patch \
%D%/packages/patches/gcc-fix-texi2pod.patch \
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 63c2380..b736185 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1241,123 +1241,136 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
;; library, such as dir.h/struct DIR/readdir, locales, signals... Also,
;; with gcc-2.95.3, binutils (2.14.0, 2.20.1a) and glibc-2.2.5 we found a
;; GNU toolchain triplet "that works".
- (package
- (inherit gcc)
- (name "gcc-core-mesboot0")
- (version "2.95.3")
- (source (origin
- (method url-fetch)
- (uri (string-append "mirror://gnu/gcc/gcc-2.95.3/gcc-core-"
- version
- ".tar.gz"))
- ;; `patches' needs XZ
- ;; (patches (search-patches "gcc-boot-2.95.3.patch"))
- (sha256
- (base32
- "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an"))))
- (supported-systems '("i686-linux" "x86_64-linux"))
- (inputs '())
- (propagated-inputs '())
- (native-inputs `(("boot-patch" ,(search-patch "gcc-boot-2.95.3.patch"))
- ("binutils" ,binutils-mesboot0)
- ,@(%boot-tcc-inputs)))
- (outputs '("out"))
- (arguments
- `(#:implicit-inputs? #f
- #:guile ,%bootstrap-guile
- #:tests? #f
- #:parallel-build? #f
- #:strip-binaries? #f
- #:configure-flags
- (let ((out (assoc-ref %outputs "out")))
- `("--enable-static"
- "--disable-shared"
- "--disable-werror"
- "--build=i686-unknown-linux-gnu"
- "--host=i686-unknown-linux-gnu"
- ,(string-append "--prefix=" out)))
- #:make-flags
- `("CC=tcc -static -D __GLIBC_MINOR__=6"
- "OLDCC=tcc -static -D __GLIBC_MINOR__=6"
- "CC_FOR_BUILD=tcc -static -D __GLIBC_MINOR__=6"
- "AR=ar"
- "RANLIB=ranlib"
- ,(string-append "LIBGCC2_INCLUDES=-I "
- (assoc-ref %build-inputs "tcc")
- "/include")
- "LANGUAGES=c"
- ,(string-append "BOOT_LDFLAGS="
- " -B" (assoc-ref %build-inputs "tcc")
- "/lib/"))
- #:modules ((guix build gnu-build-system)
- (guix build utils)
- (srfi srfi-1))
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'apply-boot-patch
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((patch-file (assoc-ref inputs "boot-patch")))
- (system* "patch" "--force" "-p1" "-i" patch-file)
- #t)))
- (add-before 'configure 'setenv
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (bash (assoc-ref %build-inputs "bash"))
- (shell (string-append bash "/bin/bash"))
- (tcc (assoc-ref %build-inputs "tcc"))
- (cppflags " -D __GLIBC_MINOR__=6"))
- (setenv "CONFIG_SHELL" shell)
- (setenv "CPPFLAGS" cppflags)
- (setenv "CC" (string-append "tcc" cppflags))
- (setenv "CC_FOR_BUILD" (string-append "tcc" cppflags))
- (setenv "CPP" (string-append "tcc -E" cppflags))
- (with-output-to-file "config.cache"
- (lambda _
- (display "
+ (let ((triplet (match (%current-system)
+ ((or "armhf-linux" "aarch64-linux")
+ "arm-unknown-linux-gnu")
+ ((or "i686-linux" "x86_64-linux")
+ "i686-unknown-linux-gnu"))))
+ (package
+ (inherit gcc)
+ (name "gcc-core-mesboot0")
+ (version "2.95.3")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnu/gcc/gcc-2.95.3/gcc-core-"
+ version
+ ".tar.gz"))
+ ;; `patches' needs XZ
+ ;; (patches (search-patches "gcc-boot-2.95.3.patch"
+ ;; "gcc-boot-2.95.3-arm.patch"))
+ (sha256
+ (base32
+ "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an"))))
+ (supported-systems '("armhf-linux" "aarch64-linux"
+ "i686-linux" "x86_64-linux"))
+ (inputs '())
+ (propagated-inputs '())
+ (native-inputs `(("boot-patch" ,(search-patch "gcc-boot-2.95.3.patch"))
+ ("arm-patch" ,(search-patch
"gcc-boot-2.95.3-arm.patch"))
+ ("binutils" ,binutils-mesboot0)
+ ,@(%boot-tcc-inputs)))
+ (outputs '("out"))
+ (arguments
+ `(#:implicit-inputs? #f
+ #:guile ,%bootstrap-guile
+ #:tests? #f
+ #:parallel-build? #f
+ #:strip-binaries? #f
+ #:configure-flags
+ (let ((out (assoc-ref %outputs "out")))
+ (list "--enable-static"
+ "--disable-shared"
+ "--disable-werror"
+ (string-append "--build=" ,triplet)
+ (string-append "--host=" ,triplet)
+ (string-append "--target=" ,triplet)
+ (string-append "--prefix=" out)))
+ #:make-flags
+ `("CC=tcc -static -D __GLIBC_MINOR__=6"
+ "OLDCC=tcc -static -D __GLIBC_MINOR__=6"
+ "CC_FOR_BUILD=tcc -static -D __GLIBC_MINOR__=6"
+ "AR=ar"
+ "RANLIB=ranlib"
+ ,(string-append "LIBGCC2_INCLUDES=-I "
+ (assoc-ref %build-inputs "tcc")
+ "/include")
+ "LANGUAGES=c"
+ ,(string-append "BOOT_LDFLAGS="
+ " -B" (assoc-ref %build-inputs "tcc")
+ "/lib/"))
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-1))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'apply-patches
+ (lambda* (#:key inputs #:allow-other-keys)
+ (for-each
+ (lambda (name)
+ (let ((patch (assoc-ref inputs name)))
+ (invoke "patch" "-p1" "--force" "-i" patch)))
+ '("boot-patch"
+ "arm-patch"))))
+ (add-before 'configure 'setenv
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bash (assoc-ref %build-inputs "bash"))
+ (shell (string-append bash "/bin/bash"))
+ (tcc (assoc-ref %build-inputs "tcc"))
+ (cppflags " -D __GLIBC_MINOR__=6"))
+ (setenv "CONFIG_SHELL" shell)
+ (setenv "CPPFLAGS" cppflags)
+ (setenv "CC" (string-append "tcc" cppflags))
+ (setenv "CC_FOR_BUILD" (string-append "tcc" cppflags))
+ (setenv "CPP" (string-append "tcc -E" cppflags))
+ (setenv "enable_threads" "single")
+ (with-output-to-file "config.cache"
+ (lambda _
+ (display "
ac_cv_c_float_format='IEEE (little-endian)'
"))))))
- ;; gcc-2.95.3
- (replace 'configure ; needs classic invocation of configure
- (lambda* (#:key configure-flags #:allow-other-keys)
- (format (current-error-port)
- "running ./configure ~a\n" (string-join configure-flags))
- (apply invoke "./configure" configure-flags)))
- (add-after 'configure 'remove-info
- (lambda _
- ;; no info at this stage
- (delete-file-recursively "texinfo")
- (invoke "touch" "gcc/cpp.info" "gcc/gcc.info")))
- (add-after 'install 'install2
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((tcc (assoc-ref %build-inputs "tcc"))
- (tcc-lib (string-append tcc "/lib/x86-mes-gcc"))
- (out (assoc-ref outputs "out"))
- (gcc-dir (string-append
- out
"/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3")))
- (mkdir-p "tmp")
- (with-directory-excursion "tmp"
- (invoke "ar" "x" (string-append "../gcc/libgcc2.a"))
- (invoke "ar" "x" (string-append tcc "/lib/libtcc1.a"))
- (apply invoke "ar" "r" (string-append gcc-dir "/libgcc.a")
- (find-files "." "\\.o")))
- (copy-file "gcc/libgcc2.a" (string-append out "/lib/libgcc2.a"))
- (copy-file (string-append tcc "/lib/libtcc1.a")
- (string-append out "/lib/libtcc1.a"))
- (invoke "ar" "x" (string-append tcc "/lib/libtcc1.a"))
- (invoke "ar" "x" (string-append tcc "/lib/libc.a"))
- (invoke "ar" "r" (string-append gcc-dir "/libc.a")
- "libc.o" "libtcc1.o")
- #t))))))
- (native-search-paths
- (list (search-path-specification
- (variable "C_INCLUDE_PATH")
- (files '("include"
-
- ;; Needed to get things like GCC's <stddef.h>.
- "lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include")))
- (search-path-specification
- (variable "LIBRARY_PATH")
- (files '("lib")))))))
+ ;; gcc-2.95.3
+ (replace 'configure ; needs classic invocation of configure
+ (lambda* (#:key configure-flags #:allow-other-keys)
+ (format (current-error-port)
+ "running ./configure ~a\n" (string-join
configure-flags))
+ (apply invoke "./configure" configure-flags)))
+ (add-after 'configure 'remove-info
+ (lambda _
+ ;; no info at this stage
+ (delete-file-recursively "texinfo")
+ (invoke "touch" "gcc/cpp.info" "gcc/gcc.info")))
+ (add-after 'install 'install2
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((tcc (assoc-ref %build-inputs "tcc"))
+ (out (assoc-ref outputs "out"))
+ (gcc-dir (string-append
+ out "/lib/gcc-lib/" ,triplet "/2.95.3")))
+ (mkdir-p "tmp")
+ (with-directory-excursion "tmp"
+ (invoke "ar" "x" (string-append "../gcc/libgcc2.a"))
+ (invoke "ar" "x" (string-append tcc "/lib/tcc/libtcc1.a"))
+ (copy-file "../gcc/libgcc.a" "libgcc.a")
+ (apply invoke "ar" "r" "libgcc.a" (find-files "." "\\.o"))
+ (copy-file "libgcc.a" (string-append gcc-dir "/libgcc.a")))
+ (copy-file "gcc/libgcc2.a"
+ (string-append out "/lib/libgcc2.a"))
+ (copy-file (string-append tcc "/lib/tcc/libtcc1.a")
+ (string-append out "/lib/libtcc1.a"))
+ (invoke "ar" "x" (string-append tcc "/lib/tcc/libtcc1.a"))
+ (invoke "ar" "x" (string-append tcc "/lib/libc.a"))
+ (invoke "ar" "r" (string-append gcc-dir "/libc.a")
+ "libc.o" "libtcc1.o")
+ #t))))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "C_INCLUDE_PATH")
+ (files `("include"
+ ;; Needed to get things like GCC's <stddef.h>.
+ ,(string-append "lib/gcc-lib/" triplet
"/2.95.3/include"))))
+ (search-path-specification
+ (variable "LIBRARY_PATH")
+ (files '("lib"))))))))
(define (%boot-mesboot-core-inputs)
`(("binutils" ,binutils-mesboot0)
diff --git a/gnu/packages/patches/gcc-boot-2.95.3-arm.patch
b/gnu/packages/patches/gcc-boot-2.95.3-arm.patch
new file mode 100644
index 0000000..73a059e
--- /dev/null
+++ b/gnu/packages/patches/gcc-boot-2.95.3-arm.patch
@@ -0,0 +1,31 @@
+This patch enables building gcc-2.95.3 on armhf-linux using TCC and
+Mes C Library.
+
+ * Add include/asm/unist.h linux header.
+ * Disable libgcc2.c float and long long functions.
+
+Upstream status: Not presented upstream.
+
+--- gcc-2.95.3/include/asm/unistd.h.orig 1970-01-01 01:00:00.000000000
+0100
++++ gcc-2.95.3/include/asm/unistd.h 2020-12-23 07:49:44.156673879 +0100
+@@ -0,0 +1,9 @@
++#ifndef __ASM_UNISTD_H
++#define __ASM_UNISTD_H
++
++#if __arm__
++#define __NR_getpid 0x14
++#define __NR_kill 0x25
++#endif
++
++#endif // __ASM_UNISTD_H
+--- gcc-2.95.3/gcc/Makefile.in.orig 2020-12-23 08:31:57.733501802 +0100
++++ gcc-2.95.3/gcc/Makefile.in 2020-12-23 08:31:49.985371208 +0100
+@@ -1260,7 +1260,7 @@
+ -(cd tmpcopy; chmod +w * > /dev/null 2>&1)
+ (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2))
+ (cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a
*$(objext))
+- rm -rf libgcc2.a tmpcopy
++ rm -rf tmpcopy
+ if $(RANLIB_TEST_FOR_TARGET) ; then \
+ $(RANLIB_FOR_TARGET) tmplibgcc.a; \
+ else true; fi
- 18/26: commencement: diffutils-mesboot: Support ARM., (continued)
- 18/26: commencement: diffutils-mesboot: Support ARM., guix-commits, 2021/01/12
- 01/26: gnu: mescc-tools: Update to 0.7.0., guix-commits, 2021/01/12
- 10/26: commencement: bootstrap-mes-rewired: Support ARM., guix-commits, 2021/01/12
- 12/26: commencement: tcc-boot0: Support ARM, update to 0.9.26-1136-g0fbeb2dd., guix-commits, 2021/01/12
- 16/26: commencement: bash-mesboot0: Support ARM., guix-commits, 2021/01/12
- 21/26: commencement: binutils-mesboot0: Support ARM., guix-commits, 2021/01/12
- 20/26: commencement: sed-mesboot0: Support ARM., guix-commits, 2021/01/12
- 23/26: commencement: mesboot-headers: Support ARM., guix-commits, 2021/01/12
- 24/26: commencement: gawk-mesboot: Support ARM., guix-commits, 2021/01/12
- 26/26: commencement: gcc-mesboot0: Support ARM., guix-commits, 2021/01/12
- 22/26: commencement: gcc-core-mesboot0: Support ARM.,
guix-commits <=