archrelease: copy trunk to community-any
[arch-community.git] / bupstash / trunk / PKGBUILD
blob4232a72b4176790c43f04032b585e81534c193fb
1 # Maintainer: George Rawlinson <george@rawlinson.net.nz>
3 pkgname=bupstash
4 pkgver=0.12.0
5 pkgrel=1
6 pkgdesc='A tool for encrypted backups'
7 arch=('x86_64')
8 url='https://bupstash.io'
9 license=('MIT')
10 depends=('libsodium' 'gcc-libs')
11 makedepends=('git' 'rust' 'ruby-ronn-ng')
12 checkdepends=('bash-bats' 'python' 'jq') # if you hate yourself, add procps-ng + bubblewrap
13 options=('!lto')
14 _commit='edab7c3db03e20e557272ee6999ede216b7693d2'
15 source=("$pkgname::git+https://github.com/andrewchambers/bupstash.git#commit=$_commit")
16 b2sums=('SKIP')
18 pkgver() {
19   cd "$pkgname"
21   git describe --tags | sed 's/^v//'
24 prepare() {
25   cd "$pkgname"
27   # download dependencies
28   cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
30 build() {
31   cd "$pkgname"
33   cargo build --release --frozen
36 check() {
37   cd "$pkgname"
39   # run cargo tests
40   cargo test
42   # run cli tests
43   # ensure recently-built binary is first in $PATH
44   PATH="$(pwd)/target/release:$PATH"
45   bats ./cli-tests
48 package() {
49   cd "$pkgname"
51   # binary
52   install -vDm755 -t "$pkgdir/usr/bin" "target/release/$pkgname"
54   # license
55   install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
57   # documentation
58   install -vd "$pkgdir/usr/share/doc/$pkgname"
59   cp -vr doc/* "$pkgdir/usr/share/doc/$pkgname"
60   rm -vrf "$pkgdir/usr/share/doc/$pkgname/man"
62   # man pages
63   OLDIFS="$IFS"
64   IFS="."
65   cd doc/man
66   for filename in *; do
67     read -ra PART <<< "$filename"
69     title="${PART[0]}"
70     section="${PART[1]}"
72     # generate man directory if required
73     if [ ! -d "$pkgdir/usr/share/man/man${section}" ]; then
74       install -vd "$pkgdir/usr/share/man/man${section}"
75     fi
77     # generate man page
78     ronn --roff \
79       <"$filename" \
80       >"$pkgdir/usr/share/man/man${section}/${title}.${section}"
81   done
82   IFS="$OLDIFS"
83   unset OLDIFS