summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d8160e62ccadcc99cf9ff0493b31b05f4fb1ecdf (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: rahmerh <rahmerh@users.noreply.github.com>

pkgname=sax-git
pkgver=0.3.0.r22.g9f8e185
pkgrel=1
pkgdesc="A simple but smart archiving and extraction tool (latest Git commit)"
arch=('x86_64')
url="https://github.com/rahmerh/sax"
license=('MIT')
depends=('gcc-libs')
makedepends=('cargo' 'git')
provides=("sax=$pkgver")
conflicts=('sax')
options=('!lto')
source=('sax::git+https://github.com/rahmerh/sax.git#branch=main')
sha256sums=('SKIP')

pkgver() {
  cd sax

  local cargo_version
  cargo_version="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n 1)"

  printf '%s.r%s.g%s' "$cargo_version" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}

prepare() {
  cd sax

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

build() {
  cd sax

  cargo build --frozen --release
}

check() {
  cd sax

  cargo test --frozen
}

package() {
  cd sax

  install -Dm755 "target/release/sax" "$pkgdir/usr/bin/sax"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}