# Contributor: Melven Roehrig-Zoellner <Melven.Roehrig-Zoellner@DLR.de>
# mostly copied from ../mingw-w64-python-pyqt5/PKGBUILD

_realname=pyqt5-3d
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=5.15.4
pkgrel=2
pkgdesc="Qt5 Qt3D bindings for Python (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
license=('GPL')
url="https://riverbankcomputing.com/software/pyqt3d"
depends=("${MINGW_PACKAGE_PREFIX}-python-pyqt5")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-sip"
             "${MINGW_PACKAGE_PREFIX}-pyqt-builder"
             "${MINGW_PACKAGE_PREFIX}-python-packaging")
source=(https://pypi.python.org/packages/source/P/PyQt3D/PyQt3D-${pkgver}.tar.gz)
sha256sums=('36bc56d7432ab6c59ea77e1df6f6f688d8abd6cdb340706d5cb0a9c665e13975')

prepare() {
 cd "${srcdir}"/PyQt3D-${pkgver}

}

build() {
  [[ -d python-${MINGW_CHOST} ]] && rm -rf python-${MINGW_CHOST}
  cp -r PyQt3D-${pkgver} python-${MINGW_CHOST} && cd python-${MINGW_CHOST}

  MSYS2_ARG_CONV_EXCL="--api-dir=;" \
  ${MINGW_PREFIX}/bin/sip-build \
    --no-make \
    --api-dir=${MINGW_PREFIX}/share/qt5/qsci/api/python \
    --qmake=${MINGW_PREFIX}/bin/qmake.exe

    cd build
    make
}

package(){
  cd python-${MINGW_CHOST}/build

  make DESTDIR="${pkgdir}" INSTALL_ROOT="${pkgdir}" install
}
