void-packages/srcpkgs/python-PyQt4/template

181 lines
5.0 KiB
Bash

# Template file for 'python-PyQt4'
pkgname=python-PyQt4
version=4.12.1
revision=3
lib32disabled=yes
wrksrc="PyQt4_gpl_x11-${version}"
hostmakedepends="pkg-config python python3"
makedepends="python-devel python3-devel python-sip-devel python3-sip-devel
qt-webkit-devel dbus-devel python-dbus-devel MesaLib-devel phonon-devel"
depends="python-sip"
pycompile_module="PyQt4"
short_desc="Python2 bindings for the Qt4 toolkit"
maintainer="Alessio Sergi <al3hex@gmail.com>"
homepage="https://riverbankcomputing.com/software/pyqt/intro"
license="GPL-3"
distfiles="${SOURCEFORGE_SITE}/pyqt/PyQt4_gpl_x11-${version}.tar.gz"
checksum=45d724461ae58b019b9be95076ca07e212eb73084aec9125bb254825c3a05383
alternatives="pyqt4:pyuic4:/usr/bin/python2-pyuic4"
if [ -n "$CROSS_BUILD" ]; then
hostmakedepends+=" qt-devel sip phonon-devel python-dbus-devel qt-webkit-devel"
fi
pre_build() {
mkdir -p pyqt4-${py2_ver}
mv * pyqt4-${py2_ver} || true
cp -a pyqt4-${py2_ver} pyqt4-${py3_ver}
rm -rf pyqt4-${py2_ver}/pyuic/uic/port_v3
rm -rf pyqt4-${py3_ver}/pyuic/uic/port_v2
}
do_build() {
local tools=
for pyver in $py2_ver $py3_ver; do
cd $wrksrc/pyqt4-$pyver
if [ -n "$CROSS_BUILD" ]; then
cat > qtdetail.inc << END
QMAKE_CC="$CC_host"
QMAKE_CFLAGS="$CFLAGS_host"
QMAKE_CXX="$CXX_host"
QMAKE_CXXFLAGS="$CXXFLAGS_host"
QMAKE_LINK="$CXX_host"
QMAKE_LINK_SHLIB=
QMAKE_LFLAGS=
END
cat > application.inc << END
QMAKE_CC="${CC}"
QMAKE_CFLAGS="${CFLAGS}"
QMAKE_CXX="${CXX}"
QMAKE_CXXFLAGS="${CXXFLAGS}"
QMAKE_LINK="${CXX}"
QMAKE_LINK_SHLIB="${CXX}"
QMAKE_LFLAGS="${LDFLAGS}"
QMAKE_STRIP=""
END
# configure-ng.py stops when $XBPS_CROSS_BASE is empty
# in a native build; so only set sysroot when cross compiling
_sysroot="--sysroot=$XBPS_CROSS_BASE"
else
_sysroot=""
fi
python${pyver} configure-ng.py --confirm-license --assume-shared \
--qmake=/usr/lib/qt/bin/qmake --verbose $_sysroot \
QMAKE_CC="${CC}" QMAKE_CFLAGS="${CFLAGS}" QMAKE_CXX="${CXX}" QMAKE_CXXFLAGS="${CXXFLAGS}" \
QMAKE_LINK="${CXX}" QMAKE_LINK_SHLIB="${CXX}" QMAKE_LFLAGS="${LDFLAGS}" QMAKE_STRIP=""
find -name Makefile -exec sed -i "{}" \
-e "s;\(\$(INSTALL_ROOT)/usr/\)${XBPS_CROSS_TRIPLET}/;\1;g" \;
make ${makejobs}
done
}
do_install() {
# install python-pyqt4
make -C pyqt4-${py2_ver} DESTDIR=${DESTDIR} INSTALL_ROOT=${DESTDIR} install
# create versioned pyuic4 wrapper
sed -i -e 's,/usr/bin/python2.7,/usr/bin/python2,' ${DESTDIR}/usr/bin/pyuic4
if [ -n "$CROSS_BUILD" ]; then
sed -i -e "s,${XBPS_CROSS_TRIPLET}/,," ${DESTDIR}/usr/bin/pyuic4
fi
mv ${DESTDIR}/usr/bin/{,python2-}pyuic4
# install python3-pyqt4
make -C pyqt4-${py3_ver} DESTDIR=${DESTDIR} INSTALL_ROOT=${DESTDIR} install
# create versioned pyuic4 wrapper
sed -i -e 's,/usr/bin/python3[.0-9]*,/usr/bin/python3,' ${DESTDIR}/usr/bin/pyuic4
if [ -n "$CROSS_BUILD" ]; then
sed -i -e "s,${XBPS_CROSS_TRIPLET}/,," ${DESTDIR}/usr/bin/pyuic4
fi
mv ${DESTDIR}/usr/bin/{,python3-}pyuic4
cd pyqt4-${py2_ver}
# install doc
vmkdir usr/share/doc/${pkgname}
vcopy doc/html usr/share/doc/${pkgname}
}
python-PyQt4-devel-tools_package() {
short_desc+=" - development tools"
pkg_install() {
vmove usr/bin/pylupdate4
vmove usr/bin/pyrcc4
}
}
python-PyQt4-devel_package() {
depends="python-sip-devel python3-sip-devel
python-PyQt4-${version}_${revision} python3-PyQt4-${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/share/sip
}
}
python-PyQt4-dbus_package() {
lib32disabled=yes
depends="${sourcepkg}-${version}_${revision} python-dbus"
short_desc+=" - dbus support"
pkg_install() {
vmove ${py2_sitelib}/dbus/mainloop/qt.so
}
}
python-PyQt4-phonon_package() {
lib32disabled=yes
depends="${sourcepkg}-${version}_${revision}"
short_desc+=" - phonon bindings"
pkg_install() {
vmove ${py2_sitelib}/PyQt4/phonon.so
}
}
python-PyQt4-webkit_package() {
lib32disabled=yes
depends="${sourcepkg}-${version}_${revision}"
short_desc+=" - webkit module"
pkg_install() {
vmove ${py2_sitelib}/PyQt4/QtWebKit.so
}
}
python-PyQt4-doc_package() {
noarch=yes
short_desc+=" - documentation files"
pkg_install() {
vmove usr/share/doc
}
}
python3-PyQt4_package() {
lib32disabled=yes
depends="python3-sip"
pycompile_module="PyQt4"
short_desc="${short_desc/Python2/Python3}"
alternatives="pyqt4:pyuic4:/usr/bin/python3-pyuic4"
pkg_install() {
vmove usr/bin/python3-pyuic4
vmove ${py3_sitelib}
}
}
python3-PyQt4-dbus_package() {
lib32disabled=yes
depends="python3-PyQt4-${version}_${revision} python3-dbus"
short_desc="${short_desc/Python2/Python3} - dbus support"
pkg_install() {
vmove ${py3_sitelib}/dbus/mainloop/qt.so
}
}
python3-PyQt4-phonon_package() {
lib32disabled=yes
depends="python3-PyQt4-${version}_${revision}"
short_desc="${short_desc/Python2/Python3} - phonon bindings"
pkg_install() {
vmove ${py3_sitelib}/PyQt4/phonon.so
}
}
python3-PyQt4-webkit_package() {
lib32disabled=yes
depends="python3-PyQt4-${version}_${revision}"
short_desc="${short_desc/Python2/Python3} - webkit module"
pkg_install() {
vmove ${py3_sitelib}/PyQt4/QtWebKit.so
}
}