summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2024-11-16 23:16:36 +0200
committerHilton Chain <hako@ultrarare.space>2024-12-31 10:56:34 +0800
commit18b7fce25cf72b4c86b17af32c2ca094fa79b126 (patch)
treef8aaa40057d4b10b75c3e4fcd6642d69326d7ec5
parent6fc811d02afe792f7ec09b2aa92a87b9ce191321 (diff)
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 Modified-by: Hilton Chain <hako@ultrarare.space> Signed-off-by: Hilton Chain <hako@ultrarare.space>
-rw-r--r--guix/build/zig-build-system.scm20
1 files changed, 19 insertions, 1 deletions
diff --git a/guix/build/zig-build-system.scm b/guix/build/zig-build-system.scm
index 93a5d915369..90d1a644bbd 100644
--- a/guix/build/zig-build-system.scm
+++ b/guix/build/zig-build-system.scm
@@ -54,6 +54,24 @@ gcc_dir=")
(close-port port))
(setenv "ZIG_LIBC" "/tmp/guix-zig-libc-paths"))
+(define (zig-target target)
+ (cond
+ ((string=? target "i586-pc-gnu")
+ "x86-hurd-gnu")
+ ((string=? target "i686-linux-gnu")
+ "x86-linux-gnu")
+ ((string=? target "i686-w64-mingw32")
+ "x86-windows-gnu")
+ ((string=? target "mips64el-linux-gnu")
+ "mips64el-linux-gnuabi64")
+ ((string=? target "powerpc-linux-gnu")
+ "powerpc-linux-gnueabi")
+ ((string=? target "x86_64-pc-gnu")
+ "x86_64-hurd-gnu")
+ ((string=? target "x86_64-w64-mingw32")
+ "x86_64-windows-gnu")
+ (else target)))
+
(define* (build #:key
zig-build-flags
zig-release-type ;; "safe", "fast" or "small" empty for a
@@ -69,7 +87,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))