# Maintainer: Maksim Bondarenkov <maksapple2306@gmail.com>

_realname=rufus
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.11
pkgrel=1
pkgdesc="The Reliable USB Formatting Utility (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64')
url='https://rufus.ie'
msys2_repository_url='https://github.com/pbatard/rufus'
license=('spdx:GPL-3.0-or-later')
msys2_references=(
  'anitya: 378415'
  'cpe: cpe:2.3:a:rufus_project:rufus'
)
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-cc")
source=("${msys2_repository_url}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('a565d60d78d215382e50717b49c685bc557a1f6ea89321bf22029f1b936ad48a')

build() {
  mkdir -p "build-${MSYSTEM}" && cd "build-${MSYSTEM}"

  ../"${_realname}-${pkgver}"/configure \
    --prefix="${MINGW_PREFIX}" \
    --disable-debug

  make
}

package() {
  cd "build-${MSYSTEM}"

  install -Dm755 src/rufus.exe "${pkgdir}${MINGW_PREFIX}/bin/rufus.exe"
  install -Dm644 "../${_realname}-${pkgver}/LICENSE.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.txt"
}
