From f7da569879acb7cf7bc9c1ba127e5da95324c8f8 Mon Sep 17 00:00:00 2001 From: LN Liberda <lauren@selfisekai.rocks> Date: Tue, 11 Mar 2025 20:43:37 +0100 Subject: [PATCH] testing/wayprompt: rebuild with zig 0.14 --- .../0001-build-update-to-Zig-0.14.0.patch | 326 ++++++++++++++++++ testing/wayprompt/APKBUILD | 9 +- 2 files changed, 332 insertions(+), 3 deletions(-) create mode 100644 testing/wayprompt/0001-build-update-to-Zig-0.14.0.patch diff --git a/testing/wayprompt/0001-build-update-to-Zig-0.14.0.patch b/testing/wayprompt/0001-build-update-to-Zig-0.14.0.patch new file mode 100644 index 000000000000..7a6679a4d5ac --- /dev/null +++ b/testing/wayprompt/0001-build-update-to-Zig-0.14.0.patch @@ -0,0 +1,326 @@ +From 5c972303d25f8452d65632c813f16e74183e7442 Mon Sep 17 00:00:00 2001 +From: LN Liberda <lauren@selfisekai.rocks> +Date: Tue, 11 Mar 2025 20:13:20 +0100 +Subject: [PATCH] build: update to Zig 0.14.0 + +--- + build.zig | 16 +++++++-------- + build.zig.zon | 42 +++++++++++++++++++++----------------- + src/Config.zig | 9 ++++---- + src/SecretBuffer.zig | 4 ++-- + src/Wayland.zig | 28 ++++++++++++------------- + src/wayprompt-pinentry.zig | 2 +- + 6 files changed, 52 insertions(+), 49 deletions(-) + +diff --git a/build.zig b/build.zig +index d5e155e..3501960 100644 +--- a/build.zig ++++ b/build.zig +@@ -2,7 +2,7 @@ const std = @import("std"); + const fs = std.fs; + const mem = std.mem; + +-const Scanner = @import("zig-wayland").Scanner; ++const Scanner = @import("wayland").Scanner; + + pub fn build(b: *std.Build) !void { + const target = b.standardTargetOptions(.{}); +@@ -13,7 +13,7 @@ pub fn build(b: *std.Build) !void { + const llvm = !(b.option(bool, "no-llvm", "(expirimental) Use non-LLVM x86 Zig backend") orelse false); + + const scanner = Scanner.create(b, .{}); +- scanner.addCustomProtocol("protocol/wlr-layer-shell-unstable-v1.xml"); ++ scanner.addCustomProtocol(b.path("protocol/wlr-layer-shell-unstable-v1.xml")); + scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml"); // Dependency of layer-shell. + scanner.addSystemProtocol("staging/cursor-shape/cursor-shape-v1.xml"); + scanner.addSystemProtocol("unstable/tablet/tablet-unstable-v2.xml"); // Dependency of cursor-shape. +@@ -25,11 +25,11 @@ pub fn build(b: *std.Build) !void { + scanner.generate("wl_output", 4); + + const wayland = b.createModule(.{ .root_source_file = scanner.result }); +- const xkbcommon = b.dependency("zig-xkbcommon", .{}).module("xkbcommon"); +- const pixman = b.dependency("zig-pixman", .{}).module("pixman"); +- const spoon = b.dependency("zig-spoon", .{}).module("spoon"); +- const fcft = b.dependency("zig-fcft", .{}).module("fcft"); +- const ini = b.dependency("zig-ini", .{}).module("ini"); ++ const xkbcommon = b.dependency("xkbcommon", .{}).module("xkbcommon"); ++ const pixman = b.dependency("pixman", .{}).module("pixman"); ++ const spoon = b.dependency("spoon", .{}).module("spoon"); ++ const fcft = b.dependency("fcft", .{}).module("fcft"); ++ const ini = b.dependency("ini", .{}).module("ini"); + + const wayprompt_cli = b.addExecutable(.{ + .name = "wayprompt", +@@ -45,7 +45,6 @@ pub fn build(b: *std.Build) !void { + wayprompt_cli.root_module.addImport("wayland", wayland); + wayprompt_cli.linkSystemLibrary("wayland-client"); + wayprompt_cli.linkSystemLibrary("wayland-cursor"); +- scanner.addCSource(wayprompt_cli); + wayprompt_cli.root_module.addImport("ini", ini); + wayprompt_cli.root_module.addImport("fcft", fcft); + wayprompt_cli.linkSystemLibrary("fcft"); +@@ -71,7 +70,6 @@ pub fn build(b: *std.Build) !void { + wayprompt_pinentry.root_module.addImport("wayland", wayland); + wayprompt_pinentry.linkSystemLibrary("wayland-client"); + wayprompt_pinentry.linkSystemLibrary("wayland-cursor"); +- scanner.addCSource(wayprompt_pinentry); + wayprompt_pinentry.root_module.addImport("ini", ini); + wayprompt_pinentry.root_module.addImport("fcft", fcft); + wayprompt_pinentry.linkSystemLibrary("fcft"); +diff --git a/build.zig.zon b/build.zig.zon +index d1c0b83..ea435e4 100644 +--- a/build.zig.zon ++++ b/build.zig.zon +@@ -1,31 +1,35 @@ + .{ +- .name = "wayprompt", ++ .name = .wayprompt, + .version = "0.2.0", + .paths = .{""}, + .dependencies = .{ +- .@"zig-ini" = .{ +- .url = "https://git.sr.ht/~leon_plickat/zig-ini/archive/879c74a3a801d49fa34343aebd55a22f591899b3.tar.gz", +- .hash = "12201bbf05e1fb73323a9b13d2599dc4bf82851e6d328d7523a1af5b861a87edf286", ++ .ini = .{ ++ // https://lists.sr.ht/~leon_plickat/public-inbox/patches/57972 ++ .url = "https://s.lnl.gay/3LR6ldrkzAmZH7PTCdTV8USxkppSEhj7.tar.zst", ++ .hash = "ini-1.0.2-vBSBn_RmAACl2QUv14WHU5Q2bpKsXpr5hD1E5i7Tmjyl", + }, +- .@"zig-spoon" = .{ +- .url = "https://git.sr.ht/~leon_plickat/zig-spoon/archive/fdba8e643c9558254bf4e6c600dfbd782fa7a267.tar.gz", +- .hash = "12202727aaaf0e742d4945be55af1ace8b25902095e0c1b0a24b70cc80a81b7ac518", ++ .spoon = .{ ++ // https://lists.sr.ht/~leon_plickat/public-inbox/patches/57973 ++ .url = "https://s.lnl.gay/yD0sBtXHlar8sU4AwmAhP9US0WB2P9es.tar.zst", ++ .hash = "spoon-0.1.0-jYZhgyOkAgAcVmy4HaMNShXHc18g0QUAJ_zTZNI6xvWK", + }, +- .@"zig-pixman" = .{ +- .url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.2.0.tar.gz", +- .hash = "12209db20ce873af176138b76632931def33a10539387cba745db72933c43d274d56", ++ .pixman = .{ ++ .url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.3.0.tar.gz", ++ .hash = "pixman-0.3.0-LClMnz2VAAAs7QSCGwLimV5VUYx0JFnX5xWU6HwtMuDX", + }, +- .@"zig-wayland" = .{ +- .url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.2.0.tar.gz", +- .hash = "1220687c8c47a48ba285d26a05600f8700d37fc637e223ced3aa8324f3650bf52242", ++ .wayland = .{ ++ .url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.3.0.tar.gz", ++ .hash = "wayland-0.3.0-lQa1kjPIAQDmhGYpY-zxiRzQJFHQ2VqhJkQLbKKdt5wl", + }, +- .@"zig-xkbcommon" = .{ +- .url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.2.0.tar.gz", +- .hash = "1220c90b2228d65fd8427a837d31b0add83e9fade1dcfa539bb56fd06f1f8461605f", ++ .xkbcommon = .{ ++ .url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.3.0.tar.gz", ++ .hash = "xkbcommon-0.3.0-VDqIe3K9AQB2fG5ZeRcMC9i7kfrp5m2rWgLrmdNn9azr", + }, +- .@"zig-fcft" = .{ +- .url = "https://git.sr.ht/~novakane/zig-fcft/archive/1.1.0.tar.gz", +- .hash = "1220a4029ee3ee70d3175c69878e2b70dccd000c4324bc74ba800d8a143b7250fb38", ++ .fcft = .{ ++ // https://lists.sr.ht/~novakane/public-inbox/patches/57974 ++ .url = "https://s.lnl.gay/vIXYI8JINhdNcFVakwBWo6qkGGtY9xC7.tar.zst", ++ .hash = "fcft-1.0.0-zcx6C5EaAACt1GaWAjvr5c4QF3-_Ug5RA1-YbhYTpDd-", + }, + }, ++ .fingerprint = 0xc45742f410512433, + } +diff --git a/src/Config.zig b/src/Config.zig +index 7d24429..461bf18 100644 +--- a/src/Config.zig ++++ b/src/Config.zig +@@ -53,7 +53,7 @@ const WaylandColours = struct { + cancel_button_text: pixman.Color = comptimePixmanColourFromRGB("0x000000"), + + fn assign(self: *WaylandColours, path: []const u8, line: usize, variable: []const u8, value: []const u8) error{BadConfig}!bool { +- const info = @typeInfo(WaylandColours).Struct; ++ const info = @typeInfo(WaylandColours).@"struct"; + inline for (info.fields) |field| { + if (fieldEql(field.name, variable)) { + debug.assert(@TypeOf(@field(self, field.name)) == pixman.Color); +@@ -99,7 +99,7 @@ const WaylandUi = struct { + } + + fn assign(self: *WaylandUi, alloc: mem.Allocator, path: []const u8, line: usize, variable: []const u8, value: []const u8) error{ BadConfig, OutOfMemory }!bool { +- const info = @typeInfo(WaylandUi).Struct; ++ const info = @typeInfo(WaylandUi).@"struct"; + inline for (info.fields) |field| { + if (fieldEql(field.name, variable)) { + switch (@TypeOf(@field(self, field.name))) { +@@ -144,12 +144,12 @@ alloc: mem.Allocator, + /// as such they are provided by the gpg-agent. + /// Populated at runtime. + tty_name: ?[:0]const u8 = null, +-wayland_display: ?[:0]const u8 = null, ++wayland_display: ?[]const u8 = null, + + /// Frees all memory using provided allocator. + pub fn reset(self: *Config, alloc: mem.Allocator) void { + self.wayland_ui.reset(alloc); +- const info = @typeInfo(@TypeOf(self.labels)).Struct; ++ const info = @typeInfo(@TypeOf(self.labels)).@"struct"; + inline for (info.fields) |field| { + if (@field(self.labels, field.name)) |str| { + @field(self.labels, field.name) = null; +@@ -254,6 +254,7 @@ fn comptimePixmanColourFromRGB(hex: []const u8) pixman.Color { + } + + fn pixmanColourFromRGB(hex: []const u8) !pixman.Color { ++ @setEvalBranchQuota(10_000); + if (hex.len != "0xRRGGBB".len and hex.len != "0xRRGGBBAA".len) return error.BadColour; + if (hex[0] != '0' or hex[1] != 'x') return error.BadColour; + +diff --git a/src/SecretBuffer.zig b/src/SecretBuffer.zig +index d3955f6..1e39e6c 100644 +--- a/src/SecretBuffer.zig ++++ b/src/SecretBuffer.zig +@@ -8,7 +8,7 @@ const unicode = std.unicode; + + const Self = @This(); + +-buffer: []align(mem.page_size) u8, ++buffer: []align(heap.page_size_min) u8, + fba: heap.FixedBufferAllocator, + str: std.ArrayListUnmanaged(u8), + len: usize, +@@ -16,7 +16,7 @@ len: usize, + extern fn mlock(addr: *const anyopaque, len: usize) c_int; + + pub fn init(self: *Self, alloc: mem.Allocator) !void { +- self.buffer = try alloc.alignedAlloc(u8, mem.page_size, 1024); ++ self.buffer = try alloc.alignedAlloc(u8, heap.page_size_min, 1024); + self.fba = heap.FixedBufferAllocator.init(self.buffer); + self.str = .{}; + self.len = 0; +diff --git a/src/Wayland.zig b/src/Wayland.zig +index 7015054..359b62a 100644 +--- a/src/Wayland.zig ++++ b/src/Wayland.zig +@@ -243,7 +243,7 @@ const Seat = struct { + + // Touch related objects. + wl_touch: ?*wl.Touch = null, +- touchpoints: std.TailQueue(TouchPoint) = .{}, ++ touchpoints: std.DoublyLinkedList(TouchPoint) = .{}, + + pub fn init(self: *Seat, w: *Wayland, wl_seat: *wl.Seat) !void { + self.* = .{ .w = w, .wl_seat = wl_seat }; +@@ -575,7 +575,7 @@ const Seat = struct { + // generally is better UX. We have a list of + // touchpoints instead of a single one so that we can + // support multi-touch operation. +- const node = alloc.create(std.TailQueue(TouchPoint).Node) catch return; ++ const node = alloc.create(std.DoublyLinkedList(TouchPoint).Node) catch return; + node.data = .{ + .id = ev.id, + .hotspot = hotspot, +@@ -622,7 +622,7 @@ const Seat = struct { + } + } + +- fn touchPointNodeFromId(seat: *Seat, id: i32) ?*std.TailQueue(TouchPoint).Node { ++ fn touchPointNodeFromId(seat: *Seat, id: i32) ?*std.DoublyLinkedList(TouchPoint).Node { + debug.assert(seat.wl_touch != null); + var it = seat.touchpoints.first; + while (it) |node| : (it = node.next) { +@@ -1264,7 +1264,7 @@ const BufferPool = struct { + + /// The buffers. This is a linked list and not an array list, because we + /// need stable pointers for the listener of the wl_buffer object. +- buffers: std.TailQueue(Buffer) = .{}, ++ buffers: std.DoublyLinkedList(Buffer) = .{}, + + /// Deinit the buffer pool, destroying all buffers and freeing all memory. + pub fn deinit(self: *BufferPool, alloc: mem.Allocator) void { +@@ -1295,7 +1295,7 @@ const BufferPool = struct { + + fn findSuitableBuffer(self: *BufferPool, w: *Wayland, width: u31, height: u31) !?*Buffer { + var it = self.buffers.first; +- var first_unbusy_buffer_node: ?*std.TailQueue(Buffer).Node = null; ++ var first_unbusy_buffer_node: ?*std.DoublyLinkedList(Buffer).Node = null; + while (it) |node| : (it = node.next) { + if (node.data.busy) continue; + if (node.data.width == width and node.data.height == height) { +@@ -1319,7 +1319,7 @@ const BufferPool = struct { + fn newBuffer(self: *BufferPool, w: *Wayland, width: u31, height: u31) !*Buffer { + log.debug("New buffer: {}x{}", .{ width, height }); + const alloc = w.config.alloc; +- const node = try alloc.create(std.TailQueue(Buffer).Node); ++ const node = try alloc.create(std.DoublyLinkedList(Buffer).Node); + errdefer alloc.destroy(node); + try node.data.init(w, width, height); + self.buffers.append(node); +@@ -1354,7 +1354,7 @@ const BufferPool = struct { + const Buffer = struct { + wl_buffer: ?*wl.Buffer = null, + pixman_image: ?*pixman.Image = null, +- data: ?[]align(std.mem.page_size) u8 = null, ++ data: ?[]align(std.heap.page_size_min) u8 = null, + width: u31 = 0, // u31 can coerce to i32. + height: u31 = 0, + busy: bool = false, +@@ -1441,7 +1441,7 @@ layer_shell: ?*zwlr.LayerShellV1 = null, + cursor_shape_manager: ?*wp.CursorShapeManagerV1 = null, + compositor: ?*wl.Compositor = null, + shm: ?*wl.Shm = null, +-seats: std.TailQueue(Seat) = .{}, ++seats: std.DoublyLinkedList(Seat) = .{}, + buffer_pool: BufferPool = .{}, + surface: ?Surface = null, + +@@ -1699,27 +1699,27 @@ fn abort(self: *Wayland, reason: anyerror) void { + fn registryListener(registry: *wl.Registry, event: wl.Registry.Event, self: *Wayland) void { + switch (event) { + .global => |ev| { +- if (mem.orderZ(u8, ev.interface, zwlr.LayerShellV1.getInterface().name) == .eq) { ++ if (mem.orderZ(u8, ev.interface, zwlr.LayerShellV1.interface.name) == .eq) { + self.layer_shell = registry.bind(ev.name, zwlr.LayerShellV1, 4) catch { + self.abort(error.OutOfMemory); + return; + }; +- } else if (mem.orderZ(u8, ev.interface, wp.CursorShapeManagerV1.getInterface().name) == .eq) { ++ } else if (mem.orderZ(u8, ev.interface, wp.CursorShapeManagerV1.interface.name) == .eq) { + self.cursor_shape_manager = registry.bind(ev.name, wp.CursorShapeManagerV1, 1) catch { + self.abort(error.OutOfMemory); + return; + }; +- } else if (mem.orderZ(u8, ev.interface, wl.Compositor.getInterface().name) == .eq) { ++ } else if (mem.orderZ(u8, ev.interface, wl.Compositor.interface.name) == .eq) { + self.compositor = registry.bind(ev.name, wl.Compositor, 4) catch { + self.abort(error.OutOfMemory); + return; + }; +- } else if (mem.orderZ(u8, ev.interface, wl.Shm.getInterface().name) == .eq) { ++ } else if (mem.orderZ(u8, ev.interface, wl.Shm.interface.name) == .eq) { + self.shm = registry.bind(ev.name, wl.Shm, 1) catch { + self.abort(error.OutOfMemory); + return; + }; +- } else if (mem.orderZ(u8, ev.interface, wl.Seat.getInterface().name) == .eq) { ++ } else if (mem.orderZ(u8, ev.interface, wl.Seat.interface.name) == .eq) { + const seat = registry.bind(ev.name, wl.Seat, 1) catch { + self.abort(error.OutOfMemory); + return; +@@ -1735,7 +1735,7 @@ fn registryListener(registry: *wl.Registry, event: wl.Registry.Event, self: *Way + } + + fn addSeat(self: *Wayland, wl_seat: *wl.Seat) !void { +- const node = try self.config.alloc.create(std.TailQueue(Seat).Node); ++ const node = try self.config.alloc.create(std.DoublyLinkedList(Seat).Node); + try node.data.init(self, wl_seat); + self.seats.append(node); + } +diff --git a/src/wayprompt-pinentry.zig b/src/wayprompt-pinentry.zig +index 305636e..b84f039 100644 +--- a/src/wayprompt-pinentry.zig ++++ b/src/wayprompt-pinentry.zig +@@ -276,7 +276,7 @@ fn parseInput(writer: io.BufferedWriter(4096, fs.File.Writer).Writer, line: []co + if (mode != .none) return; + + const alloc = gpa.allocator(); +- var it = mem.tokenize(u8, line, &ascii.whitespace); ++ var it = mem.tokenizeSequence(u8, line, &ascii.whitespace); + const command = it.next() orelse return; + if (ascii.eqlIgnoreCase(command, "settitle")) { + try setString(writer, "title", line["settitle".len..]); diff --git a/testing/wayprompt/APKBUILD b/testing/wayprompt/APKBUILD index 635e6955155d..d8c07f9e9200 100644 --- a/testing/wayprompt/APKBUILD +++ b/testing/wayprompt/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Maarten van Gompel <proycon@anaproy.nl> pkgname=wayprompt pkgver=0.1.2 -pkgrel=0 +pkgrel=1 pkgdesc="multi-purpose prompt tool for Wayland " url="https://git.sr.ht/~leon_plickat/wayprompt" # aarch64: failing on the package builder, connection issues @@ -16,8 +16,10 @@ makedepends=" zig " subpackages="$pkgname-doc" -source="https://codeberg.org/ifreund/waylock/releases/download/v$pkgver/waylock-$pkgver.tar.gz" -source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~leon_plickat/wayprompt/archive/v$pkgver.tar.gz" +source=" + $pkgname-$pkgver.tar.gz::https://git.sr.ht/~leon_plickat/wayprompt/archive/v$pkgver.tar.gz + 0001-build-update-to-Zig-0.14.0.patch + " builddir="$srcdir/$pkgname-v$pkgver" # !check: no test suite # net: downloads dependencies defined in build.zig.zon @@ -37,4 +39,5 @@ package() { sha512sums=" b9599b25bc83ed2fc5da4573a2bf687ccb856cb9a16ee5e2946668c252264743a5b5b67813115b1240e0bb7e4ca89ac24f7a84bc9aaee25482c2ee787e127f0e wayprompt-0.1.2.tar.gz +f1e019369be74d2f7b017d9194ecf201036acadff2e6ac8cb81ce321085d7dcf25478d7ec84fcb9200da880bd010bf567be8b39b24a5a3b4a4256ba57ad0c9ea 0001-build-update-to-Zig-0.14.0.patch " -- GitLab