summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f9330e74d6578a2a4e29a163b23edcfe77d321c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Maintainer: VanillaGreen <ai1@vanillagreen.com>
pkgname=kendex
# kendex 1.0.0 follows 5.0.1, so the version number goes backwards. pacman
# compares versions, and without an epoch it reads 1.0.0 as older than the
# 5.x a machine already holds and refuses the upgrade. Every kendex package
# carries the same epoch so the four stay comparable with each other.
epoch=1
pkgver=1.20.0
pkgrel=1
pkgdesc='Package manager for AI coding agents, skills, and hooks (desktop app and CLI)'
arch=('x86_64' 'aarch64')
url='https://kendex.ai'
license=('MIT')
# The other three install the same `kendex` command and cannot be
# co-installed with this one. No `replaces`: every name here already exists
# under its own recipe, and a `replaces` would swap a person's chosen
# variant for another one during an ordinary system upgrade.
conflicts=('kendex-git' 'kendex-bin' 'kendex-cli-git')
# git is a runtime as well as a build need, and they are different needs:
# the build clones with it, and the installed program materializes a catalog
# with it. 2.41 is the first that takes `--attr-source`, below which every
# install of a package from a git repository is refused.
depends=(
  'git>=2.41'
  # The command links libdbus-1 directly: the keyring crate reaches
  # libdbus-sys through its sync-secret-service backend, and that build
  # probes dbus-1.pc with pkg-config and panics when it is absent. One name
  # carries the build need and the runtime one, since Arch ships the shared
  # library, the headers and dbus-1.pc in the same package.
  'dbus'
  # The desktop app is a webkit2gtk shell. gtk3 is linked directly as well
  # as through it, so it is named rather than left to webkit2gtk to pull.
  'webkit2gtk-4.1'
  'gtk3'
  'hicolor-icon-theme'
  # The app makes itself the `kendex://` handler on first launch, through
  # `update-desktop-database` (desktop-file-utils) and `xdg-mime`
  # (xdg-utils). Without them on PATH a `kendex://` link opens a browser.
  'desktop-file-utils'
  'xdg-utils'
)
# No git: this package's source is the tag's tarball, so nothing in the
# build clones. git is a runtime dependency above, at the version the
# installed program needs.
makedepends=('cargo' 'npm')
# makepkg LTO makes ring's C objects fail to link with rust-lld.
options=('!lto')
source=("kendex-$pkgver.tar.gz::https://github.com/vanillagreencom/kendex/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('4a48a3668710c650b866203ebc9cd612728b3217f4386a42db637b1096c549d0')

prepare() {
  cd "$srcdir/kendex-$pkgver"
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
  npm ci --prefix ui
}

build() {
  cd "$srcdir/kendex-$pkgver"
  export RUSTUP_TOOLCHAIN=stable
  # The desktop binary embeds ui/dist through tauri's context macro. Only
  # `cargo tauri build` runs the frontend build on its own, and this package
  # builds plain binaries rather than a bundle, so the frontend is built
  # here or the app ships an empty window. `cargo tauri build` also turns on
  # tauri's `custom-protocol` feature; without it the binary is a dev build
  # whose window loads the dev server URL instead of the embedded frontend.
  npm run --prefix ui build
  cargo build --release --locked -p kendex-cli -p kendex-app --features tauri/custom-protocol
}

package() {
  cd "$srcdir/kendex-$pkgver"
  install -Dm755 target/release/kendex "$pkgdir/usr/bin/kendex"
  # The desktop app stays off PATH so the `kendex` command is the CLI.
  install -Dm755 target/release/kendex-app "$pkgdir/usr/lib/kendex/kendex-app"
  # Every size the app ships, each in its own slot: a launcher that picks
  # the 128px icon for a HiDPI slot upscales it and the result looks soft.
  install -Dm644 crates/app/icons/32x32.png "$pkgdir/usr/share/icons/hicolor/32x32/apps/kendex.png"
  install -Dm644 crates/app/icons/128x128.png "$pkgdir/usr/share/icons/hicolor/128x128/apps/kendex.png"
  install -Dm644 'crates/app/icons/128x128@2x.png' "$pkgdir/usr/share/icons/hicolor/256x256/apps/kendex.png"
  install -Dm644 crates/app/icons/icon.png "$pkgdir/usr/share/icons/hicolor/512x512/apps/kendex.png"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  # This entry has to match the one install.sh writes, field for field apart
  # from Exec — the same launcher reads whichever one is installed.
  # StartupWMClass ties the window to this entry: without it a launcher
  # shows the running app as a second, unnamed, iconless item.
  install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/kendex.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=kendex
Comment=Manage AI coding agents, skills, and hooks
Exec=/usr/lib/kendex/kendex-app
Icon=kendex
StartupWMClass=kendex-app
Categories=Development;Utility;
Terminal=false
DESKTOP
}