guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system hea


From: Eric Bavier
Subject: Re: [PATCH v5 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
Date: Tue, 26 Apr 2016 22:15:37 -0500

On Wed, 27 Apr 2016 00:23:29 +0200
Jan Nieuwenhuizen <address@hidden> wrote:

> Hi!
> 
> With this new patch set, mingw guile.exe runs; Yay!  I have cleaned-up
> the cross-base.scm and gcc patch (thanks Andy!).  It can be built doing
> 
>     ./pre-inst-env guix build --target=i686-w64-mingw32 guile

That exciting.

Just a few comments:

> From af9fa5754a1c85cc22ae3056945f841acdf1d72d Mon Sep 17 00:00:00 2001
> From: Jan Nieuwenhuizen <address@hidden>
> Date: Tue, 26 Apr 2016 10:51:52 +0200
> Subject: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system
>  headers.
> 
> * gnu/packages/patches/gcc-cross-environment-variables.patch: Also use CROSS_
>   variants: CROSS_C_INCLUDE_PATH, CROSS_CPLUS_INCLUDE_PATH,
>   CROSS_OBJC_INCLUDE_PATH, CROSS_OBJCPLUS_INCLUDE_PATH to be used for system
>   libraries, see
>   https://lists.gnu.org/archive/html/guix-devel/2016-04/msg00620.html.
> * gnu/packages/cross-base.scm (cross-gcc, cross-gcc-arguments, cross-libc):
>   Use CROSS_*_INCLUDE_PATH (WAS: CPATH).

We've started following the Changelog conventions more closely lately,
notably the lack of indentation spacing on newlines.

> ---
>  gnu/packages/cross-base.scm                        | 68 +++++++++++++--------
>  .../patches/gcc-cross-environment-variables.patch  | 70 
> ++++++++++++++++------
>  2 files changed, 95 insertions(+), 43 deletions(-)
> 
> diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
> index 8bd599c..c5bf66f 100644
> --- a/gnu/packages/cross-base.scm
> +++ b/gnu/packages/cross-base.scm
> @@ -1,6 +1,7 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <address@hidden>
>  ;;; Copyright © 2014, 2015 Mark H Weaver <address@hidden>
> +;;; Copyright © 2016 Jan Nieuwenhuizen <address@hidden>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -31,6 +32,7 @@
>    #:use-module (guix build-system trivial)
>    #:use-module (srfi srfi-1)
>    #:use-module (srfi srfi-26)
> +  #:use-module (ice-9 and-let-star)
>    #:use-module (ice-9 match)
>    #:export (cross-binutils
>              cross-libc
> @@ -174,28 +176,32 @@ may be either a libc package or #f.)"
>                        ;; Return #t if X is a cross-libc or cross Linux.
>                        (or (string-prefix? libc x)
>                            (string-prefix? linux x)))
> -
> -                    (setenv "CROSS_CPATH"
> -                            (string-append libc "/include:"
> -                                           linux "/include"))
> +                    (let ((cpath (string-append
> +                                  libc "/include"
> +                                  ":" linux "/include")))

I prefer the old alignment of the string-append (nitpick).

> +                      (for-each (cut setenv <> cpath)
> +                                '("CROSS_C_INCLUDE_PATH"
> +                                  "CROSS_CPLUS_INCLUDE_PATH"
> +                                  "CROSS_OBJC_INCLUDE_PATH"
> +                                  "CROSS_OBJCPLUS_INCLUDE_PATH")))
>                      (setenv "CROSS_LIBRARY_PATH"
>                              (string-append libc "/lib"))
> -
> -                    (let ((cpath   (search-path-as-string->list
> -                                    (getenv "C_INCLUDE_PATH")))
> -                          (libpath (search-path-as-string->list
> -                                    (getenv "LIBRARY_PATH"))))
> -                      (setenv "CPATH"
> -                              (list->search-path-as-string
> -                               (remove cross? cpath) ":"))
> -                      (for-each unsetenv
> -                                '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
> -                      (setenv "LIBRARY_PATH"
> -                              (list->search-path-as-string
> -                               (remove cross? libpath) ":"))
> -                      #t)))
> -                ,phases)
> -              phases)))))))
> +                    (setenv "CPP" (string-append gcc "/bin/cpp"))
> +                    (for-each (lambda (var)
> +                                (and-let* ((value (getenv var))
> +                                           (path (search-path-as-string->list
> +                                                  value))
> +                                           (native-path
> +                                            (list->search-path-as-string
> +                                             (remove cross? path) ":")))
> +                                  (setenv var native-path)))
> +                              '("C_INCLUDE_PATH"
> +                                "CPLUS_INCLUDE_PATH"
> +                                "OBJC_INCLUDE_PATH"
> +                                "OBJCPLUS_INCLUDE_PATH"
> +                                "LIBRARY_PATH"))))
> +               ,phases))
> +            (else phases))))))))

The phase overall should result in a boolean, but the for-each here
returns undefined.  There has been sentiment around here to avoid
and-let* where possibly; 'and=>' should work nicely in this case, since
there's only a single application that could return #f.

>  
>  (define (cross-gcc-patches target)
>    "Return GCC patches needed for TARGET."
> @@ -228,6 +234,7 @@ GCC that does not target a libc; otherwise, target that 
> libc."
>       `(#:implicit-inputs? #f
>         #:modules ((guix build gnu-build-system)
>                    (guix build utils)
> +                  (ice-9 and-let-star)
>                    (ice-9 regex)
>                    (srfi srfi-1)
>                    (srfi srfi-26))
> @@ -261,7 +268,16 @@ GCC that does not target a libc; otherwise, target that 
> libc."
>      ;; Only search target inputs, not host inputs.
>      (search-paths
>       (list (search-path-specification
> -            (variable "CROSS_CPATH")
> +            (variable "CROSS_C_INCLUDE_PATH")
> +            (files '("include")))
> +           (search-path-specification
> +            (variable "CROSS_CPLUS_INCLUDE_PATH")
> +            (files '("include")))
> +           (search-path-specification
> +            (variable "CROSS_OBJC_INCLUDE_PATH")
> +            (files '("include")))
> +           (search-path-specification
> +            (variable "CROSS_OBJCPLUS_INCLUDE_PATH")
>              (files '("include")))
>             (search-path-specification
>              (variable "CROSS_LIBRARY_PATH")
> @@ -316,9 +332,13 @@ XBINUTILS and the cross tool chain."
>          `(alist-cons-before
>            'configure 'set-cross-linux-headers-path
>            (lambda* (#:key inputs #:allow-other-keys)
> -            (let ((linux (assoc-ref inputs "linux-headers")))
> -              (setenv "CROSS_CPATH"
> -                      (string-append linux "/include"))
> +            (let* ((linux (assoc-ref inputs "linux-headers"))
> +                   (cpath (string-append linux "/include")))

Based on the module added above, did you mean to use and-let* here?

`~Eric



reply via email to

[Prev in Thread] Current Thread [Next in Thread]