From 7b3318e34f4e2743254a88b908859901db960e9a Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 22 May 2017 16:13:15 +0200 Subject: gnu: Allow overriding of xgcc package in cross-gcc. * gnu/packages/cross-base.scm (cross-gcc-arguments): Take extra "xgcc" argument. (cross-gcc): Use keyword arguments; take optional "xgcc" argument. * gnu/packages/embedded.scm (gcc-arm-none-eabi-4.9, propeller-gcc, gcc-vc4): Use keyword arguments. * gnu/packages/avr.scm (avr-gcc-4.9): Likewise. --- gnu/packages/cross-base.scm | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'gnu/packages/cross-base.scm') diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 47e0958193..54303b7b45 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -100,9 +100,9 @@ (define (cross-binutils target) binutils) target))) -(define (cross-gcc-arguments target libc) - "Return build system arguments for a cross-gcc for TARGET, using LIBC (which -may be either a libc package or #f.)" +(define (cross-gcc-arguments target xgcc libc) + "Return build system arguments for a cross-gcc for TARGET, using XGCC as the +base compiler and using LIBC (which may be either a libc package or #f.)" ;; Set the current target system so that 'glibc-dynamic-linker' returns the ;; right name. (parameterize ((%current-target-system target)) @@ -111,7 +111,7 @@ (define (cross-gcc-arguments target libc) ;; ;; for instance. (let ((args `(#:strip-binaries? #f - ,@(package-arguments %xgcc)))) + ,@(package-arguments xgcc)))) (substitute-keyword-arguments args ((#:configure-flags flags) `(append (list ,(string-append "--target=" target) @@ -183,18 +183,22 @@ (define (cross-gcc-snippet target) (else #f))) (define* (cross-gcc target - #:optional (xbinutils (cross-binutils target)) libc) + #:key + (xgcc %xgcc) + (xbinutils (cross-binutils target)) + (libc #f)) "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use -XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a -GCC that does not target a libc; otherwise, target that libc." - (package (inherit %xgcc) +XGCC as the base compiler. Use XBINUTILS as the associated cross-Binutils. +If LIBC is false, then build a GCC that does not target a libc; otherwise, +target that libc." + (package (inherit xgcc) (name (string-append "gcc-cross-" (if libc "" "sans-libc-") target)) - (source (origin (inherit (package-source %xgcc)) + (source (origin (inherit (package-source xgcc)) (patches (append - (origin-patches (package-source %xgcc)) + (origin-patches (package-source xgcc)) (cons (search-patch "gcc-cross-environment-variables.patch") (cross-gcc-patches target)))) (modules '((guix build utils))) @@ -216,7 +220,7 @@ (define* (cross-gcc target (srfi srfi-26) (ice-9 regex)) - ,@(cross-gcc-arguments target libc))) + ,@(cross-gcc-arguments target xgcc libc))) (native-inputs `(("ld-wrapper-cross" ,(make-ld-wrapper @@ -230,7 +234,7 @@ (define* (cross-gcc target ("libc-native" ,@(assoc-ref (%final-inputs) "libc")) ;; Remaining inputs. - ,@(let ((inputs (append (package-inputs %xgcc) + ,@(let ((inputs (append (package-inputs xgcc) (alist-delete "libc" (%final-inputs))))) (cond ((target-mingw? target) -- cgit v1.2.3