# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Nathan Angelacos <nangel@alpinelinux.org>
pkgname=flashrom
pkgver=1.3.0
pkgrel=2
pkgdesc="A utility for identifying, reading, writing, verifying and erasing flash chips"
url="https://www.flashrom.org/Flashrom"
arch="all"
license="GPL-2.0-or-later"
install="$pkgname.post-install"
depends="dmidecode"
makedepends="
	libftdi1-dev
	libusb-dev
	linux-headers
	meson
	pciutils-dev
	"
checkdepends="cmocka-dev"
subpackages="$pkgname-doc $pkgname-dev $pkgname-libs"
source="https://download.flashrom.org/releases/flashrom-v$pkgver.tar.bz2"
builddir="$srcdir"/$pkgname-v$pkgver
options="!check" # can't run without special setup..?

build() {
	# internal dmi- false- prefer dmidecode cli
	abuild-meson \
		-Duse_internal_dmi=false \
		-Dtests="$(want_check && echo enabled || echo disabled)" \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
73b6e00bd3bc66c98d4ad53966a65b19d3d92f07d7b210d69e041d6f5788605b9791a9bf7aec0a52e13d19fcb62c4bdaf4bab9f805fc31468393ca313129a77b  flashrom-v1.3.0.tar.bz2
"
