summary refs log tree commit diff
path: root/gnu/packages/base.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-04-03 21:26:24 +0200
committerLudovic Courtès <ludo@gnu.org>2015-04-03 22:31:15 +0200
commit4a740d0fec9ee3813417145816c521757cd1cc64 (patch)
tree0447506f87656364867e328b8d6e0bf6e5801b38 /gnu/packages/base.scm
parent9bab6bea86e83c1aae355a7654263a87f0a4c130 (diff)
downloadguix-4a740d0fec9ee3813417145816c521757cd1cc64.tar.gz
gnu: cross-base: Use an 'ld' wrapper also when cross-compiling.
* gnu/packages/base.scm (make-ld-wrapper): Add #:target parameter and
  honor it.
* gnu/packages/cross-base.scm (cross-gcc-arguments)[#:phases]
  <make-cross-binutils-visible>: Refer to the ld wrapper.
  (cross-gcc)[native-inputs]: Add "ld-wrapper-cross".
Diffstat (limited to 'gnu/packages/base.scm')
-rw-r--r--gnu/packages/base.scm20
1 files changed, 14 insertions, 6 deletions
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index c935784663..0c12505724 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -358,11 +358,14 @@ included.")
    (license gpl3+)
    (home-page "http://www.gnu.org/software/binutils/")))
 
-(define* (make-ld-wrapper name #:key binutils guile bash
+(define* (make-ld-wrapper name #:key binutils
+                          (guile (canonical-package guile-2.0))
+                          (bash (canonical-package bash)) target
                           (guile-for-build guile))
   "Return a package called NAME that contains a wrapper for the 'ld' program
-of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line.  The
-wrapper uses GUILE and BASH."
+of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line.  When
+TARGET is not #f, make a wrapper for the cross-linker for TARGET, called
+'TARGET-ld'.  The wrapper uses GUILE and BASH."
   (package
     (name name)
     (version "0")
@@ -382,8 +385,10 @@ wrapper uses GUILE and BASH."
 
                    (let* ((out (assoc-ref %outputs "out"))
                           (bin (string-append out "/bin"))
-                          (ld  (string-append bin "/ld"))
-                          (go  (string-append bin "/ld.go")))
+                          (ld  ,(if target
+                                    `(string-append bin "/" ,target "-ld")
+                                    '(string-append bin "/ld")))
+                          (go  (string-append ld ".go")))
 
                      (setvbuf (current-output-port) _IOLBF)
                      (format #t "building ~s/bin/ld wrapper in ~s~%"
@@ -403,7 +408,10 @@ wrapper uses GUILE and BASH."
                                        "/bin/bash"))
                        (("@LD@")
                         (string-append (assoc-ref %build-inputs "binutils")
-                                       "/bin/ld")))
+                                       ,(if target
+                                            (string-append "/bin/"
+                                                           target "-ld")
+                                            "/bin/ld"))))
                      (chmod ld #o555)
                      (compile-file ld #:output-file go)))))
     (synopsis "The linker wrapper")