~novakane/public-inbox

rivercarro: common: fixed build issues v1 REJECTED

~mohan43u: 1
 common: fixed build issues

 3 files changed, 26 insertions(+), 35 deletions(-)
#946495 .build.yml failed
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~novakane/public-inbox/patches/39278/mbox | git am -3
Learn more about email & git

[PATCH rivercarro] common: fixed build issues Export this patch

From: Mohan R <mohan43u@gmail.com>

fixed build issues with latest zig 0.11.0-dev.1638+7199d7c77
---
 build.zig        | 55 ++++++++++++++++++++----------------------------
 common/flags.zig |  4 ++--
 deps/zig-wayland |  2 +-
 3 files changed, 26 insertions(+), 35 deletions(-)

diff --git a/build.zig b/build.zig
index fc9ee9a..b79ed16 100644
--- a/build.zig
@@ -1,6 +1,5 @@
const std = @import("std");
const Builder = @import("std").build.Builder;
const Step = @import("std").build.Step;
const zbs = @import("std").Build;
const assert = std.debug.assert;
const fs = std.fs;
const mem = std.mem;
@@ -14,21 +13,21 @@ const ScanProtocolsStep = @import("deps/zig-wayland/build.zig").ScanProtocolsSte
/// suffix added.
const version = "0.3.0-dev";

pub fn build(b: *Builder) !void {
pub fn build(b: *zbs.Builder) !void {
    const target = b.standardTargetOptions(.{});
    const mode = b.standardReleaseOptions();
    const optimize = b.standardOptimizeOption(.{});

    const full_version = blk: {
        if (mem.endsWith(u8, version, "-dev")) {
            var ret: u8 = undefined;

            const git_describe_long = b.execAllowFail(
                &[_][]const u8{ "git", "-C", b.build_root, "describe", "--long" },
                &[_][]const u8{ "git", "-C", b.build_root.path.?, "describe", "--long" },
                &ret,
                .Inherit,
            ) catch break :blk version;

            var it = mem.split(u8, mem.trim(u8, git_describe_long, &std.ascii.spaces), "-");
            var it = mem.split(u8, mem.trim(u8, git_describe_long, &std.ascii.whitespace), "-");
            _ = it.next().?; // previous tag
            const commit_count = it.next().?;
            const commit_hash = it.next().?;
@@ -47,40 +46,32 @@ pub fn build(b: *Builder) !void {

    const scanner = ScanProtocolsStep.create(b);
    scanner.addProtocolPath("protocol/river-layout-v3.xml");

    const exe = b.addExecutable("rivercarro", "src/main.zig");
    exe.setTarget(target);
    exe.setBuildMode(mode);

    const options = b.addOptions();
    options.addOption([]const u8, "version", full_version);
    exe.addOptions("build_options", options);

    exe.step.dependOn(&scanner.step);

    exe.addPackagePath("flags", "common/flags.zig");

    scanner.generate("wl_output", 4);
    scanner.generate("river_layout_manager_v3", 2);

    exe.addPackage(.{
        .name = "wayland",
        .source = .{ .generated = &scanner.result },
    });
    exe.linkLibC();
    exe.linkSystemLibrary("wayland-client");
    const compiler = b.addExecutable(.{ .name = "rivercarro", .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimize = optimize });
    compiler.step.dependOn(&scanner.step);
    const flags = b.createModule(.{ .source_file = .{ .path = "common/flags.zig" } });
    compiler.addModule("flags", flags);
    const wayland = b.createModule(.{ .source_file = .{ .generated = &scanner.result } });
    compiler.addModule("wayland", wayland);
    scanner.addCSource(compiler);
    compiler.linkLibC();
    compiler.linkSystemLibrary("wayland-client");

    scanner.addCSource(exe);
    const options = b.addOptions();
    options.addOption([]const u8, "version", full_version);
    compiler.addOptions("build_options", options);

    exe.install();
    compiler.install();
    b.installFile("doc/rivercarro.1", "share/man/man1/rivercarro.1");

    const run_cmd = exe.run();
    run_cmd.step.dependOn(b.getInstallStep());
    const runner = b.addRunArtifact(compiler);
    runner.step.dependOn(b.getInstallStep());
    if (b.args) |args| {
        run_cmd.addArgs(args);
        runner.addArgs(args);
    }

    const run_step = b.step("run", "Run the app");
    run_step.dependOn(&run_cmd.step);
    const runnerStep = b.step("run", "Run the app");
    runnerStep.dependOn(&runner.step);
}
diff --git a/common/flags.zig b/common/flags.zig
index 1e34ce1..ffce566 100644
--- a/common/flags.zig
+++ b/common/flags.zig
@@ -41,14 +41,14 @@ pub fn parser(comptime Arg: type, comptime flags: []const Flag) type {
                    const field: std.builtin.Type.StructField = switch (flag.kind) {
                        .boolean => .{
                            .name = flag.name,
                            .field_type = bool,
                            .type = bool,
                            .default_value = &false,
                            .is_comptime = false,
                            .alignment = @alignOf(bool),
                        },
                        .arg => .{
                            .name = flag.name,
                            .field_type = ?[:0]const u8,
                            .type = ?[:0]const u8,
                            .default_value = &@as(?[:0]const u8, null),
                            .is_comptime = false,
                            .alignment = @alignOf(?[:0]const u8),
diff --git a/deps/zig-wayland b/deps/zig-wayland
index 71d2195..4212e2a 160000
--- a/deps/zig-wayland
+++ b/deps/zig-wayland
@@ -1 +1 @@
Subproject commit 71d21959b4671a848f1d198f6bb919f54d541f41
Subproject commit 4212e2a3129822ec6c79b397d1ab8a703ecb6c2c
-- 
2.34.7
rivercarro/patches/.build.yml: FAILED in 1m31s

[common: fixed build issues][0] from [~mohan43u][1]

[0]: https://lists.sr.ht/~novakane/public-inbox/patches/39278
[1]: mailto:mohan43u@gmail.com

✗ #946495 FAILED rivercarro/patches/.build.yml https://builds.sr.ht/~novakane/job/946495
Thanks for the patch, but rivercarro like river and all dependencies
follows zig stable release and I don't intend to change that.