Date: Sunday, January 8, 2023 @ 18:27:36
  Author: freswa
Revision: 1382037

upgpkg: waylock 0.5.0-1

Added:
  waylock/trunk/zig_0.10.0.patch
Modified:
  waylock/trunk/PKGBUILD

------------------+
 PKGBUILD         |   45 ++++++++++++++++---------
 zig_0.10.0.patch |   94 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 124 insertions(+), 15 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-01-08 18:26:56 UTC (rev 1382036)
+++ PKGBUILD    2023-01-08 18:27:36 UTC (rev 1382037)
@@ -1,8 +1,8 @@
 # Maintainer: David Runge <[email protected]>
 
 pkgname=waylock
-pkgver=0.3.5
-_commit=20f1f5c5b0349eeb0a8d5d98bba81245b84cc16e  # refs/tags/v0.3.5^{}
+pkgver=0.5.0
+_commit=0bb019937c9a5d21cb205526493559deedfdeace  # refs/tags/v0.5.0^{}
 pkgrel=1
 pkgdesc="A simple screenlocker for wayland compositors"
 arch=(x86_64)
@@ -9,31 +9,46 @@
 url="https://github.com/ifreund/waylock";
 license=(MIT)
 depends=(gcc-libs glibc)
-makedepends=(git libxkbcommon pam rust)
-source=(git+https://github.com/ifreund/waylock#commit=$_commit?signed)
-sha256sums=('SKIP')
+# NOTE: if scdoc is installed zig build tries to install man page to system 
location :-/
+makedepends=(git libxkbcommon pam scdoc wayland wayland-protocols zig)
+source=(
+  git+https://github.com/ifreund/waylock#commit=$_commit?signed
+  git+https://github.com/ifreund/zig-wayland
+  git+https://github.com/ifreund/zig-xkbcommon
+  zig_0.10.0.patch
+)
+sha256sums=('SKIP'
+            'SKIP'
+            'SKIP'
+            'b123ddf515e2fccff1c4fa20193e2a946a3bda8807f15a1445fbbbc04255b142')
 validpgpkeys=('5FBDF84DD2278DB2B8AD8A5286DED400DDFD7A11') # Isaac Freund 
<[email protected]>
 
 prepare() {
   cd $pkgname
-  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
+  git submodule init
+  git config submodule."deps/zig-wayland".url "${srcdir}/zig-wayland"
+  git config submodule."deps/zig-xkbcommon".url "${srcdir}/zig-xkbcommon"
+  git -c protocol.file.allow=always submodule update
+
+  # zig 0.10.0 compatibility
+  patch -Np1 < ../zig_0.10.0.patch
+  cd deps/zig-wayland
+  git checkout 71d21959b4671a848f1d198f6bb919f54d541f41
+  cd ../zig-xkbcommon
+  git checkout bfd1f97c277c32fddb77dee45979d2f472595d19
 }
 
 build() {
   cd $pkgname
-  cargo build --frozen --release --all-features --target-dir=target
+  DESTDIR="build" zig build -Dpie --prefix /usr install
 }
 
-check() {
-  cd $pkgname
-  cargo test --release --locked --target-dir=target
-}
-
 package() {
-  depends+=(libpam.so libxkbcommon.so)
+  depends+=(libpam.so libwayland-client.so libxkbcommon.so)
 
   cd $pkgname
-  install -vDm 755 target/release/$pkgname -t "$pkgdir/usr/bin"
+  mv -v build/* "$pkgdir"
+
   install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
-  install -vDm 644 {README.md,waylock.toml} -t 
"$pkgdir/usr/share/doc/$pkgname/"
+  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
 }

Added: zig_0.10.0.patch
===================================================================
--- zig_0.10.0.patch                            (rev 0)
+++ zig_0.10.0.patch    2023-01-08 18:27:36 UTC (rev 1382037)
@@ -0,0 +1,94 @@
+From 3f4ab22d6c3e8f995ab5971d8c337d926fb0a172 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <[email protected]>
+Date: Thu, 29 Sep 2022 11:16:26 +0200
+Subject: [PATCH] build: update to zig master
+
+---
+ build.zig          |  2 +-
+ deps/zig-wayland   |  2 +-
+ deps/zig-xkbcommon |  2 +-
+ src/Lock.zig       | 21 ++-------------------
+ src/auth.zig       |  4 ++--
+ src/pam.zig        |  2 +-
+ 6 files changed, 8 insertions(+), 25 deletions(-)
+
+diff --git a/build.zig b/build.zig
+index b9bd8d0..adddb19 100644
+--- a/build.zig
++++ b/build.zig
+@@ -91,7 +91,7 @@ pub fn build(b: *zbs.Builder) !void {
+
+     waylock.addPackage(.{
+         .name = "wayland",
+-        .path = .{ .generated = &scanner.result },
++        .source = .{ .generated = &scanner.result },
+     });
+     waylock.step.dependOn(&scanner.step);
+     waylock.addPackagePath("xkbcommon", 
"deps/zig-xkbcommon/src/xkbcommon.zig");
+diff --git a/src/Lock.zig b/src/Lock.zig
+index 0a34ceb..aaa810e 100644
+--- a/src/Lock.zig
++++ b/src/Lock.zig
+@@ -443,25 +443,8 @@ fn create_buffers(shm: *wl.Shm, options: Options) 
![3]*wl.Buffer {
+
+ fn shm_fd_create() !os.fd_t {
+     switch (builtin.target.os.tag) {
+-        .linux => {
+-            return os.memfd_createZ("waylock-shm", os.linux.MFD_CLOEXEC);
+-        },
+-        .freebsd => {
+-            // TODO upstream this to the zig standard library
+-            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("waylock-shm", 
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),
+-            }
++        .linux, .freebsd => {
++            return os.memfd_createZ("waylock-shm", os.linux.MFD.CLOEXEC);
+         },
+         else => @compileError("Target OS not supported"),
+     }
+diff --git a/src/auth.zig b/src/auth.zig
+index 4c7da08..94ca6b2 100644
+--- a/src/auth.zig
++++ b/src/auth.zig
+@@ -102,7 +102,7 @@ pub fn run(conn: Connection) noreturn {
+
+             const end_result = pamh.end(setcred_result);
+             if (end_result != .success) {
+-                log.err("PAM deinitialization failed: {s}", .{end_result});
++                log.err("PAM deinitialization failed: {s}", 
.{end_result.description()});
+             }
+
+             os.exit(0);
+@@ -117,7 +117,7 @@ pub fn run(conn: Connection) noreturn {
+             if (auth_result == .abort) {
+                 const end_result = pamh.end(auth_result);
+                 if (end_result != .success) {
+-                    log.err("PAM deinitialization failed: {s}", 
.{end_result});
++                    log.err("PAM deinitialization failed: {s}", 
.{end_result.description()});
+                 }
+                 os.exit(1);
+             }
+diff --git a/src/pam.zig b/src/pam.zig
+index 0e3693e..8b7f144 100644
+--- a/src/pam.zig
++++ b/src/pam.zig
+@@ -41,7 +41,7 @@ pub const Response = extern struct {
+ };
+
+ pub const Conv = extern struct {
+-    conv: fn (
++    conv: *const fn (
+         num_msg: c_int,
+         /// Note: This matches the Linux-PAM API, apparently Solaris PAM 
differs
+         /// in how the msg argument is used.

Reply via email to