hako pushed a commit to branch wip-zig-bootstrap
in repository guix.
commit cbb44fcaf307899c69c5d8c87c35d9a9751be21f
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 302d096976..fe9a0d68d4 100644
--- a/guix/build/zig-build-system.scm
+++ b/guix/build/zig-build-system.scm
@@ -52,6 +52,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
@@ -67,7 +78,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))