# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.pro>

_realname=jom
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgdesc="JOM - the parallel make tool for Windows (mingw-w64)"
pkgver=1.1.3
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url='https://wiki.qt.io/Jom'
license=('GPL3')
depends=("${MINGW_PACKAGE_PREFIX}-qt5")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-cmake")
options=('strip' 'staticlibs')
#options=('!strip' 'debug' 'staticlibs')
source=("${_realname}-v${pkgver}.tar.gz::https://codereview.qt-project.org/gitweb?p=qt-labs/jom.git;a=snapshot;h=refs/tags/v${pkgver};sf=tgz")
sha256sums=('1207452997f428505203741a4de4bb7b35fb37b357bf56092280c57c8e47d18b')

build() {
  cd "${srcdir}"
  [[ -d build-${CARCH} ]] && rm -rf build-${CARCH}
  mkdir build-${CARCH} && cd build-${CARCH}

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

  make
}

package() {
  cd "${srcdir}/build-${CARCH}"
  make DESTDIR=${pkgdir} install
  
  install -Dm644 "${srcdir}/${_realname}-v${pkgver}/LICENSE.GPL" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
