guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

14/22: gnu: commencement: gcc-core-mesboot0: Support ARM.


From: guix-commits
Subject: 14/22: gnu: commencement: gcc-core-mesboot0: Support ARM.
Date: Sun, 16 Oct 2022 05:26:47 -0400 (EDT)

janneke pushed a commit to branch wip-aarch64-bootstrap
in repository guix.

commit b7a8cc315477a6b00843053c2ad183c83afca022
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Thu Dec 23 09:50:05 2021 +0100

    gnu: 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 | 240 ++++++++++++++++++++++--------------------
 2 files changed, 127 insertions(+), 114 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 0297a9a380..9cb9413ca3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1089,6 +1089,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-cross-gxx-include-dir.patch          \
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 35c4507a97..8de6adb251 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1024,122 +1024,134 @@ MesCC-Tools), and finally M2-Planet.")
   ;; 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 `(("binutils" ,binutils-mesboot0)
-                     ,@(%boot-tcc-inputs)))
-    (outputs '("out"))
-    (arguments
-     (list #: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
-                          #$(local-file
-                             (search-patch "gcc-boot-2.95.3.patch"))))
-                     (invoke "patch" "--force" "-p1" "-i" patch-file))))
-               (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"))
+                (sha256
+                 (base32
+                  "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an"))))
+      (supported-systems '("armhf-linux" "aarch64-linux"
+                           "i686-linux" "x86_64-linux"))
+      (inputs '())
+      (propagated-inputs '())
+      (native-inputs `(("binutils" ,binutils-mesboot0)
+                       ,@(%boot-tcc-inputs)))
+      (outputs '("out"))
+      (arguments
+       (list #: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"
+                   ,(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-boot-patch
+                   (lambda* (#:key inputs #:allow-other-keys)
+                     (let ((patch-file
+                            #$(local-file
+                               (search-patch "gcc-boot-2.95.3.patch"))))
+                       (invoke "patch" "--force" "-p1" "-i" patch-file))
+                     (let ((patch-file
+                            #$(local-file
+                               (search-patch "gcc-boot-2.95.3-arm.patch"))))
+                       (invoke "patch" "--force" "-p1" "-i" patch-file))))
+                 (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")))))))
-    (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")))))))
+      (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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]