summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 014a473b67316beabd6686ca41c15d79e9c34ac2 (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: Max Hösel <aur at spacebird dot dev>

# shellcheck disable=all
pkgname=alacritty-theme-switcher
pkgver=0.1.5
pkgrel=2
epoch=0
pkgdesc="Easily switch between color themes for Alacritty"
arch=(
    'x86_64'
    'aarch64'
)
url="https://github.com/spacebird-dev/alacritty-theme-switcher"
license=("GPL-3.0-only")
makedepends=(
    git
    cargo
)
optdepends=(
    'alacritty: theme usage'
)
source=(
    "git+https://github.com/spacebird-dev/alacritty-theme-switcher.git#tag=v$pkgver"
)
sha256sums=(
    SKIP
)

prepare() {
    cd "${pkgbase}"

    # Keep rust/cargo build-dependency management inside the build directory
    export CARGO_HOME="${srcdir}/cargo"

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


build() {
    cd "${pkgbase}"

    # Keep rust/cargo build-dependency management inside the build directory
    export CARGO_HOME="${srcdir}/cargo"

    # Follow Rust package guidelines
    ## https://wiki.archlinux.org/title/Rust_package_guidelines
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target

    cargo build --frozen --release --all-features
}

package() {
    install -Dm 0755 -t "$pkgdir/usr/bin/" "alacritty-theme-switcher/target/release/$pkgname"
	install -Dm 0644 -t "$pkgdir/usr/share/bash-completion/completions/" alacritty-theme-switcher/dist/completions/bash/completions/alacritty-theme-switcher
	install -Dm 0644 -t "$pkgdir/usr/share/zsh/site-functions/" alacritty-theme-switcher/dist/completions/zsh/site-functions/_alacritty-theme-switcher
}