From 76e9c9d4c1d5853a46b9afbbb0580e08f6a2dcab Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Mon, 8 Jan 2024 17:40:08 +0100 Subject: [PATCH] update all zig code in accordance with upstream changes --- mzte-nv/build.zig | 21 ++++++++------------- mzte-nv/build.zig.zon | 4 ++-- scripts/mzteinit/build.zig | 12 +++--------- scripts/mzteinit/build.zig.zon | 4 ++-- scripts/openbrowser/build.zig | 2 +- scripts/playtwitch/build.zig | 5 +---- scripts/prompt/build.zig | 7 +++---- scripts/prompt/build.zig.zon | 8 ++++---- scripts/randomwallpaper/build.zig | 4 +--- scripts/vinput/build.zig | 13 ++++--------- scripts/vinput/build.zig.zon | 9 ++++----- scripts/withjava/build.zig | 5 ----- scripts/wlbg/build.zig | 16 +++++++--------- scripts/wlbg/build.zig.zon | 8 ++++---- 14 files changed, 44 insertions(+), 74 deletions(-) diff --git a/mzte-nv/build.zig b/mzte-nv/build.zig index 4830307..699112d 100644 --- a/mzte-nv/build.zig +++ b/mzte-nv/build.zig @@ -1,10 +1,10 @@ const std = @import("std"); const common = @import("build_common.zig"); -pub fn build(b: *std.build.Builder) !void { +pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); - if (target.os_tag orelse @import("builtin").os.tag == .windows) + if (target.result.os.tag == .windows) // windows is an error in many ways return error.Windows; @@ -25,21 +25,17 @@ pub fn build(b: *std.build.Builder) !void { const opts = b.addOptions(); opts.addOption([]const u8, "font", cg_opt.term_font); - lib.addOptions("opts", opts); + lib.root_module.addImport("opts", opts.createModule()); - lib.addModule("nvim", znvim_dep.module("nvim_c")); - lib.addModule("znvim", znvim_dep.module("znvim")); + lib.root_module.addImport("nvim", znvim_dep.module("nvim_c")); + lib.root_module.addImport("znvim", znvim_dep.module("znvim")); lib.linkLibC(); lib.linkSystemLibrary("luajit"); - lib.strip = switch (mode) { - .Debug, .ReleaseSafe => false, - .ReleaseFast, .ReleaseSmall => true, - }; - lib.unwind_tables = true; + lib.root_module.unwind_tables = true; - b.getInstallStep().dependOn(&b.addInstallFile(lib.getOutputSource(), "share/nvim/mzte-nv.so").step); + b.getInstallStep().dependOn(&b.addInstallFile(lib.getEmittedBin(), "share/nvim/mzte-nv.so").step); // this is the install step for the lua config compiler binary const compiler = b.addExecutable(.{ @@ -52,8 +48,7 @@ pub fn build(b: *std.build.Builder) !void { compiler.linkLibC(); compiler.linkSystemLibrary("luajit"); - compiler.strip = mode != .Debug; - compiler.unwind_tables = true; + compiler.root_module.unwind_tables = true; b.installArtifact(compiler); } diff --git a/mzte-nv/build.zig.zon b/mzte-nv/build.zig.zon index 33d2e06..492f54a 100644 --- a/mzte-nv/build.zig.zon +++ b/mzte-nv/build.zig.zon @@ -4,8 +4,8 @@ .dependencies = .{ .znvim = .{ - .url = "https://mzte.de/git/LordMZTE/znvim/archive/948e496ffd1222dd468db05d17176c757bbe9b92.tar.gz", - .hash = "122048ba32858a12ca090a5fb6f41e35878d2cb9c22b267c2256f6d9cc9724003f9a", + .url = "git+https://git.mzte.de/LordMZTE/znvim.git#8e52c461dc071e6b88c8e77e49aa2805f225e7da", + .hash = "122029929d792aa32a71c0b98bb67d344d971d269d6fea5b8f8693e29f0f45924951", }, }, .paths = .{""}, diff --git a/scripts/mzteinit/build.zig b/scripts/mzteinit/build.zig index 84a92ec..5a417f5 100644 --- a/scripts/mzteinit/build.zig +++ b/scripts/mzteinit/build.zig @@ -1,7 +1,7 @@ const std = @import("std"); const common = @import("build_common.zig"); -pub fn build(b: *std.build.Builder) !void { +pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); @@ -21,14 +21,8 @@ pub fn build(b: *std.build.Builder) !void { .optimize = optimize, }); - exe.strip = switch (optimize) { - .ReleaseFast, .ReleaseSmall => true, - .ReleaseSafe, .Debug => false, - }; - mzteinitctl.strip = exe.strip; - inline for (.{ mzteinitctl, exe }) |e| { - e.addModule("ansi-term", ansi_term_mod); + e.root_module.addImport("ansi-term", ansi_term_mod); } const cg_opt = try common.confgenGet(struct { @@ -37,7 +31,7 @@ pub fn build(b: *std.build.Builder) !void { const opts = b.addOptions(); opts.addOption([]const u8, "gtk_theme", cg_opt.gtk_theme); - exe.addOptions("opts", opts); + exe.root_module.addImport("opts", opts.createModule()); b.installArtifact(exe); b.installArtifact(mzteinitctl); diff --git a/scripts/mzteinit/build.zig.zon b/scripts/mzteinit/build.zig.zon index 3cb0ac5..941de81 100644 --- a/scripts/mzteinit/build.zig.zon +++ b/scripts/mzteinit/build.zig.zon @@ -4,8 +4,8 @@ .dependencies = .{ .ansi_term = .{ - .url = "https://github.com/ziglibs/ansi-term/archive/1614b61486d567b59abe11a097d11aa6ce679819.tar.gz", - .hash = "1220647eea49d2c48d5e59354291e975f813be3cc5a9d9920a50bbfaa40a891a06ee", + .url = "git+https://github.com/LordMZTE/ansi-term.git#73c03175068679685535111dbea72cade075719e", + .hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7", }, }, .paths = .{""}, diff --git a/scripts/openbrowser/build.zig b/scripts/openbrowser/build.zig index 714b235..98a4e34 100644 --- a/scripts/openbrowser/build.zig +++ b/scripts/openbrowser/build.zig @@ -1,6 +1,6 @@ const std = @import("std"); -pub fn build(b: *std.build.Builder) void { +pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const mode = b.standardOptimizeOption(.{}); diff --git a/scripts/playtwitch/build.zig b/scripts/playtwitch/build.zig index d9bd938..a0b132e 100644 --- a/scripts/playtwitch/build.zig +++ b/scripts/playtwitch/build.zig @@ -1,10 +1,9 @@ const std = @import("std"); -pub fn build(b: *std.build.Builder) void { +pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); - //const exe = b.addExecutable("playtwitch", "src/main.zig"); const exe = b.addExecutable(.{ .name = "playtwitch", .root_source_file = .{ .path = "src/main.zig" }, @@ -18,8 +17,6 @@ pub fn build(b: *std.build.Builder) void { exe.linkSystemLibrary("glew"); exe.linkSystemLibrary("curl"); - exe.strip = optimize != .Debug and optimize != .ReleaseSafe; - b.installArtifact(exe); var logo_install_step = b.addInstallFile( diff --git a/scripts/prompt/build.zig b/scripts/prompt/build.zig index bdf2def..0740657 100644 --- a/scripts/prompt/build.zig +++ b/scripts/prompt/build.zig @@ -1,6 +1,6 @@ const std = @import("std"); -pub fn build(b: *std.build.Builder) void { +pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const mode = b.standardOptimizeOption(.{}); @@ -10,13 +10,12 @@ pub fn build(b: *std.build.Builder) void { .target = target, .optimize = mode, }); - exe.strip = mode != .Debug; exe.linkLibC(); exe.linkSystemLibrary("libgit2"); - exe.addModule("ansi-term", b.dependency("ansi_term", .{}).module("ansi-term")); - exe.addModule("known-folders", b.dependency("known_folders", .{}).module("known-folders")); + exe.root_module.addImport("ansi-term", b.dependency("ansi_term", .{}).module("ansi-term")); + exe.root_module.addImport("known-folders", b.dependency("known_folders", .{}).module("known-folders")); b.installArtifact(exe); diff --git a/scripts/prompt/build.zig.zon b/scripts/prompt/build.zig.zon index dd9df98..0fc62dd 100644 --- a/scripts/prompt/build.zig.zon +++ b/scripts/prompt/build.zig.zon @@ -4,12 +4,12 @@ .dependencies = .{ .ansi_term = .{ - .url = "https://github.com/ziglibs/ansi-term/archive/1614b61486d567b59abe11a097d11aa6ce679819.tar.gz", - .hash = "1220647eea49d2c48d5e59354291e975f813be3cc5a9d9920a50bbfaa40a891a06ee", + .url = "git+https://github.com/LordMZTE/ansi-term.git#73c03175068679685535111dbea72cade075719e", + .hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7", }, .known_folders = .{ - .url = "https://github.com/ziglibs/known-folders/archive/8bb4bf761bab20ffed74ffac83c3a9eb4456f28d.tar.gz", - .hash = "122002462f37b67a54fa1ab712d870d4637dae0d94437c0077b148e1fb75616c573d", + .url = "git+https://github.com/ziglibs/known-folders#806ba01b872820004c7dec3117cb0db66b206af6", + .hash = "122094b48dea08e241b48d0ec32e3df6965e814091e3cabaff942e62d053f3ff9b5f", }, }, .paths = .{""}, diff --git a/scripts/randomwallpaper/build.zig b/scripts/randomwallpaper/build.zig index d16c03f..8084980 100644 --- a/scripts/randomwallpaper/build.zig +++ b/scripts/randomwallpaper/build.zig @@ -1,6 +1,6 @@ const std = @import("std"); -pub fn build(b: *std.build.Builder) void { +pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const mode = b.standardOptimizeOption(.{}); @@ -15,8 +15,6 @@ pub fn build(b: *std.build.Builder) void { exe.linkSystemLibrary("xcb"); exe.linkSystemLibrary("xcb-xinerama"); - exe.strip = mode != .Debug; - b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); diff --git a/scripts/vinput/build.zig b/scripts/vinput/build.zig index 30c2c7d..6eaffaa 100644 --- a/scripts/vinput/build.zig +++ b/scripts/vinput/build.zig @@ -2,12 +2,12 @@ const std = @import("std"); const Scanner = @import("wayland").Scanner; -pub fn build(b: *std.build.Builder) void { +pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const mode = b.standardOptimizeOption(.{}); const scanner = Scanner.create(b, .{}); - const wayland_mod = b.createModule(.{ .source_file = scanner.result }); + const wayland_mod = scanner.mod; const exe = b.addExecutable(.{ .name = "vinput", @@ -16,7 +16,7 @@ pub fn build(b: *std.build.Builder) void { .optimize = mode, }); - exe.addModule("wayland", wayland_mod); + exe.root_module.addImport("wayland", wayland_mod); scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml"); @@ -26,12 +26,7 @@ pub fn build(b: *std.build.Builder) void { scanner.generate("wl_shm", 1); scanner.generate("xdg_wm_base", 3); - exe.linkLibC(); - exe.linkSystemLibrary("wayland-client"); - - exe.strip = mode != .Debug; - - scanner.addCSource(exe); + exe.root_module.linkSystemLibrary("wayland-client", .{}); b.installArtifact(exe); diff --git a/scripts/vinput/build.zig.zon b/scripts/vinput/build.zig.zon index e7618b9..09ac583 100644 --- a/scripts/vinput/build.zig.zon +++ b/scripts/vinput/build.zig.zon @@ -2,11 +2,10 @@ .name = "vinput", .version = "0.0.0", .paths = .{""}, - .dependencies = .{ .wayland = .{ - .url = "https://git.mzte.de/LordMZTE/zig-wayland/archive/cbd535c4666a04f20bb303dc6485ec51d7db8bf5.tar.gz", - .hash = "1220d3aa22102fa17a6870d241a9541e6810d79d2a69c1ccca71ac90c825b26dd9e1", - } - } + .url = "git+https://git.mzte.de/LordMZTE/zig-wayland#4de9f2d6d5fddae1fbb29e21fd1dae69e646ab7d", + .hash = "1220d6448c277e5c41348aa95ce2ba2fc92a92cb7a9e9783edf0f816cd0260122d31", + }, + }, } diff --git a/scripts/withjava/build.zig b/scripts/withjava/build.zig index 2b9a7d6..0ece26c 100644 --- a/scripts/withjava/build.zig +++ b/scripts/withjava/build.zig @@ -11,11 +11,6 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); - exe.strip = switch (optimize) { - .ReleaseSafe, .Debug => false, - .ReleaseFast, .ReleaseSmall => true, - }; - b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); diff --git a/scripts/wlbg/build.zig b/scripts/wlbg/build.zig index 181de7a..56638e4 100644 --- a/scripts/wlbg/build.zig +++ b/scripts/wlbg/build.zig @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); const scanner = Scanner.create(b, .{}); - const wayland_mod = b.createModule(.{ .source_file = scanner.result }); + const wayland_mod = scanner.mod; const exe = b.addExecutable(.{ .name = "wlbg", @@ -16,11 +16,11 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); - exe.addModule("xev", b.dependency("xev", .{ + exe.root_module.addImport("xev", b.dependency("xev", .{ .target = target, .optimize = optimize, }).module("xev")); - exe.addModule("wayland", wayland_mod); + exe.root_module.addImport("wayland", wayland_mod); scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml"); scanner.addSystemProtocol("unstable/xdg-output/xdg-output-unstable-v1.xml"); @@ -34,12 +34,10 @@ pub fn build(b: *std.Build) void { scanner.generate("wl_seat", 8); scanner.generate("wl_output", 4); - exe.linkLibC(); - exe.linkSystemLibrary("wayland-client"); - exe.linkSystemLibrary("wayland-egl"); - exe.linkSystemLibrary("EGL"); - exe.linkSystemLibrary("GLESv2"); - scanner.addCSource(exe); + exe.root_module.linkSystemLibrary("wayland-client", .{}); + exe.root_module.linkSystemLibrary("wayland-egl", .{}); + exe.root_module.linkSystemLibrary("EGL", .{}); + exe.root_module.linkSystemLibrary("GLESv2", .{}); b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); diff --git a/scripts/wlbg/build.zig.zon b/scripts/wlbg/build.zig.zon index 8608b91..5b841f7 100644 --- a/scripts/wlbg/build.zig.zon +++ b/scripts/wlbg/build.zig.zon @@ -4,12 +4,12 @@ .paths = .{""}, .dependencies = .{ .wayland = .{ - .url = "https://git.mzte.de/LordMZTE/zig-wayland/archive/cbd535c4666a04f20bb303dc6485ec51d7db8bf5.tar.gz", - .hash = "1220d3aa22102fa17a6870d241a9541e6810d79d2a69c1ccca71ac90c825b26dd9e1", + .url = "git+https://git.mzte.de/LordMZTE/zig-wayland#4de9f2d6d5fddae1fbb29e21fd1dae69e646ab7d", + .hash = "1220d6448c277e5c41348aa95ce2ba2fc92a92cb7a9e9783edf0f816cd0260122d31", }, .xev = .{ - .url = "https://github.com/mitchellh/libxev/archive/7eada4333c36b3e16f4dc2abad707149ef7b6de5.tar.gz", - .hash = "1220be2c7b3f3a07b9150720140c7038f454a9ce0cbc5d303767c1e4a50856ec1b01", + .url = "git+https://github.com/mitchellh/libxev#2494978bedec01a856e8f3c47a33148ad1755fab", + .hash = "12203de3dbf9c235903c71122448ef031622ba8d64b250205934e2a65018b92b9717", }, }, }