# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: X0rg

pkgname=libcpuid
pkgver=0.6.5
pkgrel=1
pkgdesc='A small C library for x86 CPU detection and feature extraction'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='http://libcpuid.sourceforge.net'
license=('BSD-2-Clause')
depends=('glibc')
makedepends=(
  'git'
  'cmake'
  'ninja'
  'doxygen'
  'python'
  'graphviz'
)
provides=('libcpuid.so')
source=("$pkgname::git+https://github.com/anrieff/libcpuid#tag=v$pkgver")
sha512sums=('db7ae4ab7f35335d32727bcb6cb3a6dac030021015695448e7dd4fac4ae126bbe1b6280a15141f11cf3afba18a922b078a000658cc19836ec84b34a5fb04f065')
b2sums=('307266aaa9d9ab57e489a066507b2ecab6ac93bba3fed3446d9ac8b7b3a51d1920469a9d95dfed4f15a59f005936124c7054df746a535ad8cb0cb52bc6749a4c')

build() {
	cmake \
    -S "$pkgname" \
    -B build \
    -G Ninja \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D LIBCPUID_TESTS=ON

	cmake --build build
}

check() {
  cd build

  ninja consistency test-old
}

package() {
	DESTDIR="$pkgdir" cmake --install build

  # license
	install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" "$pkgname/COPYING"
}
