# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>

_realname=typst
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.10.0
pkgrel=1
pkgdesc='A markup-based typesetting system for the sciences (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://typst.app/'
license=('spdx:Apache-2.0')
makedepends=("${MINGW_PACKAGE_PREFIX}-rust")
source=("https://github.com/typst/typst/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('f1b7baba3c6f6f37dee6d05c9ab53d2ba5cd879a57b6e726dedf9bc51811e132')

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

  ${MINGW_PREFIX}/bin/cargo fetch --locked
}

build() {
  cd ${_realname}-${pkgver}
  ${MINGW_PREFIX}/bin/cargo build -p typst-cli --frozen --release --all-features
}

package() {
  cd ${_realname}-${pkgver}
  install -Dm0755 -t "${pkgdir}${MINGW_PREFIX}/bin/" "target/release/typst.exe"
}
