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

186 lines
5.7 KiB
Bash

# Template file for 'python3-PyQt5-webengine'
pkgname=python3-PyQt5-webengine
version=5.15.0
revision=1
wrksrc="PyQtWebEngine-${version}"
hostmakedepends="pkg-config qt5-qmake python3-PyQt5 sip5 qt5-webengine-devel
qt5-declarative-devel qt5-webchannel-devel qt5-location-devel"
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="Orphaned <orphan@voidlinux.org>"
license="GPL-3.0-only"
homepage="https://www.riverbankcomputing.com/software/pyqtwebengine/intro"
distfiles="${PYPI_SITE}/P/PyQtWebEngine/PyQtWebEngine-${version}.tar.gz"
checksum=670812688e40bf75f70ddf01eadd897d231300318d3856b275bf8e7e0085bf75
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 qmakespec=$XBPS_STATEDIR/qmake-$XBPS_TARGET_MACHINE
mkdir -p $qmakespec/target/linux-g++
# This is copied from qmake build-style
cat > "$qmakespec/target/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
cat <<-EOF > "$qmakespec/target/linux-g++/qplatformdefs.h"
#include "${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/linux-g++/qplatformdefs.h"
EOF
mkdir -p $qmakespec/host/linux-g++
cat > "$qmakespec/host/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
cat <<-EOF > "$qmakespec/host/linux-g++/qplatformdefs.h"
#include "/usr/lib/qt5/mkspecs/linux-g++/qplatformdefs.h"
EOF
cat > "$qmakespec/qt.conf" <<-_EOF
[Paths]
Sysroot=${XBPS_CROSS_BASE}
Prefix=/usr
ArchData=/usr/lib/qt5
Data=/usr/share/qt5
Documentation=/usr/share/doc/qt5
Headers=/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=$qmakespec/host/linux-g++
TargetSpec=$qmakespec/target/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/cross-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 $qmakespec/qt.conf |
sed '/^QT_INSTALL_/s,$XBPS_CROSS_BASE,,'
;;
*)
exec /usr/lib/qt5/bin/qmake -qtconf $qmakespec/qt.conf "\$@" ;;
esac
EOF
chmod +x $XBPS_WRAPPERDIR/cross-qmake
python3 configure.py --qmake=$XBPS_WRAPPERDIR/cross-qmake \
--sysroot $XBPS_CROSS_BASE/usr
# Technically, the second sed expr isn't necessary
# since all of them are the same for both host and target.
# We need to fix INSTALL_ROOT anyway, let's fix it, too.
sed -i -e "/INSTALL_ROOT/s,$XBPS_CROSS_BASE,,g" \
-e "s,-I/usr/include,-I$XBPS_CROSS_BASE/usr/include,g" \
Makefile \
QtWebEngine/Makefile \
QtWebEngineCore/Makefile \
QtWebEngineWidgets/Makefile
sed -i -e "s,$XBPS_CROSS_BASE,,g" installed.txt
}
do_configure() {
if [ "$CROSS_BUILD" ]; then
_cross_configure
else
python3 configure.py \
QMAKE_CC="${CC}" QMAKE_CFLAGS="${CFLAGS}" \
QMAKE_CXX="${CXX}" QMAKE_CXXFLAGS="${CXXFLAGS}" \
QMAKE_LINK="${CXX}" QMAKE_LINK_SHLIB="${CXX}"
QMAKE_LFLAGS="${LDFLAGS}" QMAKE_STRIP=""
fi
}
do_build() {
make ${makejobs}
}
do_install() {
make DESTDIR=${DESTDIR} INSTALL_ROOT=${DESTDIR} install
rm -rf ${DESTDIR}/usr/share
}