X-Git-Url: https://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/84157bb8bf2c610584e0836047da4c710f8eaf76..48623f5be854e923b04ae83a1a882ff1cefdc742:/gnu/packages/cross-base.scm diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 47e0958193..abc3a2821c 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès ;;; Copyright © 2014, 2015 Mark H Weaver ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis @@ -40,10 +40,13 @@ cross-gcc cross-newlib?)) -(define %xgcc +(define-syntax %xgcc ;; GCC package used as the basis for cross-compilation. It doesn't have to ;; be 'gcc' and can be a specific variant such as 'gcc-4.8'. - gcc) + ;; + ;; Note: This is a macro so that we do not refer to 'gcc' from the top + ;; level, which would lead to circular-dependency issues. + (identifier-syntax gcc)) (define %gcc-include-paths ;; Environment variables for header search paths. @@ -100,9 +103,9 @@ 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 +114,7 @@ may be either a libc package or #f.)" ;; ;; 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 +186,22 @@ may be either a libc package or #f.)" (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 +223,7 @@ GCC that does not target a libc; otherwise, target that libc." (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 +237,7 @@ GCC that does not target a libc; otherwise, target that libc." ("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) @@ -490,8 +497,8 @@ XBINUTILS and the cross tool chain." ;; (define-public xgcc-armhf ;; (let ((triplet "arm-linux-gnueabihf")) ;; (cross-gcc triplet -;; (cross-binutils triplet) -;; (cross-libc triplet)))) +;; #:xbinutils (cross-binutils triplet) +;; #:libc (cross-libc triplet)))) ;; ;;; We don't do that here because we'd be referring to bindings from (gnu ;;; packages gcc) from the top level, which doesn't play well with circular