# Maintainer: Martell Malone <martellmalone@gmail.com>

_realname=winstorecompat
pkgbase=mingw-w64-${_realname}-git
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git"
pkgver=13.0.0.r223.gf82613935
pkgrel=1
_commit='f82613935f55f206f5bf53fd18e09fb3a3773264'
pkgdesc="MinGW-w64 winRT compat library (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://www.mingw-w64.org/"
msys2_repository_url="https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-libraries/winstorecompat/"
license=('spdx:MIT')
groups=("${MINGW_PACKAGE_PREFIX}-toolchain")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-crt"
             "${MINGW_PACKAGE_PREFIX}-headers"
             "git")
options=('!buildflags' '!emptydirs')
source=("mingw-w64"::"git+https://git.code.sf.net/p/mingw-w64/mingw-w64#commit=$_commit")
sha256sums=('7d62fd4f713bc3a544a44d67237c0c492f78f58b075a4f2dc42485ccb8eb118c')

pkgver() {
  cd "${srcdir}/mingw-w64"
  git describe --long ${_commit} | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//g'
}

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

  "${srcdir}"/mingw-w64/mingw-w64-libraries/winstorecompat/configure \
    --prefix=${MINGW_PREFIX}

  make
}

package() {
  cd "${srcdir}"/build-${MSYSTEM}
  make DESTDIR="${pkgdir}" install
}
