guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 07/11] gnu: cross-base: Add cross-libtool.


From: Jan Nieuwenhuizen
Subject: Re: [PATCH 07/11] gnu: cross-base: Add cross-libtool.
Date: Sat, 14 May 2016 22:26:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

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

>From 78efd3acd57df52ec635de5d306a5d3865b473b6 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <address@hidden>
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

-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ®  http://AvatarAcademy.nl  

reply via email to

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