Files
luxe/scripts/aur-pkgbuild.sh

55 lines
2.4 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# aur-pkgbuild — writes the PKGBUILD for the `luxe-bin` AUR package from a release.
#
# Usage: scripts/aur-pkgbuild.sh <version> [out-dir] e.g. scripts/aur-pkgbuild.sh 0.1.0 /tmp/aur
#
# `luxe-bin` repackages the release's own Linux archives, checked against the release's `.sha256`
# files, so it ships exactly what the release built and attested. It installs to /usr/bin, which
# `luxe update` reads as a package manager's copy and leaves to pacman. The updater the install
# script adds is left out for the same reason. Generate .SRCINFO from the result with
# `makepkg --printsrcinfo > .SRCINFO`.
set -euo pipefail
version="${1:?usage: aur-pkgbuild.sh <version> [out-dir]}"
out="${2:-.}"
release="https://github.com/evanwhittaker/luxe/releases/download/v${version}"
# The release's own checksum for one target's archive
checksum() {
curl -fsSL "${release}/luxe-cli-$1-unknown-linux-gnu.tar.xz.sha256" | cut -d' ' -f1
}
x86_64="$(checksum x86_64)"
aarch64="$(checksum aarch64)"
mkdir -p "${out}"
cat >"${out}/PKGBUILD" <<PKGBUILD
# Maintainer: Evan Whittaker <contact@luxe.dev>
# Generated by scripts/aur-pkgbuild.sh in https://github.com/evanwhittaker/luxe
pkgname=luxe-bin
pkgver=${version}
pkgrel=1
pkgdesc="A terminal coding agent: streaming chat, tools, guided diff review, and LSP/DAP code intelligence"
arch=('x86_64' 'aarch64')
url="https://luxe.dev"
license=('MIT' 'Apache-2.0')
depends=('gcc-libs' 'glibc')
provides=('luxe')
conflicts=('luxe')
# The release's binary as it was built and attested: not stripped again, no debug split
options=('!strip' '!debug')
source_x86_64=("luxe-cli-x86_64-\${pkgver}.tar.xz::https://github.com/evanwhittaker/luxe/releases/download/v\${pkgver}/luxe-cli-x86_64-unknown-linux-gnu.tar.xz")
source_aarch64=("luxe-cli-aarch64-\${pkgver}.tar.xz::https://github.com/evanwhittaker/luxe/releases/download/v\${pkgver}/luxe-cli-aarch64-unknown-linux-gnu.tar.xz")
sha256sums_x86_64=('${x86_64}')
sha256sums_aarch64=('${aarch64}')
package() {
cd "luxe-cli-\${CARCH}-unknown-linux-gnu"
install -Dm755 luxe "\${pkgdir}/usr/bin/luxe"
install -Dm644 LICENSE-MIT "\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE-MIT"
install -Dm644 LICENSE-APACHE "\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE-APACHE"
install -Dm644 README.md "\${pkgdir}/usr/share/doc/\${pkgname}/README.md"
}
PKGBUILD
echo "wrote ${out}/PKGBUILD for luxe-bin ${version}"