# Contributor: Stefan Wagner <stw@bit-strickerei.de>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=avrdude
pkgver=8.0
pkgrel=0
pkgdesc="Download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers"
url="https://github.com/avrdudes/avrdude"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	byacc
	cmake
	elfutils-dev
	flex
	hidapi-dev
	libftdi1-dev
	libgpiod-dev
	libusb-dev
	linux-headers
	samurai
	"
subpackages="$pkgname-dev $pkgname-libs $pkgname-doc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/avrdudes/avrdude/archive/refs/tags/v$pkgver.tar.gz
	"
options="!check" # no tests

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	cmake -B build -G Ninja -Wno-dev \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
		-DHAVE_LINUXGPIO=ON \
		-DHAVE_LINUXSPI=ON \
		-DBUILD_SHARED_LIBS=ON
	cmake --build build
}

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

sha512sums="
c6fa365924aa8ad58a1b2f85c36ecc498c9b049b9bce455994752b8b13c06aa31ac6c8420eea4be307f42e64284c87ec08f75d6eaec640de7dc097c523d02dac  avrdude-8.0.tar.gz
"
