# Maintainer: Dimitris Mantzouranis <d3xter93@gmail.com>

_realname=sonixflasher
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=2.0.8
pkgrel=1
pkgdesc='CLI-based Flasher for Sonix SN32F2xx MCUs (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
license=('spdx:GPL-3.0-only')
depends=("${MINGW_PACKAGE_PREFIX}-pkgconf"
         "${MINGW_PACKAGE_PREFIX}-hidapi")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             'make')
url='https://github.com/SonixQMK/SonixFlasherC'
source=("https://github.com/SonixQMK/SonixFlasherC/archive/${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('fb84fca699d7a91e2bfcfe6aad00a5967f6ad08606c602d49d37d5a7a7fa0db8')

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

  make CC=${CC}
}

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

  install -Dm755 sonixflasher.exe "${pkgdir}${MINGW_PREFIX}/bin/sonixflasher.exe"
}