| 1 | # Maintainer: maria-rcks <maria at kuuro dot net> |
| 2 | |
| 3 | pkgname=t3code-bin |
| 4 | pkgver=0.0.33 |
| 5 | pkgrel=1 |
| 6 | pkgdesc='Desktop control surface for local coding agents' |
| 7 | arch=('x86_64') |
| 8 | url='https://github.com/pingdotgg/t3code' |
| 9 | license=('MIT') |
| 10 | depends=( |
| 11 | 'alsa-lib' |
| 12 | 'at-spi2-core' |
| 13 | 'cairo' |
| 14 | 'dbus' |
| 15 | 'expat' |
| 16 | 'gdk-pixbuf2' |
| 17 | 'glib2' |
| 18 | 'glibc' |
| 19 | 'gtk3' |
| 20 | 'hicolor-icon-theme' |
| 21 | 'libcups' |
| 22 | 'libdrm' |
| 23 | 'libgcc' |
| 24 | 'libstdc++' |
| 25 | 'libx11' |
| 26 | 'libxcb' |
| 27 | 'libxcomposite' |
| 28 | 'libxdamage' |
| 29 | 'libxext' |
| 30 | 'libxfixes' |
| 31 | 'libxkbcommon' |
| 32 | 'libxrandr' |
| 33 | 'mesa' |
| 34 | 'nspr' |
| 35 | 'nss' |
| 36 | 'pango' |
| 37 | 'systemd-libs' |
| 38 | 'xdg-utils' |
| 39 | 'zlib' |
| 40 | ) |
| 41 | optdepends=('openai-codex: use the system-installed Codex CLI') |
| 42 | provides=("t3code=$pkgver") |
| 43 | conflicts=('t3code') |
| 44 | options=('!debug' '!strip') |
| 45 | |
| 46 | _appimage="T3-Code-${pkgver}-x86_64.AppImage" |
| 47 | source=( |
| 48 | "$_appimage::https://github.com/pingdotgg/t3code/releases/download/v${pkgver}/$_appimage" |
| 49 | "${pkgname}-${pkgver}-LICENSE::https://raw.githubusercontent.com/pingdotgg/t3code/v${pkgver}/LICENSE" |
| 50 | ) |
| 51 | sha256sums=( |
| 52 | '415c8648f43c3d22d572f27f2c50fdc8c310ea7fcde9537b903e1e2f1c8775a1' # AppImage |
| 53 | '935d8f2af0c703f9c39517ee57cc4930b19d02d533be930b63f0e82f93614b43' # upstream license |
| 54 | ) |
| 55 | |
| 56 | prepare() { |
| 57 | chmod +x "$srcdir/$_appimage" |
| 58 | rm -rf "$srcdir/squashfs-root" |
| 59 | "$srcdir/$_appimage" --appimage-extract >/dev/null |
| 60 | |
| 61 | if [[ ! -x "$srcdir/squashfs-root/AppRun" || |
| 62 | ! -f "$srcdir/squashfs-root/chrome-sandbox" ]]; then |
| 63 | echo 'The AppImage payload is missing its launcher or Chromium sandbox.' >&2 |
| 64 | return 1 |
| 65 | fi |
| 66 | } |
| 67 | |
| 68 | package() { |
| 69 | install -d "$pkgdir/opt/$pkgname" |
| 70 | cp -a --no-preserve=ownership "$srcdir/squashfs-root/." "$pkgdir/opt/$pkgname/" |
| 71 | chmod -R u=rwX,go=rX "$pkgdir/opt/$pkgname" |
| 72 | chmod 4755 "$pkgdir/opt/$pkgname/chrome-sandbox" |
| 73 | |
| 74 | install -Dm755 /dev/stdin "$pkgdir/usr/bin/t3code" <<'EOF' |
| 75 | #!/bin/sh |
| 76 | exec /opt/t3code-bin/AppRun "$@" |
| 77 | EOF |
| 78 | ln -s t3code "$pkgdir/usr/bin/t3-code-desktop" |
| 79 | |
| 80 | # Icon lookup only sees sizes registered in hicolor's index.theme (max 512x512). |
| 81 | local icon size_dir |
| 82 | for icon in "$srcdir"/squashfs-root/usr/share/icons/hicolor/*/apps/t3code.png; do |
| 83 | size_dir="${icon%/apps/t3code.png}" |
| 84 | install -Dm644 "$icon" \ |
| 85 | "$pkgdir/usr/share/icons/hicolor/${size_dir##*/}/apps/t3code.png" |
| 86 | done |
| 87 | |
| 88 | install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/t3code.desktop" <<'EOF' |
| 89 | [Desktop Entry] |
| 90 | Name=T3 Code |
| 91 | Comment=Desktop control surface for local coding agents |
| 92 | Exec=t3code %U |
| 93 | TryExec=t3code |
| 94 | Terminal=false |
| 95 | Type=Application |
| 96 | Icon=t3code |
| 97 | StartupWMClass=t3code |
| 98 | Categories=Development; |
| 99 | MimeType=x-scheme-handler/t3code; |
| 100 | EOF |
| 101 | |
| 102 | install -Dm644 "$srcdir/${pkgname}-${pkgver}-LICENSE" \ |
| 103 | "$pkgdir/usr/share/licenses/$pkgname/LICENSE" |
| 104 | } |