summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2960668e36db1ae0fba0f4dc32493e083fa0f418 (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
pkgname=btop-gpu-git
pkgver=1.3.0.r875.e15e0b7
pkgrel=1
pkgdesc="A monitor of resources compiled with gpu support flags!"
arch=(any)
url="https://github.com/aristocratos/btop"
license=('Apache-2.0')
makedepends=('gcc-libs' 'make' 'git')
optdepends=(
	'rocm-smi-lib: AMD GPU Support'
	'nvidia-utils: Nvidia GPU Support'
	)
source=("${pkgname}::git+https://github.com/aristocratos/btop.git")
sha512sums=('SKIP')
provides=('btop')
conflicts=('btop')
options=(!strip)

pkgver() {
	cd "${srcdir}/${pkgname}"
	_pkgver="$(cat CHANGELOG.md | grep '^##' | sed 's/## v//g' | head -1)"

	printf "${_pkgver}.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	if ! pacman -Qq 'rocm-smi-lib' &>/dev/null && ! pacman -Qq 'nvidia-utils' &>/dev/null; then
		echo "ERROR: Either 'rocm-smi-lib' (for AMD) or 'nvidia-utils' (for Nvidia) must be installed."
		false
  	fi

	cd "${srcdir}/${pkgname}"

	git submodule update --init --recursive
}

build() {
	cd "${pkgname}"
	make -j $(nproc) ADDFLAGS=-march=native VERBOSE=true GPU_SUPPORT=true
}

package() {
	cd "${srcdir}/${pkgname}"
	DESTDIR="${pkgdir}" make PREFIX=/usr install

	install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}