summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5828dc472b24a74b03b93c6248c5f7bf1b5aecbd (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
# Maintainer: Arvid Norlander <VorpalBlade@users.noreply.github.com>
pkgname=chezmoi_modify_manager-git
pkgver=3.4.0.r0.0c55fc1
pkgrel=1
pkgdesc="Tools for chezmoi to handle mixed settings and state"
arch=(x86_64 i686 armv7h aarch64)
url="https://github.com/VorpalBlade/chezmoi_modify_manager"
license=('GPL-3.0-only')
depends=('dbus')
makedepends=('cargo' 'git')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=('chezmoi_modify_manager::git+https://github.com/VorpalBlade/chezmoi_modify_manager')
md5sums=('SKIP')

pkgver() {
    cd "$srcdir/${pkgname%-git}"
    printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g;s/^v//')"
}

prepare() {
    cd "$srcdir/${pkgname%-git}"
    export CHEZMOI_MODIFY_MANAGER_BUILDER=aur-git
    export RUSTUP_TOOLCHAIN=stable
    cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
    cd "$srcdir/${pkgname%-git}"
    export CHEZMOI_MODIFY_MANAGER_BUILDER=aur-git
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    cargo build --frozen --release --no-default-features --features=keyring
}

check() {
    cd "$srcdir/${pkgname%-git}"
    export CHEZMOI_MODIFY_MANAGER_BUILDER=aur-git
    export RUSTUP_TOOLCHAIN=stable
    cargo test --frozen --no-default-features --features=keyring
}

package() {
    local _cmd_name="target/release/${pkgname%-git}"
    cd "$srcdir/${pkgname%-git}"
    install -Dm0755 -t "$pkgdir/usr/bin/" "$_cmd_name"
    mkdir -p "$pkgdir/usr/share/bash-completion/completions/"
    mkdir -p "$pkgdir/usr/share/zsh/site-functions/"
    mkdir -p "$pkgdir/usr/share/fish/vendor_completions.d/"
    "$_cmd_name" --bpaf-complete-style-zsh > "$pkgdir/usr/share/zsh/site-functions/_${pkgname%-git}"
    "$_cmd_name" --bpaf-complete-style-bash > "$pkgdir/usr/share/bash-completion/completions/${pkgname%-git}"
    "$_cmd_name" --bpaf-complete-style-fish > "$pkgdir/usr/share/fish/vendor_completions.d/${pkgname%-git}.fish"
    # No support to install distro completions in elvish.
    # See https://github.com/elves/elvish/issues/1739
    #"$_cmd_name" --bpaf-complete-style-elvish
}