summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d6a63c22c833041cc57e829d1c556650e31d697f (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
# Maintainer: James Beddek <telans@posteo.de>

pkgname=elfshaker-git
_pkgname="${pkgname//-git}"
pkgver=v0.9.0.r83.gd8ec612
pkgrel=1
pkgdesc="A low-footprint, high-performance version control system fine-tuned for binaries"
arch=('x86_64')
license=('Apache')
provides=('elfshaker')
depends=('gcc-libs')
makedepends=('rust')
source=('elfshaker-git::git+https://github.com/elfshaker/elfshaker.git')
sha256sums=('SKIP')

prepare() {
  cd "$pkgname"

  # download dependencies
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

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

build() {
  cd "$pkgname"
  cargo build --frozen --release --all-features
}

check() {
  cd "$pkgname"
  cargo test --frozen --all-features
}

package() {
  cd "$pkgname"

  # binary
  install -vDm755 -t "$pkgdir/usr/bin" "target/release/$_pkgname"

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$_pkgname" README.md SECURITY.md
  cp -vr docs/* "$pkgdir/usr/share/doc/$_pkgname"
}