diff --git a/backend/build.zig b/backend/build.zig index 9d27bc4de..43bd5ac22 100644 --- a/backend/build.zig +++ b/backend/build.zig @@ -145,7 +145,8 @@ pub fn backendModule(dep: *std.Build.Dependency, dvui_mod: *std.Build.Module, op fn patchedSdl(b: *std.Build) ?std.Build.LazyPath { const io = b.graph.io; var names: std.ArrayList([]const u8) = .empty; - var dir = b.root.root_dir.handle.openDir(io, "patches/sdl", .{ .iterate = true }) catch |err| + b.dependOnDirectoryContents(b.path("patches/sdl")); + var dir = b.root.openDir(io, "patches/sdl", .{ .iterate = true }) catch |err| std.debug.panic("backend: open patches/sdl: {t}", .{err}); defer dir.close(io); var it = dir.iterate(); diff --git a/build.zig b/build.zig index 92ad958dd..998ac705f 100644 --- a/build.zig +++ b/build.zig @@ -12,6 +12,9 @@ pub fn build(b: *std.Build) !void { const windows_msvc_libc_opt = b.option([]const u8, "windows-msvc-libc", "zig libc manifest for *-windows-msvc when cross-compiling; forwarded by packageall for Windows children") orelse null; const fetch_msvc_opt = b.option(bool, "fetch-msvc", "If *-windows-msvc libc is missing under .velopack-msvc/, run msvcup-setup first (downloads MSVC+SDK; requires network). Defaults to true on Windows hosts targeting *-windows-msvc.") orelse null; + // ZIG017 (release packaging PR): the FIZZY_MACOS_* fallbacks below are read at configure, and + // 0.17 caches the configuration without regard to the environment; scripts/release.sh and + // release.yml pass the -D options instead. const macos_sign_app_identity = b.option([]const u8, "macos-sign-app", "macOS codesign identity for the app bundle (e.g. 'Developer ID Application: NAME (TEAMID)')") orelse b.graph.environ_map.get("FIZZY_MACOS_SIGN_APP"); const macos_sign_install_identity = b.option([]const u8, "macos-sign-installer", "macOS codesign identity for the installer pkg (e.g. 'Developer ID Installer: NAME (TEAMID)')") orelse diff --git a/build.zig.zon b/build.zig.zon index d9c38384f..07de075c6 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -8,7 +8,6 @@ "build", "build.zig", "build.zig.zon", - "update.zig", "sdk", "backend", "assets", diff --git a/build/app.zig b/build/app.zig index abf947fc0..753050182 100644 --- a/build/app.zig +++ b/build/app.zig @@ -144,7 +144,7 @@ pub fn readConfig(b: *std.Build, target: std.Build.ResolvedTarget, opts: Options var effective_win_libc: ?[]const u8 = win_libc.libc_path; if (effective_win_libc == null) { - if (cross_win_msvc) effective_win_libc = null; // ZIG017: 0.17 has no global --libc + if (cross_win_msvc) effective_win_libc = null; // ZIG017 (release packaging PR): 0.17 has no global --libc; becomes -Dwindows-libc } // Velopack in the dev/install exe is opt-in (`-Dvelopack=true`). Release @@ -204,6 +204,7 @@ pub fn readConfig(b: *std.Build, target: std.Build.ResolvedTarget, opts: Options var version_owned: ?[]u8 = null; // lives as long as the build process const app_version: []const u8 = if (app_version_opt) |v| v else blk: { + b.dependOnFileContents(b.path("VERSION")); const raw = b.root.root_dir.handle.readFileAlloc(b.graph.io, "VERSION", b.allocator, std.Io.Limit.limited(256)) catch |e| std.debug.panic("read VERSION: {}", .{e}); version_owned = raw; break :blk std.mem.trimEnd(u8, raw, "\r\n"); @@ -259,8 +260,6 @@ pub fn readConfig(b: *std.Build, target: std.Build.ResolvedTarget, opts: Options const workbench_opts = b.addOptions(); workbench_opts.addOption(bool, "file_tree", workbench_file_tree); - common.addUpdateStep(b); - const msvcup_before_compile: ?*std.Build.Step.Run = if (vz) |v| velopack.addMsvcupSetupStep(b, v, ".velopack-msvc") else null; const msvcup_setup_step = b.step("msvcup-setup", "Download MSVC SDK into .velopack-msvc/ via velopack-zig (writes zig-libc-*.ini)"); if (msvcup_before_compile) |m| msvcup_setup_step.dependOn(&m.step); @@ -336,7 +335,7 @@ pub fn construct(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. const zig_out_install_dir = cfg.zig_out_install_dir; const target_is_windows_msvc = cfg.target_is_windows_msvc; const cross_win_msvc = cfg.cross_win_msvc; - _ = cross_win_msvc; // ZIG017 + _ = cross_win_msvc; // ZIG017 (release packaging PR) const effective_win_libc = cfg.effective_win_libc; const velopack_supported_for_target = cfg.velopack_supported_for_target; const velopack_enabled = cfg.velopack_enabled; @@ -428,8 +427,20 @@ pub fn construct(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. .dest_dir = .{ .override = zig_out_install_dir }, }); // A running fizzy holds its executable on Windows: set it aside first, or the install fails. - if (false) { // ZIG017: custom step + configure-time install path, both gone in 0.17 - const aside = SetAsideRunningExe.create(b, b.getInstallPath(zig_out_install_dir, exe.out_filename)); + if (b.graph.host.result.os.tag == .windows and target.result.os.tag == .windows) { + const aside_exe = b.addExecutable(.{ + .name = "set-aside", + .root_module = b.createModule(.{ + .root_source_file = b.path("build/set_aside.zig"), + .target = b.graph.host, + .optimize = .fast, + }), + }); + const aside = b.addRunArtifact(aside_exe); + aside.setName("set aside a running executable"); + aside.addDirectoryArg(common.installDirPath(zig_out_install_dir)); + aside.addArg(exe.out_filename); + aside.has_side_effects = true; aside.step.dependOn(&exe.step); install_artifact.step.dependOn(&aside.step); } @@ -1392,7 +1403,7 @@ pub fn construct(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. }; if (effective_win_libc) |ini| { - // ZIG017: no global --libc in 0.17 + // ZIG017 (release packaging PR): no global --libc in 0.17 const libc_lp: std.Build.LazyPath = .{ .cwd_relative = ini }; velopack.applyWindowsMsvcLibcRecursive(b, roots[0..n], libc_lp); @@ -1445,45 +1456,3 @@ fn addTestBinaryArgs( } else try addTestBinaryArgs(b, run, seen, dep); } } - -/// Windows will not let a file a running process was started from be written or deleted, but it -/// will let it be renamed. So before the install, an installed executable that is running (it -/// cannot be opened for writing) is renamed aside, to `.