void-packages/srcpkgs/python3-PyQt5/template

350 lines
10 KiB
Bash

# Template file for 'python3-PyQt5'
pkgname=python3-PyQt5
version=5.15.2
revision=1
_sipver=12.8.0
wrksrc="PyQt5-${version}"
build_helper=qemu
hostmakedepends="pkg-config qscintilla-qt5-devel python3-sip-PyQt5
python3-devel python-dbus-devel qt5 qt5-devel qt5-tools-devel
python3-PyQt-builder
qt5-connectivity-devel qt5-declarative-devel qt5-location-devel
qt5-multimedia-devel qt5-qmake qt5-sensors-devel qt5-serialport-devel
qt5-svg-devel qt5-webchannel-devel qt5-webkit-devel qt5-websockets-devel
qt5-x11extras-devel qt5-xmlpatterns-devel qt5-networkauth-devel pulseaudio-devel"
makedepends="${hostmakedepends/pkg-config/}"
depends="python3-sip-PyQt5>=${_sipver}"
short_desc="Python 3 bindings for the Qt5 toolkit"
maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
license="GPL-3.0-only"
homepage="https://riverbankcomputing.com/software/pyqt/intro"
distfiles="${PYPI_SITE}/P/PyQt5/PyQt5-${version}.tar.gz"
checksum=372b08dc9321d1201e4690182697c5e7ffb2e0770e6b4a45519025134b12e4fc
lib32disabled=yes
post_extract() {
rm -rf pyuic/uic/port_v2
}
_cross_configure() {
local qplatformdefs="/usr/lib/qt5/mkspecs/linux-g++/qplatformdefs.h"
mkdir -p "${wrksrc}/.target-spec/linux-g++"
cat >"${wrksrc}/.target-spec/linux-g++/qmake.conf" <<-_EOF
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
include(/usr/lib/qt5/mkspecs/common/linux.conf)
include(/usr/lib/qt5/mkspecs/common/gcc-base-unix.conf)
include(/usr/lib/qt5/mkspecs/common/g++-unix.conf)
QMAKE_TARGET_CONFIG = ${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/qconfig.pri
QMAKE_TARGET_MODULE = ${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/qmodule.pri
QMAKE_CC = ${CC}
QMAKE_CXX = ${CXX}
QMAKE_LINK = ${CXX}
QMAKE_LINK_C = ${CC}
QMAKE_LINK_SHLIB = ${CXX}
QMAKE_AR = ${XBPS_CROSS_TRIPLET}-gcc-ar cqs
QMAKE_OBJCOPY = ${OBJCOPY}
QMAKE_NM = ${NM} -P
QMAKE_STRIP = ${STRIP}
QMAKE_CFLAGS = ${CFLAGS}
QMAKE_CXXFLAGS = ${CXXFLAGS}
QMAKE_LFLAGS = ${LDFLAGS}
load(qt_config)
_EOF
ln -sf ${XBPS_CROSS_BASE}$qplatformdefs ${wrksrc}/.target-spec/linux-g++/
mkdir -p "${wrksrc}/.host-spec/linux-g++"
cat > "${wrksrc}/.host-spec/linux-g++/qmake.conf" <<-_EOF
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
include(/usr/lib/qt5/mkspecs/common/linux.conf)
include(/usr/lib/qt5/mkspecs/common/gcc-base-unix.conf)
include(/usr/lib/qt5/mkspecs/common/g++-unix.conf)
QMAKE_TARGET_CONFIG = ${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/qconfig.pri
QMAKE_TARGET_MODULE = ${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/qmodule.pri
QMAKE_CC = ${CC_FOR_BUILD}
QMAKE_CXX = ${CXX_FOR_BUILD}
QMAKE_LINK = ${CXX_FOR_BUILD}
QMAKE_LINK_C = ${CC_FOR_BUILD}
QMAKE_LINK_SHLIB = ${CXX_FOR_BUILD}
QMAKE_AR = gcc-ar cqs
QMAKE_OBJCOPY = ${OBJCOPY_FOR_BUILD}
QMAKE_NM = ${NM_FOR_BUILD} -P
QMAKE_STRIP = ${STRIP_FOR_BUILD}
QMAKE_CFLAGS = ${CFLAGS_FOR_BUILD}
QMAKE_CXXFLAGS = ${CXXFLAGS_FOR_BUILD}
QMAKE_LFLAGS = ${LDFLAGS_FOR_BUILD}
load(qt_config)
_EOF
ln -sf $qplatformdefs ${wrksrc}/.host-spec/linux-g++/
cat >"${wrksrc}/qt.conf" <<-_EOF
[Paths]
Sysroot=${XBPS_CROSS_BASE}
Prefix=/usr
ArchData=/usr/lib/qt5
Data=/usr/share/qt5
Documentation=/usr/share/doc/qt5
Headers=${XBPS_CROSS_BASE}/usr/include/qt5
Libraries=${XBPS_CROSS_BASE}/usr/lib
LibraryExecutables=/usr/lib/qt5/libexec
Binaries=/usr/lib/qt5/bin
Tests=${XBPS_CROSS_BASE}/usr/tests
Plugins=/usr/lib/qt5/plugins
Imports=${XBPS_CROSS_BASE}/usr/lib/qt5/imports
Qml2Imports=${XBPS_CROSS_BASE}/usr/lib/qt5/qml
Translations=${XBPS_CROSS_BASE}/usr/share/qt5/translations
Settings=${XBPS_CROSS_BASE}/etc/xdg
Examples=${XBPS_CROSS_BASE}/usr/share/qt5/examples
HostPrefix=/usr
HostData=/usr/lib/qt5
HostBinaries=/usr/lib/qt5/bin
HostLibraries=/usr/lib
Spec=$wrksrc/.host-spec/linux-g++
TargetSpec=$wrksrc/.target-spec/linux-g++
_EOF
case $XBPS_TARGET_MACHINE in
i686*) _qt_arch=i386;;
x86_64*) _qt_arch=x86_64;;
aarch64*) _qt_arch=arm64;;
arm*) _qt_arch=arm;;
mips*) _qt_arch=mips;;
esac
cat >$XBPS_WRAPPERDIR/qmake <<_EOF
#!/bin/sh
export PREFIX=/usr
export QT_INSTALL_PREFIX=/usr
export LIB=/usr/lib
export QT_TARGET_ARCH=$_qt_arch
export PKG_CONFIG_EXECUTABLE=$XBPS_WRAPPERDIR/$PKG_CONFIG
case " \$* " in
" -query ")
/usr/lib/qt5/bin/qmake "\$@" -qtconf $wrksrc/qt.conf |
sed '/^QT_INSTALL_/s,$XBPS_CROSS_BASE,,'
;;
*)
exec /usr/lib/qt5/bin/qmake -qtconf $wrksrc/qt.conf "\$@" ;;
esac
_EOF
chmod +x $XBPS_WRAPPERDIR/qmake
}
do_configure() {
if [ "$CROSS_BUILD" ]; then
_cross_configure
fi
mkdir -p build
sip-build --confirm-license --no-make \
--api-dir /usr/share/qt5/qsci/api/python \
--build-dir build
if [ "$CROSS_BUILD" ]; then
# Fix location of libraries
find build -name Makefile |
xargs sed -i "
s, \\(/usr/lib/libQt\\), $XBPS_CROSS_BASE\\1,g
s,-L\\(/usr/lib\\),-L$XBPS_CROSS_BASE\\1,g
/INSTALL_ROOT/s,$XBPS_CROSS_BASE,,g
s,-I\\(/usr/include\\),-I$XBPS_CROSS_BASE\\1,g
s,-I\\(/usr/lib\\),-I$XBPS_CROSS_BASE\\1,g
"
fi
}
do_build() {
cd build
make ${makejobs}
}
do_install() {
cd build
make DESTDIR=${DESTDIR} INSTALL_ROOT=${DESTDIR} install
for f in pylupdate5 pyrcc5 pyuic5; do
sed -i '1s,python3[.0-9]*,python3,' ${DESTDIR}/usr/bin/${f}
mv ${DESTDIR}/usr/bin/{,python3-}${f}
done
}
python3-PyQt5-devel-tools_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc+=" - development tools"
alternatives="
pyqt5:pylupdate5:/usr/bin/python3-pylupdate5
pyqt5:pyrcc5:/usr/bin/python3-pyrcc5
pyqt5:pyuic5:/usr/bin/python3-pyuic5"
pkg_install() {
vmove usr/bin
vmove "${py3_sitelib}/PyQt5/pylupdate*"
vmove "${py3_sitelib}/PyQt5/pyrcc*"
}
}
python3-PyQt5-devel_package() {
depends="sip5 python3-PyQt5-${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove ${py3_sitelib}/PyQt5/bindings
}
}
python3-PyQt5-dbus_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision} python3-dbus"
short_desc="${short_desc} - dbus support"
pkg_install() {
vmove ${py3_sitelib}/dbus
}
}
python3-PyQt5-connectivity_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - connectivity module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtBluetooth.*"
vmove "${py3_sitelib}/PyQt5/QtNfc.*"
}
}
python3-PyQt5-multimedia_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - multimedia module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtMultimedia.*"
vmove "${py3_sitelib}/PyQt5/QtMultimediaWidgets.*"
}
}
python3-PyQt5-networkauth_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - networkauth module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtNetworkAuth.*"
}
}
python3-PyQt5-opengl_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - opengl module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtOpenGL.*"
if [ -z "$CROSS_BUILD" ]; then
vmove "${py3_sitelib}/PyQt5/_QOpenGLFunctions_*"
fi
}
}
python3-PyQt5-location_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - location module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtLocation.*"
vmove "${py3_sitelib}/PyQt5/QtPositioning.*"
}
}
python3-PyQt5-quick_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - quick module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtQml.*"
vmove "${py3_sitelib}/PyQt5/QtQuick.*"
vmove "${py3_sitelib}/PyQt5/QtQuickWidgets.*"
vmove usr/lib/qt5/plugins/PyQt5/libpyqt5qmlplugin.so
}
}
python3-PyQt5-sensors_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - sensors module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtSensors.*"
}
}
python3-PyQt5-serialport_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - serialport module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtSerialPort.*"
}
}
python3-PyQt5-sql_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - sql module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtSql.*"
}
}
python3-PyQt5-svg_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - svg module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtSvg.*"
}
}
python3-PyQt5-tools_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - designer, help modules"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtHelp.*"
vmove "${py3_sitelib}/PyQt5/QtDesigner.*"
vmove usr/lib/qt5/plugins/designer
}
}
python3-PyQt5-webchannel_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - webchannel module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtWebChannel.*"
}
}
python3-PyQt5-webkit_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - webkit module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtWebKit.*"
vmove "${py3_sitelib}/PyQt5/QtWebKitWidgets.*"
}
}
python3-PyQt5-websockets_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - websockets module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtWebSockets.*"
}
}
python3-PyQt5-x11extras_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - x11extras module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtX11Extras.*"
}
}
python3-PyQt5-xmlpatterns_package() {
lib32disabled=yes
depends="python3-PyQt5-${version}_${revision}"
short_desc="${short_desc} - xmlpatterns module"
pkg_install() {
vmove "${py3_sitelib}/PyQt5/QtXmlPatterns.*"
}
}