@@ -97,6 +97,31 @@ (define (cross? x)
;; We're building the sans-libc cross-compiler, so nothing to do.
#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* (set-cross-path/mingw #:key inputs target #:allow-other-keys)
"Add the cross MinGW headers to CROSS_C_*_INCLUDE_PATH, and remove them from
C_*INCLUDE_PATH."
@@ -174,13 +199,15 @@ (define* (cross-gcc-build-phases target
a target triplet."
(modify-phases phases
(add-before 'configure 'set-cross-path
- ;; This mingw32 target checking logic should match that of target-mingw?
- ;; 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
+ ;; This mingw32 target checking logic should match that of target-mingw?
+ ;; 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.
+ ((string-suffix? "-mingw32" target)
+ (cut set-cross-path/mingw #:target target <...>))
+ ((string-prefix? "avr" target) set-cross-path/avr)
+ (else set-cross-path)))
(add-after 'install 'make-cross-binutils-visible
(cut make-cross-binutils-visible #:target target <...>))
(replace 'install install-strip)))