diff options
author | Donald Carr | 2020-11-23 17:55:55 -0800 |
---|---|---|
committer | Donald Carr | 2020-11-23 17:56:31 -0800 |
commit | 4bc8f087ccab2245b801f204f8e0a4991530d59b (patch) | |
tree | e57ae862c376b2b16d994a183151f4150914ed31 | |
download | aur-4bc8f087ccab2245b801f204f8e0a4991530d59b.tar.gz |
import qt-sdk-raspberry-pi
Change-Id: I34b5d7e521e1bdb8434f44749e10eb6b6892421c
-rw-r--r-- | .SRCINFO | 23 | ||||
-rw-r--r-- | 0001-Remove-super-shit-QPA-hueristics.patch | 72 | ||||
-rw-r--r-- | 0001-Turn-bcm_host-library-into-makeSpec-source.patch | 80 | ||||
-rw-r--r-- | 0005-Fix-qtdeclarative-build-configured-with-qreal-float.patch | 35 | ||||
-rw-r--r-- | PKGBUILD | 546 | ||||
-rw-r--r-- | PKGBUILD.libs | 20 | ||||
-rw-r--r-- | PKGBUILD.libs.debug | 19 | ||||
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | _qpi.install | 135 | ||||
-rwxr-xr-x | python | bin | 0 -> 14088 bytes | |||
-rwxr-xr-x | qpi-env-exec | 15 | ||||
-rw-r--r-- | qpi-mesa.sh | 7 | ||||
-rw-r--r-- | qpi-proprietary.sh | 2 | ||||
-rw-r--r-- | qpi.install | 139 | ||||
-rw-r--r-- | qpi.sh | 2 |
15 files changed, 1106 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..e0a5a5a698e3 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,23 @@ +pkgbase = qt-sdk + pkgdesc = Qt SDK for the Raspberry Pi 1/2/3 + pkgver = 6.0.0 + pkgrel = 0 + url = http://www.chaos-reins.com/qpi/ + arch = x86_64 + license = LGPL3 + license = GPL3 + makedepends = git + makedepends = pkgconfig + makedepends = gcc + makedepends = gperf + makedepends = python + optdepends = qtcreator: Integrated Raspberry Pi IDE development + provides = qt-sdk + options = !strip + source = git://github.com/sirspudd/mkspecs.git + source = https://download.qt.io/development_releases/qt/6.0/6.0.0-beta5/single/qt-everywhere-src-6.0.0-beta5.tar.xz + sha256sums = SKIP + sha256sums = 0955320341731051d682e155d4f1252453f933725fb140a7606c3482cafea3b4 + +pkgname = qt-sdk + diff --git a/0001-Remove-super-shit-QPA-hueristics.patch b/0001-Remove-super-shit-QPA-hueristics.patch new file mode 100644 index 000000000000..d104fe62f23e --- /dev/null +++ b/0001-Remove-super-shit-QPA-hueristics.patch @@ -0,0 +1,72 @@ +From 77bc37d717d5072e7f8218bc3ec78fafe1117716 Mon Sep 17 00:00:00 2001 +From: Donald Carr <d@chaos-reins.com> +Date: Mon, 16 Sep 2019 00:38:06 -0700 +Subject: [PATCH] Remove super shit QPA hueristics + +Change-Id: I7776958c24822b483de304f7c5d530666b3ae227 +--- + src/core/content_browser_client_qt.cpp | 43 +++++++++++++++----------- + 1 file changed, 25 insertions(+), 18 deletions(-) + +diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp +index 16945020..af34baf3 100644 +--- a/src/core/content_browser_client_qt.cpp ++++ b/src/core/content_browser_client_qt.cpp +@@ -168,29 +168,36 @@ public: + : gl::GLContext(0) + , m_handle(0) + { +- QString platform = qApp->platformName().toLower(); +- QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface(); +- if (platform == QLatin1String("xcb") || platform == QLatin1String("offscreen")) { ++ if (qEnvironmentVariableIsSet(QT_WEBENGINE_SKIP_QPA_DETECTION)) { + if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) + m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); + else + m_handle = pni->nativeResourceForContext(QByteArrayLiteral("glxcontext"), qtContext); +- } else if (platform == QLatin1String("cocoa")) +- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("cglcontextobj"), qtContext); +- else if (platform == QLatin1String("qnx")) +- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); +- else if (platform == QLatin1String("eglfs") || platform == QLatin1String("wayland") +- || platform == QLatin1String("wayland-egl")) +- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); +- else if (platform == QLatin1String("windows")) { +- if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) +- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglContext"), qtContext); +- else +- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("renderingcontext"), qtContext); + } else { +- qFatal("%s platform not yet supported", platform.toLatin1().constData()); +- // Add missing platforms once they work. +- Q_UNREACHABLE(); ++ QString platform = qApp->platformName().toLower(); ++ QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface(); ++ if (platform == QLatin1String("xcb") || platform == QLatin1String("offscreen")) { ++ if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) ++ m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); ++ else ++ m_handle = pni->nativeResourceForContext(QByteArrayLiteral("glxcontext"), qtContext); ++ } else if (platform == QLatin1String("cocoa")) ++ m_handle = pni->nativeResourceForContext(QByteArrayLiteral("cglcontextobj"), qtContext); ++ else if (platform == QLatin1String("qnx")) ++ m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); ++ else if (platform == QLatin1String("eglfs") || platform == QLatin1String("wayland") ++ || platform == QLatin1String("wayland-egl")) ++ m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); ++ else if (platform == QLatin1String("windows")) { ++ if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) ++ m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglContext"), qtContext); ++ else ++ m_handle = pni->nativeResourceForContext(QByteArrayLiteral("renderingcontext"), qtContext); ++ } else { ++ qFatal("%s platform not yet supported", platform.toLatin1().constData()); ++ // Add missing platforms once they work. ++ Q_UNREACHABLE(); ++ } + } + } + +-- +2.23.0 + diff --git a/0001-Turn-bcm_host-library-into-makeSpec-source.patch b/0001-Turn-bcm_host-library-into-makeSpec-source.patch new file mode 100644 index 000000000000..7ecbc27dde99 --- /dev/null +++ b/0001-Turn-bcm_host-library-into-makeSpec-source.patch @@ -0,0 +1,80 @@ +From 0a50f3de2be1ec6456714d4d54ba86236873b820 Mon Sep 17 00:00:00 2001 +From: Joerg Bornemann <joerg.bornemann@qt.io> +Date: Mon, 11 Feb 2019 15:00:09 +0100 +Subject: [PATCH] Turn bcm_host library into makeSpec source + +The makespec provides LIBDIR, INCDIR and LIBS for bcm_host. + +Change-Id: I4bc268504dc48edaf2884f1c14b745260fd9112c +Fixes: QTBUG-73727 +--- + mkspecs/devices/linux-rasp-pi-g++/qmake.conf | 4 ++++ + mkspecs/devices/linux-rasp-pi2-g++/qmake.conf | 5 +++++ + mkspecs/devices/linux-rasp-pi3-g++/qmake.conf | 4 ++++ + src/gui/configure.json | 3 ++- + 4 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/mkspecs/devices/linux-rasp-pi-g++/qmake.conf b/mkspecs/devices/linux-rasp-pi-g++/qmake.conf +index b72091373d..6ec7817efb 100644 +--- a/mkspecs/devices/linux-rasp-pi-g++/qmake.conf ++++ b/mkspecs/devices/linux-rasp-pi-g++/qmake.conf +@@ -20,6 +20,10 @@ QMAKE_INCDIR_OPENVG = $${QMAKE_INCDIR_EGL} + QMAKE_LIBS_EGL = -lEGL -lGLESv2 + QMAKE_LIBS_OPENVG = -lEGL -lOpenVG -lGLESv2 + ++QMAKE_INCDIR_BCM_HOST = $$[QT_SYSROOT]/opt/vc/include ++QMAKE_LIBDIR_BCM_HOST = $$[QT_SYSROOT]/opt/vc/lib ++QMAKE_LIBS_BCM_HOST = -lbcm_host ++ + contains(DISTRO, squeeze) { + #Debian Squeeze: Legacy everything + QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 -lEGL +diff --git a/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf b/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf +index ffe8f5739a..3b49f19a5b 100644 +--- a/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf ++++ b/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf +@@ -16,6 +16,11 @@ QMAKE_INCDIR_OPENVG = $${QMAKE_INCDIR_EGL} + + QMAKE_LIBS_EGL = -lEGL -lGLESv2 + QMAKE_LIBS_OPENVG = -lEGL -lOpenVG -lGLESv2 ++ ++QMAKE_INCDIR_BCM_HOST = $$[QT_SYSROOT]/opt/vc/include ++QMAKE_LIBDIR_BCM_HOST = $$[QT_SYSROOT]/opt/vc/lib ++QMAKE_LIBS_BCM_HOST = -lbcm_host ++ + QMAKE_CFLAGS += -march=armv7-a -marm -mthumb-interwork -mfpu=neon-vfpv4 -mtune=cortex-a7 -mabi=aapcs-linux + QMAKE_CXXFLAGS = $$QMAKE_CFLAGS + +diff --git a/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf b/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf +index 2bb70ffb5a..c35a828745 100644 +--- a/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf ++++ b/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf +@@ -31,6 +31,10 @@ QMAKE_LIBS_OPENGL_ES2 = $${VC_LINK_LINE} -lGLESv2 + # The official opt vc EGL references GLESv2 symbols: need to link it + QMAKE_LIBS_EGL = $${VC_LINK_LINE} -lEGL -lGLESv2 + ++QMAKE_LIBDIR_BCM_HOST = =$${VC_LIBRARY_PATH} ++QMAKE_INCDIR_BCM_HOST = $$VC_INCLUDE_PATH ++QMAKE_LIBS_BCM_HOST = -lbcm_host ++ + QMAKE_CFLAGS = -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 + QMAKE_CXXFLAGS = $$QMAKE_CFLAGS + +diff --git a/src/gui/configure.json b/src/gui/configure.json +index 70d0817791..3108b691be 100644 +--- a/src/gui/configure.json ++++ b/src/gui/configure.json +@@ -59,8 +59,9 @@ + }, + "bcm_host": { + "export": "", ++ "headers": "bcm_host.h", + "sources": [ +- "-lbcm_host" ++ { "type": "makeSpec", "spec": "BCM_HOST" } + ] + }, + "dxguid": { +-- +2.20.1 + diff --git a/0005-Fix-qtdeclarative-build-configured-with-qreal-float.patch b/0005-Fix-qtdeclarative-build-configured-with-qreal-float.patch new file mode 100644 index 000000000000..22a46290f7e1 --- /dev/null +++ b/0005-Fix-qtdeclarative-build-configured-with-qreal-float.patch @@ -0,0 +1,35 @@ +From d9aad59d4144f5bf725893b5a008fe5c52ff5634 Mon Sep 17 00:00:00 2001 +From: Donald Carr <d@chaos-reins.com> +Date: Thu, 28 Mar 2019 22:23:54 -0700 +Subject: [PATCH 5/7] Fix qtdeclarative build configured with -qreal=float + +There is a sole point of failure in Qt 5.13 beta1 + +Change-Id: I58a41e310604a8bccbf14f463f734877d6a65a73 +Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> +--- + src/plugins/scenegraph/openvg/qsgopenvghelpers.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/plugins/scenegraph/openvg/qsgopenvghelpers.cpp b/src/plugins/scenegraph/openvg/qsgopenvghelpers.cpp +index 6bc99d32a..ab5cfb48b 100644 +--- a/src/plugins/scenegraph/openvg/qsgopenvghelpers.cpp ++++ b/src/plugins/scenegraph/openvg/qsgopenvghelpers.cpp +@@ -220,10 +220,10 @@ void qDrawTiled(VGImage image, const QSize imageSize, const QRectF &targetRect, + void qDrawBorderImage(VGImage image, const QSizeF &textureSize, const QRectF &targetRect, const QRectF &innerTargetRect, const QRectF &subSourceRect) + { + // Create normalized margins +- QMarginsF margins(qMax(innerTargetRect.left() - targetRect.left(), 0.0), +- qMax(innerTargetRect.top() - targetRect.top(), 0.0), +- qMax(targetRect.right() - innerTargetRect.right(), 0.0), +- qMax(targetRect.bottom() - innerTargetRect.bottom(), 0.0)); ++ QMarginsF margins(qMax(innerTargetRect.left() - targetRect.left(), qreal(0.0)), ++ qMax(innerTargetRect.top() - targetRect.top(), qreal(0.0)), ++ qMax(targetRect.right() - innerTargetRect.right(), qreal(0.0)), ++ qMax(targetRect.bottom() - innerTargetRect.bottom(), qreal(0.0))); + + QRectF sourceRect(0, 0, textureSize.width(), textureSize.height()); + +-- +2.21.0 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..1279ca11f8e1 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,546 @@ +# Maintainer: Donald Carr <d at chaos-reins dot com> + +#set -x + +# Documentation + +# Set up the pi for Qt compilation. +# For a comprehensive set of deps I just install chromium which pulls in everything + +#* I had to removed xcomposite as code path breaks +#* Remove 2 (mesa) pkgconfig files we allow to screw our mkspec +# * rm /usr/lib/pkgconfig/glesv2.pc +# * rm /usr/lib/pkgconfig/egl.pc + +# I use NFS to develop against my sysroot personally: sudo mount qpi2.local:/ /mnt/pi + +# NB: Mandatory edit: set this variable to point to your raspberry pi's sysroot + +# Arch: build dependencies for the target device documented in PKGBUILD.libs +# Fedora: systemd-devel mesa-*-devel wayland*-devel fontconfig-devel libinput-devel freetype-devel qt5-qtdeclarative-devel + +pkgname="qt-sdk" + +# Sanity check +_building=true + +# Options +_target_host=true +_sysroot="" +_piver="" +_use_mesa=false +_float=false +_shadow_build=true +# automatically disabled if you are building webengine +_debug=true +_skip_qtscript=false +_skip_qtwebengine=false +_skip_qtwidgets=false +_static_build=false +_build_from_local_src_tree=false +_patching=true +_minimal=false +_uber_minimal=false + +if [[ -z ${startdir} ]]; then + _building=false; +fi + +if [[ -f build-from-local-src-tree ]]; then + _build_from_local_src_tree=true +fi + +if [[ -f no-debug ]]; then + _debug=false +fi + +if [[ -f static ]]; then + _static_build=true + _uber_minimal=true + _debug=false + #_float=true +fi + +if [[ -f full-build ]]; then + _minimal=false +fi + +if [[ -f uber-minimal ]]; then + _uber_minimal=true +fi + +# Only present for the sake of sanity testing the qpi.install script +#_piver=$LOCAL_PI_VER +#_sysroot=/mnt/pi${_piver} + +# Sanity check options +if $_building && [[ -n $LOCAL_PI_VER ]]; then + if [[ -z $_piver ]]; then _piver=$LOCAL_PI_VER; fi + _sysroot=/mnt/pi${_piver} + + if [[ ! -d "${_sysroot}/etc" ]]; then + echo "You have to set a valid sysroot to proceed with the build" + exit 1 + fi +fi + +# vars +_local_qt5_repo="${local_qt5_repo}" +#_pkgvermajmin="5.15" +_pkgvermajmin="6.0" +_pkgverpatch=".0" +# {alpha/beta/beta2/rc} +_dev_suffix="beta5" +pkgrel=0 +pkgver="${_pkgvermajmin}${_pkgverpatch}" +$_build_from_local_src_tree && pkgver=6.6.6 +_pkgver=${pkgver} +_release_type="development_releases" +_profiled_gpu_fn=qpi-proprietary.sh + +__pkgconfigpath=${_sysroot}/usr/lib/pkgconfig +__eglpkgconfigpath="${__pkgconfigpath}/egl.pc" +__glespkgconfigpath="${__pkgconfigpath}/glesv2.pc" + +#_opengl_variant="desktop" +if [ -n "${_piver}" ]; then + _opengl_variant="es2" +fi + +_overwrite_mkspec=true +_mkspec="linux-rpi${_piver}-g++" +case ${_piver} in +1) + _toolchain_name=armv6-rpi-linux-gnueabihf + _toolchain="/opt/${_toolchain_name}/bin/${_toolchain_name}-" + _float=true + # too problematic for me to care about + #_float=true +;; +2) + #_toolchain_name=armv7-rpi2-linux-gnueabihf + #_toolchain="/opt/${_toolchain_name}/bin/${_toolchain_name}-" + # eats shit when linking artriculate with ltcg + _toolchain_name=arm-cortexa9_neon-linux-gnueabihf + _toolchain="/opt/x-tools/${_toolchain_name}/bin/${_toolchain_name}-" + _float=true + #_mkspec="linux-rpi${_piver}-vc4-g++" + #_use_mesa=true +;; +3) + _toolchain_name=aarch64-rpi3-linux-gnu + _toolchain="/opt/x-tools/${_toolchain_name}/bin/${_toolchain_name}-" + _use_mesa=true + # just for projectmofo! + #_opengl_variant="desktop" +;; +4) + # yuck; here lies tinkerboard until I find a better way of generalizing this + #_toolchain="/opt/gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-" + _toolchain="${HOME}/x-tools/aarch64-spudd-linux-gnu/bin/aarch64-spudd-linux-gnu-" + + # upstream mkspec is 32 bit + #_mkspec="linux-rasp-pi4-v3d-g++" + #_overwrite_mkspec=false + + _use_mesa=true +;; +5) + # https://developer.nvidia.com/embedded/dlc/kernel-gcc-6-4-tool-chain + # took forever to find one that worked + #_toolchain="/usr/bin/aarch64-linux-gnu-" + _toolchain="/opt/gcc-linaro-6.4.1-2017.08-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-" + _mkspec="linux-jetson-nano-g++" + _opengl_variant="desktop" +;; + +esac + +if $_target_host; then + _use_mesa=true +elif [[ "${_piver}" = "4" ]]; then + echo "" +elif [[ "${_piver}" = "5" ]]; then + echo "" +else + depends=("qpi${_piver}-toolchain") +fi + +if [[ -z "${_dev_suffix}" ]]; then _release_type="official_releases"; fi + +$_build_from_local_src_tree && _patching=false + +# PKGBUILD vars + +#install=qpi.install + +#rm $install +#touch $install + +if [[ -n ${_piver} ]] || ! $_building; then + pkgname="${pkgname}-raspberry-pi${_piver}" +fi +provides=($pkgname) + +if $_static_build; then + pkgname="${pkgname}-static" +fi + +if $_building && $_uber_minimal; then + _minimal=true + _skip_qtwidgets=true +fi + +if [[ -f debug ]]; then + _debug=true +fi + +if $_building && $_minimal; then + _skip_qtscript=true + _skip_qtwebengine=true +fi + +$_skip_qtwebengine && _additional_configure_flags="$_additional_configure_flags -skip qtwebengine -no-icu" +$_skip_qtscript && _additional_configure_flags="$_additional_configure_flags -skip qtscript" +$_skip_qtwidgets && _additional_configure_flags="$_additional_configure_flags -no-widgets" +$_static_build && _additional_configure_flags="$_additional_configure_flags -static -ltcg" +$_float && _additional_configure_flags="$_additional_configure_flags -qreal float" +$_debug && _additional_configure_flags="$_additional_configure_flags -force-debug-info -separate-debug-info" + +_libspkgname="${pkgname}-target-libs" +_libsdebugpkgname="${pkgname}-target-libs-debug" +_packaginguser=$(whoami) +_qt_package_name_prefix="qt-everywhere-src" +if [[ -n ${_dev_suffix} ]]; then + _pkgver=${pkgver}-${_dev_suffix} +fi +_source_package_name=${_qt_package_name_prefix}-${_pkgver} +_baseprefix="/opt/qt" +_installprefix=${_baseprefix}/${pkgname} + +pkgdesc="Qt SDK for the Raspberry Pi 1/2/3" +arch=("x86_64") +url="http://www.chaos-reins.com/qpi/" +license=("LGPL3" "GPL3") +optdepends=('qtcreator: Integrated Raspberry Pi IDE development') +makedepends=("git" "pkgconfig" "gcc" "gperf" "python") +#_provider=http://qt.mirror.constant.com/ +_provider=https://download.qt.io +_tmpfs_dir=/vortex/build + +_arch_specific_configure_options="\ + -prefix /usr \ + -docdir /usr/share/doc/qt \ + -headerdir /usr/include/qt \ + -archdatadir /usr/lib/qt \ + -datadir /usr/share/qt \ + -sysconfdir /etc/xdg \ + -examplesdir /usr/share/doc/qt/examples \ + -no-rpath \ +" + +retired_exhaustive_uber_minimal_specific_configure_options="\ + -no-linuxfb \ +" + +if $_minimal; then + _additional_configure_flags="$_additional_configure_flags \ + -no-xcb \ + -qpa eglfs \ + -egl \ + " +fi + +if $_uber_minimal; then + _additional_configure_flags="$_additional_configure_flags \ + -no-direct2d \ + -no-directfb \ + -no-cups \ + -no-iconv \ + -no-gif \ + -no-sql-mysql \ + -no-sql-psql \ + -no-tslib \ + -no-feature-bearermanagement \ + -no-qml-debug \ + -no-ico \ + -no-glib \ + " +fi + +if ! $_static_build && ! $_target_host; then + _additional_configure_flags="$_additional_configure_flags \ + -hostprefix ${_installprefix} \ + " +fi + +#-journald \ +_core_configure_options=" \ + -qt-pcre \ + -pkg-config \ + -prefix ${_installprefix} \ + -opengl ${_opengl_variant} \ + -qt-sqlite \ + -confirm-license \ + -opensource \ + -release \ + -pch \ + -make libs \ + -nomake tools \ + -nomake examples \ + \ + -reduce-exports \ + " + +#_tar_xz_sha256="94a02e3e1879f7492340de675b65b9b98a671698063d28c97e91b78098724548" +_tar_xz_sha256="0955320341731051d682e155d4f1252453f933725fb140a7606c3482cafea3b4" + +source=("git://github.com/sirspudd/mkspecs.git") +sha256sums=("SKIP") + +if ! $_build_from_local_src_tree; then + source+=("${_provider}/${_release_type}/qt/${_pkgvermajmin}/${_pkgver}/single/${_source_package_name}.tar.xz") + sha256sums+=("$_tar_xz_sha256") +fi + +options=('!strip') + +if ${_use_mesa}; then + _profiled_gpu_fn=qpi-mesa.sh + _additional_configure_flags="$_additional_configure_flags -gbm -kms" +else + _additional_configure_flags="$_additional_configure_flags -no-gbm" + if $_building && ([[ -f ${__eglpkgconfigpath} ]] || [[ -f ${__glespkgconfigpath} ]]); then + echo "Mesa is about to eat our communal poodle; delete egl.pc and glesv2.pc in your sysroot" + exit 1 + fi +fi + +# callbacks +finish() { + if [[ -n ${startdir} ]]; then + cd ${startdir} + #rm $install + #touch $install + fi +} + +adjust_bin_dir() { + adjust_src_dir + if [[ -n ${_srcdir} ]]; then + _bindir="${_srcdir}" + else + # Probably repackaging: gonna have to make some assumptions + _bindir="${startdir}/src/${_source_package_name}" + fi + if $_shadow_build; then + _bindir="${startdir}/build" + if $_minimal && [[ -d $_tmpfs_dir ]]; then + _bindir="${_tmpfs_dir}/${_bindir}" + fi + fi +} + +adjust_src_dir() { + if $_build_from_local_src_tree; then + if [[ -z $_local_qt5_repo ]]; then echo "Need to set a repo dir to build from head"; exit 1; fi + _srcdir=$_local_qt5_repo + fi +} + +build() { + # Qt tries to do the right thing and stores these, breaking cross compilation + # unset everything set in /etc/makepkg.conf + unset LDFLAGS + unset CFLAGS + unset CXXFLAGS + unset CHOST + unset CPPFLAGS + unset CARCH + unset HOSTTYPE + unset MACHTYPE + unset DEBUG_CFLAGS + unset DEBUG_CXXFLAGS + + export PATH=${startdir}:${PATH} + + _srcdir="${srcdir}/${_source_package_name}" + adjust_bin_dir + + local _basedir="${_srcdir}/qtbase" + local _mkspec_dir="${_basedir}/mkspecs/devices/${_mkspec}" + +if $_uber_minimal; then + local _qtpro=${_srcdir}/qt.pro + local _tmp_qtpro=$(mktemp) + cp $_qtpro $_tmp_qtpro + echo "QT_BUILD_MODULES = qtbase qtdeclarative" > $_qtpro + cat $_tmp_qtpro >> $_qtpro +fi + + # enable reduce relocations + sed -i '/error Symbolic function binding/d' ${_srcdir}/qtbase/configure.json + +if ! $_target_host && $_overwrite_mkspec; then + # Get our mkspec + mkdir $_mkspec_dir + rsync -r ${srcdir}/mkspecs/${_mkspec}/ $_mkspec_dir/ +fi + + rm -Rf ${_bindir} + mkdir -p ${_bindir} + cd ${_bindir} + + # Too bleeding big + # -developer-build \ + # -separate-debug-info \ + + # Chromium requires python2 to be the system python on your build host + # I literally symlink /usr/bin/python to /usr/bin/python2 on arch + + # Just because you can enable something doesnt mean you should + # Prepare for breakage in all your Qt derived projects + #-qtnamespace "Pi${_piver}" \ + +if $_target_host; then + local _configure_line="${_srcdir}/configure \ + -platform linux-clang-libc++ \ + ${_core_configure_options} \ + ${_additional_configure_flags}" +# ${_arch_specific_configure_options} \ +else + # Fuck debian multi-arch dead + export PKG_CONFIG_LIBDIR=${_sysroot}/usr/lib/$(${_toolchain}gcc -dumpmachine)/pkgconfig/:${_sysroot}/usr/lib/pkgconfig/ + export PKG_CONFIG_SYSROOT_DIR=${_sysroot} + + # I harbour a certain amount of X11 prejudice + local _configure_line="${_srcdir}/configure \ + ${_core_configure_options} \ + -qtlibinfix "Pi${_piver}" \ + -sysroot ${_sysroot} \ + -device ${_mkspec} \ + -optimize-size \ + -device-option CROSS_COMPILE=${_toolchain} \ + ${_additional_configure_flags}" +fi + local _configure_line_fn=configure_line + echo ${_configure_line} > ${_configure_line_fn} + set &> configure_env + ${_configure_line} || exit 1 + ninja all || exit 1 +} + +create_install_script() { + local _prefix=/tmp + + if [[ -n "${startdir}" ]]; then + _prefix=${startdir} + else + startdir=$PWD + fi + + local _install_script_location="${_prefix}/${install}" + + echo _piver="${_piver}" > ${_install_script_location} + echo _qmakepath="${_installprefix}/bin/qmake" >> ${_install_script_location} + echo _sysroot="${_sysroot}" >> ${_install_script_location} + echo _toolchain="${_toolchain}" >> ${_install_script_location} + + cat "${startdir}/_${install}" >> "${_prefix}/${install}" +} +#create_install_script + +package() { + adjust_bin_dir + + #create_install_script + + # Qt is now installed to $pkgdir/$sysroot/$prefix + # manually generate/decompose host/target + + local _basepkgdir=${pkgdir}/${_installprefix} + + local _libsdir="${startdir}/${_libspkgname}" + local _libsdebugdir="${startdir}/${_libsdebugpkgname}" + + local _libspkgdir="${_libsdir}/topkg" + local _libsdebugpkgdir="${_libsdebugdir}/topkg" + + local _libspkgbuild="${_libsdir}/PKGBUILD" + local _libsdebugpkgbuild="${_libsdebugdir}/PKGBUILD" + + local _pkgprofiled=${_libspkgdir}/etc/profile.d + local _pkgbindir=${_libspkgdir}/usr/bin + local _profiledfn=qpi.sh + local _qpienvexecfn=qpi-env-exec + + local _installed_dir="${pkgdir}/${_sysroot}/${_baseprefix}" + local _installed_dir_sans_sysroot_offset="${pkgdir}/${_baseprefix}" + + rm -Rf ${_libspkgdir} ${_libsdebugpkgdir} ${pkgdir} + mkdir -p ${_libspkgdir} ${_libsdebugpkgdir} ${pkgdir} + + cd "${_bindir}" + DESTDIR="$pkgdir" ninja install || exit 1 + + # attempt to fix Qt 5.12.1's insane complete qualification of linked libraries + # this still results in other sources of the complete path + find ${_installed_dir}/${pkgname} -type f -regex '.*\(prl\|pc\|pri\)' | xargs sed -i "s,/mnt/pi4/[^ ]*lib\(.[^ ]*\)\.so,-l\1,g" + # this breaks stuff as gcc does not look inside of sysroots for supposedly qualified paths + #find ${_installed_dir}/${pkgname}/mkspecs/modules -type f | xargs sed -i "s,${_sysroot}\([^ ]*\.so\),\1,g" + + cd $(dirname $(dirname ${_installed_dir})) + +if $_debug; then + find $(basename $(dirname ${_installed_dir})) -name '*.debug' -exec cp --parents '{}' ${_libsdebugpkgdir} \; -exec rm '{}' \; + + cp ${startdir}/PKGBUILD.libs.debug ${_libsdebugpkgbuild} + + sed -i "s/libspkgrel/${pkgrel}/" ${_libsdebugpkgbuild} + sed -i "s/libspkgver/${pkgver}/" ${_libsdebugpkgbuild} +if $_target_host || $_static_build; then + sed -i "s/libspkgname/${pkgname}/" ${_libsdebugpkgbuild} +else + sed -i "s/libspkgname/${_libspkgname}/" ${_libsdebugpkgbuild} +fi + sed -i "s/libsdebugpkgname/${_libsdebugpkgname}/" ${_libsdebugpkgbuild} + sed -i "s/libspiver/${_piver}/" ${_libsdebugpkgbuild} + + cd ${_libsdebugdir} + runuser -l ${_packaginguser} -c 'makepkg -d -f' || exit 1 + #mv ${_libsdebugdir}/${_libsdebugpkgname}-${pkgver}-${pkgrel}-any.pkg.tar.* ${startdir} +fi + + if $_static_build || $_target_host; then + if ! $_target_host; then + mkdir $(dirname ${_installed_dir_sans_sysroot_offset}) + mv ${_installed_dir} `dirname ${_installed_dir_sans_sysroot_offset}` + fi + else + mv `dirname ${_installed_dir}` ${_libspkgdir} + + cp ${_bindir}/configure_line ${_bindir}/config.opt ${_libspkgdir} + + cp ${startdir}/PKGBUILD.libs ${_libspkgbuild} + + # set correct libs version + sed -i "s/libspkgrel/${pkgrel}/" ${_libspkgbuild} + sed -i "s/libspkgver/${pkgver}/" ${_libspkgbuild} + sed -i "s/libspkgname/${_libspkgname}/" ${_libspkgbuild} + sed -i "s/libspiver/${_piver}/" ${_libspkgbuild} + + mkdir -p ${_pkgprofiled} + mkdir -p ${_pkgbindir} + + cp -L ${startdir}/${_profiledfn} ${_pkgprofiled} + cp -L ${startdir}/${_profiled_gpu_fn} ${_pkgprofiled} + cp -L ${startdir}/${_qpienvexecfn} ${_pkgbindir} + sed -i "s,localpiprefix,${_installprefix}," ${_pkgprofiled}/${_profiledfn} + + cd ${_libsdir} + runuser -l ${_packaginguser} -c 'makepkg -d -f' || exit 1 + #mv ${_libsdir}/${_libspkgname}-${pkgver}-${pkgrel}-any.pkg.tar.* ${startdir} + fi + + cp ${_bindir}/configure_line ${_bindir}/config.opt ${_basepkgdir} +} diff --git a/PKGBUILD.libs b/PKGBUILD.libs new file mode 100644 index 000000000000..35c6d3c634f6 --- /dev/null +++ b/PKGBUILD.libs @@ -0,0 +1,20 @@ +# Maintainer: Donald Carr <sirspudd at gmail dot com> + +pkgname=libspkgname +pkgver=libspkgver +pkgrel=libspkgrel +pkgdesc="Qt ${pkgver} libs cross compiled for the Raspberry Pi libspiver" +# I don't know how to set this correct for cross architecture builds +arch=("any") +url="http://www.qt.io" +license=("LGPL3" "GPL3") +source=() +sha256sums=() +options=('!strip') +# qtwebengine flac snappy libsrtp jsoncpp libvpx speex opus libxml2 libwebp icu +depends=("ttf-croscore" "ttf-dejavu" "fontconfig" "wayland" "libxkbcommon" "gstreamer" "flac" "snappy" "libsrtp" "jsoncpp" "libvpx" "speex" "opus" "libxml2" "libwebp" "icu" "pulseaudio" "mtdev" "libinput" "pcre2" "openssl-1.0" "tslib" "double-conversion") +provides=('qt-sdk-raspberry-pi-target-libs') + +package() { + mv ${startdir}/topkg/* ${pkgdir} +} diff --git a/PKGBUILD.libs.debug b/PKGBUILD.libs.debug new file mode 100644 index 000000000000..5b1a586e3a6e --- /dev/null +++ b/PKGBUILD.libs.debug @@ -0,0 +1,19 @@ +# Maintainer: Donald Carr <sirspudd at gmail dot com> + +pkgname=libsdebugpkgname +provides=("qt5-declarative" "libsdebugpkgname") +pkgver=libspkgver +pkgrel=libspkgrel +pkgdesc="Qt ${pkgver} libs cross compiled for the Raspberry Pi libspiver" +# I don't know how to set this correct for cross architecture builds +arch=("any") +url="http://www.qt.io" +license=("LGPL3" "GPL3") +source=() +sha256sums=() +options=('!strip') +depends=("libspkgname") + +package() { + mv ${startdir}/topkg/* ${pkgdir} +} diff --git a/README.md b/README.md new file mode 100644 index 000000000000..ec916b377d35 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# AUR recipe for consistent creation of Qt SDKS for various targets + +What started out as the intention to facilitate Qt cross platform development for the Raspberry Pi has grown legs and now been extended to: + +1) Raspberry Pi 0/1 +2) Raspberry Pi 2 +3) Raspberry Pi 3 +4) Tinkerboard +5) Jetson-Nano + +if you dont use Arch or consume this recipe, you can always extract information from PKGBUILD which is basically a bash script. diff --git a/_qpi.install b/_qpi.install new file mode 100644 index 000000000000..8c03b23cde5f --- /dev/null +++ b/_qpi.install @@ -0,0 +1,135 @@ +_sdktool="/usr/lib/qtcreator/sdktool" +_altsdktool="/usr/libexec/qtcreator/sdktool" +_devicefamily="spuddrpi" +_devicename="${_devicefamily}${_piver}" +_familytext="Raspberry Pi" +_devicetext="${_familytext} ${_piver}" + +if [[ -x ${_altsdktool} ]]; then + _sdktool=${_altsdktool} +fi + +# ACHTUNG: this used to work without sudo when the Qt Creator dudes let you write to a user directory +_sdktool="sudo ${_sdktool}" + +setup_toolchain() { + echo "Registering toolchain with Qt Creator" +${_sdktool} addTC \ + --id "${_devicename}-gcc" \ + --language 1 \ + --name "${_devicetext} toolchain" \ + --path ${_toolchain}gcc \ + --abi arm-linux-generic-elf-64bit \ + --supportedAbis arm-linux-generic-elf-64bit + +${_sdktool} addTC \ + --id "${_devicename}-g++" \ + --language 2 \ + --name "${_devicetext} toolchain" \ + --path ${_toolchain}g++ \ + --abi arm-linux-generic-elf-64bit \ + --supportedAbis arm-linux-generic-elf-64bit + + echo "Registering debugger with Qt Creator" +${_sdktool} addDebugger \ + --id "${_devicename}-gdb" \ + --name "${_devicetext} gdb" \ + --binary ${_toolchain}gdb \ + --abis arm-linux-generic-elf-64bit \ + --engine 1 +} + +remove_toolchain() { +${_sdktool} rmTC \ + --id "${_devicename}-gcc" + +${_sdktool} rmTC \ + --id "${_devicename}-g++" + +${_sdktool} rmDebugger \ + --id "${_devicename}-gdb" +} + +remove_kit() { +${_sdktool} rmQt \ + --id "${_devicename}_qt" + +${_sdktool} rmKit \ + --id "${_devicename}_kit" + +${_sdktool} rmDev \ + --id "${_devicename}_device" +} + +setup_kit() { + remove_toolchain + remove_kit + setup_toolchain + + echo "Registering device with Qt Creator" +${_sdktool} addDev \ + --id "${_devicename}_device" \ + --name "${_devicetext}" \ + --host "qpi${_piver}.local" \ + --uname "root" \ + --password "root" \ + --osType "GenericLinuxOsType" \ + --type 0 \ + --sshPort 22 \ + --freePorts "10000-10100" + + echo "Registering Qt install with Qt Creator" +${_sdktool} addQt \ + --id "${_devicename}_qt" \ + --name "${_devicetext} Qt" \ + --qmake ${_qmakepath} \ + --type RemoteLinux.EmbeddedLinuxQt + + echo "Creating Qt Creator Kit" +${_sdktool} addKit \ + --id "${_devicename}_kit" \ + --name "${_devicetext} Kit" \ + --debugger "${_devicename}_gdb" \ + --devicetype GenericLinuxOsType \ + --device "${_devicename}_device" \ + --sysroot ${_sysroot} \ + --toolchain "${_devicename}-g++" \ + --qt "${_devicename}_qt" \ + --mkspec "devices/linux-rpi${_piver}-g++" +} + +## arg 1: the new package version +pre_install() { + echo "" +} + +## arg 1: the new package version +post_install() { + setup_kit +} +#post_install + +## arg 1: the new package version +## arg 2: the old package version +pre_upgrade() { + echo "" +} + +## arg 1: the new package version +## arg 2: the old package version +post_upgrade() { + setup_kit +} +#post_upgrade + +## arg 1: the old package version +pre_remove() { + echo "" +} +#pre_remove + +## arg 1: the old package version +post_remove() { + remove_kit +} +#post_remove diff --git a/python b/python Binary files differnew file mode 100755 index 000000000000..b394ac141913 --- /dev/null +++ b/python diff --git a/qpi-env-exec b/qpi-env-exec new file mode 100755 index 000000000000..86816f52e45e --- /dev/null +++ b/qpi-env-exec @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +executed_file=$(readlink -f ${BASH_SOURCE[0]}) +script_dir=$(dirname ${executed_file}) +script_name=$(basename ${executed_file}) + +for i in $(ls /etc/profile.d/qpi*); do + echo "sourcing: $i" + source $i +done + +echo "Environment" +env +echo "Running: $@" +$@ diff --git a/qpi-mesa.sh b/qpi-mesa.sh new file mode 100644 index 000000000000..b196251970ae --- /dev/null +++ b/qpi-mesa.sh @@ -0,0 +1,7 @@ +# Shared by many platforms; uncomment as necessary +#export QT_QPA_PLATFORM=wayland +# export EGL_LOG_LEVEL=debug +# https://bugreports.qt.io/browse/QTBUG-60330 +#export EGL_PLATFORM=0x31D7 +#export QT_LOGGING_RULES="qt.qpa.eglfs.kms=true;qt.qpa.egldeviceintegration=true" +#export QT_LOGGING_TO_CONSOLE=1 diff --git a/qpi-proprietary.sh b/qpi-proprietary.sh new file mode 100644 index 000000000000..b847a7ae32fa --- /dev/null +++ b/qpi-proprietary.sh @@ -0,0 +1,2 @@ +export QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=brcm +export QT_QPA_PLATFORM=wayland diff --git a/qpi.install b/qpi.install new file mode 100644 index 000000000000..fb4ad8a6eff3 --- /dev/null +++ b/qpi.install @@ -0,0 +1,139 @@ +_piver=2 +_qmakepath=/opt/qt/qt-sdk-raspberry-pi2/bin/qmake +_sysroot=/mnt/pi2 +_toolchain=/opt/x-tools/arm-cortexa9_neon-linux-gnueabihf/bin/arm-cortexa9_neon-linux-gnueabihf- +_sdktool="/usr/lib/qtcreator/sdktool" +_altsdktool="/usr/libexec/qtcreator/sdktool" +_devicefamily="spuddrpi" +_devicename="${_devicefamily}${_piver}" +_familytext="Raspberry Pi" +_devicetext="${_familytext} ${_piver}" + +if [[ -x ${_altsdktool} ]]; then + _sdktool=${_altsdktool} +fi + +# ACHTUNG: this used to work without sudo when the Qt Creator dudes let you write to a user directory +_sdktool="sudo ${_sdktool}" + +setup_toolchain() { + echo "Registering toolchain with Qt Creator" +${_sdktool} addTC \ + --id "${_devicename}-gcc" \ + --language 1 \ + --name "${_devicetext} toolchain" \ + --path ${_toolchain}gcc \ + --abi arm-linux-generic-elf-64bit \ + --supportedAbis arm-linux-generic-elf-64bit + +${_sdktool} addTC \ + --id "${_devicename}-g++" \ + --language 2 \ + --name "${_devicetext} toolchain" \ + --path ${_toolchain}g++ \ + --abi arm-linux-generic-elf-64bit \ + --supportedAbis arm-linux-generic-elf-64bit + + echo "Registering debugger with Qt Creator" +${_sdktool} addDebugger \ + --id "${_devicename}-gdb" \ + --name "${_devicetext} gdb" \ + --binary ${_toolchain}gdb \ + --abis arm-linux-generic-elf-64bit \ + --engine 1 +} + +remove_toolchain() { +${_sdktool} rmTC \ + --id "${_devicename}-gcc" + +${_sdktool} rmTC \ + --id "${_devicename}-g++" + +${_sdktool} rmDebugger \ + --id "${_devicename}-gdb" +} + +remove_kit() { +${_sdktool} rmQt \ + --id "${_devicename}_qt" + +${_sdktool} rmKit \ + --id "${_devicename}_kit" + +${_sdktool} rmDev \ + --id "${_devicename}_device" +} + +setup_kit() { + remove_toolchain + remove_kit + setup_toolchain + + echo "Registering device with Qt Creator" +${_sdktool} addDev \ + --id "${_devicename}_device" \ + --name "${_devicetext}" \ + --host "qpi${_piver}.local" \ + --uname "root" \ + --password "root" \ + --osType "GenericLinuxOsType" \ + --type 0 \ + --sshPort 22 \ + --freePorts "10000-10100" + + echo "Registering Qt install with Qt Creator" +${_sdktool} addQt \ + --id "${_devicename}_qt" \ + --name "${_devicetext} Qt" \ + --qmake ${_qmakepath} \ + --type RemoteLinux.EmbeddedLinuxQt + + echo "Creating Qt Creator Kit" +${_sdktool} addKit \ + --id "${_devicename}_kit" \ + --name "${_devicetext} Kit" \ + --debugger "${_devicename}_gdb" \ + --devicetype GenericLinuxOsType \ + --device "${_devicename}_device" \ + --sysroot ${_sysroot} \ + --toolchain "${_devicename}-g++" \ + --qt "${_devicename}_qt" \ + --mkspec "devices/linux-rpi${_piver}-g++" +} + +## arg 1: the new package version +pre_install() { + echo "" +} + +## arg 1: the new package version +post_install() { + setup_kit +} +#post_install + +## arg 1: the new package version +## arg 2: the old package version +pre_upgrade() { + echo "" +} + +## arg 1: the new package version +## arg 2: the old package version +post_upgrade() { + setup_kit +} +#post_upgrade + +## arg 1: the old package version +pre_remove() { + echo "" +} +#pre_remove + +## arg 1: the old package version +post_remove() { + remove_kit +} +#post_remove diff --git a/qpi.sh b/qpi.sh new file mode 100644 index 000000000000..b93c2aae38f1 --- /dev/null +++ b/qpi.sh @@ -0,0 +1,2 @@ +PATH="localpiprefix/bin:${PATH}" +export PATH |