summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4b96af9544760326352ab0bc1871f87966cd771f (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
# Maintainer: Danilo Bargen <aur at dbrgn dot ch>
pkgname=tealdeer-git
_name=tealdeer
_binname=tldr
pkgver=r255.30b7c5f
pkgrel=1
pkgdesc="A fast tldr client in Rust."
arch=('x86_64' 'armv6h' 'armv7h' 'aarch64')
url="https://github.com/dbrgn/tealdeer"
license=('MIT' 'Apache')
depends=('openssl')
makedepends=('git' 'rust' 'cargo')
provides=('tldr')
conflicts=('tldr')
options=(!emptydirs)
source=('git+https://github.com/dbrgn/tealdeer')
sha256sums=('SKIP')

build() {
  cd "$srcdir/$_name" || exit 1

  # Patch version
  sed -i 's/^version = "\(.*\)"/version = "\1-aur-'${pkgver}'"/' Cargo.toml

  # Build a release build
  cargo build --release
}

package() {
  cd "$srcdir/$_name" || exit 1

  # Install binary
  install -D -o root -g root -m 755 target/release/tldr "$pkgdir/usr/bin/${_binname}"

  # Install shell completions
  install -D -o root -g root -m 644 bash_tealdeer "${pkgdir}/usr/share/bash-completion/completions/${_binname}"
  install -D -o root -g root -m 644 fish_tealdeer "${pkgdir}/usr/share/fish/completions/${_binname}.fish"
  install -D -o root -g root -m 644 zsh_tealdeer "${pkgdir}/usr/share/zsh/site-functions/_${_binname}"

  # Install MIT license
  install -Dm 644 "${srcdir}/tealdeer/LICENSE-MIT" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-MIT"
}

pkgver() {
  cd "$srcdir/$_name" || exit 1
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

# vim:set ts=2 sw=2 et: