GNU bug report logs - #66263
[PATCH 00/23] guix: Add avr as a platform.

Previous Next

Package: guix-patches;

Reported by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>

Date: Fri, 29 Sep 2023 09:15:02 UTC

Severity: normal

Tags: moreinfo, patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

Bug is archived. No further changes may be made.

Full log


Message #178 received at 66263 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 66263 <at> debbugs.gnu.org
Cc: Jean-Pierre De Jesus DIAZ <me <at> jeandudey.tech>,
 Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v1 11/22] gnu: cross-toolchain: Add set-cross-path for AVR.
Date: Tue, 28 Nov 2023 12:34:54 +0100
* gnu/build/cross-toolchain.scm (set-cross-path/avr): New procedure.
* gnu/build/cross-toolchain.scm (cross-gcc-build-phases)
  [string-prefix? "avr"]: Return set-cross-path/avr procedure.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me <at> jeandudey.tech>
Change-Id: I00bd39236ac2e31fef02164a7fffc8b56a166f0d
---
 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 085b88a2c3..6f5e3b0f57 100644
--- a/gnu/build/cross-toolchain.scm
+++ b/gnu/build/cross-toolchain.scm
@@ -170,6 +170,31 @@ (define (unpacked-mingw-dir)
               (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
@@ -188,9 +213,11 @@ (define* (cross-gcc-build-phases target
       ;; 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)))
-- 
2.41.0





This bug report was last modified 1 year and 220 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.