Integrate crosswalk build with chromium-ewk build scripts
authorPiotr Tworek <p.tworek@samsung.com>
Tue, 10 Mar 2015 15:27:52 +0000 (16:27 +0100)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
The goal of the patch is simple, it should be possible to build
crosswalk for both desktop and tizen using the same scripts as we use
for chromium-ewk. The actual change is simple, but we have to take into
account the fact that we do configure chromium sligtly different than
crosswalk does. I does not seems to matter much for crosswalk, but it
means we'll have to test such setup at some point. Still this is the
only way to go if we intent to ship chromium code as a shared library
used by both xwalk binary and chromium-ewk lib at some point.

Change-Id: I212a38093b67ccb2f99b423177ad17599df3f7bf
Signed-off-by: Piotr Tworek <p.tworek@samsung.com>
Signed-off-by: hh4813.kim <hh4813.kim@samsung.com>
tizen_src/build/common.sh
tizen_src/build/gyp_chromiumefl
tizen_src/build/gyp_chromiumefl.sh
tizen_src/chromium_impl/content/child/npapi/webplugin_delegate_impl_efl.cc [new file with mode: 0644]
tizen_src/chromium_impl/content/content_efl.gypi
tizen_src/packaging/chromium-efl.spec

index e3c793f..629aa92 100755 (executable)
@@ -58,6 +58,7 @@ OPTIONS:
    -jN                   Set number of jobs, just like with make or ninja
    --skip-gyp            Skip restore_gyp, jhbuild and gyp_chromium steps
    --skip-ninja          Skip ninja step
+   --xwalk               Build crosswalk and friends
 
 examples:
 $0 --skip-gyp
@@ -76,6 +77,7 @@ function parseHostBuildScriptParams() {
   export SKIP_NINJA=0
   export BUILD_EWK_UNITTESTS=0
   export BUILD_CONTENT_SHELL=0
+  export BUILD_XWALK=0
   export BUILD_SUBDIRECTORY=Release
 
   local platform="$1"
@@ -112,6 +114,9 @@ function parseHostBuildScriptParams() {
       --debug)
         export BUILD_SUBDIRECTORY="Debug"
         ;;
+      --xwalk)
+        export BUILD_XWALK=1
+        ;;
       -j*)
         export JOBS="$1"
         ;;
@@ -139,6 +144,9 @@ function hostNinja() {
     if [[ $BUILD_CONTENT_SHELL == 1 ]]; then
       TARGETS="$TARGETS content_shell"
     fi
+    if [[ $BUILD_XWALK == 1 ]]; then
+      TARGETS="$TARGETS xwalk"
+    fi
     BUILDDIR=${GYP_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
     ninja -C $BUILDDIR ${JOBS} ${TARGETS}
   fi
index 8588027..48a2bb9 100755 (executable)
@@ -6,6 +6,7 @@ import subprocess
 import sys
 
 top_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
+xwalk_dir = os.path.join(top_dir, '..', 'xwalk')
 chrome_src = os.environ.get('CHROME_SRC')
 if chrome_src:
   chrome_src = os.path.abspath(chrome_src)
@@ -54,6 +55,7 @@ sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit',
 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit',
     'Source', 'build', 'scripts'))
 sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build'))
+sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build'))
 
 import repack_locales
 
@@ -76,6 +78,9 @@ def additional_include_files(args=[]):
     if os.path.realpath(path) not in specified_includes:
       result.append(path)
 
+  # Include xwalk common.gypi to effect chromium source tree.
+  AddInclude(os.path.join(xwalk_dir, 'build', 'common.gypi'))
+
   # Always include common.gypi.
   AddInclude(os.path.join(script_dir, 'common.gypi'))
 
@@ -121,7 +126,8 @@ if __name__ == '__main__':
       break
 
   if not gyp_file_specified:
-      args.append(os.path.join(top_dir, 'tizen_src', 'ewk', 'chromium-ewk.gyp'))
+      args.append(os.path.join(top_dir, 'ewk', 'chromium-ewk.gyp'))
+      args.append(os.path.join(xwalk_dir, 'xwalk.gyp'))
 
   args.extend(['-I' + i for i in additional_include_files(args)])
 
index 519dec9..58a8138 100755 (executable)
@@ -61,7 +61,7 @@ COMMON_GYP_PARAMETERS="
                       -Duse_openssl=1
                       -Duse_openssl_certs=1
                       -Dtizen_multimedia_support=1
-                      -Denable_plugins=0
+                      -Denable_plugins=1
                       -Duse_cups=0
                       -Duse_allocator=none
                       -Ddisable_fatal_linker_warnings=
@@ -86,6 +86,7 @@ add_arm_flags() {
 
 add_tizen_flags() {
   ADDITIONAL_GYP_PARAMETERS+="-Dbuilding_for_tizen=1
+                              -Dtizen=1
                               -Dwerror=
                               -Dpython_ver=$(getPythonVersion)
                               -Denable_basic_printing=1
@@ -97,6 +98,7 @@ add_tizen_flags() {
                               -Dlinux_use_bundled_gold=0
                               -Dlinux_use_gold_flags=0
                               -Dlinux_use_bundled_binutils=0
+                              -Ddisable_nacl=1
                               -Dprebuilt_ld_gold_dir=${TOPDIR}/tizen_src/build/prebuild
                              "
   if [ "$target" == "mobile" ]; then
@@ -186,7 +188,8 @@ done
 
 ${TOPDIR}/tizen_src/build/gyp_chromiumefl \
     ${_GYP_ARGS} \
-    ${TOPDIR}/tizen_src/ewk/chromium-ewk.gyp
+    ${TOPDIR}/tizen_src/ewk/chromium-ewk.gyp \
+    ${TOPDIR}/xwalk/xwalk.gyp
 
 ret=$?
 
diff --git a/tizen_src/chromium_impl/content/child/npapi/webplugin_delegate_impl_efl.cc b/tizen_src/chromium_impl/content/child/npapi/webplugin_delegate_impl_efl.cc
new file mode 100644 (file)
index 0000000..a700e7c
--- /dev/null
@@ -0,0 +1,66 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/child/npapi/webplugin_delegate_impl.h"
+
+#include "content/child/npapi/plugin_instance.h"
+#include "content/common/cursors/webcursor.h"
+
+using blink::WebInputEvent;
+
+namespace content {
+
+WebPluginDelegateImpl::WebPluginDelegateImpl(WebPlugin* plugin,
+                                             PluginInstance* instance) {
+}
+
+WebPluginDelegateImpl::~WebPluginDelegateImpl() {
+}
+
+bool WebPluginDelegateImpl::PlatformInitialize() {
+  return true;
+}
+
+void WebPluginDelegateImpl::PlatformDestroyInstance() {
+  // Nothing to do here.
+}
+
+void WebPluginDelegateImpl::Paint(SkCanvas* canvas, const gfx::Rect& rect) {
+}
+
+bool WebPluginDelegateImpl::WindowedCreatePlugin() {
+  return true;
+}
+
+void WebPluginDelegateImpl::WindowedDestroyWindow() {
+}
+
+bool WebPluginDelegateImpl::WindowedReposition(
+    const gfx::Rect& window_rect,
+    const gfx::Rect& clip_rect) {
+  return true;
+}
+
+void WebPluginDelegateImpl::WindowedSetWindow() {
+}
+
+void WebPluginDelegateImpl::WindowlessUpdateGeometry(
+    const gfx::Rect& window_rect,
+    const gfx::Rect& clip_rect) {
+}
+
+void WebPluginDelegateImpl::WindowlessPaint(gfx::NativeDrawingContext context,
+                                            const gfx::Rect& damage_rect) {
+}
+
+bool WebPluginDelegateImpl::PlatformSetPluginHasFocus(bool focused) {
+  return true;
+}
+
+bool WebPluginDelegateImpl::PlatformHandleInputEvent(
+    const WebInputEvent& event, WebCursor::CursorInfo* cursor_info) {
+  return false;
+}
+
+}  // namespace content
index b8eb313..b7d95f3 100644 (file)
         ],
       }],
 
+      ['_target_name=="content_child"', {
+        'sources': [
+          'child/npapi/webplugin_delegate_impl_efl.cc',
+        ],
+      }],
+
       ['_target_name=="content_shell_lib"', {
         'sources': [
           'shell/browser/shell_efl.cc',
index 2a6f964..805969d 100644 (file)
@@ -152,6 +152,17 @@ BuildRequires: pkgconfig(gstreamer-plugins-base-0.10)
 BuildRequires: pkgconfig(gstreamer-app-0.10)
 %endif
 
+%if 0%{?build_xwalk}
+BuildRequires:  pkgconfig(xmlsec1)
+BuildRequires:  pkgconfig(haptic)
+BuildRequires:  pkgconfig(nss)
+BuildRequires:  pkgconfig(pkgmgr)
+BuildRequires:  pkgconfig(pkgmgr-info)
+BuildRequires:  pkgconfig(pkgmgr-installer)
+BuildRequires:  pkgconfig(pkgmgr-parser)
+BuildRequires:  pkgconfig(secure-storage)
+%endif
+
 %description
 Browser Engine based on Chromium EFL (Shared Library)
 
@@ -171,6 +182,15 @@ Requires: %{name} = %{version}-%{release}
 Chromium EFL version of content_shell application
 %endif
 
+%if 0%{?build_xwalk}
+%package -n crosswalk
+Summary: Chromium-based app rintime
+Group: Web Framework/Web Run Time
+%description -n crosswalk
+Crosswalk is an app runtime based on Chromium. It is an open source project
+started by the Intel Open Source Technology Center (http://www.01.org).
+%endif
+
 %if 0%{?_enable_unittests}
 %package unittests
 Summary: Chromium unittests
@@ -197,6 +217,13 @@ Group: Development/Libraries
 Selenium WebDriver for t-browser
 %endif
 
+%define _manifestdir %TZ_SYS_RO_PACKAGES
+%define _manifestdir_ro %TZ_SYS_RO_PACKAGE
+%define _desktop_icondir %TZ_SYS_RW_ICONS/default/small
+%define _desktop_icondir_ro %TZ_SYS_RO_ICONS/default/small
+%define _dbusservicedir /usr/share/dbus-1/services
+%define _systemduserservicedir /usr/lib/systemd/user
+
 # Directory for internal chromium executable components
 %global CHROMIUM_EXE_DIR %{_libdir}/%{name}
 # Constant read only data used by chromium-efl port
@@ -267,11 +294,24 @@ export GYP_GENERATOR_OUTPUT=$PWD/%{OUTPUT_BASE_FOLDER}
 %else
   %global OUTPUT_FOLDER %{OUTPUT_BASE_FOLDER}/Release
 %endif
+%global XWALK_GEN %{OUTPUT_FOLDER}/xwalk_gen
 
 if type ccache &> /dev/null; then
   source build/ccache_env.sh %{OUTPUT_BUILD_PROFILE_TARGET}
 fi
 
+%if 0%{?build_xwalk}
+  mkdir -p "%{XWALK_GEN}"
+  sed "s/@VERSION@/%{version}/g" xwalk/packaging/crosswalk.xml.in > "%{XWALK_GEN}"/crosswalk.xml
+  sed "s|@LIB_INSTALL_DIR@|%{_libdir}|g" xwalk/packaging/xwalk.in > "%{XWALK_GEN}"/xwalk
+  sed "s|@LIB_INSTALL_DIR@|%{_libdir}|g" xwalk/packaging/xwalk.service.in > "%{XWALK_GEN}"/xwalk.service
+  cp -a xwalk/packaging/crosswalk.manifest "%{XWALK_GEN}"
+  cp -a xwalk/packaging/crosswalk.png "%{XWALK_GEN}"
+  cp -a xwalk/LICENSE "%{XWALK_GEN}"/LICENSE.xwalk
+  cp -a AUTHORS "%{XWALK_GEN}"/AUTHORS.chromium
+  cp -a LICENSE "%{XWALK_GEN}"/LICENSE.chromium
+%endif
+
 #gyp generate
 %if %{?_skip_gyp:0}%{!?_skip_gyp:1}
 #run standard gyp_chromiumefl wrapper
@@ -289,6 +329,7 @@ fi
 %if 0%{?chromium_efl_tizen_version:1}
   -Dchromium_efl_tizen_version=%{chromium_efl_tizen_version} \
 %endif
+  -Dtizen_"%{OUTPUT_BUILD_PROFILE_TARGET}"=1 \
   -Dbuilding_for_tizen_"%{OUTPUT_BUILD_PROFILE_TARGET}"=1
 %endif
 
@@ -306,6 +347,9 @@ tizen_src/build/prebuild/ninja %{_smp_mflags} -C"%{OUTPUT_FOLDER}" \
 %if 0%{?build_chromedriver}
   chromedriver_efl \
 %endif
+%if 0%{?build_xwalk}
+  xwalk xwalk_launcher xwalk_application_tools \
+%endif
   efl_webprocess chromium-ewk efl_webview_app mini_browser ubrowser
 
 %if 0%{?_enable_unittests}
@@ -441,6 +485,36 @@ install -m 0644 "%{OUTPUT_FOLDER}"/ewk_unittests %{buildroot}/opt/usr/utc_exec/
 install -m 0755 tizen_src/ewk/utc_gtest_run.sh %{buildroot}/opt/usr/utc_exec/
 %endif
 
+%if 0%{?build_xwalk}
+install -m 0755 -p -D %{OUTPUT_FOLDER}/xwalk %{buildroot}%{_libdir}/xwalk/xwalk
+install -m 0755 -p -D %{OUTPUT_FOLDER}/xwalkctl %{buildroot}%{_bindir}/xwalkctl
+install -m 0755 -p -D %{OUTPUT_FOLDER}/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher
+install -m 0755 -p -D %{OUTPUT_FOLDER}/xwalk_backend %{buildroot}%{_libdir}/xwalk/xwalk_backend
+
+# Supporting libraries and resources.
+install -m 0644 -p -D xwalk/packaging/org.crosswalkproject.Runtime1.service %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service
+install -m 0644 -p -D %{XWALK_GEN}/xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service
+install -m 0644 -p -D %{OUTPUT_FOLDER}/lib/libxwalk_backend_lib.so %{buildroot}%{_libdir}/xwalk/libxwalk_backend_lib.so
+install -m 0644 -p -D %{OUTPUT_FOLDER}/icudtl.dat %{buildroot}%{_libdir}/xwalk/icudtl.dat
+install -m 0644 -p -D %{OUTPUT_FOLDER}/libffmpegsumo.so %{buildroot}%{_libdir}/xwalk/libffmpegsumo.so
+install -m 0644 -p -D %{OUTPUT_FOLDER}/xwalk.pak %{buildroot}%{_libdir}/xwalk/xwalk.pak
+install -d %{buildroot}%{_datadir}/xwalk
+install -m 0644 -p -D xwalk/application/common/tizen/configuration/*.xsd %{buildroot}%{_datadir}/xwalk
+
+# PNaCl
+%if %{?_disable_nacl}%{!?_disable_nacl:1} == 0
+install -m 0755 -p -D %{OUTPUT_FOLDER}/nacl_bootstrap_raw %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_raw
+install -m 0755 -p -D %{OUTPUT_FOLDER}/nacl_helper %{buildroot}%{_libdir}/xwalk/nacl_helper
+install -m 0755 -p -D %{OUTPUT_FOLDER}/nacl_helper_bootstrap %{buildroot}%{_libdir}/xwalk/nacl_helper_bootstrap
+install -m 0644 -p -D %{OUTPUT_FOLDER}/nacl_irt_*.nexe %{buildroot}%{_libdir}/xwalk
+install -d %{buildroot}%{_libdir}/xwalk/pnacl
+install -m 0644 -p -D %{OUTPUT_FOLDER}/pnacl/* %{buildroot}%{_libdir}/xwalk/pnacl
+%endif
+
+# Register xwalk to the package manager.
+install -m 0644 -p -D %{XWALK_GEN}/crosswalk.xml %{buildroot}%{_manifestdir}/crosswalk.xml
+install -m 0644 -p -D %{XWALK_GEN}/crosswalk.png %{buildroot}%{_desktop_icondir}/crosswalk.png
+%endif
 
 %post
 # apply smack rule
@@ -456,6 +530,23 @@ smack_reload.sh
 mkdir -p %{CHROMIUM_WEBDB_DIR}/data/
 chown -R app:app %{CHROMIUM_WEBDB_DIR}/data
 
+mkdir -p %{_desktop_icondir_ro}
+mkdir -p %{_manifestdir_ro}
+
+ln -sf %{_libdir}/xwalk/libxwalk_backend_lib.so /etc/package-manager/backendlib/libxpk.so
+ln -sf %{_libdir}/xwalk/libxwalk_backend_lib.so /etc/package-manager/backendlib/libwgt.so
+ln -sf %{_libdir}/xwalk/xwalk_backend /etc/package-manager/backend/xpk
+ln -sf %{_libdir}/xwalk/xwalk_backend /etc/package-manager/backend/wgt
+
+%preun
+if [ $1 -eq 0 ] ; then
+ # don't remove if we are upgrade the rpm package
+[ -L /etc/package-manager/backendlib/libxpk.so ] && rm /etc/package-manager/backendlib/libxpk.so
+[ -L /etc/package-manager/backendlib/libwgt.so ] && rm /etc/package-manager/backendlib/libwgt.so
+[ -L /etc/package-manager/backend/xpk ] && rm /etc/package-manager/backend/xpk
+[ -L /etc/package-manager/backend/wgt ] && rm /etc/package-manager/backend/wgt
+fi
+
 %postun
 
 %files
@@ -517,3 +608,29 @@ chown -R app:app %{CHROMIUM_WEBDB_DIR}/data
 /usr/bin/start-chrome-driver.sh
 /usr/apps/com.samsung.chromedriver
 %endif
+
+%if 0%{?build_xwalk}
+%files -n crosswalk
+%manifest %{XWALK_GEN}/crosswalk.manifest
+%license %{XWALK_GEN}/AUTHORS.chromium %{XWALK_GEN}/LICENSE.chromium %{XWALK_GEN}/LICENSE.xwalk
+%{_bindir}/xwalkctl
+%{_bindir}/xwalk-launcher
+%{_libdir}/xwalk/icudtl.dat
+%{_libdir}/xwalk/libffmpegsumo.so
+%if %{?_disable_nacl}%{!?_disable_nacl:1} == 0
+%{_libdir}/xwalk/nacl_bootstrap_raw
+%{_libdir}/xwalk/nacl_helper
+%{_libdir}/xwalk/nacl_helper_bootstrap
+%{_libdir}/xwalk/nacl_irt_*.nexe
+%{_libdir}/xwalk/pnacl/*
+%endif
+%{_libdir}/xwalk/xwalk
+%{_libdir}/xwalk/xwalk.pak
+%{_libdir}/xwalk/libxwalk_backend_lib.so
+%{_libdir}/xwalk/xwalk_backend
+%{_manifestdir}/crosswalk.xml
+%{_desktop_icondir}/crosswalk.png
+%{_dbusservicedir}/org.crosswalkproject.Runtime1.service
+%{_systemduserservicedir}/xwalk.service
+%{_datadir}/xwalk/*
+%endif