From 5a304a9adb834afc946c949cf8538a4f8b5d7cdd Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Tue, 4 Feb 2014 17:12:25 +0100 Subject: Fix the embedded build Adopt to toolchain changes and fix the build with the current snapshot. This patch adds some missing overrides and build system configurations. Change-Id: I488929500347bdb5a077ac14e9553cedfcaa605d Reviewed-by: Jocelyn Turcotte --- src/core/chromium_overrides.cpp | 23 ++++++++++++++++++++++- src/core/content_browser_client_qt.cpp | 6 +++++- src/core/gyp_run.pro | 6 +++--- src/core/qtwebengine.gypi | 28 ++++++++++++++++++++++++++++ src/core/qtwebengine_extras.gypi | 1 + src/process/process.pro | 3 ++- src/webenginewidgets/webenginewidgets.pro | 7 ++++--- tools/qmake/mkspecs/features/functions.prf | 4 +++- 8 files changed, 68 insertions(+), 10 deletions(-) diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 383fc6587..be97bc089 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -41,7 +41,6 @@ #include "chromium_overrides.h" -#include "base/message_loop/message_pump_gtk.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include @@ -49,7 +48,12 @@ #include #include +#if defined(OS_ANDROID) +#include "media/video/capture/fake_video_capture_device.h" +#endif + #if defined(USE_X11) +#include "base/message_loop/message_pump_gtk.h" #include #endif @@ -113,3 +117,20 @@ void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebKit::WebScreenInfo* resul } } + +#if defined(OS_ANDROID) +namespace ui { +bool GrabViewSnapshot(gfx::NativeView /*view*/, std::vector* /*png_representation*/, const gfx::Rect& /*snapshot_bounds*/) +{ + NOTIMPLEMENTED(); + return false; +} +} + +namespace media { +const std::string FakeVideoCaptureDevice::Name::GetModel() const +{ + return ""; +} +} +#endif diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 24b478268..8adad10f0 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -213,9 +213,13 @@ public: m_handle = pni->nativeResourceForContext(QByteArrayLiteral("cglcontextobj"), qtContext); else if (platform == QStringLiteral("qnx")) m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); - else + else if (platform == QStringLiteral("eglfs")) + m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); + else { + qFatal("%s platform not yet supported", platform.toLatin1().constData()); // Add missing platforms once they work. Q_UNREACHABLE(); + } } virtual void* GetHandle() Q_DECL_OVERRIDE { return m_handle; } diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index 44e353e8b..2cc13b7ea 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -9,13 +9,13 @@ cross_compile { GYP_ARGS = "-D qt_cross_compile=1 -D os_posix=1" TOOLCHAIN_SYSROOT = $$[QT_SYSROOT] - linux-android { + android { CC = $$which($$QMAKE_CC) ANDROID_TOOLCHAIN = $$dirname(CC) TOOLCHAIN_SYSROOT = $$ANDROID_BUILD_TOP - GYP_ARGS += "-D android_src=\"$${ANDROID_BUILD_TOP}\" -D android_toolchain=\"$${ANDROID_TOOLCHAIN}\"" \ - "-D android_ndk_root=\"$${ANDROID_BUILD_TOP}\" -D android_product_out=\"$${ANDROID_PRODUCT_OUT}\"" + GYP_ARGS += "-D qt_os=\"android\" -D android_src=\"$${TOOLCHAIN_SYSROOT}\" -D android_toolchain=\"$${ANDROID_TOOLCHAIN}\"" \ + "-D android_ndk_root=\"$${TOOLCHAIN_SYSROOT}\" -D android_product_out=\"$${ANDROID_PRODUCT_OUT}\"" } !isEmpty(TOOLCHAIN_SYSROOT): GYP_ARGS += "-D sysroot=\"$${TOOLCHAIN_SYSROOT}\"" diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi index 394f087fc..d1415f3f6 100644 --- a/src/core/qtwebengine.gypi +++ b/src/core/qtwebengine.gypi @@ -55,6 +55,34 @@ '<(chromium_src_dir)/base/allocator/allocator.gyp:allocator', ], }], + ['_toolset=="target" and qt_os=="android"', { + 'configurations': { + 'Debug_Base': { + # Reduce the binary size. + 'variables': { + 'debug_optimize%': 's', + }, + 'ldflags': [ + # Only link with needed input sections. + '-Wl,--gc-sections', + # Warn in case of text relocations. + '-Wl,--warn-shared-textrel', + '-Wl,-O1', + '-Wl,--as-needed', + ], + 'cflags': [ + '-fomit-frame-pointer', + '-fdata-sections', + '-ffunction-sections', + ], + }, + }, + 'dependencies': [ + '<(chromium_src_dir)/third_party/ashmem/ashmem.gyp:ashmem', + '<(chromium_src_dir)/third_party/freetype/freetype.gyp:ft2', + '<(chromium_src_dir)/third_party/android_tools/ndk/android_tools_ndk.gyp:cpu_features', + ], + }], ['OS=="win"', { 'resource_include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit', diff --git a/src/core/qtwebengine_extras.gypi b/src/core/qtwebengine_extras.gypi index f4d3e38b7..7eefe2062 100644 --- a/src/core/qtwebengine_extras.gypi +++ b/src/core/qtwebengine_extras.gypi @@ -1,6 +1,7 @@ { 'variables': { 'werror%': '', + 'qt_os%': '', }, 'target_defaults': { # patterns used to exclude chromium files from the build when we have a drop-in replacement diff --git a/src/process/process.pro b/src/process/process.pro index 8e9c37f86..cc68e3dda 100644 --- a/src/process/process.pro +++ b/src/process/process.pro @@ -5,10 +5,11 @@ macx { LIBPATH = $$getOutDir()/$$getConfigDir() CONFIG -= app_bundle } else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib -LIBS_PRIVATE += -lQt5WebEngineCore -L$$LIBPATH +LIBS_PRIVATE += -L$$LIBPATH -lQt5WebEngineCore QMAKE_RPATHDIR += $$LIBPATH qnx: QMAKE_RPATHLINKDIR += $${QNX_DIR}/$${QNX_CPUDIR}/usr/lib/qt5/lib +else: cross_compile: QMAKE_RPATHLINKDIR += $$[QT_INSTALL_LIBS] load(qt_build_paths) DESTDIR = $$MODULE_BASE_OUTDIR/libexec diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro index a78efaa6c..a683998af 100644 --- a/src/webenginewidgets/webenginewidgets.pro +++ b/src/webenginewidgets/webenginewidgets.pro @@ -15,7 +15,7 @@ QT_PRIVATE += widgets-private gui-private core-private # FIXME: all this should eventually be turned into QT += webenginecore macx:LIBPATH = $$getOutDir()/$$getConfigDir() else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib -LIBS_PRIVATE += -lQt5WebEngineCore -L$$LIBPATH +LIBS_PRIVATE += -L$$LIBPATH -lQt5WebEngineCore QMAKE_RPATHDIR += $$LIBPATH DESTDIR = $$LIBPATH @@ -38,9 +38,10 @@ HEADERS = \ load(qt_module) -# QNX ld only supports staging-relative rpath values and can't use the rpath specified above. +# Some binutils versions configured for cross compilation only support +# sysroot-relative rpath values and can't use the rpath specified above. # Instead, append an appropriate rpath-link to lib_qt_webenginewidgets.pri. -qnx:!build_pass { +cross_compile:!build_pass { local_build_rpath_link = "QMAKE_RPATHLINKDIR += $$LIBPATH" # MODULE_PRI is defined in qt_module_pris.prf write_file($$MODULE_PRI, local_build_rpath_link, append) diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index d4fdf6393..46d43be96 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -19,7 +19,9 @@ defineReplace(getConfigDir) { } defineReplace(extractCFlag) { - OPTION = $$find(QMAKE_CFLAGS, $$1) + CFLAGS = $$QMAKE_CFLAGS + !isEmpty(ANDROID_TARGET_CFLAGS): CFLAGS = $$ANDROID_TARGET_CFLAGS + OPTION = $$find(CFLAGS, $$1) OPTION = $$split(OPTION, =) return ($$member(OPTION, 1)) } -- cgit v1.2.3