# Maintainer: Ruben Agin <phabrics@phabrics.com>

_realname=tme
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.12rc14
pkgrel=2
pkgdesc="The Machine Emulator, or tme, provides a general-purpose framework for computer emulation. (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
license=('GPL3')
url="https://phabrics.github.io/tme.html"
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-pkgconf")
depends=("${MINGW_PACKAGE_PREFIX}-gtk4"
         "${MINGW_PACKAGE_PREFIX}-SDL2"
         "${MINGW_PACKAGE_PREFIX}-libvncserver"
         "${MINGW_PACKAGE_PREFIX}-libltdl")
source=("https://github.com/phabrics/nme/releases/download/${pkgver}/${_realname}-${pkgver}.tar.xz")
sha256sums=('fc94d5a9adaf4c0d94f6132c07181be9f9cbaf3f6d7688876254d03bdad3d1ff')
options=('libtool')

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

    ../"${_realname}-${pkgver}"/configure \
      --prefix="${MINGW_PREFIX}" \
      --build="${MINGW_CHOST}" \
      --host="${MINGW_CHOST}" \
      --disable-ltdl-install

    make
}

package() {
    cd "${srcdir}/build-${MSYSTEM}"
    make install DESTDIR="${pkgdir}"
    install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
