# Template file for 'python-PyQt4'
pkgname=python-PyQt4
version=4.11.1
revision=2
wrksrc="PyQt-x11-gpl-${version}"
build_style=
maintainer="Dominik Honnef <dominik@honnef.co>"
hostmakedepends="python-sip python3.4-sip python-devel python3.4-devel qt-qmake qt-devel>=4"
makedepends="${hostmakedepends}"
depends="python python-sip"
license="GPL"
homepage="http://www.riverbankcomputing.co.uk/software/pyqt/intro"
short_desc="Python2 bindings for the Qt toolkit"
distfiles="http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-${version}/PyQt-x11-gpl-${version}.tar.gz"
checksum="df9d7358d70748efa5b84fa3fe9e182a80c39ac590157daaabcc2618df176da3"

_do_pyqt_build() {
	local v=$1 tools=${2:-yes} suffix=$3 tools_flag
	[[ "$tools" != "yes" ]] && tools_flag="--no-tools"
	python${v} configure-ng.py  \
		--confirm-license \
		--bindir="/usr/bin" \
		--sipdir="/usr/share/sip${v}" \
		--sip="/usr/bin/sip${v}" \
		--destdir="/usr/lib/python${v}/site-packages" \
		--assume-shared \
		$tools_flag \
		INCDIR="${XBPS_CROSS_BASE}/usr/include/python${v}${suffix}" \
		CC="${CC}" \
		CFLAGS="${CFLAGS}" \
		CXX="${CXX}" \
		CXXFLAGS="${CXXFLAGS}" \
		LINK="${CXX}" \
		LINK_SHLIB="${CXX}" \
		LFLAGS="${LDFLAGS}" \
		STRIP=""

	make $makejobs
	make INSTALL_ROOT=${DESTDIR} install
}

do_build() {
	_do_pyqt_build 2.7
	_do_pyqt_build 3.4 no "m"
}

do_install() {
	true
}

python3.4-PyQt4_package() {
	depends="python3.4 python3.4-sip"
	short_desc="${short_desc/Python2/Python3.4}"
	pkg_install() {
		mkdir -p ${PKGDESTDIR}/usr/{lib,share}
		mv ${DESTDIR}/usr/lib/python3.4 ${PKGDESTDIR}/usr/lib/
		mv ${DESTDIR}/usr/share/sip3.4 ${PKGDESTDIR}/usr/share/
	}
}
