PKGBUILD: use patch file for nim-dbus dtBool fix

This commit is contained in:
Niko Marmeladkov 2026-05-30 11:01:25 +03:00
parent 7a1f142266
commit fa8183561a
Signed by untrusted user who does not match committer: Niko
GPG key ID: E3B955F9442D44E3
2 changed files with 17 additions and 9 deletions

View file

@ -18,21 +18,18 @@ prepare() {
cd "$srcdir/$_repodir"
nimble install -y --depsOnly --nimbleDir:"$srcdir/nimble" 2>/dev/null || true
export NIMBLE_DIR="$srcdir/nimble"
# patch nim-dbus: add dtBool to getPrimitive, nil-safe $ for DbusType
local dbus_val="$NIMBLE_DIR/pkgs2/$(ls "$NIMBLE_DIR/pkgs2" | grep '^dbus-')/dbus/private/value.nim"
local dbus_typ="$NIMBLE_DIR/pkgs2/$(ls "$NIMBLE_DIR/pkgs2" | grep '^dbus-')/dbus/private/types.nim"
if ! grep -q 'of dtBool:' "$dbus_val" 2>/dev/null; then
sed -i '/^ of dtDouble:/i\ of dtBool:\n return addr val.boolValue' "$dbus_val"
fi
if ! grep -q 'isNil' "$dbus_typ" 2>/dev/null; then
sed -i '/^proc `\$`\*(t: DbusType): string =/a\ if t.isNil:\n return "\<nil\>"' "$dbus_typ"
# patch nim-dbus: add dtBool to getPrimitive
local dbus_dir="$NIMBLE_DIR/pkgs2/$(ls "$NIMBLE_DIR/pkgs2" | grep '^dbus-')"
if ! grep -q 'of dtBool' "$dbus_dir/dbus/private/value.nim" 2>/dev/null; then
patch -d "$dbus_dir" -p1 < "$srcdir/$_repodir/nim-dbus-dtbool.patch"
fi
}
build() {
cd "$srcdir/$_repodir"
export NIMBLE_DIR="$srcdir/nimble"
export HOME="$srcdir" # isolate nim cache
# fresh nimcache to force recompile patched deps
rm -rf "$srcdir/nimcache"
nim c \
--path:"$NIMBLE_DIR/pkgs2" \
--nimcache:"$srcdir/nimcache" \

11
nim-dbus-dtbool.patch Normal file
View file

@ -0,0 +1,11 @@
--- a/dbus/private/value.nim
+++ b/dbus/private/value.nim
@@ -93,6 +93,8 @@ type DbusNativePrimitive = bool | float64 | int32 | int16 | uint16 | uint64 | ui
proc getPrimitive(val: DbusValue): pointer =
case val.kind
+ of dtBool:
+ return addr val.uint32Value
of dtDouble:
return addr val.doubleValue
of dtInt32: