~novakane/zelbar

c5c611985759b79364e5bbbdedb941e3d0953f9e — Hugo Machet 1 year, 3 months ago 2769156
Update to zig 0.10
M .builds/archlinux.yml => .builds/archlinux.yml +4 -4
@@ 27,10 27,10 @@ tasks:
      cd ..

      # Remove a lot of useless lines from wget and tar output.
      wget -nv https://ziglang.org/download/0.9.1/zig-linux-x86_64-0.9.1.tar.xz
      tar -xvf zig-linux-x86_64-0.9.1.tar.xz 1>/dev/null
      sudo mv zig-linux-x86_64-0.9.1/zig /usr/bin/
      sudo mv zig-linux-x86_64-0.9.1/lib /usr/lib/zig
      wget -nv https://ziglang.org/download/0.10.0/zig-linux-x86_64-0.10.0.tar.xz
      tar -xvf zig-linux-x86_64-0.10.0.tar.xz 1>/dev/null
      sudo mv zig-linux-x86_64-0.10.0/zig /usr/bin/
      sudo mv zig-linux-x86_64-0.10.0/lib /usr/lib/zig
  - build: |
      cd zelbar
      zig build

M .builds/freebsd.yml => .builds/freebsd.yml +4 -4
@@ 33,10 33,10 @@ tasks:
      cd ..

      # Remove a lot of useless lines from wget and tar output.
      wget -nv https://ziglang.org/download/0.9.1/zig-freebsd-x86_64-0.9.1.tar.xz
      tar -xvf zig-freebsd-x86_64-0.9.1.tar.xz 1>/dev/null
      sudo mv zig-freebsd-x86_64-0.9.1/zig /usr/bin/
      sudo mv zig-freebsd-x86_64-0.9.1/lib /usr/lib/zig
      wget -nv https://ziglang.org/download/0.10.0/zig-freebsd-x86_64-0.10.0.tar.xz
      tar -xvf zig-freebsd-x86_64-0.10.0.tar.xz 1>/dev/null
      sudo mv zig-freebsd-x86_64-0.10.0/zig /usr/bin/
      sudo mv zig-freebsd-x86_64-0.10.0/lib /usr/lib/zig
  - build: |
      cd zelbar
      zig build

M README.md => README.md +1 -1
@@ 6,7 6,7 @@ Wayland statusbar reading input from STDIN, inspired by [lemonbar].

Requirements:

-   [zig] 0.9.1
-   [zig] 0.10
-   [fcft] 3.0.1 (see fcft [requirements] if you want support for everything)

Init submodules:

M build.zig => build.zig +3 -3
@@ 68,7 68,7 @@ pub fn build(b: *Builder) !void {

    const wayland = std.build.Pkg{
        .name = "wayland",
        .path = .{ .generated = &scanner.result },
        .source = .{ .generated = &scanner.result },
    };
    exe.addPackage(wayland);
    exe.linkLibC();


@@ 77,14 77,14 @@ pub fn build(b: *Builder) !void {

    const pixman = std.build.Pkg{
        .name = "pixman",
        .path = .{ .path = "deps/zig-pixman/pixman.zig" },
        .source = .{ .path = "deps/zig-pixman/pixman.zig" },
    };
    exe.addPackage(pixman);
    exe.linkSystemLibrary("pixman-1");

    const fcft = std.build.Pkg{
        .name = "fcft",
        .path = .{ .path = "deps/zig-fcft/fcft.zig" },
        .source = .{ .path = "deps/zig-fcft/fcft.zig" },
        .dependencies = &[_]std.build.Pkg{pixman},
    };
    exe.addPackage(fcft);

M deps/zig-pixman => deps/zig-pixman +1 -1
@@ 1,1 1,1 @@
Subproject commit d381567de9b6e40dd7f4c6e0b5740f94ebd8c9d7
Subproject commit 4a49ba13eb9ebb0c0f991de924328e3d615bf283

M deps/zig-wayland => deps/zig-wayland +1 -1
@@ 1,1 1,1 @@
Subproject commit 1b9628ba7787653ad6e5c0d3ff1f4b83428313d5
Subproject commit 10ca26f93e61f1d97b9a2e71bc475617bc2da924

M src/Backend.zig => src/Backend.zig +5 -28
@@ 58,7 58,7 @@ const Output = struct {
    fn output_listener(_: *wl.Output, event: wl.Output.Event, output: *Output) void {
        switch (event) {
            .done => {
                log.info("output {s} configured", .{output.name});
                log.info("output {?s} configured", .{output.name});
                output.configured = true;
            },
            .scale => |ev| output.scale = ev.factor,


@@ 391,9 391,11 @@ const Buffer = struct {
        const size: u31 = stride * height;

        // Open a memory backed file.
        const fd = try create_shm_fd();
        const fd = switch (builtin.target.os.tag) {
            .linux, .freebsd => try os.memfd_createZ("zelbar-shm-buffer-pool", os.linux.MFD.CLOEXEC),
            else => @compileError("target OS not supported"),
        };
        defer os.close(fd);

        try os.ftruncate(fd, size);

        // mmap the memory file, to be used by the pximan image.


@@ 445,31 447,6 @@ const Buffer = struct {
            },
        }
    }

    fn create_shm_fd() !os.fd_t {
        switch (builtin.target.os.tag) {
            .linux => {
                return os.memfd_createZ("zelbar-shm-buffer-pool", os.linux.MFD_CLOEXEC);
            },
            .freebsd => {
                const freebsd = struct {
                    const MFD_CLOEXEC = 1;
                    extern fn memfd_create(name: [*:0]const u8, flags: c_uint) c_int;
                };

                const ret = freebsd.memfd_create("zelbar-shm-buffer-pool", freebsd.MFD_CLOEXEC);
                switch (os.errno(ret)) {
                    .SUCCESS => return ret,
                    .BADF => unreachable,
                    .INVAL => unreachable,
                    .NFILE => return error.SystemFdQuotaExceeded,
                    .MFILE => return error.ProcessFdQuotaExceeded,
                    else => |err| return os.unexpectedErrno(err),
                }
            },
            else => @compileError("target OS not supported"),
        }
    }
};

display: *wl.Display = undefined,

M src/event_loop.zig => src/event_loop.zig +2 -2
@@ 42,12 42,12 @@ pub fn run() !void {
        .revents = 0,
    };

    os.sigaction(os.SIG.TERM, &os.Sigaction{
    try os.sigaction(os.SIG.TERM, &os.Sigaction{
        .handler = .{ .handler = handle_sig },
        .mask = os.empty_sigset,
        .flags = 0,
    }, null);
    os.sigaction(os.SIG.INT, &os.Sigaction{
    try os.sigaction(os.SIG.INT, &os.Sigaction{
        .handler = .{ .handler = handle_sig },
        .mask = os.empty_sigset,
        .flags = 0,