# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=pyqt5-sip
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python-sip"
           "${MINGW_PACKAGE_PREFIX}-python-sip4")
replaces=("${MINGW_PACKAGE_PREFIX}-python-sip"
          "${MINGW_PACKAGE_PREFIX}-python-sip4")
pkgver=12.9.0
pkgrel=1
pkgdesc="The sip extension module provides support for the PyQt5 package (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=('GPL')
url="https://riverbankcomputing.com/software/pyqt"
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=('strip' 'staticlibs')
source=(https://pypi.python.org/packages/source/P/PyQt5_sip/PyQt5_sip-${pkgver}.tar.gz)
sha256sums=('d3e4489d7c2b0ece9d203ae66e573939f7f60d4d29e089c9f11daa17cfeaae32')

prepare() {
  cd "${srcdir}"
  rm -rf python-build-${MINGW_CHOST} | true
  cp -r "PyQt5_sip-${pkgver}" "python-build-${MINGW_CHOST}"
}

build() {
  cd python-build-${MINGW_CHOST}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py build
}

package(){
  cd "${srcdir}"/python-build-${MINGW_CHOST}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
}
