# Maintainer: umarcor <unai.martinezcorral@ehu.eus>

_realname=icesprog
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.1.1
pkgrel=1
pkgdesc="iCESugar FPGA Board programming tool (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://github.com/wuxx/icesugar/tree/master/tools/"
license=('GPLv2+')
groups=("${MINGW_PACKAGE_PREFIX}-eda")
depends=("${MINGW_PACKAGE_PREFIX}-hidapi"
         "${MINGW_PACKAGE_PREFIX}-libusb")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "git")

_ver="1.1b"
source=("icesugar::https://codeload.github.com//wuxx/icesugar/tar.gz/v${_ver}")
sha256sums=('00c8ccfa247a2c9aa0de23f467ffb66faa4e71e39c44917d9c7b1df2309df3d7')

build() {
  cd "${srcdir}/icesugar-${_ver}"/tools/src
  make
}

check() {
  "${srcdir}/icesugar-${_ver}"/tools/src/icesprog.exe -h
}

package() {
  mkdir -p "${pkgdir}${MINGW_PREFIX}"/bin/
  cp "${srcdir}/icesugar-${_ver}"/tools/src/icesprog.exe "${pkgdir}${MINGW_PREFIX}"/bin/
}
