[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
57/85: build-system: zig: Support cross compilation.
From: |
guix-commits |
Subject: |
57/85: build-system: zig: Support cross compilation. |
Date: |
Sat, 21 Dec 2024 12:30:52 -0500 (EST) |
hako pushed a commit to branch wip-zig-bootstrap
in repository guix.
commit 287dbfdb9cb0c89698733e0e30d9c8f5b8eed6fe
Author: Hilton Chain <hako@ultrarare.space>
AuthorDate: Sun Nov 17 02:42:35 2024 +0800
build-system: zig: Support cross compilation.
* guix/build/zig-build-system.scm (configure): New procedure.
(set-cc,set-zig-global-cache-dir): Delete procedures.
(%standard-phases): Adjust accordingly.
Change-Id: I08d15add2b249f7016f9cbb07f151ecf469fe656
---
guix/build/zig-build-system.scm | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/guix/build/zig-build-system.scm b/guix/build/zig-build-system.scm
index 8352a73324..c797615e2f 100644
--- a/guix/build/zig-build-system.scm
+++ b/guix/build/zig-build-system.scm
@@ -34,14 +34,24 @@
;; https://github.com/riverwm/river/blob/master/PACKAGING.md
(define global-cache-dir "zig-cache")
-(define* (set-cc #:rest args)
- ;; TODO: Zig needs the gcc-toolchain in order to find the libc.
- ;; we need to think about how to solve this in the build system
- ;; directly: --libc
- (setenv "CC" "gcc"))
+(define* (configure #:key inputs target #:allow-other-keys)
+ ;; Set cache dir, otherwise Zig looks for `$HOME/.cache'.
+ (setenv "ZIG_GLOBAL_CACHE_DIR" global-cache-dir)
-(define* (set-zig-global-cache-dir #:rest args)
- (setenv "ZIG_GLOBAL_CACHE_DIR" global-cache-dir))
+ ;; Libc paths for target.
+ (let ((libc (assoc-ref inputs (if target "cross-libc" "libc")))
+ (port (open-file "/tmp/guix-zig-libc-paths" "w" #:encoding "utf8")))
+ (display
+ (string-append "\
+include_dir=" libc "/include
+sys_include_dir=" libc "/include
+crt_dir=" libc "/lib
+msvc_lib_dir=
+kernel32_lib_dir=
+gcc_dir=")
+ port)
+ (close-port port))
+ (setenv "ZIG_LIBC" "/tmp/guix-zig-libc-paths"))
(define* (build #:key
zig-build-flags
@@ -91,9 +101,7 @@
(define %standard-phases
(modify-phases gnu:%standard-phases
(delete 'bootstrap)
- (delete 'configure)
- (add-before 'build 'set-zig-global-cache-dir set-zig-global-cache-dir)
- (add-before 'build 'set-cc set-cc)
+ (replace 'configure configure)
(replace 'build build)
(replace 'check check)
(replace 'install install)))
- 76/85: gnu: Add zig-metrics., (continued)
- 76/85: gnu: Add zig-metrics., guix-commits, 2024/12/21
- 03/85: gnu: zig-0.10: Fix RUNPATH issue., guix-commits, 2024/12/21
- 30/85: gnu: Add zig-0.10.0-3660., guix-commits, 2024/12/21
- 44/85: gnu: Add zig-0.11.0-702., guix-commits, 2024/12/21
- 12/85: gnu: Add zig-0.10.0-961., guix-commits, 2024/12/21
- 42/85: gnu: Add zig-0.11.0-631., guix-commits, 2024/12/21
- 58/85: build/zig: Adjust the build triplets for some systems., guix-commits, 2024/12/21
- 47/85: gnu: Add zig-0.11.0-3245., guix-commits, 2024/12/21
- 39/85: gnu: Add zig-0.11.0-384., guix-commits, 2024/12/21
- 31/85: gnu: Add zig-0.10.0-3726., guix-commits, 2024/12/21
- 57/85: build-system: zig: Support cross compilation.,
guix-commits <=
- 67/85: gnu: river: Update to 0.3.5., guix-commits, 2024/12/21
- 22/85: gnu: Add zig-0.10.0-1713., guix-commits, 2024/12/21
- 29/85: gnu: Add zig-0.10.0-2838., guix-commits, 2024/12/21
- 50/85: gnu: Add zig-0.11.0-3503., guix-commits, 2024/12/21
- 66/85: gnu: Add zig-xkbcommon., guix-commits, 2024/12/21
- 72/85: gnu: Add zig-zls-0.13., guix-commits, 2024/12/21
- 84/85: gnu: Remove zig-zls-0.10., guix-commits, 2024/12/21
- 02/85: gnu: zig-0.9: Update patches., guix-commits, 2024/12/21
- 10/85: gnu: Add zig-0.10.0-851., guix-commits, 2024/12/21
- 33/85: gnu: Add zig-0.10.0-3807., guix-commits, 2024/12/21