gnu: zig: Update to 0.9.0
* gnu/packages/patches/zig-disable-libc-note-test.patch: Move patch changes to new file. * gnu/packages/patches/zig-use-system-paths.patch: Update line numbers. * gnu/packages/zig.scm: Update to 0.9.0 Signed-off-by: Ludovic Courtès <ludo@gnu.org>master
parent
c9627323ec
commit
6504587168
|
@ -1,14 +1,14 @@
|
|||
This test fails with "error.CompilationIncorrectlySucceeded".
|
||||
|
||||
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
|
||||
index fd1255c..20d5548 100644
|
||||
index b1eaa0302..621f9db0a 100644
|
||||
--- a/test/compile_errors.zig
|
||||
+++ b/test/compile_errors.zig
|
||||
@@ -2751,15 +2751,15 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
@@ -2943,15 +2943,15 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
"tmp.zig:3:5: error: dependency on libc must be explicitly specified in the build command",
|
||||
});
|
||||
|
||||
- cases.addTest("libc headers note",
|
||||
- ctx.testErrStage1("libc headers note",
|
||||
- \\const c = @cImport(@cInclude("stdio.h"));
|
||||
- \\export fn entry() void {
|
||||
- \\ _ = c.printf("hello, world!\n");
|
||||
|
@ -17,15 +17,15 @@ index fd1255c..20d5548 100644
|
|||
- "tmp.zig:1:11: error: C import failed",
|
||||
- "tmp.zig:1:11: note: libc headers not available; compilation does not link against libc",
|
||||
- });
|
||||
+// cases.addTest("libc headers note",
|
||||
+// \\const c = @cImport(@cInclude("stdio.h"));
|
||||
+// \\export fn entry() void {
|
||||
+// \\ _ = c.printf("hello, world!\n");
|
||||
+// \\}
|
||||
+// , &[_][]const u8{
|
||||
+// "tmp.zig:1:11: error: C import failed",
|
||||
+// "tmp.zig:1:11: note: libc headers not available; compilation does not link against libc",
|
||||
+// });
|
||||
+ // ctx.testErrStage1("libc headers note",
|
||||
+ // \\const c = @cImport(@cInclude("stdio.h"));
|
||||
+ // \\export fn entry() void {
|
||||
+ // \\ _ = c.printf("hello, world!\n");
|
||||
+ // \\}
|
||||
+ // , &[_][]const u8{
|
||||
+ // "tmp.zig:1:11: error: C import failed",
|
||||
+ // "tmp.zig:1:11: note: libc headers not available; compilation does not link against libc",
|
||||
+ // });
|
||||
}
|
||||
|
||||
cases.addTest("comptime vector overflow shows the index",
|
||||
ctx.testErrStage1("comptime vector overflow shows the index",
|
||||
|
|
|
@ -2,11 +2,11 @@ This patch replaces the OS-specific detection mechanism by one that solely
|
|||
relies on environment variables. This has the benefit that said environment
|
||||
variables can be used as search paths in Guix.
|
||||
|
||||
Index: zig-0.8.1/lib/std/zig/system.zig
|
||||
===================================================================
|
||||
--- zig-0.8.1.orig/lib/std/zig/system.zig
|
||||
+++ zig-0.8.1/lib/std/zig/system.zig
|
||||
@@ -39,101 +39,57 @@ pub const NativePaths = struct {
|
||||
diff --git a/lib/std/zig/system/NativePaths.zig b/lib/std/zig/system/NativePaths.zig
|
||||
index 8e3e46e48..1ed9d3206 100644
|
||||
--- a/lib/std/zig/system/NativePaths.zig
|
||||
+++ b/lib/std/zig/system/NativePaths.zig
|
||||
@@ -26,73 +26,42 @@ pub fn detect(allocator: Allocator, native_info: NativeTargetInfo) !NativePaths
|
||||
};
|
||||
errdefer self.deinit();
|
||||
|
||||
|
@ -15,11 +15,11 @@ Index: zig-0.8.1/lib/std/zig/system.zig
|
|||
- defer allocator.free(nix_cflags_compile);
|
||||
-
|
||||
- is_nix = true;
|
||||
- var it = mem.tokenize(nix_cflags_compile, " ");
|
||||
- var it = mem.tokenize(u8, nix_cflags_compile, " ");
|
||||
+ // TODO: Support cross-compile paths?
|
||||
+ if (process.getEnvVarOwned(allocator, "C_INCLUDE_PATH")) |c_include_path| {
|
||||
+ defer allocator.free(c_include_path);
|
||||
+ var it = mem.tokenize(c_include_path, ":");
|
||||
+ var it = mem.tokenize(u8, c_include_path, ":");
|
||||
while (true) {
|
||||
- const word = it.next() orelse break;
|
||||
- if (mem.eql(u8, word, "-isystem")) {
|
||||
|
@ -44,12 +44,12 @@ Index: zig-0.8.1/lib/std/zig/system.zig
|
|||
}
|
||||
- if (process.getEnvVarOwned(allocator, "NIX_LDFLAGS")) |nix_ldflags| {
|
||||
- defer allocator.free(nix_ldflags);
|
||||
|
||||
-
|
||||
- is_nix = true;
|
||||
- var it = mem.tokenize(nix_ldflags, " ");
|
||||
- var it = mem.tokenize(u8, nix_ldflags, " ");
|
||||
+ if (process.getEnvVarOwned(allocator, "CPLUS_INCLUDE_PATH")) |cplus_include_path| {
|
||||
+ defer allocator.free(cplus_include_path);
|
||||
+ var it = mem.tokenize(cplus_include_path, ":");
|
||||
+ var it = mem.tokenize(u8, cplus_include_path, ":");
|
||||
while (true) {
|
||||
- const word = it.next() orelse break;
|
||||
- if (mem.eql(u8, word, "-rpath")) {
|
||||
|
@ -77,10 +77,10 @@ Index: zig-0.8.1/lib/std/zig/system.zig
|
|||
- return self;
|
||||
- }
|
||||
-
|
||||
- if (comptime Target.current.isDarwin()) {
|
||||
- if (comptime builtin.target.isDarwin()) {
|
||||
- try self.addIncludeDir("/usr/include");
|
||||
- try self.addIncludeDir("/usr/local/include");
|
||||
|
||||
-
|
||||
- try self.addLibDir("/usr/lib");
|
||||
- try self.addLibDir("/usr/local/lib");
|
||||
-
|
||||
|
@ -90,7 +90,7 @@ Index: zig-0.8.1/lib/std/zig/system.zig
|
|||
- return self;
|
||||
+ if (process.getEnvVarOwned(allocator, "LIBRARY_PATH")) |library_path| {
|
||||
+ defer allocator.free(library_path);
|
||||
+ var it = mem.tokenize(library_path, ":");
|
||||
+ var it = mem.tokenize(u8, library_path, ":");
|
||||
+ while (true) {
|
||||
+ const dir = it.next() orelse break;
|
||||
+ try self.addLibDir(dir);
|
||||
|
@ -101,6 +101,11 @@ Index: zig-0.8.1/lib/std/zig/system.zig
|
|||
+ error.OutOfMemory => |e| return e,
|
||||
}
|
||||
|
||||
if (comptime native_target.os.tag == .solaris) {
|
||||
@@ -106,32 +75,17 @@ pub fn detect(allocator: Allocator, native_info: NativeTargetInfo) !NativePaths
|
||||
return self;
|
||||
}
|
||||
|
||||
- if (native_target.os.tag != .windows) {
|
||||
- const triple = try native_target.linuxTriple(allocator);
|
||||
- const qual = native_target.cpu.arch.ptrBitWidth();
|
||||
|
@ -129,7 +134,7 @@ Index: zig-0.8.1/lib/std/zig/system.zig
|
|||
- try self.addLibDirFmt("/lib/{s}", .{triple});
|
||||
+ if (process.getEnvVarOwned(allocator, "DYLD_FRAMEWORK_PATH")) |dyld_framework_path| {
|
||||
+ defer allocator.free(dyld_framework_path);
|
||||
+ var it = mem.tokenize(dyld_framework_path, ":");
|
||||
+ var it = mem.tokenize(u8, dyld_framework_path, ":");
|
||||
+ while (true) {
|
||||
+ const dir = it.next() orelse break;
|
||||
+ try self.addFrameworkDir(dir);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2021 Liliana Marie Prikler <liliana.prikler@gmail.com>
|
||||
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
|
||||
;;; Copyright © 2021 Calum Irwin <calumirwin1@gmail.com>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -28,7 +29,7 @@
|
|||
(define-public zig
|
||||
(package
|
||||
(name "zig")
|
||||
(version "0.8.1")
|
||||
(version "0.9.0")
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
|
@ -37,18 +38,18 @@
|
|||
(commit version)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32 "147qx7xgj0r353wh5ragzn6kmm1vrf31i8038z3zqwjnqqgqxi6c"))
|
||||
(base32 "1zdz5s434c48z3y0c8l9wm2z1gxa7yyzd53zmr68lwj6mcl7by8x"))
|
||||
(patches
|
||||
(search-patches
|
||||
"zig-disable-libc-note-test.patch"
|
||||
"zig-use-system-paths.patch"))))
|
||||
(build-system cmake-build-system)
|
||||
(inputs
|
||||
(list clang-12 ; Clang propagates llvm.
|
||||
lld-12))
|
||||
(list clang-13 ; Clang propagates llvm.
|
||||
lld))
|
||||
;; Zig compiles fine with GCC, but also needs native LLVM libraries.
|
||||
(native-inputs
|
||||
(list llvm-12))
|
||||
(list llvm-13))
|
||||
(arguments
|
||||
`(#:configure-flags
|
||||
(list ,@(if (%current-target-system)
|
||||
|
|
Reference in New Issue