[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/23: gnu: cross-toolchain: Add set-cross-path for AVR.
From: |
guix-commits |
Subject: |
11/23: gnu: cross-toolchain: Add set-cross-path for AVR. |
Date: |
Mon, 11 Dec 2023 06:57:41 -0500 (EST) |
efraim pushed a commit to branch master
in repository guix.
commit c7d2faf1788a1f40defc9d4b875d19b912b6ef01
Author: Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com>
AuthorDate: Tue Nov 28 12:34:54 2023 +0100
gnu: cross-toolchain: Add set-cross-path for AVR.
* gnu/build/cross-toolchain.scm (set-cross-path/avr): New procedure.
(cross-gcc-build-phases) [string-prefix? "avr"]: Return
set-cross-path/avr procedure.
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Change-Id: I00bd39236ac2e31fef02164a7fffc8b56a166f0d
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
---
gnu/build/cross-toolchain.scm | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm
index 1933b3e49a..da9016488f 100644
--- a/gnu/build/cross-toolchain.scm
+++ b/gnu/build/cross-toolchain.scm
@@ -168,6 +168,31 @@ C_*INCLUDE_PATH."
(cons "LIBRARY_PATH" %gcc-include-paths))
#t))
+(define* (set-cross-path/avr #:key inputs #:allow-other-keys)
+ (match (assoc-ref inputs "libc")
+ ((? string? libc)
+ (define (cross? x)
+ ;; Return #t if X is a cross-libc.
+ (string-prefix? libc x))
+
+ (let ((cpath (string-append libc "/avr/include")))
+ (for-each (cut setenv <> cpath)
+ %gcc-cross-include-paths))
+
+ (setenv "CROSS_LIBRARY_PATH"
+ (string-append libc "/avr/lib"))
+
+ (for-each (lambda (var)
+ (and=> (getenv var)
+ (lambda (value)
+ (let* ((path (search-path-as-string->list value))
+ (native-path (list->search-path-as-string
+ (remove cross? path) ":")))
+ (setenv var native-path)))))
+ (cons "LIBRARY_PATH" %gcc-include-paths)))
+ ;; AVR sans-libc cross-compiler.
+ (else #t)))
+
(define (install-strip . _)
"Install a stripped GCC."
;; Unlike our 'strip' phase, this will do the right thing for
@@ -186,9 +211,11 @@ a target triplet."
;; in (guix utils), but (guix utils) is too large too copy over to the
;; build side entirely and for now we have no way to select variables to
;; copy over. See (gnu packages cross-base) for more details.
- (if (string-suffix? "-mingw32" target)
- (cut set-cross-path/mingw #:target target <...>)
- set-cross-path))
+ (cond
+ ((string-suffix? "-mingw32" target)
+ (cut set-cross-path/mingw #:target target <...>))
+ ((string-prefix? "avr" target) set-cross-path/avr)
+ (#t set-cross-path)))
(add-after 'install 'make-cross-binutils-visible
(cut make-cross-binutils-visible #:target target <...>))
(replace 'install install-strip)))
- branch master updated (8e61e63515 -> 911c3deb40), guix-commits, 2023/12/11
- 01/23: gnu: cross-libc: Return #f if no libc available., guix-commits, 2023/12/11
- 02/23: guix: gnu-build-system: Handle missing libc., guix-commits, 2023/12/11
- 06/23: gnu: make-avr-libc: Fix synopsis., guix-commits, 2023/12/11
- 10/23: gnu: cross-gcc: Handle AVR inputs., guix-commits, 2023/12/11
- 09/23: gnu: cross-libc: Add AVR Libc support., guix-commits, 2023/12/11
- 12/23: gnu: cross-gcc: Find AVR Libc files., guix-commits, 2023/12/11
- 11/23: gnu: cross-toolchain: Add set-cross-path for AVR.,
guix-commits <=
- 13/23: gnu: cross-gcc: Only C and C++ for AVR., guix-commits, 2023/12/11
- 17/23: gnu: Add gcc-cross-avr-toolchain., guix-commits, 2023/12/11
- 20/23: gnu: lufa: Use AVR target., guix-commits, 2023/12/11
- 04/23: guix: Add target-avr?., guix-commits, 2023/12/11
- 07/23: gnu: cross-gcc: Enable multilib for AVR., guix-commits, 2023/12/11
- 03/23: guix: Add avr platform., guix-commits, 2023/12/11
- 08/23: gnu: cross-gcc: Handle target include paths., guix-commits, 2023/12/11
- 15/23: guix: meson-build-system: Disable PIC for AVR., guix-commits, 2023/12/11
- 22/23: gnu: Add gcc-cross-x86_64-w64-mingw32-toolchain., guix-commits, 2023/12/11
- 05/23: gnu: microscheme: Move to avr-xyz., guix-commits, 2023/12/11