summary refs log tree commit diff
path: root/gnu/packages/cross-base.scm
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2020-03-24 15:39:06 -0400
committerCarl Dong <contact@carldong.me>2020-04-02 17:59:53 -0400
commit79825bee07fceb781efc40a8c56a85aac13bba5a (patch)
tree6e4426eb273711bf96196e3ada9e776acf501af3 /gnu/packages/cross-base.scm
parent5517750344be05c91bc2979c1a0e2348a9ae902d (diff)
downloadguix-79825bee07fceb781efc40a8c56a85aac13bba5a.tar.gz
gnu: cross-base: Add mingw-w64 specific binutils patches.
These patches were originally found at the debian mingw-w64 team's
binutils repo, and should improve the reproducibility of our mingw-w64
toolchain.

* gnu/packages/patches/binutils-mingw-w64-reproducible-import-libraries.patch:
New file.
* gnu/packages/patches/binutils-mingw-w64-specify-timestamp.patch:
New file.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
* gnu/packages/cross-base.scm (cross-binutils): Apply relevant patches
if target is mingw-w64.
(package-with-extra-patches): New procedure.
Diffstat (limited to 'gnu/packages/cross-base.scm')
-rw-r--r--gnu/packages/cross-base.scm22
1 files changed, 17 insertions, 5 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index ab866eebc6..945ef12088 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -76,6 +76,12 @@
     (source (origin (inherit (package-source original))
               (patches (list patch))))))
 
+(define (package-with-extra-patches original patches)
+  "Return package ORIGINAL with all PATCHES appended to its list of patches."
+  (package-with-patch original
+                      `(,@(origin-patches (package-source original))
+                        ,@patches))
+
 (define (cross-binutils target)
   "Return a cross-Binutils for TARGET."
   (let ((binutils (package (inherit binutils)
@@ -97,11 +103,17 @@
                         `(cons "--with-sysroot=/" ,flags)))))))
 
     ;; For Xtensa, apply Qualcomm's patch.
-    (cross (if (string-prefix? "xtensa-" target)
-               (package-with-patch binutils
-                                   (search-patch
-                                    "ath9k-htc-firmware-binutils.patch"))
-               binutils)
+    (cross (cond ((string-prefix? "xtensa-" target)
+                  (package-with-patch binutils
+                                      (search-patch
+                                       "ath9k-htc-firmware-binutils.patch")))
+                 ((target-mingw? target)
+                  (package-with-extra-patches
+                   binutils
+                   (search-patches
+                    "binutils-mingw-w64-specify-timestamp.patch"
+                    "binutils-mingw-w64-reproducible-import-libraries.patch")))
+                 (else binutils))
            target)))
 
 (define (cross-gcc-arguments target xgcc libc)