# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.su>

_realname=webview2-loader
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.0.3296.44
_pkgsha=6a4755acf0fbe8a7e169cf84146845d83be8270d
pkgrel=1
pkgdesc="WebView2 Loader from Rust bindings (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/wravery/webview2-rs'
license=('spdx:MIT')
conflicts=("${MINGW_PACKAGE_PREFIX}-typstudio")
source=("${url}/archive/${_pkgsha}/webview2-rs-${_pkgsha}.tar.gz")
sha256sums=('a6c3057f3a380c1390ad387ae7d932ecbbdea95002756a4d97204db95611ce81')

package() {
  cd "webview2-rs-${_pkgsha}"

  local _arch=x64
  if [[ ${CARCH} == aarch64 ]]; then
      _arch=arm64
  fi

  install -Dm644 "crates/bindings/${_arch}/WebView2Loader.dll" "${pkgdir}${MINGW_PREFIX}/bin/WebView2Loader.dll"

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
