diff mbox series

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

Message ID 20230929091627.7820-16-jean@foundationdevices.com
State New
Headers show
Series guix: Add avr as a platform. | expand

Commit Message

Jean-Pierre De Jesus DIAZ Sept. 29, 2023, 9:16 a.m. UTC
* gnu/packages/cross-base.scm (cross-gcc-search-paths): Handle AVR
  target case.
---
 gnu/packages/cross-base.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Maxim Cournoyer Oct. 5, 2023, 3:08 p.m. UTC | #1
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

> * 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)))

That was a bit hard to parse, but LGTM.
diff mbox series

Patch

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)