# Template file for 'sip4'
pkgname=sip4
version=4.19.25
revision=3
hostmakedepends="python3-devel"
makedepends="${hostmakedepends}"
short_desc="Python extension module generator for C/C++ libraries"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only, GPL-3.0-only, custom:SIP"
homepage="https://riverbankcomputing.com/software/sip/intro"
distfiles="https://www.riverbankcomputing.com/static/Downloads/sip/${version}/sip-${version}.tar.gz"
checksum=b39d93e937647807bac23579edbff25fe46d16213f708370072574ab1f1b4211
replaces="sip<=${version}_${revision}"
provides="sip-${version}_${revision}"

do_build() {
	python3 configure.py \
		CC="${CC}" CFLAGS="${CFLAGS}" CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" \
		LINK="${CXX}" LINK_SHLIB="${CXX}" LFLAGS="${LDFLAGS}" STRIP="" \
		INCDIR="${XBPS_CROSS_BASE}/${py3_inc}"
	make ${makejobs}
}

do_install() {
	make DESTDIR=${DESTDIR} install -C sipgen
	make DESTDIR=${DESTDIR} install -C siplib
	vinstall sipconfig.py 644 $py3_sitelib
	vinstall sipdistutils.py 644 $py3_sitelib
	vlicense LICENSE
}

python3-sip_package() {
	lib32disabled=yes
	depends="python3"
	short_desc="Python3 SIP bindings"
	pkg_install() {
		vmove ${py3_sitelib}/sip.so
		vmove ${py3_sitelib}/sipconfig.py
		vmove ${py3_sitelib}/sip.pyi
		vlicense LICENSE
	}
}

python3-sip-devel_package() {
	depends="python3-sip-${version}_${revision} sip4-${version}_${revision}"
	short_desc="Python3 SIP bindings - development files"
	pkg_install() {
		vmove ${py3_inc}
		vmove ${py3_sitelib}/sipdistutils.py
	}
}
