# Template file for 'shiboken2'
pkgname=shiboken2
version=5.11.2
revision=4
_pkgname="pyside-setup-everywhere-src-${version}"
wrksrc="$_pkgname"
configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr
 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF"
hostmakedepends="cmake"
makedepends="python3-devel qt5-devel qt5-xmlpatterns-devel clang libxml2-devel
 libxslt-devel python3-numpy"
short_desc="Python binding generator of Qt5 C++ API"
maintainer="yopito <pierre.bourgin@free.fr>"
license="GPL-3.0-or-later"
homepage="https://wiki.qt.io/Qt_for_Python/Shiboken"
distfiles="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/${_pkgname}.tar.xz"
checksum=18f572f1f832e476083d30fccabab167450f2a8cbe5cd9c6e6e4fa078ccb86c2

pre_build() {
	# Fix inconsistent naming of .so and .cmake files
	sed -i "/get_python_extension_suffix()/d" sources/shiboken2/CMakeLists.txt
}

do_build() {
	[ ! -d build ] && mkdir build
	pushd build
	export CLANG_INSTALL_DIR=/usr
	cmake ../sources/shiboken2 ${configure_args}
	make ${makejobs}
	popd
}

do_install() {
	make -C build DESTDIR=${DESTDIR} install
}

libshiboken2-devel_package() {
	depends="${sourcepkg}-${version}_${revision}
	 libshiboken2-${version}_${revision}"
	short_desc+=" - common development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}

libshiboken2_package() {
	short_desc="Python3 shiboken2 bindings - shared library"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}

python3-shiboken2_package() {
	short_desc="Python3 shiboken2 bindings"
	pkg_install() {
		vmove ${py3_sitelib}
	}
}

python3-shiboken_package() {
	short_desc="Python3 shiboken2 bindings - tranditional dummy pkg"
	depends="python3-shiboken2-${version}_${revision}"
	build_style=meta
	archs=noarch
}

libshiboken-python3_package() {
	short_desc="Python3 shiboken2 bindings - tranditional dummy pkg"
	depends="python3-shiboken2-${version}_${revision}"
	build_style=meta
	archs=noarch
}
