Przeglądaj źródła

zig update 0.11.0-dev.86+b83e4d965

Jonathan Marler 2 lat temu
rodzic
commit
03f5baf4e3
7 zmienionych plików z 25 dodań i 18 usunięć
  1. 1 1
      .github/workflows/artifact.yml
  2. 2 2
      GitRepoStep.zig
  3. 1 1
      build2.zig
  4. 3 3
      test.zig
  5. 10 4
      win32exelink.zig
  6. 1 1
      zigetsha
  7. 7 6
      zigup.zig

+ 1 - 1
.github/workflows/artifact.yml

@@ -12,7 +12,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: goto-bus-stop/setup-zig@v1
         with:
-          version: 0.10.0-dev.3027+0e26c6149
+          version: 0.11.0-dev.86+b83e4d965
       - run: |
           zig build test -Dfetch -Dci_target=${{matrix.os}}-${{matrix.arch}}
       - run: |

+ 2 - 2
GitRepoStep.zig

@@ -1,4 +1,4 @@
-//! Publish Date: 2022_05_05
+//! Publish Date: 2022_09_09
 //! This file is hosted at github.com/marler8997/zig-build-repos and is meant to be copied
 //! to projects that use it.
 const std = @import("std");
@@ -27,7 +27,7 @@ url: []const u8,
 name: []const u8,
 branch: ?[]const u8 = null,
 sha: []const u8,
-path: []const u8 = null,
+path: []const u8,
 sha_check: ShaCheck = .warn,
 fetch_enabled: bool,
 

+ 1 - 1
build2.zig

@@ -114,7 +114,7 @@ fn addZigupExe(
         const zarc_repo = GitRepoStep.create(b, .{
             .url = "https://github.com/marler8997/zarc",
             .branch = "protected",
-            .sha = "acd3f4b7fe1fbd2ac533f441f85a56bfaa489f49",
+            .sha = "8ed576df2c8f1bc0832b3b9a29f2bbd178656102",
         });
         exe.step.dependOn(&zarc_repo.step);
         const zarc_repo_path = zarc_repo.getPath(&exe.step);

+ 3 - 3
test.zig

@@ -24,9 +24,9 @@ pub fn main() !u8 {
     try std.fs.cwd().makeDir(install_dir);
 
     // NOTE: for now we are incorrectly assuming the install dir is CWD/zig-out
-    const zigup = "." ++ sep ++ bin_dir ++ sep ++ "zigup" ++ builtin.target.exeFileExt();
+    const zigup = comptime "." ++ sep ++ bin_dir ++ sep ++ "zigup" ++ builtin.target.exeFileExt();
     try std.fs.cwd().copyFile(
-        "zig-out" ++ sep ++ "bin" ++ sep ++ "zigup" ++ builtin.target.exeFileExt(),
+        comptime "zig-out" ++ sep ++ "bin" ++ sep ++ "zigup" ++ builtin.target.exeFileExt(),
         std.fs.cwd(),
         zigup,
         .{},
@@ -191,7 +191,7 @@ pub fn main() !u8 {
         defer allocator.free(scratch_bin2_path);
 
         {
-            var file = try std.fs.cwd().createFile(bin2_dir ++ sep ++ "zig" ++ builtin.target.exeFileExt(), .{});
+            var file = try std.fs.cwd().createFile(comptime bin2_dir ++ sep ++ "zig" ++ builtin.target.exeFileExt(), .{});
             defer file.close();
             try file.writer().writeAll("a fake executable");
         }

+ 10 - 4
win32exelink.zig

@@ -1,3 +1,4 @@
+const builtin = @import("builtin");
 const std = @import("std");
 
 const log = std.log.scoped(.zigexelink);
@@ -93,10 +94,15 @@ const win32 = struct {
     pub const CTRL_LOGOFF_EVENT = @as(u32, 5);
     pub const CTRL_SHUTDOWN_EVENT = @as(u32, 6);
     pub const GetLastError = std.os.windows.kernel32.GetLastError;
-    pub const PHANDLER_ROUTINE = fn(
-        CtrlType: u32,
-    ) callconv(@import("std").os.windows.WINAPI) BOOL;
-    pub extern "KERNEL32" fn SetConsoleCtrlHandler(
+    pub const PHANDLER_ROUTINE = switch (builtin.zig_backend) {
+        .stage1 => fn(
+            CtrlType: u32,
+        ) callconv(@import("std").os.windows.WINAPI) BOOL,
+        else => *const fn(
+            CtrlType: u32,
+        ) callconv(@import("std").os.windows.WINAPI) BOOL,
+    };
+    pub extern "kernel32" fn SetConsoleCtrlHandler(
         HandlerRoutine: ?PHANDLER_ROUTINE,
         Add: BOOL,
     ) callconv(@import("std").os.windows.WINAPI) BOOL;

+ 1 - 1
zigetsha

@@ -1 +1 @@
-116486f06e82aa7de9895e9145a22b384e029e5f
+f16d9d35076e18b2ad1150fbfc53e647ca675a8a

+ 7 - 6
zigup.zig

@@ -123,7 +123,7 @@ fn makeZigPathLinkString(allocator: Allocator) ![]const u8 {
     const zigup_dir = try std.fs.selfExeDirPathAlloc(allocator);
     defer allocator.free(zigup_dir);
 
-    return try std.fs.path.join(allocator, &[_][]const u8{ zigup_dir, "zig" ++ builtin.target.exeFileExt() });
+    return try std.fs.path.join(allocator, &[_][]const u8{ zigup_dir, comptime "zig" ++ builtin.target.exeFileExt() });
 }
 
 // TODO: this should be in standard lib
@@ -334,7 +334,7 @@ pub fn runCompiler(allocator: Allocator, args: []const []const u8) !u8 {
     }
 
     var argv = std.ArrayList([]const u8).init(allocator);
-    try argv.append(try std.fs.path.join(allocator, &.{ compiler_dir, "files", "zig" ++ builtin.target.exeFileExt() }));
+    try argv.append(try std.fs.path.join(allocator, &.{ compiler_dir, "files", comptime "zig" ++ builtin.target.exeFileExt() }));
     try argv.appendSlice(args[1..]);
 
     // TODO: use "execve" if on linux
@@ -658,13 +658,14 @@ fn setDefaultCompiler(allocator: Allocator, compiler_dir: []const u8, exist_veri
     switch (exist_verify) {
         .existence_verified => {},
         .verify_existence => {
-            (std.fs.openDirAbsolute(compiler_dir, .{}) catch |err| switch (err) {
+            var dir = std.fs.openDirAbsolute(compiler_dir, .{}) catch |err| switch (err) {
                 error.FileNotFound => {
                     std.log.err("compiler '{s}' is not installed", .{std.fs.path.basename(compiler_dir)});
                     return error.AlreadyReported;
                 },
                 else => |e| return e,
-            }).close();
+            };
+            dir.close();
         },
     }
 
@@ -673,7 +674,7 @@ fn setDefaultCompiler(allocator: Allocator, compiler_dir: []const u8, exist_veri
 
     try verifyPathLink(allocator, path_link);
 
-    const link_target = try std.fs.path.join(allocator, &[_][]const u8{ compiler_dir, "files", "zig" ++ builtin.target.exeFileExt() });
+    const link_target = try std.fs.path.join(allocator, &[_][]const u8{ compiler_dir, "files", comptime "zig" ++ builtin.target.exeFileExt() });
     defer allocator.free(link_target);
     if (builtin.os.tag == .windows) {
         try createExeLink(link_target, path_link);
@@ -843,7 +844,7 @@ const win32 = struct {
         nFileIndexHigh: u32,
         nFileIndexLow: u32,
     };
-    pub extern "KERNEL32" fn GetFileInformationByHandle(
+    pub extern "kernel32" fn GetFileInformationByHandle(
         hFile: ?@import("std").os.windows.HANDLE,
         lpFileInformation: ?*BY_HANDLE_FILE_INFORMATION,
     ) callconv(@import("std").os.windows.WINAPI) BOOL;