# Maintainer (aur): Nico Huber <nico.h@gmx.de>
# Maintainer: Wael Karram <wael AT waelk.tech>

# Parabola Changes and Rationale
# 1) Clarified license version (GPLv2 only).
# 2) Dropped unsupported architectures.
# 3) Build from archive, not git repo tags.

pkgname="flashprog"
pkgdesc="Flashprog is a utility which can be used to detect, read, erase, or write BIOS chips (DIP, PLCC, SPI)."
pkgver=1.4
pkgrel=1
archive_suffix=.tar.bz2
url="https://flashprog.org/"
license=('GPL2')
source=(https://flashprog.org/releases/flashprog-v${pkgver}${archive_suffix})
sha256sums=('641e4c7cef61ac53ea5e50545885c35ee484f319d293375c650aedd7fbed46f1')
validpgpkeys=('2853079C9C66AB7E82C64966A5C163B7E557CAEB')
depends=('pciutils' 'libusb' 'libftdi' 'libjaylink') # libgpiod became incompatible with 2.0
makedepends=('git' 'make')
optdepends=("dmidecode: for SMBIOS/DMI table decoder support")
arch=('armv7h' 'i686' 'x86_64')

build() {
	cd "${srcdir}/${pkgname}-v${pkgver}"
	make CONFIG_LINUX_GPIO_SPI=no
}

package() {
	cd "${srcdir}/${pkgname}-v${pkgver}"
	install -d "${pkgdir}/usr/bin"
	install -d "${pkgdir}/usr/man/man8"
	install -m 0755 flashprog "${pkgdir}/usr/bin/"
	install -m 0644 flashprog.8 "${pkgdir}/usr/man/man8/"
	install -m 0755 util/ich_descriptors_tool/ich_descriptors_tool "${pkgdir}/usr/bin/"
}
