Files
omarchy-pkgs/pkgbuilds/cua-driver-bin/PKGBUILD
T
Spencer Bull 5c6444e604 Update cua-driver-bin to 0.33.4, which captures multi-monitor Hyprland desktops again (#807)
Driver 0.28.3 through 0.33.3 refused desktop capture on Hyprland with more than one output or one output away from the origin (trycua/cua#4161), which is why the package was held at 0.28.2; 0.33.4 fixes it (trycua/cua#4305). The plugin sources are unchanged from 0.32.0 through 0.33.4 and speak the same input protocol, so the plugin package stays and only its README names the new pairing.
2026-10-08 22:08:08 -05:00

116 lines
4.9 KiB
Bash

# Maintainer: Spencer Bull <spencerbull2554@gmail.com>
# cua-driver ships prebuilt from the trycua/cua monorepo release feed, so this
# repackages the vendor tarball. Upstream keeps the CLI, its cursor-theme
# compiler, and the SDK artifacts together in one directory and exposes the
# CLI through a symlink -- the binary resolves its helpers as siblings of
# /proc/self/exe -- so the whole tree lands under /usr/lib/cua-driver with a
# /usr/bin symlink. Upstream updates are held ("sync": false): Omarchy bumps
# the version and checksums below by hand, from the release's checksums.txt.
# .omarchy/upstream.sh still selects releases for when the hold lifts.
#
# The binary carries its own updater: `cua-driver update --apply` pipes the
# vendor installer into bash, which would install a second copy under
# ~/.cua-driver and link it into ~/.local/bin, stepping around pacman and
# this repository's release gate. Driver 0.27.0 detects pacman ownership, but
# deliberately treats failed and timed-out ownership queries as unmanaged.
# A /usr/bin wrapper would not cover MCP configurations that record the
# resolved executable, so prepare() rewrites the installer URL inside the
# binary to point at pm.sh, a stand-in that declines and names pacman instead.
pkgname=cua-driver-bin
pkgver=0.33.4
pkgrel=1
pkgdesc="Computer-use driver for native GUI apps: accessibility-tree snapshots and input injection"
arch=('x86_64' 'aarch64')
url="https://github.com/trycua/cua"
license=('MIT')
# at-spi2-core carries the AT-SPI accessibility bus the driver reads GUI
# trees through; the X libraries are linked, not dlopen'd.
depends=(
'at-spi2-core'
'gcc-libs'
'glibc'
'libx11'
'libxcb'
'libxext'
'libxi'
'libxkbcommon'
)
provides=("cua-driver=${pkgver}")
conflicts=('cua-driver')
# Prebuilt Rust binaries ship byte-exact apart from the installer rewrite
# below: their build ids are what upstream symbolication matches.
options=('!strip' '!debug')
source=('LICENSE' 'pm.sh')
source_x86_64=("https://github.com/trycua/cua/releases/download/cua-driver-rs-v${pkgver}/cua-driver-rs-${pkgver}-linux-x86_64.tar.gz")
source_aarch64=("https://github.com/trycua/cua/releases/download/cua-driver-rs-v${pkgver}/cua-driver-rs-${pkgver}-linux-arm64.tar.gz")
sha256sums=('c0779290c1d4783169aa3dbfb55feb505e563ef8a004bbf55298ceffcfbda8d9'
'c76e251c3ed424200eac52bec35ba534336307fabd83a175ab0b47e2084ab0d8')
sha256sums_x86_64=('a4759cc41c00691a345f08abfc28ece79aef41447d27a463ddd8662939fa3378')
sha256sums_aarch64=('63a1e858a1a407c44ceb407ad133909b8cddedd713aea3b56d7ccb6db784eb48')
case "${CARCH}" in
x86_64) _platform="linux-x86_64" ;;
aarch64) _platform="linux-arm64" ;;
esac
_vendor_tree="cua-driver-rs-${pkgver}-${_platform}"
# Rust strings carry their length out of band, so the replacement has to be
# exactly as long as the original, which is what fixes the
# stand-in's short name and location.
_vendor_installer='https://cua.ai/driver/install.sh'
_pacman_installer='file:///usr/lib/cua-driver/pm.sh'
prepare() {
cd "${srcdir}/${_vendor_tree}"
if (( ${#_vendor_installer} != ${#_pacman_installer} )); then
echo "installer URLs must be the same length to rewrite in place" >&2
return 1
fi
# Through 0.33.4 the URL appears in the updater, the printed reinstall
# command, and two embedded copies of Skills/cua-driver/README.md. Rewrite all four
# so the embedded instructions also defer to pacman. Any other count means
# the release layout changed and needs review before packaging.
local expected=4 found
found=$(grep -obUaF "${_vendor_installer}" cua-driver | wc -l)
if (( found != expected )); then
echo "expected the vendor installer URL ${expected} times in cua-driver, found ${found}" >&2
return 1
fi
local size_before size_after
size_before=$(stat -c %s cua-driver)
sed -i "s|${_vendor_installer//./\\.}|${_pacman_installer}|g" cua-driver
size_after=$(stat -c %s cua-driver)
if (( size_before != size_after )) \
|| grep -qUaF "${_vendor_installer}" cua-driver \
|| (( $(grep -obUaF "${_pacman_installer}" cua-driver | wc -l) != expected )); then
echo "installer URL rewrite did not land cleanly in cua-driver" >&2
return 1
fi
}
package() {
cd "${srcdir}/${_vendor_tree}"
# The vendor tree stays together: cua-driver execs cua-cursor-theme as a
# sibling of the resolved binary, and the SDK library, node runtime, ABI
# header, and the GNOME wayland-helper extension are versioned with it.
install -d "${pkgdir}/usr/lib/cua-driver"
cp -a . "${pkgdir}/usr/lib/cua-driver/"
chmod -R a+rX "${pkgdir}/usr/lib/cua-driver"
# The path prepare() wrote into the binary.
install -Dm755 "${srcdir}/pm.sh" "${pkgdir}/usr/lib/cua-driver/pm.sh"
install -d "${pkgdir}/usr/bin"
ln -s ../lib/cua-driver/cua-driver "${pkgdir}/usr/bin/cua-driver"
install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -Dm644 THIRD_PARTY_NOTICES.md "${pkgdir}/usr/share/licenses/${pkgname}/THIRD_PARTY_NOTICES.md"
}