summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 844ac20678bfb6ae0f09e911397ed9683396dc09 (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
# Maintainer: KokaKiwi <kokakiwi+aur@kokakiwi.net>

pkgname=rhai-lsp-git
pkgver=r182.2f1fcd7
pkgrel=1
pkgdesc='Language server for Rhai'
url='https://github.com/rhaiscript/lsp'
license=('Apache')
arch=('x86_64' 'aarch64')
makedepends=(git cargo)
depends=(gcc-libs)
source=("$pkgname::git+https://github.com/rhaiscript/lsp.git")
sha256sums=('SKIP')

export RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN:-stable}

pkgver() {
  cd "$pkgname"

  ( set -o pipefail
    git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  )
}

prepare() {
  cd "$pkgname"

  cargo fetch
}

build() {
  cd "$pkgname"

  CARGO_TARGET_DIR="target" \
    cargo build --bin rhai --frozen --release
}

package() {
  cd "$pkgname"

  install -Dm0755 target/release/rhai "$pkgdir/usr/bin/rhai-lsp"

  install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.md
}