# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer:  Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-sip
_pkgname=sip
pkgver=4.19.5
pkgrel=0
pkgdesc="A tool that makes it easy to create Python bindings for C and C++ libraries. Python 3 package."
url="http://www.riverbankcomputing.com/software/sip/"
arch="all"
license="custom:sip"
makedepends="python3-dev"
# upstram does not provide test
options="!check"
replaces="py-sip"
subpackages="$pkgname-dev"
source="https://sourceforge.net/projects/pyqt/files/$_pkgname/$_pkgname-$pkgver/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

build() {
	cd "$builddir"
	local sip_api_major_nr=$(sed -nre 's:^#define SIP_API_MAJOR_NR\s+([0-9]+):\1:p' siplib/sip.h.in)
	python3 configure.py
	make CC="${CC:-gcc}" \
		CXX="${CXX:-g++}" \
		CFLAGS="$CFLAGS -fPIC" \
		CXXFLAGS="$CXXFLAGS"
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/custom/${pkgname}/LICENSE
}

sha512sums="15d0c0daacf11534a61cd3961613e0015afb9f61fd484094008d1b3d344765d03a2bed2eb08c92a347bbe6868622ab1f7dc0a3bd3e2e662a8e08a53ac8e88463  sip-4.19.5.tar.gz"
