Browse Source

zig update to 0.11.0-dev.1507+6f13a725a

Jonathan Marler 2 years ago
parent
commit
7831a8726e
4 changed files with 34 additions and 5 deletions
  1. 1 1
      .github/workflows/artifact.yml
  2. 31 2
      build2.zig
  3. 1 1
      zigetsha
  4. 1 1
      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.11.0-dev.86+b83e4d965
+          version: 0.11.0-dev.1507+6f13a725a
       - run: |
           zig build test -Dfetch -Dci_target=${{matrix.os}}-${{matrix.arch}}
       - run: |

+ 31 - 2
build2.zig

@@ -49,7 +49,10 @@ pub fn build(b: *Builder) !void {
             const exe = b.addExecutable("win32exelink", "win32exelink.zig");
             exe.setTarget(target);
             exe.setBuildMode(mode);
-            zigup_build_options.addOptionFileSource("win32exelink_filename", .{ .generated = &exe.output_path_source });
+            // workaround @embedFile not working with absolute paths, see https://github.com/ziglang/zig/issues/14551
+            //zigup_build_options.addOptionFileSource("win32exelink_filename", .{ .generated = &exe.output_path_source });
+            const update_step = RelativeOutputPathSourceStep.create(exe);
+            zigup_build_options.addOptionFileSource("win32exelink_filename", .{ .generated = &update_step.output_path_source });
             break :blk exe;
         }
         break :blk null;
@@ -71,6 +74,32 @@ pub fn build(b: *Builder) !void {
     addTest(b, exe, target, mode);
 }
 
+// This whole step is a workaround to @embedFile not working with absolute paths, see https://github.com/ziglang/zig/issues/14551
+const RelativeOutputPathSourceStep = struct {
+    step: std.build.Step,
+    exe: *std.build.LibExeObjStep,
+    output_path_source: std.build.GeneratedFile,
+    pub fn create(exe: *std.build.LibExeObjStep) *RelativeOutputPathSourceStep {
+        const s = exe.builder.allocator.create(RelativeOutputPathSourceStep) catch unreachable;
+        s.* = .{
+            .step = std.build.Step.init(.custom, "relative output path", exe.builder.allocator, make),
+            .exe = exe,
+            .output_path_source = .{
+                .step = &s.step,
+            },
+        };
+        return s;
+    }
+    fn make(step: *std.build.Step) !void {
+        const self = @fieldParentPtr(RelativeOutputPathSourceStep, "step", step);
+        const b = self.exe.builder;
+        //std.log.info("output path is '{s}'", .{self.exe.output_path_source.path.?});
+        const abs_path = self.exe.output_path_source.path.?;
+        std.debug.assert(std.mem.startsWith(u8, abs_path, b.build_root));
+        self.output_path_source.path = std.mem.trimLeft(u8, abs_path[b.build_root.len..], "\\/");
+    }
+};
+
 fn addTest(b: *Builder, exe: *std.build.LibExeObjStep, target: std.zig.CrossTarget, mode: std.builtin.Mode) void {
     const test_exe = b.addExecutable("test", "test.zig");
     test_exe.setTarget(target);
@@ -114,7 +143,7 @@ fn addZigupExe(
         const zarc_repo = GitRepoStep.create(b, .{
             .url = "https://github.com/marler8997/zarc",
             .branch = "protected",
-            .sha = "8ed576df2c8f1bc0832b3b9a29f2bbd178656102",
+            .sha = "ca9554ffbfceedec6aae5f39fc71a52dbdec2a15",
         });
         exe.step.dependOn(&zarc_repo.step);
         const zarc_repo_path = zarc_repo.getPath(&exe.step);

+ 1 - 1
zigetsha

@@ -1 +1 @@
-f16d9d35076e18b2ad1150fbfc53e647ca675a8a
+ef19d1906053d6737b34412bc98e4f7d96ebba9a

+ 1 - 1
zigup.zig

@@ -595,7 +595,7 @@ fn readDefaultCompiler(allocator: Allocator, buffer: *[std.fs.MAX_PATH_BYTES + 1
             std.log.err("path link file '{s}' is too small", .{path_link});
             return error.AlreadyReported;
         }
-        const target_exe = std.mem.span(std.meta.assumeSentinel(@as([]u8, buffer).ptr, 0));
+        const target_exe = std.mem.sliceTo(buffer, 0);
         return try allocator.dupe(u8, targetPathToVersion(target_exe));
     }