summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0d88d140318b90b8fd7522bf04bc0d924f5637d2 (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
48
49
50
51
52
53
54
55
56
57
# Maintainer: Chocobo1 <chocobo1 AT archlinux DOT net>

pkgname=bao-git
pkgver=0.12.1.r6.ge5f01f8
pkgrel=1
pkgdesc="A verified streaming tool"
arch=('i686' 'x86_64')
url="https://github.com/oconnor663/bao"
license=('Apache-2.0' 'CC0-1.0')
depends=('gcc-libs')
makedepends=('git' 'rust')
provides=("bao=$pkgver")
conflicts=('bao')
source=("git+https://github.com/oconnor663/bao")
sha256sums=('SKIP')


prepare() {
  cd "bao"

  if [ ! -f "bao_bin/Cargo.lock" ]; then
    cargo update \
      --manifest-path "bao_bin/Cargo.toml"
  fi
  cargo fetch \
    --manifest-path "bao_bin/Cargo.toml"
}

pkgver() {
  cd "bao"

  _tag=$(git tag -l --sort -v:refname | head -n1)
  _rev=$(git rev-list --count $_tag..HEAD)
  _hash=$(git rev-parse --short HEAD)
  printf "%s.r%s.g%s" "$_tag" "$_rev" "$_hash"
}

check() {
  cd "bao"

  cargo test \
    --frozen \
    --manifest-path "bao_bin/Cargo.toml"
}

package() {
  cd "bao"

  cargo install \
    --locked \
    --no-track \
    --root "$pkgdir/usr" \
    --path "$srcdir/bao/bao_bin"

  install -Dm644 "README.md" -t "$pkgdir/usr/share/doc/bao"
  install -Dm644 "LICENSE" -t "$pkgdir/usr/share/licenses/bao"
}