hako pushed a commit to branch wip-zig-bootstrap
in repository guix.
commit 3859675595f0c22113e42670b8ec627294c9cc4c
Author: Hilton Chain <[email protected]>
AuthorDate: Mon Nov 11 11:08:36 2024 +0800
gnu: Add zig-0.10.0-3660.
* gnu/packages/patches/zig-0.11-use-system-paths.patch: New file.
* gnu/local.mk (dist_patch_DATA): Regisiter it.
* gnu/packages/zig.scm (zig-source): Use it.
(zig-0.10.0-3660): New variable.
Change-Id: Ib05ee3026cadab2f5f7cf1da8639a4a4578737ee
---
gnu/local.mk | 1 +
.../patches/zig-0.11-use-system-paths.patch | 47 ++++++++++++++++++++++
gnu/packages/zig.scm | 28 +++++++++++--
3 files changed, 73 insertions(+), 3 deletions(-)
diff --git a/gnu/local.mk b/gnu/local.mk
index 1097f1b8d1..2672d5a7c1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2369,6 +2369,7 @@ dist_patch_DATA =
\
%D%/packages/patches/zig-0.10.0-675-TypeOf-hack.patch \
%D%/packages/patches/zig-0.10.0-747-CallOptions.patch \
%D%/packages/patches/zig-0.10.0-1638-re-add-qualCast.patch \
+ %D%/packages/patches/zig-0.11-use-system-paths.patch \
%D%/packages/patches/zig-use-baseline-cpu-by-default.patch \
%D%/packages/patches/zig-use-system-paths.patch \
%D%/packages/patches/zsh-egrep-failing-test.patch \
diff --git a/gnu/packages/patches/zig-0.11-use-system-paths.patch
b/gnu/packages/patches/zig-0.11-use-system-paths.patch
new file mode 100644
index 0000000000..0592928d04
--- /dev/null
+++ b/gnu/packages/patches/zig-0.11-use-system-paths.patch
@@ -0,0 +1,47 @@
+From 8ef5bfb0863d531dca7074fc1327d1f185949b7e Mon Sep 17 00:00:00 2001
+From: Hilton Chain <[email protected]>
+Date: Wed, 13 Nov 2024 12:54:43 +0800
+Subject: [PATCH] Use system paths.
+
+Add support for "CROSS_" environment variables, and set RUNPATH for directories
+in CROSS_LIBRARY_PATH (or LIBRARY_PATH).
+---
+ lib/std/zig/system/NativePaths.zig | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/lib/std/zig/system/NativePaths.zig
b/lib/std/zig/system/NativePaths.zig
+index 4c8f1286b8..1a4ff0fa0d 100644
+--- a/lib/std/zig/system/NativePaths.zig
++++ b/lib/std/zig/system/NativePaths.zig
+@@ -132,24 +132,25 @@ pub fn detect(arena: Allocator, native_info:
NativeTargetInfo) !NativePaths {
+ // variables to search for headers and libraries.
+ // We use os.getenv here since this part won't be executed on
+ // windows, to get rid of unnecessary error handling.
+- if (std.os.getenv("C_INCLUDE_PATH")) |c_include_path| {
++ if (std.os.getenv("CROSS_C_INCLUDE_PATH") orelse
std.os.getenv("C_INCLUDE_PATH")) |c_include_path| {
+ var it = mem.tokenizeScalar(u8, c_include_path, ':');
+ while (it.next()) |dir| {
+ try self.addIncludeDir(dir);
+ }
+ }
+
+- if (std.os.getenv("CPLUS_INCLUDE_PATH")) |cplus_include_path| {
++ if (std.os.getenv("CROSS_CPLUS_INCLUDE_PATH") orelse
std.os.getenv("CPLUS_INCLUDE_PATH")) |cplus_include_path| {
+ var it = mem.tokenizeScalar(u8, cplus_include_path, ':');
+ while (it.next()) |dir| {
+ try self.addIncludeDir(dir);
+ }
+ }
+
+- if (std.os.getenv("LIBRARY_PATH")) |library_path| {
++ if (std.os.getenv("CROSS_LIBRARY_PATH") orelse
std.os.getenv("LIBRARY_PATH")) |library_path| {
+ var it = mem.tokenizeScalar(u8, library_path, ':');
+ while (it.next()) |dir| {
+ try self.addLibDir(dir);
++ try self.addRPath(dir);
+ }
+ }
+ }
+--
+2.46.0
+
diff --git a/gnu/packages/zig.scm b/gnu/packages/zig.scm
index 56a11f292c..1cff552bc7 100644
--- a/gnu/packages/zig.scm
+++ b/gnu/packages/zig.scm
@@ -50,9 +50,14 @@
;; This is meant to be handled with a 'shrink-runpath' build phase.
;; May be related: <https://github.com/ziglang/zig/issues/18434>.
(search-patches
- (if (version>=? version "0.10")
- "zig-0.10-use-system-paths.patch"
- "zig-use-system-paths.patch"))))
+ (cond
+ ((and (version>=? version "0.10.0-3660")
+ (not (string=? version "0.10.1")))
+ "zig-0.11-use-system-paths.patch")
+ ((version>=? version "0.10")
+ "zig-0.10-use-system-paths.patch")
+ (else
+ "zig-use-system-paths.patch")))))
(snippet
#~(for-each (lambda (file)
(when (file-exists? file)
@@ -932,4 +937,21 @@ toolchain. Among other features it provides
(modify-inputs (package-native-inputs base)
(replace "zig" `(,base "zig1")))))))
+(define zig-0.10.0-3660
+ (let ((commit "22c6b6c9a9378aaca75c83c2182a6d94298f6bc2")
+ (revision "3660")
+ (base zig-0.10.0-2838))
+ (package
+ (inherit base)
+ (name "zig")
+ (version (git-version "0.10.0" revision commit))
+ (source (zig-source
+ version commit
+ "0dhcdi6008qqvy3ws2hhmj51wr213whbyghh7n9arai3zyg6y65g"))
+ ;; zig2+zig1
+ (arguments (package-arguments zig-0.10.0-748))
+ (native-inputs
+ (modify-inputs (package-native-inputs base)
+ (replace "zig" `(,base "zig1")))))))
+
(define-public zig zig-0.10)