From 3bfee8ff0255f43018aedbde0b8710cd8905745f Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 6 Aug 2017 00:13:06 +0300 Subject: gnu: make-u-boot-package: Don't unnecessarily cross-compile. * gnu/packages/bootloaders.scm (make-u-boot-package)[native-inputs]: Only use cross-gcc and cross-binutils if compiling for a different architecture. [arguments]: Only use cross compiling make-flags if cross compiling. --- gnu/packages/bootloaders.scm | 92 ++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index c0d16b6c88..ac18884385 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -333,48 +333,56 @@ also initializes the boards (RAM etc).") (define (make-u-boot-package board triplet) "Returns a u-boot package for BOARD cross-compiled for TRIPLET." - (package - (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))) - (arguments - `(#:modules ((ice-9 ftw) (guix build utils) (guix build gnu-build-system)) - #:test-target "test" - #:make-flags - (list "HOSTCC=gcc" (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))) - (begin - (display "Invalid board name. Valid board names are:") - (let ((suffix-len (string-length "_defconfig"))) - (scandir "configs" - (lambda (file-name) - (when (string-suffix? "_defconfig" file-name) - (format #t - "- ~A\n" - (string-drop-right file-name - suffix-len)))))) - #f))))) - (replace 'install - (lambda* (#:key outputs make-flags #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (libexec (string-append out "/libexec")) - (uboot-files (find-files "." ".*\\.(bin|efi|spl)$"))) - (mkdir-p libexec) - (for-each - (lambda (file) - (let ((target-file (string-append libexec "/" file))) - (mkdir-p (dirname target-file)) - (copy-file file target-file))) - uboot-files))))))))) + (let ((same-arch? (if (string-prefix? (%current-system) triplet) + `#t + `#f))) + (package + (inherit u-boot) + (name (string-append "u-boot-" (string-downcase board))) + (native-inputs + `(,@(if (not same-arch?) + `(("cross-gcc" ,(cross-gcc triplet)) + ("cross-binutils" ,(cross-binutils triplet))) + '()) + ,@(package-native-inputs u-boot))) + (arguments + `(#:modules ((ice-9 ftw) (guix build utils) (guix build gnu-build-system)) + #:test-target "test" + #:make-flags + (list "HOSTCC=gcc" + ,@(if (not same-arch?) + `((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))) + (begin + (display "Invalid board name. Valid board names are:") + (let ((suffix-len (string-length "_defconfig"))) + (scandir "configs" + (lambda (file-name) + (when (string-suffix? "_defconfig" file-name) + (format #t + "- ~A\n" + (string-drop-right file-name + suffix-len)))))) + #f))))) + (replace 'install + (lambda* (#:key outputs make-flags #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (libexec (string-append out "/libexec")) + (uboot-files (find-files "." ".*\\.(bin|efi|spl)$"))) + (mkdir-p libexec) + (for-each + (lambda (file) + (let ((target-file (string-append libexec "/" file))) + (mkdir-p (dirname target-file)) + (copy-file file target-file))) + uboot-files)))))))))) (define-public u-boot-vexpress (make-u-boot-package "vexpress_ca9x4" "arm-linux-gnueabihf")) -- cgit v1.2.3 ad unsigned nar size and download size from substituter....Ludovic Courtès 2021-11-19daemon: Micro-optimize 'deletePath'....Ludovic Courtès 2021-11-16daemon: Do not deduplicate files smaller than 8 KiB....Ludovic Courtès 2021-10-01build: Don’t delete ‘guix-gc.timer’ file....Xinglu Chen 2021-09-20etc: Add systemd files for running ‘guix gc’ periodically...Thiago Jung Bauermann 2021-04-09daemon: 'guix substitute' replies on FD 4....Ludovic Courtès 2021-04-03daemon: Remove dead code....Ludovic Courtès 2021-03-30gnu: guix: Fix openrc init scripts....zimoun 2021-03-18daemon: Prevent privilege escalation with '--keep-failed' [security]....Ludovic Courtès 2021-03-17daemon: Correctly handle '--discover' with no value....Ludovic Courtès