From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <20160426221537.10eccb14@openmailbox.org> References: <87lh4080wu.fsf@drakenvlieg.flower> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avFxS-0001Lt-4k for guix-devel@gnu.org; Tue, 26 Apr 2016 23:16:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avFxO-0003eW-SO for guix-devel@gnu.org; Tue, 26 Apr 2016 23:16:10 -0400 Received: from smtp25.openmailbox.org ([62.4.1.59]:45421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avFxO-0003e2-G9 for guix-devel@gnu.org; Tue, 26 Apr 2016 23:16:06 -0400 In-Reply-To: <87lh4080wu.fsf@drakenvlieg.flower> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Jan Nieuwenhuizen Cc: guix-devel@gnu.org On Wed, 27 Apr 2016 00:23:29 +0200 Jan Nieuwenhuizen wrote: > Hi! >=20 > 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 >=20 > ./pre-inst-env guix build --target=3Di686-w64-mingw32 guile That exciting. Just a few comments: > From af9fa5754a1c85cc22ae3056945f841acdf1d72d Mon Sep 17 00:00:00 2001 > From: Jan Nieuwenhuizen > Date: Tue, 26 Apr 2016 10:51:52 +0200 > Subject: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system > headers. >=20 > * gnu/packages/patches/gcc-cross-environment-variables.patch: Also use CR= OSS_ > variants: CROSS_C_INCLUDE_PATH, CROSS_CPLUS_INCLUDE_PATH, > CROSS_OBJC_INCLUDE_PATH, CROSS_OBJCPLUS_INCLUDE_PATH to be used for sys= tem > 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(-) >=20 > 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 =C2=A9 2013, 2014, 2015, 2016 Ludovic Court=C3=A8s > ;;; Copyright =C2=A9 2014, 2015 Mark H Weaver > +;;; Copyright =C2=A9 2016 Jan Nieuwenhuizen > ;;; > ;;; 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=3D>' should work nicely in this case, since there's only a single application that could return #f. > =20 > (define (cross-gcc-patches target) > "Return GCC patches needed for TARGET." > @@ -228,6 +234,7 @@ GCC that does not target a libc; otherwise, target th= at 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 t= hat 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