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

_realname=quarter
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.2.3
pkgrel=1
pkgdesc="Coin GUI binding for Qt (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://www.coin3d.org/Quarter/html/'
msys2_repository_url='https://github.com/coin3d/quarter'
license=('BSD')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-graphviz"
             "${MINGW_PACKAGE_PREFIX}-doxygen"
             "${MINGW_PACKAGE_PREFIX}-qt6-tools")
depends=("${MINGW_PACKAGE_PREFIX}-cc-libs"
         "${MINGW_PACKAGE_PREFIX}-coin"
         "${MINGW_PACKAGE_PREFIX}-qt6-base")
optdepends=("${MINGW_PACKAGE_PREFIX}-qt6-tools: Designer plugin")
options=('!strip' '!buildflags')
source=("${msys2_repository_url}/archive/v${pkgver}/quarter-${pkgver}.tar.gz")
sha256sums=('e78ceaafbc319267e6391183afe1f81b773f840608b1573b7eff5b7ea9d46b90')

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

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake.exe \
    -G"MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DCMAKE_BUILD_TYPE=Release \
    -DQUARTER_BUILD_PLUGIN=ON \
    -DQUARTER_BUILD_EXAMPLES=OFF \
    -DQUARTER_BUILD_DOCUMENTATION=ON \
    -DQUARTER_USE_CPPFLAGS=-DQUARTER_DLL \
    ../quarter-${pkgver}

  cmake --build .
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  DESTDIR="${pkgdir}" cmake --install .

  install -Dm644 "${srcdir}/quarter-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}

# vim:set ts=2 sw=2 et:
