summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8371c01961b2bb9d317d0a5a7bda4beefe174190 (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
59
60
61
62
# Maintainer: Hisbaan Noorani <hisbaan@gmail.com>
pkgname=whoops-git
pkgver=0.0.1
pkgrel=1
pkgdesc="A CLI utility to undo common commands"
arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64')
url="https://github.com/hisbaan/whoops"
license=('GPL3')
depends=('gcc-libs')
makedepends=('git' 'cargo' 'binutils')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=('git+https://github.com/hisbaan/whoops')
sha256sums=('SKIP')

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

prepare() {
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target

    cd "$srcdir/${pkgname%-git}"
    cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target

    cd "$srcdir/${pkgname%-git}"
    cargo build --release --frozen
    strip target/release/${pkgname%-git}
}

# Testing is not strictly required as it is done by the CI/CD workflow on the git repository.
# check() {
#     cd "$srcdir/${pkgname%-git}"
#     export RUSTUP_TOOLCHAIN=stable
#     export CARGO_TARGET_DIR=target
#     cargo test --release --frozen
# }

package() {
	cd "$srcdir/${pkgname%-git}"

    install -Dm755 target/release/${pkgname%-git} -t "${pkgdir}/usr/bin/"

    # Install readme.
    install -Dm644 docs/README.md -t "${pkgdir}/usr/share/doc/${pkgname%-git}/"

    # # Install man page
    # install -Dm644 man/dym.1 -t "${pkgdir}/usr/share/man/man1/"

    # # Install shell completions
    # install -Dm644 completions/dym.bash -t "${pkgdir}/usr/share/bash-completion/completions/"
    # install -Dm644 completions/dym.fish -t "${pkgdir}/usr/share/fish/vendor_completions.d/"
    # install -Dm644 completions/_dym -t "${pkgdir}/usr/share/zsh/site-functions/"
}