# Maintainer: Raphael Amorim <rapha850@gmail.com>
_realname=rio
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.2.37
pkgrel=1
pkgdesc="A hardware-accelerated GPU terminal emulator focusing to run in desktops and browsers (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/raphamorim/rio"
msys2_changelog_url='https://rioterm.com/changelog'
license=('spdx:MIT')
msys2_references=(
  'archlinux: rio'
  'aur: rio-git'
  'purl: pkg:cargo/rioterm'
  'purl: pkg:cargo/corcovado'
  'purl: pkg:cargo/rio-backend'
  'purl: pkg:cargo/rio-proc-macros'
  'purl: pkg:cargo/rio-window'
  'purl: pkg:cargo/sugarloaf'
)
depends=("${MINGW_PACKAGE_PREFIX}-cc-libs")
makedepends=("${MINGW_PACKAGE_PREFIX}-rust")
source=("https://github.com/raphamorim/${_realname}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('f52bcd0fb3c669cae016c614a77a95547c2769e6a98a17d7bbc703b6e72af169')

prepare() {
  cd "${_realname}-${pkgver}"

  cargo fetch --locked --target "${RUST_CHOST}"
}

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

  cargo build -p rioterm --release --frozen
}

check() {
  cd "${_realname}-${pkgver}"

  cargo test -p rioterm --release --frozen
}

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

  cargo install \
    --offline \
    --no-track \
    --frozen \
    --path frontends/rioterm \
    --root "${pkgdir}${MINGW_PREFIX}"
}
