summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8252c4e6466409802d229dc7b7b6a24a45f2139d (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
# Maintainer: thialfi17 <thialfi17+arch@gmail.com>
pkgname=lash-git
_pkgname=lash
pkgver=r27.96998c0
pkgrel=1
pkgdesc='Symlink manager for dotfiles - a GNU Stow alternative'
arch=('any')
url='https://github.com/thialfi17/lash'
license=('GPL-3.0-only')
makedepends=('cargo' 'git')
source=("git+https://github.com/thialfi17/lash")
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/$_pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  export RUSTUP_TOOLCHAIN=stable
  cd "$_pkgname"
  cargo fetch --locked --target "$(rustc -vV | sed -n 's|host: ||p')"
}

build() {
  export RUSTUP_TOOLCHAIN=stable
  cd "$srcdir/$_pkgname"

  cargo build --frozen --release --target-dir target
  cargo xtask completions --target-dir target
}

check() {
  export RUSTUP_TOOLCHAIN=stable
  cd "$srcdir/$_pkgname"
  cargo test --workspace --frozen
}

package() {
  cd "$srcdir/$_pkgname"

  install -Dm755 target/release/lash "${pkgdir}/usr/bin/lash"

  install -Dm644 target/lash.bash "${pkgdir}/usr/share/bash-completion/completions/lash.bash"
  install -Dm644 target/lash.fish "${pkgdir}/usr/share/fish/vendor_completions.d/lash.fish"
  install -Dm644 target/_lash "${pkgdir}/usr/share/zsh/site-functions/_lash"
}