From 937ff1c56be6bb0a3ef296b92fd1f2326b99dca9 Mon Sep 17 00:00:00 2001
From: Andras Becsi <andras.becsi@theqtcompany.com>
Date: Fri, 14 Aug 2015 15:17:25 +0200
Subject: [PATCH] Fix the build on embedded linux

This patch:
    - adds required options to the embedded_linux.pri config
    - adds missing events_ozone.gyp:events_ozone_evdev dependency
    - fixes pkg-config not to pick host paths when cross compiling
    - implements missing functions of the OzonePlatform interface
    - updates the submodule to include fixes for chromium

Change-Id: I77b384738fa7d41938a68c10a007728b10d7db28
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
---
 src/3rdparty                       |  2 +-
 src/core/config/embedded_linux.pri |  3 +++
 src/core/ozone_platform_eglfs.cpp  | 12 +++++++++++-
 src/core/ozone_platform_eglfs.h    |  3 +++
 src/core/qtwebengine.gypi          |  3 +++
 tools/buildscripts/gyp_qtwebengine |  5 +++++
 6 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/3rdparty b/src/3rdparty
index 154d7a361..4140f5c53 160000
--- a/src/3rdparty
+++ b/src/3rdparty
@@ -1 +1 @@
-Subproject commit 154d7a3611197845352b3e1d3ebeaf429d37e656
+Subproject commit 4140f5c535bd1626c06c6be122da6b97e2a737bb
diff --git a/src/core/config/embedded_linux.pri b/src/core/config/embedded_linux.pri
index 0133dc6b0..bc7c42ab7 100644
--- a/src/core/config/embedded_linux.pri
+++ b/src/core/config/embedded_linux.pri
@@ -23,6 +23,7 @@ GYP_CONFIG += \
     gtest_target_type=none \
     host_clang=0 \
     notifications=0 \
+    ozone_auto_platforms=0 \
     ozone_platform_dri=0 \
     ozone_platform_test=0 \
     p2p_apis=0 \
@@ -39,7 +40,9 @@ GYP_CONFIG += \
     use_gnome_keyring=0 \
     use_kerberos=0 \
     use_libpci=0 \
+    use_nss_certs=0 \
     use_openssl=1 \
+    use_openssl_certs=1 \
     use_ozone=1 \
     use_pango=0 \
     use_system_fontconfig=1 \
diff --git a/src/core/ozone_platform_eglfs.cpp b/src/core/ozone_platform_eglfs.cpp
index 43a3e4a11..9dca83685 100644
--- a/src/core/ozone_platform_eglfs.cpp
+++ b/src/core/ozone_platform_eglfs.cpp
@@ -95,6 +95,7 @@ public:
     void Restore() override { }
     void SetCursor(PlatformCursor) override { }
     void MoveCursorTo(const gfx::Point&) override { }
+    void ConfineCursorToBounds(const gfx::Rect&) override { }
 
     // PlatformEventDispatcher:
     bool CanDispatchEvent(const PlatformEvent& event) override;
@@ -160,6 +161,14 @@ scoped_ptr<PlatformWindow> OzonePlatformEglfs::CreatePlatformWindow(
                           bounds));
 }
 
+ui::InputController* OzonePlatformEglfs::GetInputController() {
+    return input_controller_.get();
+}
+
+scoped_ptr<ui::SystemInputInjector> OzonePlatformEglfs::CreateSystemInputInjector() {
+    return nullptr;  // no input injection support.
+}
+
 scoped_ptr<ui::NativeDisplayDelegate> OzonePlatformEglfs::CreateNativeDisplayDelegate()
 {
     return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone());
@@ -170,8 +179,9 @@ OzonePlatform* CreateOzonePlatformEglfs() { return new OzonePlatformEglfs; }
 void OzonePlatformEglfs::InitializeUI() {
   device_manager_ = CreateDeviceManager();
   cursor_factory_ozone_.reset(new CursorFactoryOzone());
-  event_factory_ozone_.reset(new EventFactoryEvdev(NULL, device_manager_.get()));
+  event_factory_ozone_.reset(new EventFactoryEvdev(NULL, device_manager_.get(), NULL));
   gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
+  input_controller_ = CreateStubInputController();
 }
 
 void OzonePlatformEglfs::InitializeGPU() {
diff --git a/src/core/ozone_platform_eglfs.h b/src/core/ozone_platform_eglfs.h
index 6954595dd..ae95fa8eb 100644
--- a/src/core/ozone_platform_eglfs.h
+++ b/src/core/ozone_platform_eglfs.h
@@ -62,6 +62,8 @@ class OzonePlatformEglfs : public OzonePlatform {
       PlatformWindowDelegate* delegate,
       const gfx::Rect& bounds) override;
   virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() override;
+  virtual ui::InputController* GetInputController() override;
+  virtual scoped_ptr<ui::SystemInputInjector> CreateSystemInputInjector() override;
 
  private:
   virtual void InitializeUI() override;
@@ -74,6 +76,7 @@ class OzonePlatformEglfs : public OzonePlatform {
 
   scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
   scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
+  scoped_ptr<InputController> input_controller_;
 
   DISALLOW_COPY_AND_ASSIGN(OzonePlatformEglfs);
 };
diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi
index cad6882eb..7a6b26ab7 100644
--- a/src/core/qtwebengine.gypi
+++ b/src/core/qtwebengine.gypi
@@ -84,6 +84,9 @@
             ],
           },
         },
+        'dependencies': [
+          '<(chromium_src_dir)/ui/events/ozone/events_ozone.gyp:events_ozone_evdev'
+        ]
       }],
       ['qt_os=="win32" and qt_gl=="opengl"', {
         'include_dirs': [
diff --git a/tools/buildscripts/gyp_qtwebengine b/tools/buildscripts/gyp_qtwebengine
index 116f8f2bd..39d9cc4b4 100755
--- a/tools/buildscripts/gyp_qtwebengine
+++ b/tools/buildscripts/gyp_qtwebengine
@@ -86,6 +86,11 @@ if __name__ == '__main__':
   if 'qt_cross_compile=1' in sys.argv:
     os.environ['GYP_CROSSCOMPILE'] = '1'
 
+  sysroot = 'sysroot='
+  for opt in sys.argv:
+    if opt.startswith(sysroot):
+        os.environ['PKG_CONFIG_SYSROOT_DIR'] = opt[len(sysroot):]
+
   gyp_helper.apply_chromium_gyp_env()
 
   # This could give false positives since it doesn't actually do real option
-- 
GitLab