python3-PyQt5-webengine: build with sip-build

This commit is contained in:
Đoàn Trần Công Danh 2020-09-27 14:13:48 +07:00
parent 377145c395
commit eef89aac1e
1 changed files with 36 additions and 45 deletions

View File

@ -1,9 +1,10 @@
# Template file for 'python3-PyQt5-webengine' # Template file for 'python3-PyQt5-webengine'
pkgname=python3-PyQt5-webengine pkgname=python3-PyQt5-webengine
version=5.15.0 version=5.15.0
revision=1 revision=2
wrksrc="PyQtWebEngine-${version}" wrksrc="PyQtWebEngine-${version}"
hostmakedepends="pkg-config qt5-qmake python3-PyQt5 sip5 qt5-webengine-devel hostmakedepends="pkg-config qt5-qmake python3-PyQt5 sip5 qt5-webengine-devel
python3-PyQt-builder python3-PyQt5-devel
qt5-declarative-devel qt5-webchannel-devel qt5-location-devel" qt5-declarative-devel qt5-webchannel-devel qt5-location-devel"
makedepends="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" qt5-webengine-devel python3-devel python3-PyQt5-devel"
@ -27,10 +28,10 @@ post_extract() {
} }
_cross_configure() { _cross_configure() {
local qmakespec=$XBPS_STATEDIR/qmake-$XBPS_TARGET_MACHINE local qplatformdefs="/usr/lib/qt5/mkspecs/linux-g++/qplatformdefs.h"
mkdir -p $qmakespec/target/linux-g++
# This is copied from qmake build-style mkdir -p "${wrksrc}/.target-spec/linux-g++"
cat > "$qmakespec/target/linux-g++/qmake.conf" <<-_EOF cat >"${wrksrc}/.target-spec/linux-g++/qmake.conf" <<-_EOF
MAKEFILE_GENERATOR = UNIX MAKEFILE_GENERATOR = UNIX
CONFIG += incremental CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib QMAKE_INCREMENTAL_STYLE = sublib
@ -57,14 +58,10 @@ _cross_configure() {
QMAKE_LFLAGS = ${LDFLAGS} QMAKE_LFLAGS = ${LDFLAGS}
load(qt_config) load(qt_config)
_EOF _EOF
ln -sf ${XBPS_CROSS_BASE}$qplatformdefs ${wrksrc}/.target-spec/linux-g++/
cat <<-EOF > "$qmakespec/target/linux-g++/qplatformdefs.h" mkdir -p "${wrksrc}/.host-spec/linux-g++"
#include "${XBPS_CROSS_BASE}/usr/lib/qt5/mkspecs/linux-g++/qplatformdefs.h" cat > "${wrksrc}/.host-spec/linux-g++/qmake.conf" <<-_EOF
EOF
mkdir -p $qmakespec/host/linux-g++
cat > "$qmakespec/host/linux-g++/qmake.conf" <<-_EOF
MAKEFILE_GENERATOR = UNIX MAKEFILE_GENERATOR = UNIX
CONFIG += incremental CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib QMAKE_INCREMENTAL_STYLE = sublib
@ -91,20 +88,16 @@ _cross_configure() {
QMAKE_LFLAGS = ${LDFLAGS_FOR_BUILD} QMAKE_LFLAGS = ${LDFLAGS_FOR_BUILD}
load(qt_config) load(qt_config)
_EOF _EOF
ln -sf $qplatformdefs ${wrksrc}/.host-spec/linux-g++/
cat <<-EOF > "$qmakespec/host/linux-g++/qplatformdefs.h" cat > "$wrksrc/qt.conf" <<-_EOF
#include "/usr/lib/qt5/mkspecs/linux-g++/qplatformdefs.h"
EOF
cat > "$qmakespec/qt.conf" <<-_EOF
[Paths] [Paths]
Sysroot=${XBPS_CROSS_BASE} Sysroot=${XBPS_CROSS_BASE}
Prefix=/usr Prefix=/usr
ArchData=/usr/lib/qt5 ArchData=/usr/lib/qt5
Data=/usr/share/qt5 Data=/usr/share/qt5
Documentation=/usr/share/doc/qt5 Documentation=/usr/share/doc/qt5
Headers=/usr/include/qt5 Headers=${XBPS_CROSS_BASE}/usr/include/qt5
Libraries=${XBPS_CROSS_BASE}/usr/lib Libraries=${XBPS_CROSS_BASE}/usr/lib
LibraryExecutables=/usr/lib/qt5/libexec LibraryExecutables=/usr/lib/qt5/libexec
Binaries=/usr/lib/qt5/bin Binaries=/usr/lib/qt5/bin
@ -119,11 +112,10 @@ _cross_configure() {
HostData=/usr/lib/qt5 HostData=/usr/lib/qt5
HostBinaries=/usr/lib/qt5/bin HostBinaries=/usr/lib/qt5/bin
HostLibraries=/usr/lib HostLibraries=/usr/lib
Spec=$qmakespec/host/linux-g++ Spec=$wrksrc/.host-spec/linux-g++
TargetSpec=$qmakespec/target/linux-g++ TargetSpec=$wrksrc/.target-spec/linux-g++
_EOF _EOF
case $XBPS_TARGET_MACHINE in case $XBPS_TARGET_MACHINE in
i686*) _qt_arch=i386;; i686*) _qt_arch=i386;;
x86_64*) _qt_arch=x86_64;; x86_64*) _qt_arch=x86_64;;
@ -131,7 +123,7 @@ _cross_configure() {
arm*) _qt_arch=arm;; arm*) _qt_arch=arm;;
mips*) _qt_arch=mips;; mips*) _qt_arch=mips;;
esac esac
cat <<EOF >$XBPS_WRAPPERDIR/cross-qmake cat <<EOF >$XBPS_WRAPPERDIR/qmake
#!/bin/sh #!/bin/sh
export PREFIX=/usr export PREFIX=/usr
export QT_INSTALL_PREFIX=/usr export QT_INSTALL_PREFIX=/usr
@ -140,46 +132,45 @@ export QT_TARGET_ARCH=$_qt_arch
export PKG_CONFIG_EXECUTABLE=$XBPS_WRAPPERDIR/$PKG_CONFIG export PKG_CONFIG_EXECUTABLE=$XBPS_WRAPPERDIR/$PKG_CONFIG
case " \$* " in case " \$* " in
" -query ") " -query ")
/usr/lib/qt5/bin/qmake "\$@" -qtconf $qmakespec/qt.conf | /usr/lib/qt5/bin/qmake "\$@" -qtconf $wrksrc/qt.conf |
sed '/^QT_INSTALL_/s,$XBPS_CROSS_BASE,,' sed '/^QT_INSTALL_/s,$XBPS_CROSS_BASE,,'
;; ;;
*) *)
exec /usr/lib/qt5/bin/qmake -qtconf $qmakespec/qt.conf "\$@" ;; exec /usr/lib/qt5/bin/qmake -qtconf $wrksrc/qt.conf "\$@" ;;
esac esac
EOF EOF
chmod +x $XBPS_WRAPPERDIR/cross-qmake chmod +x $XBPS_WRAPPERDIR/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() { do_configure() {
if [ "$CROSS_BUILD" ]; then if [ "$CROSS_BUILD" ]; then
_cross_configure _cross_configure
else fi
python3 configure.py \ mkdir -p build
QMAKE_CC="${CC}" QMAKE_CFLAGS="${CFLAGS}" \ sip-build --no-make \
QMAKE_CXX="${CXX}" QMAKE_CXXFLAGS="${CXXFLAGS}" \ --api-dir /usr/share/qt5/qsci/api/python \
QMAKE_LINK="${CXX}" QMAKE_LINK_SHLIB="${CXX}" --build-dir build
QMAKE_LFLAGS="${LDFLAGS}" QMAKE_STRIP=""
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 fi
} }
do_build() { do_build() {
cd build
make ${makejobs} make ${makejobs}
} }
do_install() { do_install() {
cd build
make DESTDIR=${DESTDIR} INSTALL_ROOT=${DESTDIR} install make DESTDIR=${DESTDIR} INSTALL_ROOT=${DESTDIR} install
rm -rf ${DESTDIR}/usr/share rm -rf ${DESTDIR}/usr/share
} }