# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=shiboken6
_qtver=6.1.3
_clangver=12.0.1
pkgver=${_qtver/-/}
pkgrel=1
arch=(x86_64)
url='https://www.qt.io'
license=(GPL2 LGPL)
pkgdesc='Generates bindings for C++ libraries using CPython source code'
depends=(clang=$_clangver llvm libxslt qt6-base)
makedepends=(cmake python-sphinx python-numpy)
optdepends=('python: Python bindings')
_pkgfn=pyside-setup-opensource-src-$_qtver
source=(https://download.qt.io/official_releases/QtForPython/pyside6/PySide6-$pkgver-src/$_pkgfn.tar.xz)
sha256sums=('33badd9f01b72c9f69f988c47c64111e7b50a47c30841d5957a11a5c4e9821bb')

build() {
  cmake -B build -S $_pkgfn/sources/shiboken6 \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_TESTS=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build

# Install egg-info
  export PATH="/usr/lib/qt6/bin:$PATH"
  cd $_pkgfn
  python setup.py egg_info --build-type=shiboken6
  _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"`
  cp -r shiboken6.egg-info "$pkgdir"/$_pythonpath
}
