From: Eric Bavier <ericbavier@openmailbox.org>
To: Jan Nieuwenhuizen <janneke@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH v5 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
Date: Tue, 26 Apr 2016 22:15:37 -0500 [thread overview]
Message-ID: <20160426221537.10eccb14@openmailbox.org> (raw)
In-Reply-To: <87lh4080wu.fsf@drakenvlieg.flower>
On Wed, 27 Apr 2016 00:23:29 +0200
Jan Nieuwenhuizen <janneke@gnu.org> 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 <janneke@gnu.org>
> 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 <ludo@gnu.org>
> ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
> +;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
> ;;;
> ;;; 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
next prev parent reply other threads:[~2016-04-27 3:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 22:23 [PATCH v5 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
2016-04-27 3:15 ` Eric Bavier [this message]
2016-04-27 6:57 ` Jan Nieuwenhuizen
2016-04-27 10:20 ` Andy Wingo
2016-04-27 15:25 ` Jan Nieuwenhuizen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160426221537.10eccb14@openmailbox.org \
--to=ericbavier@openmailbox.org \
--cc=guix-devel@gnu.org \
--cc=janneke@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.