summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 70861b082a8a3ad30401664a0467f8d5c75f51fa (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
58
# Maintainer: tippfehlr <tippfehlr at tippfehlr dot eu>

pkgname=wrestic
pkgver=1.6.1
pkgrel=1
pkgdesc='A wrapper around restic built in rust'
arch=('x86_64')
url="https://github.com/alvaro17f/$pkgname"
license=('LGPL-3.0-only')
provides=('wrestic')
conflicts=('wrestic')
depends=("glibc" "gcc-libs")
makedepends=('cargo')
source=(
	"$pkgname-$pkgver::$url/archive/refs/tags/v$pkgver.tar.gz"
	"wrestic-1.6.1-no-self-update.patch"
)
sha256sums=(
	'475436aec4650c2ca8e47d502b663d09e1af717f3b9bba65d667924720e762d0'
	'SKIP'
)

prepare() {
	patch -Np1 -d "$pkgname-$pkgver" -i ../wrestic-1.6.1-no-self-update.patch

	cd "$srcdir/$pkgname-$pkgver"

	export RUSTUP_TOOLCHAIN=stable
	cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
	cd "$srcdir/$pkgname-$pkgver"

	export RUSTUP_TOOLCHAIN=stable
	export CARGO_TARGET_DIR=target
	cargo build --frozen --release --features no-self-update

	# completions
	cd target/release
	for shell in bash zsh fish; do
		./$pkgname completions "$shell" >"$shell-completion"
	done
}

package() {
	cd "$srcdir/$pkgname-$pkgver"
	install -Dm755 "target/release/$pkgname" "$pkgdir/usr/bin/$pkgname"
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname"
	install -Dm644 README.md "$pkgdir/usr/share/doc/wrestic/README.md"
	install -Dm644 wrestic.toml "$pkgdir/usr/share/doc/wrestic/wrestic.toml"

	# completions
	cd target/release
	install -Dm644 bash-completion "$pkgdir/usr/share/bash-completion/completions/$pkgname"
	install -Dm644 zsh-completion "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
	install -Dm644 fish-completion "$pkgdir/usr/share/fish/vendor_completions.d/$pkgname.fish"
}