From ca41d253f50bf738b3fc01e4b232a76b9c2f5fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sun, 27 Sep 2020 14:14:53 +0700 Subject: [PATCH] python3-PyQt5: build with sip-build --- .../patches/pyproject-cross.patch | 18 ++ srcpkgs/python3-PyQt5/template | 255 +++++++++++------- 2 files changed, 183 insertions(+), 90 deletions(-) create mode 100644 srcpkgs/python3-PyQt5/patches/pyproject-cross.patch diff --git a/srcpkgs/python3-PyQt5/patches/pyproject-cross.patch b/srcpkgs/python3-PyQt5/patches/pyproject-cross.patch new file mode 100644 index 00000000000..6acb1bfd787 --- /dev/null +++ b/srcpkgs/python3-PyQt5/patches/pyproject-cross.patch @@ -0,0 +1,18 @@ +--- project.py.orig 2020-09-27 14:28:27.338774698 +0700 ++++ project.py 2020-09-27 14:28:29.317795099 +0700 +@@ -51,6 +51,15 @@ + _QOpenGLFunctions_2_1, _QOpenGLFunctions_4_1_Core, + _QOpenGLFunctions_ES2, pylupdate, pyrcc] + ++ def run_command(self, args, *, fatal=True): ++ """ Run a command and display the output if requested. """ ++ qemu_machine = os.environ.get("XBPS_TARGET_QEMU_MACHINE") ++ builddir = os.environ.get("XBPS_BUILDDIR") ++ if qemu_machine and args[0].startswith(os.path.join(builddir, "PyQt5")): ++ qemu = "qemu-{}-static".format(qemu_machine) ++ args.insert(0, qemu) ++ super().run_command(args, fatal=fatal) ++ + def apply_user_defaults(self, tool): + """ Set default values where needed. """ + diff --git a/srcpkgs/python3-PyQt5/template b/srcpkgs/python3-PyQt5/template index 25809d48dab..ab3d26a1ff5 100644 --- a/srcpkgs/python3-PyQt5/template +++ b/srcpkgs/python3-PyQt5/template @@ -1,11 +1,12 @@ # Template file for 'python3-PyQt5' pkgname=python3-PyQt5 version=5.15.0 -revision=1 -_sipver=4.19.23 +revision=2 +_sipver=12.8.0 wrksrc="PyQt5-${version}" -hostmakedepends="pkg-config - python3-devel sip5 python-dbus-devel qt5 qt5-devel qt5-tools-devel +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 @@ -24,51 +25,151 @@ 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() { - local _sysroot= _configuration= qt_version if [ "$CROSS_BUILD" ]; then - qt_version=$(qmake -query QT_VERSION) - _sysroot="--sysroot $XBPS_CROSS_BASE" - _configuration="--configuration $wrksrc/pyqt5_${XBPS_CROSS_TRIPLET}.cfg" - cat >pyqt5_${XBPS_CROSS_TRIPLET}.cfg <