summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 23c52fc7523f8d84450740d208dcc20de89ffee5 (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
# Maintainer: willemw <willemw12@gmail.com>
# Contributor: Luis Martinez <luis dot martinez at disroot dot org>

pkgname=tomlq-git
pkgver=r18.666e48f
pkgrel=1
pkgdesc='Tool for getting data from TOML files'
arch=(x86_64)
url=https://github.com/jamesmunns/tomlq
license=(MIT)
makedepends=(cargo git)
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
options=(!lto)
source=("$pkgname::git+$url.git")
sha256sums=('SKIP')

pkgver() {
  printf "r%s.%s" "$(git -C $pkgname rev-list --count HEAD)" "$(git -C $pkgname rev-parse --short=7 HEAD)"
}

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

build() {
  export RUSTUP_TOOLCHAIN=stable CARGO_TARGET_DIR=target
  cd $pkgname
  cargo build --frozen --release --all-features
}

check() {
  export RUSTUP_TOOLCHAIN=stable
  cd $pkgname
  cargo test --frozen --all-features
}

package() {
  install -Dm755 "$pkgname/target/release/${pkgname%-git}" -t "$pkgdir/usr/bin"
  install -Dm644 $pkgname/LICENSE -t "$pkgdir/usr/share/licenses/${pkgname%-git}"
}