# Maintainer: fauxpark <fauxpark@gmail.com>

_realname=dfu-programmer
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=1.1.0
pkgrel=1
pkgdesc='Device firmware update based USB programmer for Atmel chips (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
license=('spdx:GPL-2.0-or-later')
url='https://github.com/dfu-programmer/dfu-programmer'
depends=("${MINGW_PACKAGE_PREFIX}-libusb")
makedepends=(
    "${MINGW_PACKAGE_PREFIX}-autotools"
    "${MINGW_PACKAGE_PREFIX}-cc")
source=("https://github.com/dfu-programmer/dfu-programmer/releases/download/v${pkgver}/dfu-programmer-${pkgver}.tar.gz")
sha256sums=('844e469be559657bc52c9d9d03c30846acd11ffbb1ddd42438fa8af1d2b8587d')

prepare() {
    cd "${srcdir}"/${_realname}-${pkgver}
    ./bootstrap.sh
}

build() {
    cd "${srcdir}"/${_realname}-${pkgver}

    ./configure \
        --prefix=${MINGW_PREFIX}
}

package() {
    cd "${srcdir}"/${_realname}-${pkgver}

    make DESTDIR="$pkgdir" install
}
