summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 21397a179f47d3a82af09a9e1d4eeea0bfdcbc53 (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
# Maintainer: Otreblan <otreblain@gmail.com>

pkgname=uva-tool-git
pkgver=r48.ac7e52e
pkgrel=2
epoch=
pkgdesc="Command Line Based UVa OJ Submitting and uHunting Tool"
arch=('x86_64')
url="https://github.com/arafat-hasan/uva-tool"
license=('MIT')
groups=()
depends=('curl')
makedepends=('git' 'cmake')
checkdepends=()
optdepends=()
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=("$pkgname::git+$url.git")
sha256sums=('SKIP')

prepare() {
	cd "$srcdir/$pkgname"

	# Update onlinejudge link
	sed -i "s/uva\.//g" src/${pkgname%-git}.cpp
}

pkgver() {
	cd "$srcdir/$pkgname"

	( set -o pipefail
	git describe --long 2>/dev/null | sed 's/^v-//;s/\([^-]*-g\)/r\1/;s/-/./g' ||
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
	)
}

build() {
	cd "$srcdir/$pkgname"

	g++ $CXXFLAGS $LDFLAGS -flto src/${pkgname%-git}.cpp -o ${pkgname%-git}
}

package() {
	cd "$srcdir/$pkgname"

	install -Dm755 ${pkgname%-git} -t "$pkgdir/usr/bin"
	install -Dm644 pid-to-num.cvs -t "$pkgdir/usr/share/${pkgname%-git}"
	install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}