void-packages/srcpkgs/python3-PyQt5-webengine/template

178 lines
5.5 KiB
Bash

# Template file for 'python3-PyQt5-webengine'
pkgname=python3-PyQt5-webengine
version=5.15.2
revision=2
wrksrc="PyQtWebEngine-${version}"
hostmakedepends="pkg-config qt5-qmake python3-PyQt5-devel
sip python3-PyQt-builder"
makedepends="qt5-declarative-devel qt5-webchannel-devel qt5-location-devel
qt5-webengine-devel python3-devel python3-PyQt5-devel"
depends="python3-PyQt5>=${version}_1 python3-PyQt5-webchannel>=${version}_1"
short_desc="Python 3 bindings for the Qt5 toolkit - webengine module"
maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
license="GPL-3.0-only"
homepage="https://www.riverbankcomputing.com/software/pyqtwebengine/intro"
distfiles="${PYPI_SITE}/P/PyQtWebEngine/PyQtWebEngine-${version}.tar.gz"
checksum=4d72fea774071ce6f76e341a3d2c5d595886c9906a9b9493239c841cce54a634
lib32disabled=yes
case "$XBPS_TARGET_MACHINE" in
ppc64le*) ;;
ppc*) broken="no webengine for big endian ppc";;
arm*) broken="depends on qt5-webengine";;
esac
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 no_qt_rpath
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
QMAKEMODULES = ${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/modules
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}
INCPATH = $XBPS_CROSS_BASE/usr/include/python$py3_ver
INCPATH += $XBPS_CROSS_BASE/usr/include/qt5/QtWebChannel
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 no_qt_rpath
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 <<EOF >$XBPS_WRAPPERDIR/qmake
#!/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
}
do_configure() {
if [ "$CROSS_BUILD" ]; then
_cross_configure
else
cat >$XBPS_WRAPPERDIR/qmake <<-'_EOF'
#!/bin/sh
exec /usr/lib/qt5/bin/qmake "$@" CONFIG+=no_qt_rpath
_EOF
fi
chmod +x $XBPS_WRAPPERDIR/qmake
mkdir -p build
sip-build --no-make \
--api-dir /usr/share/qt5/qsci/api/python \
--build-dir build
if [ "$CROSS_BUILD" ]; then
# Fix location of python include
find build -name Makefile |
xargs sed -i "s,-I\\(/usr/include\\),-I$XBPS_CROSS_BASE\\1,g"
fi
}
do_build() {
cd build
make ${makejobs}
}
do_install() {
cd build
make DESTDIR=${DESTDIR} INSTALL_ROOT=${DESTDIR} install
rm -rf ${DESTDIR}/usr/share
}