summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ef7c98d5ed57dcf5d2a1a1bed6a4e92370b83994 (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
# Maintainer: Jax Young <jaxvanyang@gmail.com>

pkgname=2048-rs-git
_pkgname=game-2048
_reponame=2048-rs
pkgver=0.5.2.r75.77fa495
pkgrel=1
pkgdesc="CLI implementation of the popular 2048 game written in Rust"
arch=('i686' 'x86_64')
url="https://github.com/pierrechevalier83/$_reponame"
license=('MIT')
depends=('glibc' 'gcc-libs')
makedepends=('git' 'cargo')
provides=("${pkgname%-git}=$pkgver")
conflicts=("${pkgname%-git}")
source=('git+https://github.com/pierrechevalier83/2048-rs.git')
sha256sums=('SKIP')

pkgver() {
	cd "$_reponame"

	printf "%s.r%s.%s" "$(cargo pkgid --offline | sed -E 's/^.*@//')" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	cd "$_reponame"

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

build() {
	cd "$_reponame"

	export RUSTUP_TOOLCHAIN=stable
	export CARGO_TARGET_DIR=target
	cargo build --frozen --release
}

check() {
	cd "$_reponame"

	export RUSTUP_TOOLCHAIN=stable
	cargo test --frozen
}

package() {
	cd "$_reponame"
	install -D target/release/game-2048 "$pkgdir/usr/bin/2048"
}