gnu: cross-base: Add 'package-with-patches'.

This is a followup to c1c50cb5b0.

* gnu/packages/cross-base.scm (package-with-patch): Rename to...
(package-with-patches): ... this, and take a list of patches.
(package-with-extra-patches): Use it.
(cross-binutils): Use 'search-patches' instead of 'search-patch'.
This commit is contained in:
Ludovic Courtès 2020-04-03 22:15:27 +02:00
parent f7b5b8cd45
commit b256d13619
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016, 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
@ -70,19 +70,17 @@ (define (cross p target)
`(cons ,(string-append "--target=" target)
,flags))))))
(define (package-with-patch original patch)
"Return package ORIGINAL with PATCH applied."
(define (package-with-patches original patches)
"Return package ORIGINAL with PATCHES applied."
(package (inherit original)
(source (origin (inherit (package-source original))
(patches (list patch))))))
(patches patches)))))
(define (package-with-extra-patches original extra-patches)
(define (package-with-extra-patches original patches)
"Return package ORIGINAL with all PATCHES appended to its list of patches."
(let ((original-origin (package-source original)))
(package (inherit original)
(source (origin (inherit original-origin)
(patches `(,@extra-patches
,@(origin-patches original-origin))))))))
(package-with-patches original
(append (origin-patches (package-source original))
patches)))
(define (cross-binutils target)
"Return a cross-Binutils for TARGET."
@ -106,9 +104,9 @@ (define (cross-binutils target)
;; For Xtensa, apply Qualcomm's patch.
(cross (cond ((string-prefix? "xtensa-" target)
(package-with-patch binutils
(search-patch
"ath9k-htc-firmware-binutils.patch")))
(package-with-patches binutils
(search-patches
"ath9k-htc-firmware-binutils.patch")))
((target-mingw? target)
(package-with-extra-patches
binutils