aboutsummaryrefslogtreecommitdiff
path: root/gnu/build/cross-toolchain.scm
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2019-08-14 13:46:53 -0400
committerJan Nieuwenhuizen <janneke@gnu.org>2019-08-14 21:29:53 +0200
commit67dac6b8920755cb011047157bb7b4fae4760143 (patch)
tree897ea1e967ae6848874d7068f8287e59f5adbef7 /gnu/build/cross-toolchain.scm
parent4afdb792497472b968d818a3ed942beb70210389 (diff)
downloadguix-67dac6b8920755cb011047157bb7b4fae4760143.tar
guix-67dac6b8920755cb011047157bb7b4fae4760143.tar.gz
gnu: mingw: Add x86_64 support.
This patch parameterizes previously hard-coded instances of i686-w64-mingw32, adding support for x86_64-w64-mingw32. * gnu/packages/mingw.scm (make-mingw-w64): New procedure. (mingw-w64-i686, mingw-w64-x86_64): New variables. (%mingw-triplet): Remove. (mingw-w64): Update to point to 'mingw-w64-i686'. * gnu/packages/cross-base.scm (cross-gcc): Use 'libc' keyword argument if specified, instead of treating it as a boolean. (native-libc): Return the correct mingw-w64 depending on machine specified in target. * gnu/packages/bootstrap.scm (glibc-dynamic-linker): Add "x86_64-mingw". * gnu/build/cross-toolchain.scm (set-cross-path/mingw): Replace hardcoded 'i686-w64-mingw32' instances with 'target' keyword argument. (cross-gcc-build-phases): Update accordingly; use 'target-mingw?' implementation of target checking and add commentary. * gnu/ci.scm (%cross-targets): Add "x86_64-w64-mingw32".
Diffstat (limited to 'gnu/build/cross-toolchain.scm')
-rw-r--r--gnu/build/cross-toolchain.scm15
1 files changed, 10 insertions, 5 deletions
diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm
index d430b8afc4..201b36ff7c 100644
--- a/gnu/build/cross-toolchain.scm
+++ b/gnu/build/cross-toolchain.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
+;;; Copyright © 2019 Carl Dong <contact@carldong.me>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -95,7 +96,7 @@ C_INCLUDE_PATH et al."
;; We're building the sans-libc cross-compiler, so nothing to do.
#t)))
-(define* (set-cross-path/mingw #:key inputs #:allow-other-keys)
+(define* (set-cross-path/mingw #:key inputs target #:allow-other-keys)
"Add the cross MinGW headers to CROSS_C_*_INCLUDE_PATH, and remove them from
C_*INCLUDE_PATH."
(let ((libc (assoc-ref inputs "libc"))
@@ -112,7 +113,7 @@ C_*INCLUDE_PATH."
(if libc
(let ((cpath (string-append libc "/include"
- ":" libc "/i686-w64-mingw32/include")))
+ ":" libc "/" target "/include")))
(for-each (cut setenv <> cpath)
%gcc-cross-include-paths))
@@ -142,7 +143,7 @@ C_*INCLUDE_PATH."
(when libc
(setenv "CROSS_LIBRARY_PATH"
(string-append libc "/lib"
- ":" libc "/i686-w64-mingw32/lib")))
+ ":" libc "/" target "/lib")))
(setenv "CPP" (string-append gcc "/bin/cpp"))
(for-each (lambda (var)
@@ -168,8 +169,12 @@ C_*INCLUDE_PATH."
a target triplet."
(modify-phases phases
(add-before 'configure 'set-cross-path
- (if (string-contains target "mingw")
- set-cross-path/mingw
+ ;; This mingw32 target checking logic should match that of target-mingw?
+ ;; in (guix utils), but (guix utils) is too large too copy over to the
+ ;; build side entirely and for now we have no way to select variables to
+ ;; copy over. See (gnu packages cross-base) for more details.
+ (if (string-suffix? "-mingw32" target)
+ (cut set-cross-path/mingw #:target target <...>)
set-cross-path))
(add-after 'install 'make-cross-binutils-visible
(cut make-cross-binutils-visible #:target target <...>))