Subject: [bug#66263] [PATCH 16/23] gnu: cross-gcc-search-paths: Handle AVR target.

From: Jean-Pierre De Jesus DIAZ <[email-masked]>
Date: Fri, 29 Sep 2023 11:16:20 +0200

* gnu/packages/cross-base.scm (cross-gcc-search-paths): Handle AVR
  target case.
---
 gnu/packages/cross-base.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 10d912b755..ee90424076 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -267,6 +267,31 @@ (define (cross-gcc-snippet target)
         "-DTOOLDIR_BASE_PREFIX=\\\"../../../../\\\""))
      #t))
 
+(define (cross-gcc-search-paths target)
+  "Return GCC search paths needed for TARGET."
+  (cons (search-path-specification
+          (variable "CROSS_LIBRARY_PATH")
+          (files `("lib" "lib64"
+                   ,@(list (string-append target "/lib")
+                           (string-append target "/lib64")))))
+
+        (map (lambda (variable)
+               (search-path-specification
+                 (variable variable)
+
+                 ;; Add 'include/c++' here so that <cstdlib>'s
+                 ;; "#include_next <stdlib.h>" finds GCC's
+                 ;; <stdlib.h>, not libc's.
+                 (files (match variable
+                          ("CROSS_CPLUS_INCLUDE_PATH"
+                           `("include/c++" "include"
+                             ,@(list (string-append target "/include/c++")
+                                     (string-append target "/include"))))
+                          (_
+                           `("include"
+                             ,@(string-append target "/include")))))))
+             %gcc-cross-include-paths)))
+
 (define* (cross-gcc target
                     #:key
                     (xgcc %xgcc)
-- 
2.34.1