summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3d450f6150fedc4f90c69ee256fd2d0161980723 (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
# Maintainer: shiro <shiro@usagi.io>

pkgname=map2-git
pkgver=1.0.0
pkgrel=2
pkgdesc="A scripting language that allows complex key remapping on Linux, written in Rust"
url="https://github.com/shiro/map2-legacy"
arch=('x86_64' 'i686')
license=('MIT')
provides=("map2")
depends=()
makedepends=(rustup)
conflicts=('map2')
source=("${pkgname}::git+https://github.com/shiro/${pkgname%-git}-legacy.git")
sha256sums=('SKIP')

build() {
  cd "$pkgname-legacy"
  cargo build --release --locked --all-features --target-dir=target
}

pkgver() {
  cd "$pkgname-legacy"
  local tag=$(git tag --sort=-v:refname | grep '^[0-9]' | head -1)
  local commits_since=$(git rev-list $tag..HEAD --count)
  echo "$tag.r$commits_since.$(git log --pretty=format:'%h' -n 1)"
}

check() {
  cd "$pkgname-legacy"
  cargo test --release --locked --target-dir=target
}

package() {
  cd "$pkgname-legacy"
  install -Dm 755 target/release/map2 -t "${pkgdir}/usr/bin"

  install -Dm644 docs/man/map2.1 "$pkgdir/usr/share/man/man1/map2.1"
}