kumquat-buildroot/package/qt5/qt5webengine/5.9.1/0001-Always-compile-QWebEnginePage-print.patch

247 lines
8.6 KiB
Diff
Raw Normal View History

qt5webengine: new package This patch is based on works [1] and [2]. With this patch, one can run the Qt5 WebEngine quicknanobrowser sample with the following options. BR2_TOOLCHAIN_BUILDROOT_LIBC="glibc" and BR2_TOOLCHAIN_BUILDROOT_CXX (Qt 5 needs a toolchain w/ wchar, NPTL, C++, dynamic library; for now it builds only with glibc) BR2_PACKAGE_LIBERATION (Qt needs at least one font) BR2_PACKAGE_QT5BASE_EXAMPLES (to install quicknanobrowser sample) BR2_PACKAGE_QT5BASE_GIF (do display gif) BR2_PACKAGE_QT5BASE_JPEG (do display jpeg) BR2_PACKAGE_QT5BASE_PNG (do display png) BR2_PACKAGE_QT5QUICKCONTROLS (needed by webengine) BR2_PACKAGE_QT5QUICKCONTROLS2 (needed by webengine) BR2_PACKAGE_QT5WEBENGINE (because it is what we want) Qt WebEngine requires an Open(E)GL-capable backend. As an example, the package rpi-userland must be enabled to build for a rpi. BR2_PACKAGE_RPI_USERLAND (to enable OpenGL ES backend) To browse for HTTPS websites, please consider adding the following options as well for SSL/TLS. BR2_PACKAGE_CA_CERT (for certificates) BR2_PACKAGE_NTPD (to sync date for certificates) Since version 5.9, chromium requires udev at runtime (see note 4). BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV (input backend) To run quicknanobrowser # cd /usr/lib/qt/examples/webengine/quicknanobrowser/ # ./quicknanobrowser https://www.buildroot.org/ Note: The chromium.inc has been generated using the following command. ( echo 'CHROMIUM_LICENSE_FILES = \' && cd output/build/qt5webengine-5.9.1/ && \ find "src/3rdparty/chromium/" -type f -iname "*LICENSE*" -o -iname "*COPYING*" -o -iname "*GPL*" | \ sed -e '/\.asm$/d' \ -e '/\.h$/d' \ -e '/\.c$/d' \ -e '/\.cc$/d' \ -e '/\.cpp$/d' \ -e '/\.pyc\?$/d' \ -e '/\.pl$/d' \ -e '/\.sha1$/d' \ -e '/\.patch$/d' \ -e '/licensecheck/d' \ -e 's,^,\t,' \ -e 's,$, \\,' | \ sort && \ echo '' ) >package/qt5/qt5webengine/chromium.inc Note 2: Since 5.9.1, the chromium's copy of opus fails with neon [3]. Qt WebEngine can uses buildroot ffmpeg copy which compiles fine (using qmake flag WEBENGINE_CONFIG+=use_system_ffmpeg). It implies selecting the following options. BR2_PACKAGE_FFMPEG BR2_PACKAGE_OPUS BR2_PACKAGE_LIBVPX BR2_PACKAGE_WEBP BR2_PACKAGE_WEBP_DEMUX In file included from ../../3rdparty/chromium/third_party/opus/src/silk/arm/NSQ_neon.c:31:0: /home/gportay/src/buildroot/output-rpi3-qt5.9/host/lib/gcc/arm-buildroot-linux-gnueabihf/6.4.0/include/arm_neon.h:8997:1: error: inlining failed in call to always_inline ‘vld1q_s32’: target specific option mismatch vld1q_s32 (const int32_t * __a) ^~~~~~~~~ ../../3rdparty/chromium/third_party/opus/src/silk/arm/NSQ_neon.c:40:15: note: called from here int32x4_t coef0 = vld1q_s32(coef32); ^~~~~ ../../3rdparty/chromium/third_party/opus/src/silk/arm/NSQ_neon.c: At top level: cc1: warning: unrecognized command line option ‘-Wno-#pragma-messages’ Note 3: Version 5.6.2 causes a build issue while building chromium. The build against this version is disabled until the release 5.6.3 is out. Note 4: Here is trace when udev does not run # cd /usr/lib/qt/examples/webengine/quicknanobrowser # ./quicknanobrowser QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' Unable to query physical screen size, defaulting to 100 dpi. To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters). [0101/000248.161973:WARNING:resource_bundle_qt.cpp(114)] locale_file_path.empty() for locale [0101/000248.384693:WARNING:resource_bundle_qt.cpp(114)] locale_file_path.empty() for locale [202:223:0101/000248.484954:FATAL:udev_loader.cc(38)] Check failed: false. #0 0x0000742b93de <unknown> #1 0x0000742c3c38 <unknown> #2 0x000073e1e1aa <unknown> #3 0x000073e1d96e <unknown> #4 0x000073e1defa <unknown> #5 0x000074af6364 <unknown> #6 0x000074302878 <unknown> #7 0x0000742c8fee <unknown> #8 0x0000742c9f44 <unknown> #9 0x0000742ca21e <unknown> #10 0x0000742cac4c <unknown> #11 0x0000742c87b2 <unknown> #12 0x0000742da4f6 <unknown> #13 0x000073ed9d38 <unknown> #14 0x000073eda03c <unknown> #15 0x0000742e9aec <unknown> #16 0x0000742e71dc <unknown> Aborted Note 5: On rpi and depending on what is insinde the .config, more GPU memory should be allocated to run properly qt samples. #0 0x0000742c63de <unknown> #1 0x0000742d0c38 <unknown> #2 0x0000749d7bde <unknown> #3 0x0000749e3c70 <unknown> #4 0x00007530227c <unknown> #5 0x000075302480 <unknown> #6 0x0000752fb1e4 <unknown> #7 0x00007430f878 <unknown> #8 0x0000742d5fee <unknown> #9 0x0000742d6f44 <unknown> #10 0x0000742d721e <unknown> #11 0x0000742d7ad6 <unknown> #12 0x0000742d57b2 <unknown> #13 0x0000742e74f6 <unknown> #14 0x0000742f6a74 <unknown> #15 0x0000742f41dc <unknown> Received signal 6 #0 0x0000742c63de <unknown> #1 0x0000742c66a0 <unknown> #2 0x0000725b5d10 <unknown> [end of stack trace] qml: Render process exited with code 256 (abnormal exit) # mount /dev/mmcblk0p1 /mnt # sed '/^gpu_mem_/s,=.*,=200,' -i /mnt/config.txt # umount /mnt Note 6: The first patch fixes a build issue when samples are compiled without the support of printing [4]. This patch is already merged in branch 5.9 [5] and concerns only 5.9.1. 085c2c52 Always compile QWebEnginePage::print It fixes the error below. .obj/browsermainwindow.o: In function `BrowserMainWindow::printRequested(QWebEnginePage*)': browsermainwindow.cpp:(.text+0x2cc0): undefined reference to `QWebEnginePage::print(QPrinter*, QWebEngineCallback<bool> const&)' The second patch loads both libEGL and libGLESv2 symbols implicitly instead of loading them with explicitly using hard-coded locations. It fixes a bug when providers of lib*GL does not create libraries named libEGL.so.1 and libGLESv2.s2 [6]. This patch is already merged in branch 5.9 [7]. d4c621f6 Load libEGL and libGLES2 symbols implicitly It fixes the error below. [327:347:1221/085837:ERROR:surface_factory_qt.cpp(68)] Failed to load /usr/lib/libGLESv2.so.2: /usr/lib/libGLESv2.so.2: cannot open shared object file: No such file or directory [1]: http://lists.busybox.net/pipermail/buildroot/2015-July/132010.html [2]: https://patchwork.ozlabs.org/patch/640633/ [3]: https://patchwork.ozlabs.org/patch/791332/ [4]: https://bugreports.qt.io/browse/QTBUG-61510 [5]: https://codereview.qt-project.org/#/c/198041/ [6]: https://bugreports.qt.io/browse/QTBUG-57761 [7]: https://codereview.qt-project.org/#/c/199554/ Cc: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp> Cc: Julien Corjon <corjon.j@ecagroup.com> Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com> [Arnout: - move more dependencies to _ARCH_DEPENDS; - mention all toolchain dependencies in the comments] Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2017-08-15 22:38:53 +02:00
From 085c2c529473bbe9dd7c8c5698a45053520cc423 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=BCri=20Valdmann?= <juri.valdmann@qt.io>
Date: Tue, 20 Jun 2017 15:36:43 +0200
Subject: [PATCH 1/1] Always compile QWebEnginePage::print
- Remove two out of five layers of ifdefs around and inside this method.
- Now always compiled but will yield an error if printing is disabled.
- Remove printing-related ifdefs from demobrowser.
Task-number: QTBUG-61510
Change-Id: I79781189d3d3fb62db0a2216b2b989e3fa1d1f86
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Rolf Eike Beer <eb@emlix.com>
Upstream-Status: Merged
Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>
---
examples/webenginewidgets/demobrowser/browsermainwindow.cpp | 12 ------------
examples/webenginewidgets/demobrowser/browsermainwindow.h | 6 ------
examples/webenginewidgets/demobrowser/printtopdfdialog.cpp | 7 -------
src/webenginewidgets/api/qwebenginepage.cpp | 10 ++--------
src/webenginewidgets/api/qwebenginepage.h | 8 --------
5 files changed, 2 insertions(+), 41 deletions(-)
diff --git a/examples/webenginewidgets/demobrowser/browsermainwindow.cpp b/examples/webenginewidgets/demobrowser/browsermainwindow.cpp
index 327d7a9d..14d49f7f 100644
--- a/examples/webenginewidgets/demobrowser/browsermainwindow.cpp
+++ b/examples/webenginewidgets/demobrowser/browsermainwindow.cpp
@@ -109,9 +109,7 @@ BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags)
, m_historyForward(0)
, m_stop(0)
, m_reload(0)
-#ifndef QT_NO_PRINTER
, m_currentPrinter(nullptr)
-#endif
{
setToolButtonStyle(Qt::ToolButtonFollowStyle);
setAttribute(Qt::WA_DeleteOnClose, true);
@@ -312,9 +310,7 @@ void BrowserMainWindow::setupMenu()
#if defined(QWEBENGINEPAGE_PRINT)
fileMenu->addAction(tr("P&rint Preview..."), this, SLOT(slotFilePrintPreview()));
#endif
-#ifndef QT_NO_PRINTER
fileMenu->addAction(tr("&Print..."), this, SLOT(slotFilePrint()), QKeySequence::Print);
-#endif
fileMenu->addAction(tr("&Print to PDF..."), this, SLOT(slotFilePrintToPDF()));
fileMenu->addSeparator();
@@ -702,23 +698,19 @@ void BrowserMainWindow::slotFileOpen()
void BrowserMainWindow::slotFilePrintPreview()
{
-#ifndef QT_NO_PRINTPREVIEWDIALOG
if (!currentTab())
return;
QPrintPreviewDialog *dialog = new QPrintPreviewDialog(this);
connect(dialog, SIGNAL(paintRequested(QPrinter*)),
currentTab(), SLOT(print(QPrinter*)));
dialog->exec();
-#endif
}
void BrowserMainWindow::slotFilePrint()
{
-#ifndef QT_NO_PRINTER
if (!currentTab())
return;
printRequested(currentTab()->page());
-#endif
}
void BrowserMainWindow::slotHandlePdfPrinted(const QByteArray& result)
@@ -751,7 +743,6 @@ void BrowserMainWindow::slotFilePrintToPDF()
currentTab()->page()->printToPdf(invoke(this, &BrowserMainWindow::slotHandlePdfPrinted), dialog->pageLayout());
}
-#ifndef QT_NO_PRINTER
void BrowserMainWindow::slotHandlePagePrinted(bool result)
{
Q_UNUSED(result);
@@ -763,7 +754,6 @@ void BrowserMainWindow::slotHandlePagePrinted(bool result)
void BrowserMainWindow::printRequested(QWebEnginePage *page)
{
-#ifndef QT_NO_PRINTDIALOG
if (m_currentPrinter)
return;
m_currentPrinter = new QPrinter();
@@ -774,9 +764,7 @@ void BrowserMainWindow::printRequested(QWebEnginePage *page)
return;
}
page->print(m_currentPrinter, invoke(this, &BrowserMainWindow::slotHandlePagePrinted));
-#endif
}
-#endif
void BrowserMainWindow::slotPrivateBrowsing()
{
diff --git a/examples/webenginewidgets/demobrowser/browsermainwindow.h b/examples/webenginewidgets/demobrowser/browsermainwindow.h
index 91e1c1d2..5bbbb292 100644
--- a/examples/webenginewidgets/demobrowser/browsermainwindow.h
+++ b/examples/webenginewidgets/demobrowser/browsermainwindow.h
@@ -56,9 +56,7 @@
#include <QtCore/QUrl>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_PRINTER
class QPrinter;
-#endif
class QWebEnginePage;
QT_END_NAMESPACE
@@ -142,10 +140,8 @@ private slots:
void slotSwapFocus();
void slotHandlePdfPrinted(const QByteArray&);
-#ifndef QT_NO_PRINTER
void slotHandlePagePrinted(bool result);
void printRequested(QWebEnginePage *page);
-#endif
void geometryChangeRequested(const QRect &geometry);
void updateToolbarActionText(bool visible);
void updateBookmarksToolbarActionText(bool visible);
@@ -180,9 +176,7 @@ private:
QAction *m_restoreLastSession;
QAction *m_addBookmark;
-#ifndef QT_NO_PRINTER
QPrinter *m_currentPrinter;
-#endif
QIcon m_reloadIcon;
QIcon m_stopIcon;
diff --git a/examples/webenginewidgets/demobrowser/printtopdfdialog.cpp b/examples/webenginewidgets/demobrowser/printtopdfdialog.cpp
index 0f3b1765..50a8bb91 100644
--- a/examples/webenginewidgets/demobrowser/printtopdfdialog.cpp
+++ b/examples/webenginewidgets/demobrowser/printtopdfdialog.cpp
@@ -52,10 +52,8 @@
#include "ui_printtopdfdialog.h"
#include <QtCore/QDir>
-#ifndef QT_NO_PRINTER
#include <QtPrintSupport/QPageSetupDialog>
#include <QtPrintSupport/QPrinter>
-#endif // QT_NO_PRINTER
#include <QtWidgets/QFileDialog>
PrintToPdfDialog::PrintToPdfDialog(const QString &filePath, QWidget *parent) :
@@ -66,11 +64,8 @@ PrintToPdfDialog::PrintToPdfDialog(const QString &filePath, QWidget *parent) :
ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(ui->chooseFilePathButton, &QToolButton::clicked, this, &PrintToPdfDialog::onChooseFilePathButtonClicked);
-#ifndef QT_NO_PRINTER
connect(ui->choosePageLayoutButton, &QToolButton::clicked, this, &PrintToPdfDialog::onChoosePageLayoutButtonClicked);
-#else
ui->choosePageLayoutButton->hide();
-#endif // QT_NO_PRINTER
updatePageLayoutLabel();
setFilePath(filePath);
}
@@ -82,7 +77,6 @@ PrintToPdfDialog::~PrintToPdfDialog()
void PrintToPdfDialog::onChoosePageLayoutButtonClicked()
{
-#ifndef QT_NO_PRINTER
QPrinter printer;
printer.setPageLayout(currentPageLayout);
@@ -92,7 +86,6 @@ void PrintToPdfDialog::onChoosePageLayoutButtonClicked()
currentPageLayout.setPageSize(printer.pageLayout().pageSize());
currentPageLayout.setOrientation(printer.pageLayout().orientation());
updatePageLayoutLabel();
-#endif // QT_NO_PRINTER
}
void PrintToPdfDialog::onChooseFilePathButtonClicked()
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 2cdb0116..6042b9fd 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -80,11 +80,9 @@
#include <QMenu>
#include <QMessageBox>
#include <QMimeData>
-#if defined(QT_PRINTSUPPORT_LIB)
-#ifndef QT_NO_PRINTER
+#ifdef ENABLE_PRINTING
#include <QPrinter>
-#endif //QT_NO_PRINTER
-#endif //QT_PRINTSUPPORT_LIB
+#endif
#include <QStandardPaths>
#include <QStyle>
#include <QTimer>
@@ -2051,8 +2049,6 @@ void QWebEnginePage::printToPdf(const QWebEngineCallback<const QByteArray&> &res
#endif // if defined(ENABLE_PDF)
}
-#if defined(QT_PRINTSUPPORT_LIB)
-#ifndef QT_NO_PRINTER
/*!
\fn void QWebEnginePage::print(QPrinter *printer, FunctorOrLambda resultCallback)
Renders the current content of the page into a temporary PDF document, then prints it using \a printer.
@@ -2089,8 +2085,6 @@ void QWebEnginePage::print(QPrinter *printer, const QWebEngineCallback<bool> &re
d->m_callbacks.invokeDirectly(resultCallback, false);
#endif // if defined(ENABLE_PDF)
}
-#endif // if defined(QT_NO_PRINTER)
-#endif // if defined(QT_PRINTSUPPORT_LIB)
/*!
\since 5.7
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
index c7d5a19e..5619639c 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/webenginewidgets/api/qwebenginepage.h
@@ -55,11 +55,7 @@
QT_BEGIN_NAMESPACE
class QMenu;
-#if defined(QT_PRINTSUPPORT_LIB)
-#ifndef QT_NO_PRINTER
class QPrinter;
-#endif // QT_NO_PRINTER
-#endif // QT_PRINTSUPPORT_LIB
class QWebChannel;
class QWebEngineContextMenuData;
@@ -294,15 +290,11 @@ public:
void printToPdf(const QWebEngineCallback<const QByteArray&> &resultCallback, const QPageLayout &layout = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF()));
#endif
-#if defined(QT_PRINTSUPPORT_LIB)
-#ifndef QT_NO_PRINTER
#ifdef Q_QDOC
void print(QPrinter *printer, FunctorOrLambda resultCallback);
#else
void print(QPrinter *printer, const QWebEngineCallback<bool> &resultCallback);
#endif // QDOC
-#endif // QT_NO_PRINTER
-#endif // QT_PRINTSUPPORT_LIB
const QWebEngineContextMenuData &contextMenuData() const;
--
2.13.2