xref: /OK3568_Linux_fs/yocto/meta-qt5/recipes-qt/qt5/qtpdf_git.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1SUMMARY = "Qt Pdf support"
2
3# Read http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
4LICENSE = "BSD-3-Clause & ( GPL-3.0-only & The-Qt-Company-GPL-Exception-1.0 | The-Qt-Company-Commercial ) & ( LGPL-3.0-only | The-Qt-Company-Commercial )"
5LIC_FILES_CHKSUM = " \
6    file://src/3rdparty/chromium/LICENSE;md5=0fca02217a5d49a14dfe2d11837bb34d \
7    file://LICENSE.LGPL3;md5=8211fde12cc8a4e2477602f5953f5b71 \
8    file://LICENSE.GPLv3;md5=88e2b9117e6be406b5ed6ee4ca99a705 \
9    file://LICENSE.GPL3;md5=d32239bcb673463ab874e80d47fae504 \
10    file://LICENSE.GPL3-EXCEPT;md5=763d8c535a234d9a3fb682c7ecb6c073 \
11    file://LICENSE.GPL2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
12"
13
14DEPENDS += " \
15    libpng-native \
16    ninja-native \
17    bison-native \
18    qtbase qtdeclarative qtxmlpatterns qtquickcontrols qtquickcontrols2 \
19    jpeg-native \
20    freetype-native \
21    gperf-native \
22    ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa-lib', '', d)} \
23    ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'libxcomposite libxcursor libxi libxrandr libxtst libxkbfile', '', d)} \
24"
25
26DEPENDS:append:libc-musl = " libexecinfo"
27
28inherit pkgconfig
29
30EXTRA_QMAKEVARS_CONFIGURE += "-feature-webengine-system-ninja -no-feature-webengine-system-gn"
31EXTRA_QMAKEVARS_PRE += "CONFIG+=force_debug_info"
32
33# chromium/third_party/openh264/openh264.gyp adds
34# -Wno-format to openh264_cflags_add
35# similarly chromium/third_party/openh264/BUILD.gn for newer qtwebengine
36# causing following error, because -Wformat-security cannot be used together with -Wno-format
37# cc1plus: error: -Wformat-security ignored without -Wformat [-Werror=format-security]
38# http://errors.yoctoproject.org/Errors/Details/150333/
39SECURITY_STRINGFORMAT = ""
40
41# To use system ffmpeg you need to enable also libwebp, opus, libvpx
42# Only depenedencies available in oe-core are enabled by default
43PACKAGECONFIG ??= "libevent libpng \
44                   ${@bb.utils.contains('DISTRO_FEATURES', 'pulseaudio', 'pulseaudio', '', d)}"
45
46PACKAGECONFIG[icu] = "-feature-webengine-system-icu,-no-feature-webengine-system-icu,icu"
47PACKAGECONFIG[ffmpeg] = "-feature-webengine-system-ffmpeg,-no-feature-webengine-system-ffmpeg,libav"
48PACKAGECONFIG[webrtc] = "-feature-webengine-webrtc,-no-feature-webengine-webrtc,libvpx"
49PACKAGECONFIG[libwebp] = "-feature-webengine-system-libwebp,-no-feature-webengine-system-libwebp,libwebp"
50PACKAGECONFIG[opus] = "-feature-webengine-system-opus,-no-feature-webengine-system-opus,libopus"
51PACKAGECONFIG[libvpx] = "-feature-webengine-system-libvpx,-no-feature-webengine-system-libvpx,libvpx"
52PACKAGECONFIG[libevent] = "-feature-webengine-system-libevent,-no-feature-webengine-system-libevent,libevent"
53PACKAGECONFIG[libpng] = "-feature-webengine-system-png,-no-feature-webengine-system-png,libpng"
54PACKAGECONFIG[harfbuzz] = "-feature-webengine-system-harfbuzz,-no-feature-webengine-system-harfbuzz,harfbuzz"
55PACKAGECONFIG[glib] = "-feature-webengine-system-glib,-no-feature-webengine-system-glib,glib-2.0"
56PACKAGECONFIG[zlib] = "-feature-webengine-system-zlib,-no-feature-webengine-system-zlib,zlib"
57PACKAGECONFIG[libxml2] = "-feature-webengine-system-libxml2,-no-feature-webengine-system-libxml2,libxml2"
58PACKAGECONFIG[minizip] = "-feature-webengine-system-minizip,-no-feature-webengine-system-minizip,minizip"
59PACKAGECONFIG[proprietary-codecs] = "-feature-webengine-proprietary-codecs,-no-feature-webengine-proprietary-codecs"
60PACKAGECONFIG[pepper-plugins] = "-feature-webengine-pepper-plugins,-no-feature-webengine-pepper-plugins"
61PACKAGECONFIG[printing-and-pdf] = "-feature-webengine-printing-and-pdf,-no-feature-webengine-printing-and-pdf"
62PACKAGECONFIG[spellchecker] = "-feature-webengine-spellchecker,-no-feature-webengine-spellchecker"
63PACKAGECONFIG[pulseaudio] = "-feature-webengine-pulseaudio,-no-feature-webengine-pulseaudio,pulseaudio"
64
65EXTRA_QMAKEVARS_CONFIGURE += "${PACKAGECONFIG_CONFARGS}"
66
67COMPATIBLE_MACHINE = "(-)"
68COMPATIBLE_MACHINE:x86 = "(.*)"
69COMPATIBLE_MACHINE:x86-64 = "(.*)"
70COMPATIBLE_MACHINE:armv6 = "(.*)"
71COMPATIBLE_MACHINE:armv7a = "(.*)"
72COMPATIBLE_MACHINE:armv7ve = "(.*)"
73COMPATIBLE_MACHINE:aarch64 = "(.*)"
74
75inherit qmake5
76inherit gettext
77inherit perlnative
78inherit features_check
79
80
81# Static builds of QtWebEngine aren't supported.
82CONFLICT_DISTRO_FEATURES = "qt5-static"
83
84# we don't want gettext.bbclass to append --enable-nls
85def gettext_oeconf(d):
86    return ""
87
88require qt5.inc
89require qt5-git.inc
90
91export GN_PKG_CONFIG_HOST = "${STAGING_BINDIR_NATIVE}/pkg-config-native"
92export GN_HOST_TOOLCHAIN_EXTRA_CPPFLAGS = "-I${STAGING_DIR_NATIVE}/usr/include"
93export NINJAFLAGS="${PARALLEL_MAKE}"
94
95do_configure() {
96
97    # qmake can't find the OE_QMAKE_* variables on it's own so directly passing them as
98    # arguments here
99    ${OE_QMAKE_QMAKE} ${EXTRA_QMAKEVARS_PRE} ${S} \
100        QMAKE_CXX="${OE_QMAKE_CXX}" \
101        QMAKE_CC="${OE_QMAKE_CC}" \
102        QMAKE_LINK="${OE_QMAKE_LINK}" \
103        QMAKE_CFLAGS="${OE_QMAKE_CFLAGS}" \
104        QMAKE_CXXFLAGS="${OE_QMAKE_CXXFLAGS}" \
105        -after ${EXTRA_QMAKEVARS_POST} -- \
106        ${EXTRA_QMAKEVARS_CONFIGURE} -verbose
107}
108
109do_configure:prepend:libc-musl() {
110        for f in `find ${S}/src/3rdparty/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ -name config.h -o -name config.asm`; do
111                sed -i -e "s:define HAVE_SYSCTL 1:define HAVE_SYSCTL 0:g" $f
112        done
113}
114
115do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"
116
117# for /usr/share/qt5/qtwebengine_resources.pak
118FILES:${PN} += "${OE_QMAKE_PATH_QT_TRANSLATIONS} ${OE_QMAKE_PATH_QT_DATA}"
119
120# Chromium uses libpci to determine which optimizations/workarounds to apply
121RDEPENDS:${PN}:append:x86 = " libpci"
122
123RDEPENDS:${PN}-examples += " \
124    ${PN}-qmlplugins \
125    qtquickcontrols-qmlplugins \
126    qtdeclarative-qmlplugins \
127"
128
129QT_MODULE_BRANCH_CHROMIUM = "87-based"
130
131QT_MODULE_BRANCH = "5.15.10"
132PV = "5.15.10+git${SRCPV}"
133
134# Uses the same repository and couple patches as qtwebengine, but qtwebengine
135# still depends on python2
136QT_MODULE = "qtwebengine"
137FILESEXTRAPATHS =. "${FILE_DIRNAME}/qtwebengine:"
138
139# Patches from https://github.com/meta-qt5/qtwebengine/commits/b5.15-glibc
140# 5.15-glibc.meta-qt5.15
141SRC_URI += " \
142    ${QT_GIT}/qtwebengine-chromium.git;name=chromium;branch=${QT_MODULE_BRANCH_CHROMIUM};protocol=${QT_GIT_PROTOCOL};destsuffix=git/src/3rdparty \
143    file://0001-Force-host-toolchain-configuration.patch \
144    file://0002-qmake.conf-lower-MODULE_VERSION-to-5.15.X.patch \
145"
146# Patches from https://github.com/meta-qt5/qtwebengine/commits/b5.15
147# 5.15.meta-qt5.15
148SRC_URI:append:libc-musl = "\
149    file://0003-musl-don-t-use-pvalloc-as-it-s-not-available-on-musl.patch \
150    file://0004-musl-link-against-libexecinfo.patch \
151    file://0005-mkspecs-Allow-builds-with-libc-glibc.patch \
152"
153
154# Patches from https://github.com/meta-qt5/qtwebengine-chromium/commits/87-based-glibc
155# 87-based-glibc.meta-qt5.9
156SRC_URI += " \
157    file://chromium/0001-chromium-workaround-for-too-long-.rps-file-name.patch;patchdir=src/3rdparty \
158    file://chromium/0002-chromium-fix-build-with-clang.patch;patchdir=src/3rdparty \
159    file://chromium/0003-chromium-Exclude-CRC32-for-32bit-arm.patch;patchdir=src/3rdparty \
160    file://chromium/0004-chromium-Do-not-try-to-set-the-guessed-values-for.patch;patchdir=src/3rdparty \
161    file://chromium/0005-chromium-fix-build-after-y2038-changes-in-glibc.patch;patchdir=src/3rdparty \
162    file://chromium/0006-chromium-Fix-build-on-32bit-arches-with-64bit-time_t.patch;patchdir=src/3rdparty \
163    file://chromium/0007-chromium-Include-cstddef-for-size_t-definition.patch;patchdir=src/3rdparty \
164    file://chromium/0008-chromium-Move-CharAllocator-definition-to-a-header-f.patch;patchdir=src/3rdparty \
165    file://chromium/0009-chromium-Link-v8-with-libatomic-on-x86.patch;patchdir=src/3rdparty \
166    file://chromium/0010-chromium-icu-use-system-library-only-targets.patch;patchdir=src/3rdparty \
167    file://chromium/0011-chromium-Remove-TRUE-to-prep-landing-of-icu68.patch;patchdir=src/3rdparty \
168    file://chromium/0012-chromium-skia-Fix-build-with-gcc-12.patch;patchdir=src/3rdparty \
169    file://chromium/0013-Remove-unsetting-_FILE_OFFSET_BITS.patch;patchdir=src/3rdparty \
170"
171
172# Patches from https://github.com/meta-qt5/qtwebengine-chromium/commits/87-based
173# 87-based.meta-qt5.9
174SRC_URI:append:libc-musl = "\
175    file://chromium/0013-chromium-musl-sandbox-Define-TEMP_FAILURE_RETRY-if-n.patch;patchdir=src/3rdparty \
176    file://chromium/0014-chromium-musl-Avoid-mallinfo-APIs-on-non-glibc-linux.patch;patchdir=src/3rdparty \
177    file://chromium/0015-chromium-musl-include-fcntl.h-for-loff_t.patch;patchdir=src/3rdparty \
178    file://chromium/0016-chromium-musl-use-off64_t-instead-of-the-internal-__.patch;patchdir=src/3rdparty \
179    file://chromium/0017-chromium-musl-linux-glibc-make-the-distinction.patch;patchdir=src/3rdparty \
180    file://chromium/0018-chromium-musl-Define-res_ninit-and-res_nclose-for-no.patch;patchdir=src/3rdparty \
181    file://chromium/0019-chromium-musl-Do-not-define-__sbrk-on-musl.patch;patchdir=src/3rdparty \
182    file://chromium/0020-chromium-musl-Adjust-default-pthread-stack-size.patch;patchdir=src/3rdparty \
183    file://chromium/0021-chromium-musl-elf_reader.cc-include-sys-reg.h-to-get.patch;patchdir=src/3rdparty \
184    file://chromium/0022-chromium-musl-pread-pwrite.patch;patchdir=src/3rdparty \
185    file://chromium/0023-chromium-musl-initialize-msghdr-in-a-compatible-mann.patch;patchdir=src/3rdparty \
186"
187
188SRCREV_qtwebengine = "c7e716ef1ffd63a8ab1f4dbf879230849eb3b505"
189# this is 3 commits ahead of what submodule in 5.15.10 uses (caba2fcb0fe8a8d213c4c79d26da3bb88eee61c7), but contains useful fix:
190SRCREV_chromium = "ecc2bb74f1f7140fc52650042299be18e826b27b"
191SRCREV = "${SRCREV_qtwebengine}"
192
193SRCREV_FORMAT = "qtwebengine_chromium"
194
195# 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]
196INSANE_SKIP:${PN} += "textrel"
197
198###
199### This recipe's part above is mostly a copy of qtwebengine_git.bb.
200### The PACKAGECONFIG flags were kept to avoid enablement of any unwished-for features
201### There were only some (build) dependencies removed.
202###
203
204# First patch skips "python2" dependency checks for the pdf module
205# Second patch repairs a failing build of the `gn` buildtool due to missing (host) libstdc++
206# Patches from https://github.com/meta-qt5/qtwebengine/commits/b5.15-qtpdf
207# 5.15-qtpdf.meta-qt5.2
208SRC_URI += " \
209    file://0001-configure.json-remove-python2-dependency.patch \
210    file://0002-gn.pro-do-not-try-to-statically-link-stdc.patch \
211"
212SRC_URI:append:toolchain-clang:runtime-llvm = " file://0003-Fix-build-with-clang.patch"
213
214# These flags below go more into detail than qtwebengine's documentation
215PACKAGECONFIG[no-core] = "-no-build-qtwebengine-core,,"
216PACKAGECONFIG[qtpdf] = "-feature-build-qtpdf,-no-feature-build-qtpdf,python3-native"
217PACKAGECONFIG[webengine-pdf] = "-feature-webengine-python2,-no-feature-webengine-python2,python3-native"
218
219# The flags below enable just the PDF widget
220PACKAGECONFIG = "no-core qtpdf"
221
222# Work around gn's dependency on python (2).
223# To build qtpdf it works just as well with python3.
224EXTRA_QMAKEVARS_PRE += "QMAKE_PYTHON2=python3"
225