summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 960e06d21f374c793ac0f33d2dddc42c988245aa (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
# Maintainer: Anakojm <https://anakojm.net/about.html>

pkgname="aoc-cli-git"
pkgver="r111.8192ad5"
pkgrel=1
pkgdesc="Advent of Code command-line tool"
arch=('any')
url="https://github.com/scarvalhojr/${pkgname%-git}"
license=('MIT')
depends=('gcc-libs' 'openssl' 'glibc')
makedepends=('git' 'cargo')
source=("$pkgname::git+$url")
md5sums=('SKIP')

pkgver(){
        cd "$pkgname"
        printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}

prepare(){
        cd "$pkgname"
        export RUSTUP_TOOLCHAIN=stable
        cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build(){
        cd "$pkgname"
        export RUSTUP_TOOLCHAIN=stable
        export CARGO_TARGET_DIR=target
        cargo build --frozen --release --all-features
}

check(){
        cd "$pkgname"
        export RUSTUP_TOOLCHAIN=stable
        cargo test --frozen --all-features
}

package(){
        cd "$pkgname"
        install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/${pkgname%-cli-git}"
}