Improve PKGBUILD with dynamic versioning and Node.js constraints

- Fix hardcoded git hash by using dynamic version conversion
- Add Node.js >=18 version constraint per package.json requirements
- Add provides=('amp') for the binary
- Use consistent variable naming throughout
- Add .gitignore for build artifacts

Amp-Thread: https://ampcode.com/threads/T-26b06bef-8e2b-4a89-a39a-9ed05ecd8dec
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Will Handley 2025-07-08 18:27:24 +01:00
parent dc4a661e83
commit a3aecee058
No known key found for this signature in database
GPG key ID: 14B25F0A12CCB2FB
2 changed files with 27 additions and 7 deletions

18
.gitignore vendored Normal file
View file

@ -0,0 +1,18 @@
# makepkg build artifacts
pkg/
src/
*.pkg.tar.zst
*.pkg.tar.zst.sig
*.tgz
*.tar.xz
*.tar.gz
# Common build files
*.log
*.swp
*.swo
*~
# IDE files
.vscode/
.idea/

View file

@ -1,27 +1,29 @@
# Maintainer: Will Handley <wh260@cam.ac.uk>
pkgname=ampcode
_full_pkgname="@sourcegraph/amp"
pkgver=0.0.1751990659
_npmname="@sourcegraph/amp"
pkgver=0.0.1751990659.g94e814
pkgrel=1
pkgdesc="CLI for Amp, an agentic coding tool in research preview from Sourcegraph"
arch=('any')
url="https://github.com/sourcegraph/amp"
license=('Apache-2.0')
depends=('nodejs')
depends=('nodejs>=18')
makedepends=('npm')
provides=('amp')
optdepends=(
'git: allow Amp to use git'
'github-cli: interact with GitHub'
'glab: interact with GitLab'
'ripgrep: enhanced file search'
)
source=("https://registry.npmjs.org/$_full_pkgname/-/amp-$pkgver-g94e814.tgz")
_npmver=${pkgver//.g/-g}
source=("https://registry.npmjs.org/$_npmname/-/amp-$_npmver.tgz")
b2sums=('ecfc63b2e30250b9268551c4cee42ec452a88bdb11b6b696ef16bc40ca5c8fb7f6988589063eafb9fcee720fb0fce823883db19be907152874ee060180e77570')
noextract=("amp-${pkgver}-g94e814.tgz")
noextract=("amp-$_npmver.tgz")
package() {
npm install -g --prefix "${pkgdir}/usr" "${srcdir}/amp-${pkgver}-g94e814.tgz"
npm install -g --prefix "${pkgdir}/usr" "${srcdir}/amp-$_npmver.tgz"
# Install README as license documentation since no LICENSE file exists
install -Dm644 "${pkgdir}/usr/lib/node_modules/@sourcegraph/amp/README.md" "${pkgdir}/usr/share/licenses/${pkgname}/README.md"
install -Dm644 "${pkgdir}/usr/lib/node_modules/$_npmname/README.md" "${pkgdir}/usr/share/licenses/${pkgname}/README.md"
}