qtpdf: add as dedicated recipe

Provide qtpdf[0] as a dedicated package.

[0] https://doc.qt.io/qt-5/qml-qtquick-pdf-pdfdocument.html

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Leif Middelschulte
2022-02-10 09:43:51 +01:00
committed by Martin Jansa
parent f23d41fe8a
commit 73326c9008
7 changed files with 437 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
From ea99142a773c7b55dcd2ee7b52d5339876056881 Mon Sep 17 00:00:00 2001
From: Samuli Piippo <samuli.piippo@qt.io>
Date: Wed, 15 Mar 2017 13:53:28 +0200
Subject: [PATCH 1/6] Force host toolchain configuration
Force gcc/g++ to be used for parts using host toolchain, since
the option(host_build) does not work in yocto builds.
Don't use QT_ARCH for the host architecture, since that's always
the target architecture in bitbake builds, instead ask specifically
for the qmakes's host architecture.
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Samuli Piippo <samuli.piippo@qt.io>
---
src/buildtools/config/linux.pri | 2 +-
src/buildtools/configure_host.pro | 14 +++++++-------
src/buildtools/gn.pro | 4 ++--
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/buildtools/config/linux.pri b/src/buildtools/config/linux.pri
index 7507d51e..1e078cbf 100644
--- a/src/buildtools/config/linux.pri
+++ b/src/buildtools/config/linux.pri
@@ -118,7 +118,7 @@ contains(QT_ARCH, "mips") {
host_build {
gn_args += custom_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:host\"
- GN_HOST_CPU = $$gnArch($$QT_ARCH)
+ GN_HOST_CPU = $$gnArch($$QMAKE_HOST.arch)
gn_args += host_cpu=\"$$GN_HOST_CPU\"
# Don't bother trying to use system libraries in this case
gn_args += use_glib=false
diff --git a/src/buildtools/configure_host.pro b/src/buildtools/configure_host.pro
index dd0d3e32..6312c867 100644
--- a/src/buildtools/configure_host.pro
+++ b/src/buildtools/configure_host.pro
@@ -4,7 +4,7 @@ TEMPLATE = aux
# Pick up the host toolchain
option(host_build)
-GN_HOST_CPU = $$gnArch($$QT_ARCH)
+GN_HOST_CPU = $$gnArch($$QMAKE_HOST.arch)
!isEmpty(QT_TARGET_ARCH): GN_TARGET_CPU = $$gnArch($$QT_TARGET_ARCH)
else: GN_TARGET_CPU = $$GN_HOST_CPU
GN_OS = $$gnOS()
@@ -31,9 +31,9 @@ GN_CONTENTS = \
"import(\"//build/config/sysroot.gni\")" \
"import(\"//build/toolchain/gcc_toolchain.gni\")" \
"gcc_toolchain(\"host\") {" \
-" cc = \"$$which($$QMAKE_CC)\" " \
-" cxx = \"$$which($$QMAKE_CXX)\" " \
-" ld = \"$$which($$QMAKE_LINK)\" " \
+" cc = \"$$which($$CC_host)\" " \
+" cxx = \"$$which($$CXX_host)\" " \
+" ld = \"$$which($$CXX_host)\" " \
" ar = \"$$which(ar)\" " \
" nm = \"$$which(nm)\" " \
" extra_cppflags = \"$$GN_HOST_EXTRA_CPPFLAGS\" " \
@@ -45,9 +45,9 @@ GN_CONTENTS = \
" } " \
"}" \
"gcc_toolchain(\"v8_snapshot\") {" \
-" cc = \"$$which($$QMAKE_CC)\" " \
-" cxx = \"$$which($$QMAKE_CXX)\" " \
-" ld = \"$$which($$QMAKE_LINK)\" " \
+" cc = \"$$which($$CC_host)\" " \
+" cxx = \"$$which($$CXX_host)\" " \
+" ld = \"$$which($$CXX_host)\" " \
" ar = \"$$which(ar)\" " \
" nm = \"$$which(nm)\" " \
" toolchain_args = { " \
diff --git a/src/buildtools/gn.pro b/src/buildtools/gn.pro
index 033202e6..a8ca6567 100644
--- a/src/buildtools/gn.pro
+++ b/src/buildtools/gn.pro
@@ -19,8 +19,8 @@ build_pass|!debug_and_release {
gn_bootstrap = $$system_path($$absolute_path(gn/build/gen.py, $$src_3rd_party_dir))
gn_gen_args = --no-last-commit-position --out-path $$out_path \
- --cc \"$$which($$QMAKE_CC)\" --cxx \"$$which($$QMAKE_CXX)\" \
- --ld \"$$which($$QMAKE_LINK)\"
+ --cc \"$$which($$CC_host)\" --cxx \"$$which($$CXX_host)\" \
+ --ld \"$$which($$CXX_host)\" --ar \"$$which(ar)\"
msvc:!clang_cl: gn_gen_args += --use-lto
--
2.34.1

View File

@@ -0,0 +1,40 @@
From ccc1d2afb10bacdf7ebdcba5ffb130ef72eaa7a5 Mon Sep 17 00:00:00 2001
From: Samuli Piippo <samuli.piippo@qt.io>
Date: Tue, 12 Dec 2017 16:06:14 +0200
Subject: [PATCH 2/6] musl: don't use pvalloc as it's not available on musl
Change-Id: I7145463ac7b9560e7459d3384a3db108bd727403
Signed-off-by: Samuli Piippo <samuli.piippo@qt.io>
---
src/core/api/qtbug-61521.cpp | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/core/api/qtbug-61521.cpp b/src/core/api/qtbug-61521.cpp
index 002a1af2..8fd2da36 100644
--- a/src/core/api/qtbug-61521.cpp
+++ b/src/core/api/qtbug-61521.cpp
@@ -74,10 +74,6 @@ SHIM_SYMBOL_VERSION(valloc);
void* __valloc(size_t size)
SHIM_ALIAS_SYMBOL(ShimValloc);
-SHIM_SYMBOL_VERSION(pvalloc);
-void* __pvalloc(size_t size)
- SHIM_ALIAS_SYMBOL(ShimPvalloc);
-
SHIM_SYMBOL_VERSION(posix_memalign);
int __posix_memalign(void** r, size_t a, size_t s)
SHIM_ALIAS_SYMBOL(ShimPosixMemalign);
@@ -110,10 +106,6 @@ SHIM_HIDDEN void* ShimValloc(size_t size) {
return valloc(size);
}
-SHIM_HIDDEN void* ShimPvalloc(size_t size) {
- return pvalloc(size);
-}
-
SHIM_HIDDEN int ShimPosixMemalign(void** r, size_t a, size_t s) {
return posix_memalign(r,a,s);
}
--
2.34.1

View File

@@ -0,0 +1,27 @@
From 406fc3c6271d3f6ba5a96b019fb3bd74916745f5 Mon Sep 17 00:00:00 2001
From: Samuli Piippo <samuli.piippo@qt.io>
Date: Thu, 14 Dec 2017 11:28:10 +0200
Subject: [PATCH 3/6] musl: link against libexecinfo
Change-Id: Ifada60f9c72691973612850121f6fb152d70839a
Signed-off-by: Samuli Piippo <samuli.piippo@qt.io>
---
src/core/core_module.pro | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/core_module.pro b/src/core/core_module.pro
index 520b452f..d2b29b29 100644
--- a/src/core/core_module.pro
+++ b/src/core/core_module.pro
@@ -5,7 +5,7 @@ include($${QTWEBENGINE_ROOT}/src/buildtools/config/linking.pri)
api_library_name = qtwebenginecoreapi$$qtPlatformTargetSuffix()
api_library_path = $$OUT_PWD/api/$$getConfigDir()
-LIBS_PRIVATE += -L$$api_library_path
+LIBS_PRIVATE += -L$$api_library_path -lexecinfo
CONFIG *= no_smart_library_merge
osx {
LIBS_PRIVATE += -Wl,-force_load,$${api_library_path}$${QMAKE_DIR_SEP}lib$${api_library_name}.a
--
2.34.1

View File

@@ -0,0 +1,51 @@
From 516203ad1419d7e76d694b621736a48a53f00291 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 12 Nov 2019 19:53:59 -0800
Subject: [PATCH 4/6] mkspecs: Allow builds with libc != glibc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/buildtools/config/support.pri | 4 ----
src/buildtools/configure.json | 4 +---
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri
index e7f869a1..f9c9c24b 100644
--- a/src/buildtools/config/support.pri
+++ b/src/buildtools/config/support.pri
@@ -191,10 +191,6 @@ defineTest(qtwebengine_checkForHostPkgCfg) {
defineTest(qtwebengine_checkForGlibc) {
module = $$1
- !qtConfig(webengine-system-glibc) {
- qtwebengine_skipBuild("A suitable version >= 2.27 of libc required to build $${module} could not be found.")
- return(false)
- }
return(true)
}
diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json
index 88d1790c..9eb5e8e3 100644
--- a/src/buildtools/configure.json
+++ b/src/buildtools/configure.json
@@ -379,7 +379,6 @@
&& (!config.sanitizer || features.webengine-sanitizer)
&& (!config.linux || features.pkg-config)
&& (!config.linux || features.webengine-host-pkg-config)
- && (!config.linux || features.webengine-system-glibc)
&& (!config.linux || features.webengine-system-khr)
&& (!config.linux || features.webengine-system-nss)
&& (!config.linux || features.webengine-system-dbus)
@@ -782,8 +781,7 @@
"webengine-system-fontconfig",
"webengine-system-dbus",
"webengine-system-nss",
- "webengine-system-khr",
- "webengine-system-glibc"
+ "webengine-system-khr"
]
},
{
--
2.34.1

View File

@@ -0,0 +1,24 @@
From 988d1e3f9c4415c2a59833b74098639d3fe71524 Mon Sep 17 00:00:00 2001
From: Leif Middelschulte <Leif.Middelschulte@klsmartin.com>
Date: Tue, 8 Feb 2022 14:14:02 +0100
Subject: [PATCH 5/6] configure.json: remove python2 dependency
---
src/buildtools/configure.json | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json
index 9eb5e8e3..ebe31c21 100644
--- a/src/buildtools/configure.json
+++ b/src/buildtools/configure.json
@@ -399,7 +399,6 @@
&& features.webengine-gperf
&& features.webengine-bison
&& features.webengine-flex
- && features.webengine-python2
&& (!config.sanitizer || features.webengine-sanitizer)
&& (!config.linux || features.pkg-config)
&& (!config.linux || features.webengine-host-pkg-config)
--
2.34.1

View File

@@ -0,0 +1,26 @@
From 4d2f525ccf3255dd4a0e774d3db0533ae4aba98f Mon Sep 17 00:00:00 2001
From: Leif Middelschulte <Leif.Middelschulte@klsmartin.com>
Date: Tue, 8 Feb 2022 16:28:14 +0100
Subject: [PATCH 6/6] gn.pro: do not try to statically link stdc++
---
src/buildtools/gn.pro | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/buildtools/gn.pro b/src/buildtools/gn.pro
index a8ca6567..9632f0ef 100644
--- a/src/buildtools/gn.pro
+++ b/src/buildtools/gn.pro
@@ -20,7 +20,8 @@ build_pass|!debug_and_release {
gn_gen_args = --no-last-commit-position --out-path $$out_path \
--cc \"$$which($$CC_host)\" --cxx \"$$which($$CXX_host)\" \
- --ld \"$$which($$CXX_host)\" --ar \"$$which(ar)\"
+ --ld \"$$which($$CXX_host)\" --ar \"$$which(ar)\" \
+ --no-static-libstdc++
msvc:!clang_cl: gn_gen_args += --use-lto
--
2.34.1

179
recipes-qt/qt5/qtpdf_git.bb Normal file
View File

@@ -0,0 +1,179 @@
SUMMARY = "Qt Pdf support"
# Read http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
LICENSE = "BSD & ( GPL-3.0 & The-Qt-Company-GPL-Exception-1.0 | The-Qt-Company-Commercial ) & ( LGPL-3.0 | The-Qt-Company-Commercial )"
LIC_FILES_CHKSUM = " \
file://src/3rdparty/chromium/LICENSE;md5=0fca02217a5d49a14dfe2d11837bb34d \
file://LICENSE.LGPL3;md5=8211fde12cc8a4e2477602f5953f5b71 \
file://LICENSE.GPLv3;md5=88e2b9117e6be406b5ed6ee4ca99a705 \
file://LICENSE.GPL3;md5=d32239bcb673463ab874e80d47fae504 \
file://LICENSE.GPL3-EXCEPT;md5=763d8c535a234d9a3fb682c7ecb6c073 \
file://LICENSE.GPL2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
"
DEPENDS += " \
libpng-native \
ninja-native \
bison-native \
qtbase qtdeclarative qtxmlpatterns qtquickcontrols qtquickcontrols2 \
jpeg-native \
freetype-native \
gperf-native \
${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa-lib', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'libxcomposite libxcursor libxi libxrandr libxtst libxkbfile', '', d)} \
"
DEPENDS:append:libc-musl = " libexecinfo"
inherit pkgconfig
EXTRA_QMAKEVARS_CONFIGURE += "-feature-webengine-system-ninja -no-feature-webengine-system-gn"
EXTRA_QMAKEVARS_PRE += "CONFIG+=force_debug_info"
# chromium/third_party/openh264/openh264.gyp adds
# -Wno-format to openh264_cflags_add
# similarly chromium/third_party/openh264/BUILD.gn for newer qtwebengine
# causing following error, because -Wformat-security cannot be used together with -Wno-format
# cc1plus: error: -Wformat-security ignored without -Wformat [-Werror=format-security]
# http://errors.yoctoproject.org/Errors/Details/150333/
SECURITY_STRINGFORMAT = ""
# To use system ffmpeg you need to enable also libwebp, opus, libvpx
# Only depenedencies available in oe-core are enabled by default
PACKAGECONFIG ??= "libevent libpng \
${@bb.utils.contains('DISTRO_FEATURES', 'pulseaudio', 'pulseaudio', '', d)}"
PACKAGECONFIG[icu] = "-feature-webengine-system-icu,-no-feature-webengine-system-icu,icu"
PACKAGECONFIG[ffmpeg] = "-feature-webengine-system-ffmpeg,-no-feature-webengine-system-ffmpeg,libav"
PACKAGECONFIG[webrtc] = "-feature-webengine-webrtc,-no-feature-webengine-webrtc,libvpx"
PACKAGECONFIG[libwebp] = "-feature-webengine-system-libwebp,-no-feature-webengine-system-libwebp,libwebp"
PACKAGECONFIG[opus] = "-feature-webengine-system-opus,-no-feature-webengine-system-opus,libopus"
PACKAGECONFIG[libvpx] = "-feature-webengine-system-libvpx,-no-feature-webengine-system-libvpx,libvpx"
PACKAGECONFIG[libevent] = "-feature-webengine-system-libevent,-no-feature-webengine-system-libevent,libevent"
PACKAGECONFIG[libpng] = "-feature-webengine-system-png,-no-feature-webengine-system-png,libpng"
PACKAGECONFIG[harfbuzz] = "-feature-webengine-system-harfbuzz,-no-feature-webengine-system-harfbuzz,harfbuzz"
PACKAGECONFIG[glib] = "-feature-webengine-system-glib,-no-feature-webengine-system-glib,glib-2.0"
PACKAGECONFIG[zlib] = "-feature-webengine-system-zlib,-no-feature-webengine-system-zlib,zlib"
PACKAGECONFIG[libxml2] = "-feature-webengine-system-libxml2,-no-feature-webengine-system-libxml2,libxml2"
PACKAGECONFIG[minizip] = "-feature-webengine-system-minizip,-no-feature-webengine-system-minizip,minizip"
PACKAGECONFIG[proprietary-codecs] = "-feature-webengine-proprietary-codecs,-no-feature-webengine-proprietary-codecs"
PACKAGECONFIG[pepper-plugins] = "-feature-webengine-pepper-plugins,-no-feature-webengine-pepper-plugins"
PACKAGECONFIG[printing-and-pdf] = "-feature-webengine-printing-and-pdf,-no-feature-webengine-printing-and-pdf"
PACKAGECONFIG[spellchecker] = "-feature-webengine-spellchecker,-no-feature-webengine-spellchecker"
PACKAGECONFIG[pulseaudio] = "-feature-webengine-pulseaudio,-no-feature-webengine-pulseaudio,pulseaudio"
EXTRA_QMAKEVARS_CONFIGURE += "${PACKAGECONFIG_CONFARGS}"
COMPATIBLE_MACHINE = "(-)"
COMPATIBLE_MACHINE:x86 = "(.*)"
COMPATIBLE_MACHINE:x86-64 = "(.*)"
COMPATIBLE_MACHINE:armv6 = "(.*)"
COMPATIBLE_MACHINE:armv7a = "(.*)"
COMPATIBLE_MACHINE:armv7ve = "(.*)"
COMPATIBLE_MACHINE:aarch64 = "(.*)"
inherit qmake5
inherit gettext
inherit perlnative
inherit features_check
# Static builds of QtWebEngine aren't supported.
CONFLICT_DISTRO_FEATURES = "qt5-static"
# we don't want gettext.bbclass to append --enable-nls
def gettext_oeconf(d):
return ""
QT_MODULE = "qtwebengine"
require qt5.inc
require qt5-git.inc
export GN_PKG_CONFIG_HOST = "${STAGING_BINDIR_NATIVE}/pkg-config-native"
export GN_HOST_TOOLCHAIN_EXTRA_CPPFLAGS = "-I${STAGING_DIR_NATIVE}/usr/include"
export NINJAFLAGS="${PARALLEL_MAKE}"
do_configure() {
# qmake can't find the OE_QMAKE_* variables on it's own so directly passing them as
# arguments here
${OE_QMAKE_QMAKE} ${EXTRA_QMAKEVARS_PRE} ${S} \
QMAKE_CXX="${OE_QMAKE_CXX}" \
QMAKE_CC="${OE_QMAKE_CC}" \
QMAKE_LINK="${OE_QMAKE_LINK}" \
QMAKE_CFLAGS="${OE_QMAKE_CFLAGS}" \
QMAKE_CXXFLAGS="${OE_QMAKE_CXXFLAGS}" \
-after ${EXTRA_QMAKEVARS_POST} -- \
${EXTRA_QMAKEVARS_CONFIGURE}
}
do_configure:prepend:libc-musl() {
for f in `find ${S}/src/3rdparty/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ -name config.h -o -name config.asm`; do
sed -i -e "s:define HAVE_SYSCTL 1:define HAVE_SYSCTL 0:g" $f
done
}
do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"
# for /usr/share/qt5/qtwebengine_resources.pak
FILES:${PN} += "${OE_QMAKE_PATH_QT_TRANSLATIONS} ${OE_QMAKE_PATH_QT_DATA}"
# Chromium uses libpci to determine which optimizations/workarounds to apply
RDEPENDS:${PN}:append:x86 = " libpci"
RDEPENDS:${PN}-examples += " \
${PN}-qmlplugins \
qtquickcontrols-qmlplugins \
qtdeclarative-qmlplugins \
"
QT_MODULE_BRANCH_CHROMIUM = "87-based"
# Patches from https://github.com/meta-qt5/qtwebengine/commits/b5.15-glibc
# 5.15-glibc.meta-qt5.12
SRC_URI += " \
${QT_GIT}/qtwebengine-chromium.git;name=chromium;branch=${QT_MODULE_BRANCH_CHROMIUM};protocol=${QT_GIT_PROTOCOL};destsuffix=git/src/3rdparty \
file://0001-Force-host-toolchain-configuration.patch \
"
# Patches from https://github.com/meta-qt5/qtwebengine/commits/b5.15
# 5.15.meta-qt5.12
SRC_URI:append:libc-musl = "\
file://0002-musl-don-t-use-pvalloc-as-it-s-not-available-on-musl.patch \
file://0003-musl-link-against-libexecinfo.patch \
file://0004-mkspecs-Allow-builds-with-libc-glibc.patch \
"
SRCREV_qtwebengine = "73e76f9e86b3fded45be6b232bdebe75e7136e4a"
SRCREV_chromium = "48a205f9e054b5cc3e67df2e25382da9460c0015"
SRCREV = "${SRCREV_qtwebengine}"
SRCREV_FORMAT = "qtwebengine_chromium"
# WARNING: qtwebengine-5.5.99+5.6.0-rc+gitAUTOINC+3f02c25de4_779a2388fc-r0 do_package_qa: QA Issue: ELF binary '/OE/build/oe-core/tmp-glibc/work/i586-oe-linux/qtwebengine/5.5.99+5.6.0-rc+gitAUTOINC+3f02c25de4_779a2388fc-r0/packages-split/qtwebengine/usr/lib/libQt5WebEngineCore.so.5.6.0' has relocations in .text [textrel]
INSANE_SKIP:${PN} += "textrel"
###
### This recipe's part above is mostly a copy of qtwebengine_git.bb.
### The PACKAGECONFIG flags were kept to avoid enablement of any unwished-for features
### There were only some (build) dependencies removed.
###
# First patch skips "python2" dependency checks for the pdf module
# Second patch repairs a failing build of the `gn` buildtool due to missing (host) libstdc++
SRC_URI += " \
file://0005-configure.json-remove-python2-dependency.patch \
file://0006-gn.pro-do-not-try-to-statically-link-stdc.patch \
"
# These flags below go more into detail than qtwebengine's documentation
PACKAGECONFIG[no-core] = "-no-build-qtwebengine-core,,"
PACKAGECONFIG[qtpdf] = "-feature-build-qtpdf,-no-feature-build-qtpdf,python3-native"
PACKAGECONFIG[webengine-pdf] = "-feature-webengine-python2,-no-feature-webengine-python2,python3-native"
# The flags below enable just the PDF widget
PACKAGECONFIG="no-core qtpdf"
# Work around gn's dependency on python (2).
# To build qtpdf it works just as well with python3.
EXTRA_QMAKEVARS_PRE += "QMAKE_PYTHON2=python3"