From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Nieuwenhuizen Subject: Re: [PATCH 07/11] gnu: cross-base: Add cross-libtool. Date: Sat, 14 May 2016 22:26:52 +0200 Message-ID: <87wpmw9yib.fsf@drakenvlieg.flower> References: <1462740169-15029-1-git-send-email-janneke@gnu.org> <1462740169-15029-8-git-send-email-janneke@gnu.org> <8737pr3d18.fsf@igalia.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1gER-0005lC-Qy for guix-devel@gnu.org; Sat, 14 May 2016 16:32:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1gEM-0007dZ-O0 for guix-devel@gnu.org; Sat, 14 May 2016 16:32:14 -0400 In-Reply-To: <8737pr3d18.fsf@igalia.com> (Andy Wingo's message of "Mon, 09 May 2016 09:29:07 +0200") 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: Andy Wingo Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain Andy Wingo writes: >> + (arguments >> + `(;; Libltdl is provided as a separate package, so don't install it here. >> + #:configure-flags >> + `("--disable-ltdl-install" >> + ,(string-append "--host=" ,target) >> + ,(string-append "--target=" ,target) >> + ,(string-append "--program-prefix=" ,target "-") >> + ,(string-append "CC=" ,target "-gcc")) > > Is this the right --host setting? I think so. The libtool script uses $host rather than $target in tests like these if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; I have added this comment ;; The libtool script uses `host' rather than `target' to decide ;; whether to use -lc, for example. ,(string-append "--host=" ,target) >> + (for-each (lambda (var) >> + (and=> (getenv var) >> + (lambda (value) >> + (let ((cross >> + (string-append "CROSS_" var))) >> + (setenv cross value)) >> + (unsetenv var)))) >> + '("C_INCLUDE_PATH" >> + "CPLUS_INCLUDE_PATH" >> + "OBJC_INCLUDE_PATH" >> + "OBJCPLUS_INCLUDE_PATH" >> + "LIBRARY_PATH")) >> + #t))))))) > > Ignorant question: Why do we have to do this here? Is libtool a special > case? We should certainly limit the number of places in Guix's code > where we have to do (for-each ... '("C_INCLUDE_PATH" ...)). libtool is `special' when it is built as a cross package, like we do here in cross-libtool. I have added this comment ;; As we are setup as a cross package, PATHs get setup ;; without the CROSS_ prefix. Change that here. (add-before 'configure 'setenv Thanks! Greetings, Jan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0007-gnu-cross-base-Add-cross-libtool.patch >From 78efd3acd57df52ec635de5d306a5d3865b473b6 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 27 Apr 2016 10:33:52 +0200 Subject: [PATCH 07/11] gnu: cross-base: Add cross-libtool. * gnu/packages/cross-base.scm (cross-libtool): New function. --- gnu/packages/cross-base.scm | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 6efd748..18329df 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -22,6 +22,7 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) #:use-module (gnu packages base) + #:use-module (gnu packages autotools) #:use-module (gnu packages bash) #:use-module (gnu packages gawk) #:use-module (gnu packages gcc) @@ -40,6 +41,7 @@ #:use-module (ice-9 match) #:export (cross-binutils cross-libc + cross-libtool cross-gcc cross-newlib?)) @@ -460,6 +462,56 @@ XBINUTILS and the cross tool chain." ,@(package-inputs glibc) ;FIXME: static-bash ,@(package-native-inputs glibc)))))))) +(define* (cross-libtool target + #:optional + (xgcc (cross-gcc target + (cross-binutils target) + (cross-libc target))) + (xbinutils (cross-binutils target)) + (xlibc (cross-libc target))) + (package + (inherit libtool) + (name (string-append "cross-libtool-" target)) + (inputs `(("xlibc" ,xlibc))) + (native-inputs `(,@`(("xgcc" ,xgcc) + ("xbinutils" ,xbinutils) + ("xlibc" ,xlibc)) + ,@(package-native-inputs libtool))) + (arguments + `(;; Libltdl is provided as a separate package, so don't install it here. + #:configure-flags + `("--disable-ltdl-install" + ;; The libtool script uses `host' rather than `target' to decide + ;; whether to use -lc, for example. + ,(string-append "--host=" ,target) + ,(string-append "--target=" ,target) + ,(string-append "--program-prefix=" ,target "-") + ,(string-append "CC=" ,target "-gcc")) + #:tests? #f + #:phases (modify-phases %standard-phases + ;; As we are setup as a cross package, PATHs get setup + ;; without the CROSS_ prefix. Change that here. + (add-before 'configure 'setenv + (lambda* (#:key inputs native-inputs #:allow-other-keys) + (let ((xgcc (assoc-ref inputs "xgcc"))) + (setenv "CPP" (string-append xgcc "/bin/" + ,target "-cpp")) + (setenv "CXXCPP" (string-append xgcc "/bin/" + ,target "-cpp"))) + (for-each (lambda (var) + (and=> (getenv var) + (lambda (value) + (let ((cross + (string-append "CROSS_" var))) + (setenv cross value)) + (unsetenv var)))) + '("C_INCLUDE_PATH" + "CPLUS_INCLUDE_PATH" + "OBJC_INCLUDE_PATH" + "OBJCPLUS_INCLUDE_PATH" + "LIBRARY_PATH")) + #t))))))) + (define (native-libc target) (if (mingw-target? target) mingw-w64 -- 2.7.3 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.nl= =20=20 --=-=-=--