diff mbox

[6/6] gnu: make-u-boot-package: Don't cross compile on arm.

Message ID 20160926103447.31830-6-david@craven.ch
State New
Headers show

Commit Message

David Craven Sept. 26, 2016, 10:34 a.m. UTC
* gnu/packages/u-boot.scm (make-u-boot-package): Don't cross compile on
  arm.
---
 gnu/packages/u-boot.scm | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/gnu/packages/u-boot.scm b/gnu/packages/u-boot.scm
index 60fd48f..d8b8291 100644
--- a/gnu/packages/u-boot.scm
+++ b/gnu/packages/u-boot.scm
@@ -88,20 +88,24 @@  also initializes the boards (RAM etc).")
     (inherit u-boot)
     (name (string-append "u-boot-" (string-downcase board)))
     (native-inputs
-     `(("cross-gcc" ,(cross-gcc triplet))
-       ("cross-binutils" ,(cross-binutils triplet))
-       ,@(package-native-inputs u-boot)))
+     `(,@(package-native-inputs u-boot)
+       ,@(if triplet
+             `(("cross-gcc" ,(cross-gcc triplet))
+               ("cross-binutils" ,(cross-binutils triplet)))
+             '())))
     (arguments
      `(#:test-target "test"
        #:make-flags
-       (list "HOSTCC=gcc" (string-append "CROSS_COMPILE=" ,triplet "-"))
+       (list "HOSTCC=gcc" ,@(if triplet
+                                `((string-append "CROSS_COMPILE=" ,triplet "-"))
+                                '()))
        #:phases
        (modify-phases %standard-phases
          (replace 'configure
            (lambda* (#:key outputs make-flags #:allow-other-keys)
              (let ((config-name (string-append ,board "_defconfig")))
                (if (file-exists? (string-append "configs/" config-name))
-                   (zero? (apply system* "make" `(,@make-flags ,config-name)))
+                   (zero? (apply system* "make" (cons config-name make-flags)))
                    (begin
                      (display "Invalid board name. Valid board names are:")
                      (let ((dir (opendir "configs"))
@@ -124,10 +128,19 @@  also initializes the boards (RAM etc).")
                        '(,@files-to-install)))))))))
 
 (define-public u-boot-vexpress
-  (make-u-boot-package "vexpress_ca9x4" "arm-linux-gnueabihf" '("u-boot.bin")))
+  (make-u-boot-package
+   "vexpress_ca9x4"
+   (if (string-prefix? "armhf" (%current-system)) #f "arm-linux-gnueabihf")
+   '("u-boot.bin")))
 
 (define-public u-boot-malta
-  (make-u-boot-package "malta" "mips64el-linux-gnuabi64" '("u-boot.bin")))
+  (make-u-boot-package
+   "malta"
+   (if (string-prefix? "mips64el" (%current-system)) #f "mips64el-linux-gnuabi64")
+   '("u-boot.bin")))
 
 (define-public u-boot-beagle-bone-black
-  (make-u-boot-package "am335x_boneblack" "arm-linux-gnueabihf" '("MLO" "u-boot.img")))
+  (make-u-boot-package
+   "am335x_boneblack"
+   (if (string-prefix? "armhf" (%current-system)) #f "arm-linux-gnueabihf")
+   '("MLO" "u-boot.img")))