# Maintainer: Nathan Osman <nathan@quickmediasolutions.com>

_realname=qhttpengine
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0.1
pkgrel=2
pkgdesc="HTTP server for Qt applications (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/nitroshare/qhttpengine'
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-qt5-base")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake")
source=("https://github.com/nitroshare/qhttpengine/archive/${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('6505cf889909dc29bab4069116656e7ca5a9e879f04935139439c5691a76c55e')

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

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DCMAKE_BUILD_TYPE=Release \
    "${srcdir}"/${_realname}-${pkgver}

  ${MINGW_PREFIX}/bin/cmake --build .
}

package() {
  cd "${srcdir}"/build-${MSYSTEM}
  DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake --install .
}
