guix-commits
[Top][All Lists]
Advanced

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

07/07: gnu: u-boot: Fix target/system comparison in 'make-u-boot-package


From: guix-commits
Subject: 07/07: gnu: u-boot: Fix target/system comparison in 'make-u-boot-package'.
Date: Wed, 17 Jul 2019 09:40:10 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 6bfcb729268e0d20c6ae78224aef0eaad2ee2e74
Author: Ludovic Courtès <address@hidden>
Date:   Wed Jul 17 15:23:04 2019 +0200

    gnu: u-boot: Fix target/system comparison in 'make-u-boot-package'.
    
    Until now, running, say:
    
      guix build -e '(@@ (gnu packages bootloaders) 
u-boot-a20-olinuxino-micro)' \
        -s armhf-linux
    
    on an x86_64-linux machine wouldn't have the desired effect
    because (%current-system) would return "x86_64-linux" when 'same-arch?'
    was evaluated.  This fixes that.
    
    * gnu/packages/bootloaders.scm (make-u-boot-package)[same-arch?]: Turn
    into a thunk so that (%current-system) is evaluated in the right
    context, and adjust callers.  Use 'string=?' instead of 'string-prefix?'.
---
 gnu/packages/bootloaders.scm | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index dda258a..41a2de9 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -524,17 +524,16 @@ board-independent tools.")))
 
 (define-public (make-u-boot-package board triplet)
   "Returns a u-boot package for BOARD cross-compiled for TRIPLET."
-  (let ((same-arch? (if (string-prefix? (%current-system)
-                                        (gnu-triplet->nix-system triplet))
-                      `#t
-                      `#f)))
+  (let ((same-arch? (lambda ()
+                      (string=? (%current-system)
+                                (gnu-triplet->nix-system triplet)))))
     (package
       (inherit u-boot)
       (name (string-append "u-boot-"
                            (string-replace-substring (string-downcase board)
                                                      "_" "-")))
       (native-inputs
-       `(,@(if (not same-arch?)
+       `(,@(if (not (same-arch?))
              `(("cross-gcc" ,(cross-gcc triplet #:xgcc gcc-7))
                ("cross-binutils" ,(cross-binutils triplet)))
              `(("gcc-7" ,gcc-7)))
@@ -547,7 +546,7 @@ board-independent tools.")))
          #:test-target "test"
          #:make-flags
          (list "HOSTCC=gcc"
-               ,@(if (not same-arch?)
+               ,@(if (not (same-arch?))
                    `((string-append "CROSS_COMPILE=" ,triplet "-"))
                    '()))
          #:phases



reply via email to

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