hako pushed a commit to branch wip-zig-bootstrap
in repository guix.
commit 130c1d3e7f4293dd603a7bfdfa428626e51ea8d4
Author: Efraim Flashner <[email protected]>
AuthorDate: Sat Nov 16 23:16:36 2024 +0200
build/zig: Adjust the build triplets for some systems.
* guix/build/zig-build-system.scm (zig-target): New procedure.
(build): Use it to set the target when cross-compiling.
Change-Id: Ic82253ce899055526e894a0cb67738ddbb476574
---
guix/build/zig-build-system.scm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/guix/build/zig-build-system.scm b/guix/build/zig-build-system.scm
index 5deb5d57f5..fe58c5e345 100644
--- a/guix/build/zig-build-system.scm
+++ b/guix/build/zig-build-system.scm
@@ -54,6 +54,17 @@ gcc_dir=")
port)
(close-port port)))
+(define (zig-target target)
+ (cond ((string=? "i686-linux-gnu" target)
+ "x86-linux-gnu")
+ ((string=? "i586-pc-gnu" target)
+ "x86-hurd-gnu")
+ ((string=? "x86_64-w64-mingw32" target)
+ "x86_64-windows-gnu")
+ ((string=? "i686-w64-mingw32" target)
+ "x86-windows-gnu")
+ (else target)))
+
(define* (build #:key
zig-build-flags
zig-release-type ;; "safe", "fast" or "small" empty for a
@@ -69,7 +80,7 @@ gcc_dir=")
"--prefix-exe-dir" "bin"
"--prefix-include-dir" "include"
,@(if target
- (list (string-append "-Dtarget=" target))
+ (list (string-append "-Dtarget=" (zig-target target)))
'())
,@(if zig-release-type
(list (string-append "-Drelease-" zig-release-type))