# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer:  Francesco Colista <fcolista@alpinelinux.org>
pkgname=py-sip
_pkgname=sip
pkgver=4.19.2
pkgrel=0
pkgdesc="A tool that makes it easy to create Python bindings for C and C++ libraries"
url="http://www.riverbankcomputing.com/software/sip/"
arch="all"
license="custom:sip"
makedepends="python2-dev"
subpackages="$pkgname-dev"
source="https://sourceforge.net/projects/pyqt/files/sip/sip-$pkgver/sip-$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)
	python configure.py
	make CC="${CC:-gcc}" \
		CXX="${CXX:-g++}" \
		CFLAGS="$CFLAGS -fPIC" \
		CXXFLAGS="$CXXFLAGS" \
		|| return 1
}

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

sha512sums="6f14f387a899130cf15820d2b58d937d134a2eefd53c65a82af060e88a6ca039442b21f822880c4a3742d6f26328853a552239873c55d7b22de62a6cc5037b3e  sip-4.19.2.tar.gz"
