From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
To: 63576@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>,
"Efraim Flashner" <efraim@flashner.co.il>,
"Denis 'GNUtoo' Carikli" <GNUtoo@cyberdimension.org>
Subject: [bug#63576] [PATCH v1 2/4] gnu: Add aarch64-none-elf-gcc.
Date: Thu, 18 May 2023 20:28:12 +0200 [thread overview]
Message-ID: <20230518182814.15881-2-GNUtoo@cyberdimension.org> (raw)
In-Reply-To: <20230518182814.15881-1-GNUtoo@cyberdimension.org>
* gnu/packages/aarch64-none-elf-toolchain.scm (aarch64-none-elf-gcc): New
variable.
---
gnu/packages/aarch64-none-elf-toolchain.scm | 59 ++++++++++++++++++++-
1 file changed, 58 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/aarch64-none-elf-toolchain.scm b/gnu/packages/aarch64-none-elf-toolchain.scm
index 14569036ce..88a2abb1f9 100644
--- a/gnu/packages/aarch64-none-elf-toolchain.scm
+++ b/gnu/packages/aarch64-none-elf-toolchain.scm
@@ -17,10 +17,67 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages aarch64-none-elf-toolchain)
+ #:use-module (guix gexp)
+ #:use-module (guix utils)
#:use-module (guix packages)
- #:use-module (gnu packages cross-base))
+ #:use-module (gnu packages cross-base)
+ #:use-module (gnu packages gcc))
(define-public aarch64-none-elf-binutils
(package
(inherit (cross-binutils "aarch64-none-elf"))
(name "aarch64-none-elf-binutils")))
+
+(define aarch64-none-elf-gcc
+ (let ((xgcc (cross-gcc "aarch64-none-elf" #:xgcc gcc #:xbinutils aarch64-none-elf-binutils)))
+ (package
+ (inherit xgcc)
+ (name "aarch64-none-elf-gcc")
+ (arguments
+ (substitute-keyword-arguments (package-arguments xgcc)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((gcc (assoc-ref inputs "gcc")))
+ ;; Remove the default compiler from CPLUS_INCLUDE_PATH to
+ ;; prevent header conflict with the GCC from native-inputs.
+ (setenv "CPLUS_INCLUDE_PATH"
+ (string-join
+ (delete (string-append gcc "/include/c++")
+ (string-split (getenv "CPLUS_INCLUDE_PATH")
+ #\:))
+ ":"))
+ (format #t
+ "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
+ (getenv "CPLUS_INCLUDE_PATH")))))
+ ;; Without a working multilib build, the resulting GCC lacks
+ ;; support for nearly every AARCH64-NONE-ELF chip.
+ (add-after 'unpack 'fix-genmultilib
+ (lambda _
+ ;; patch-shebang doesn't work here because there are actually
+ ;; several scripts inside this script, each with a #!/bin/sh
+ ;; that needs patching.
+ (substitute* "gcc/genmultilib"
+ (("#!/bin/sh") (string-append "#!" (which "sh"))))))))
+ ((#:configure-flags flags)
+ #~(delete "--disable-multilib" #$flags))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "CROSS_C_INCLUDE_PATH")
+ (files '("aarch64-none-elf/include")))
+ (search-path-specification
+ (variable "CROSS_CPLUS_INCLUDE_PATH")
+ (files '("aarch64-none-elf/include")))
+ (search-path-specification
+ (variable "CROSS_OBJC_INCLUDE_PATH")
+ (files '("aarch64-none-elf/include")))
+ (search-path-specification
+ (variable "CROSS_OBJCPLUS_INCLUDE_PATH")
+ (files '("aarch64-none-elf/include")))
+ (search-path-specification
+ (variable "CROSS_LIBRARY_PATH")
+ (files '("aarch64-none-elf/lib")))))
+ (native-inputs
+ `(("gcc" ,gcc)
+ ,@(package-native-inputs xgcc))))))
--
2.40.1
next prev parent reply other threads:[~2023-05-18 18:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 18:24 [bug#63576] [PATCH v1 0/4] Add aarch64-none-elf-gcc-toolchain Denis 'GNUtoo' Carikli
2023-05-18 18:28 ` [bug#63576] [PATCH v1 1/4] gnu: Add aarch64-none-elf-binutils Denis 'GNUtoo' Carikli
2023-05-18 18:28 ` Denis 'GNUtoo' Carikli [this message]
2023-05-18 18:28 ` [bug#63576] [PATCH v1 3/4] gnu: Add aarch64-none-elf-newlib Denis 'GNUtoo' Carikli
2023-05-18 18:28 ` [bug#63576] [PATCH v1 4/4] gnu: Add aarch64-none-elf-gcc-toolchain Denis 'GNUtoo' Carikli
2023-06-04 8:43 ` [bug#63576] [PATCH v1 0/4] " Efraim Flashner
2023-06-05 21:10 ` Denis 'GNUtoo' Carikli
2023-07-19 1:00 ` Denis 'GNUtoo' Carikli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230518182814.15881-2-GNUtoo@cyberdimension.org \
--to=gnutoo@cyberdimension.org \
--cc=63576@debbugs.gnu.org \
--cc=efraim@flashner.co.il \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).