# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=radeontop
pkgver=1.3
pkgrel=2
pkgdesc="View GPU utilization for total activity percent and individual blocks"
arch=('x86_64')
url="https://github.com/clbr/radeontop"
license=('GPL3')
depends=('glibc' 'libdrm' 'libpciaccess' 'libxcb')
makedepends=('ncurses')
source=("$pkgname-$pkgver.tar.gz::https://github.com/clbr/${pkgname}/archive/v${pkgver}.tar.gz")
sha512sums=('cc54e0726b2a934d14ad591c7a199474b49885e6122399b282e9289610d26f3c55b3d68a7d655d88a0ff8de1a0ac0994e868fa06ae1198416aaf857a099181f1')
b2sums=('41bc36c571a99a136f2d1c1d5ff1a06b1e99bccb6e01f7432b9867e2700afa9d2b5cab7f743d3560b2120642c98253313e0356af977805ada173cd3c2168acbc')

prepare() {
  cd "$pkgname-$pkgver"
  # Makefile hardcodes the binary location
  sed -e 's/sbin/bin/g' -i Makefile
  # set version
  sed -e "s/unknown/${pkgver}/" -i getver.sh
  ./getver.sh
}

build() {
  cd "$pkgname-$pkgver"
  make
}

package() {
  depends+=('libncursesw.so')
  cd "$pkgname-$pkgver"
  make DESTDIR="$pkgdir/" install
  install -vDm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}/"
}
