diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-11-11 21:54:41 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-11-11 22:36:49 +0100 |
commit | 1306b0b003a557105d3b27e44052db217c7283d3 (patch) | |
tree | 37e1385ee79afd9495291a3898701fc57732f308 /gnu/packages/cross-base.scm | |
parent | 594340bc79586f6880231b52fc94d100309fec45 (diff) |
gnu: cross-base: Apply Qualcomm's patches for Binutils and GCC.
This fixes compilation of the ath9k-htc firmware. Before that, loading
it would result in "Target is unresponsive". The patches come from
the ath9k-htc firmware source.
* gnu/packages/patches/ath9k-htc-firmware-binutils.patch,
gnu/packages/patches/ath9k-htc-firmware-gcc.patch: New files.
* gnu-system.am (dist_patch_DATA): Add them.
* gnu/packages/cross-base.scm (package-with-patch): New procedure.
(cross-binutils): Check whether TARGET starts with "xtensa-", and call
'package-with-patch' when it does.
(cross-gcc-patches): New procedure.
(cross-gcc): Use it to add patches.
Diffstat (limited to 'gnu/packages/cross-base.scm')
-rw-r--r-- | gnu/packages/cross-base.scm | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index a91952daca..a68711c91f 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -45,6 +45,12 @@ `(cons ,(string-append "--target=" target) ,flags)))))) +(define (package-with-patch original patch) + "Return package ORIGINAL with PATCH applied." + (package (inherit original) + (source (origin (inherit (package-source original)) + (patches (list patch)))))) + (define (cross-binutils target) "Return a cross-Binutils for TARGET." (let ((binutils (package (inherit binutils) @@ -64,7 +70,14 @@ ;; practice the RUNPATH of target libs only refers to ;; target libs, not native libs, so this is safe. `(cons "--with-sysroot=/" ,flags))))))) - (cross binutils target))) + + ;; For Xtensa, apply Qualcomm's patch. + (cross (if (string-prefix? "xtensa-" target) + (package-with-patch binutils + (search-patch + "ath9k-htc-firmware-binutils.patch")) + binutils) + target))) (define (cross-gcc-arguments target libc) "Return build system arguments for a cross-gcc for TARGET, using LIBC (which @@ -165,6 +178,13 @@ may be either a libc package or #f.)" ;; for instance. #f)))) +(define (cross-gcc-patches target) + "Return GCC patches needed for TARGET." + (cond ((string-prefix? "xtensa-" target) + ;; Patch by Qualcomm needed to build the ath9k-htc firmware. + (list (search-patch "ath9k-htc-firmware-gcc.patch"))) + (else '()))) + (define* (cross-gcc target #:optional (xbinutils (cross-binutils target)) libc) "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use @@ -176,8 +196,8 @@ GCC that does not target a libc; otherwise, target that libc." target)) (source (origin (inherit (package-source gcc-4.8)) (patches - (list (search-patch - "gcc-cross-environment-variables.patch"))))) + (cons (search-patch "gcc-cross-environment-variables.patch") + (cross-gcc-patches target))))) ;; For simplicity, use a single output. Otherwise libgcc_s & co. are not ;; found by default, etc. |