--- /dev/null
+Author: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
+
+This patch is part of a hack to allow us to split Crosswalk into two separate
+packages, crosswalk-libs (with Chromium shared libraries and all dependencies
+required by Crosswalk itself) and crosswalk-bin (with the Crosswalk binaries).
+
+If passes "--define build_libs 0" to the spec file, crosswalk-libs will not be
+built and we assume it is already installed. This patch is then applied to the
+source tree to make big targets that used to consume a lot of time and CPU by
+generating and building a lot of files do nothing but pass "-l<some_target>" to
+the linker. In other words, we cheat the build system into thinking those
+targets do not need to build anything.
+
+Not all targets can be converted like this, and keeping the patch up-to-date
+across Chromium releases requires manual intervention. Some rules of thumb:
+
+* Only targets whose original type is '<(component)' or 'shared_library' can be
+ converted like this. 'static_library' targets are expected to remain static
+ (technically it is possible to convert them, but then the hack gets even
+ bigger and there is no guarantee that a certain target is expected to work as
+ a shared library in the first place). If they are part of a shared library we
+ have converted they will not need to be built at all, and if a target in
+ Crosswalk itself requires them the static library will need to exist anyway.
+
+* 'direct_dependent_settings' need to be maintained, as targets that depend on
+ a converted one still need include paths and other things specified there.
+
+* 'export_depent_settings' and 'all_dependent_settings' need to be preserved
+ for the same reason: a target that depends on the converted one may still
+ need other libraries that it does not depend on directly. Consequently, this
+ means that a certain amount of targets in 'dependencies' also need to be
+ kept, since a target must be in the 'dependencies' list to be in
+ '*_dependent_settings'.
+
+* 'actions' need to be removed from the original target, as otherwise there is
+ more than one target that generates the same files.
+
+* Some target dependencies may be needed even if they are not in one of the
+ '*_dependent_settings' lists. For example, targets that generate code, like
+ the mojo ones.
+
+* Some gyp files are trickier than others. contents.gyp and skia.gyp, for
+ example, get a lot of additional settings from the .gypi files that they
+ include. This all needs to be carefully examined when updating the patch.
+
+The best way to make sure the patch still works with a newer Chromium release
+is to call `gbs build' with `--define build_bin 0' first so that only
+crosswalk-libs is generated, then install/upgrade that package and finally call
+`gbs build' with `--define build_libs 0' to build only crosswalk-bin. In the
+best case, everything still builds and the total number of targets is still
+similar to the previous count. If that is not the case, you need to check which
+Crosswalk targets have started depending on others from Chromium and, if
+possible, convert some of them.
+
+BUG=XWALK-2571
+--- src/base/base.gyp
++++ src/base/base.gyp
+@@ -13,6 +13,74 @@
+ 'targets': [
+ {
+ 'target_name': 'base',
++ 'type': 'none',
++ 'toolsets': ['host', 'target'],
++ 'link_settings': {
++ 'libraries': [
++ '-lbase',
++ ],
++ },
++ # TODO(gregoryd): direct_dependent_settings should be shared with the
++ # 64-bit target, but it doesn't work due to a bug in gyp
++ 'direct_dependent_settings': {
++ 'include_dirs': [
++ '..',
++ ],
++ },
++ 'conditions': [
++ ['use_glib==1 or <(use_ozone)==1', {
++ 'dependencies': [
++ '../build/linux/system.gyp:glib',
++ ],
++ 'export_dependent_settings': [
++ '../build/linux/system.gyp:glib',
++ ],
++ }],
++ ['OS == "linux"', {
++ 'link_settings': {
++ 'libraries': [
++ # We need rt for clock_gettime().
++ '-lrt',
++ # For 'native_library_linux.cc'
++ '-ldl',
++ ],
++ },
++ }],
++ ],
++ },
++ {
++ 'target_name': 'base_i18n',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lbase_i18n',
++ ],
++ },
++ 'dependencies': [
++ 'base',
++ ],
++ 'export_dependent_settings': [
++ 'base',
++ ],
++ },
++ {
++ 'target_name': 'base_prefs',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lbase_prefs',
++ ],
++ },
++ 'dependencies': [
++ 'base',
++ ],
++ 'export_dependent_settings': [
++ 'base',
++ ],
++ },
++
++ {
++ 'target_name': 'base_original',
+ 'type': '<(component)',
+ 'toolsets': ['host', 'target'],
+ 'variables': {
+@@ -256,7 +323,7 @@
+ ],
+ },
+ {
+- 'target_name': 'base_i18n',
++ 'target_name': 'base_i18n_original',
+ 'type': '<(component)',
+ 'variables': {
+ 'enable_wexit_time_destructors': 1,
+@@ -308,7 +375,7 @@
+ ],
+ },
+ {
+- 'target_name': 'base_prefs',
++ 'target_name': 'base_prefs_original',
+ 'type': '<(component)',
+ 'variables': {
+ 'enable_wexit_time_destructors': 1,
+--- src/cc/cc.gyp
++++ src/cc/cc.gyp
+@@ -10,6 +10,21 @@
+ {
+ # GN version: //cc
+ 'target_name': 'cc',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lcc',
++ ],
++ },
++ # Include src/gpu for gl2chromium.h.
++ 'dependencies': [
++ '../third_party/khronos/khronos.gyp:khronos_headers',
++ ],
++ },
++
++ {
++ # GN version: //cc
++ 'target_name': 'cc_original',
+ 'type': '<(component)',
+ 'dependencies': [
+ '<(DEPTH)/base/base.gyp:base',
+--- src/content/content.gyp
++++ src/content/content.gyp
+@@ -21,6 +21,69 @@
+ }],
+ ],
+ },
++
++ 'targets': [
++ {
++ # GN version: //content
++ 'target_name': 'content',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lcontent',
++ ],
++ },
++
++ 'dependencies': [
++ '../ui/accessibility/accessibility.gyp:ax_gen',
++ '../third_party/WebKit/public/blink_headers.gyp:blink_headers',
++ '../skia/skia.gyp:skia',
++
++ '../device/battery/battery.gyp:device_battery_mojo_bindings',
++ '../device/vibration/vibration.gyp:device_vibration_mojo_bindings',
++ '../mojo/mojo_base.gyp:mojo_environment_chromium',
++ '../third_party/mojo/mojo_edk.gyp:mojo_system_impl',
++ '../third_party/mojo/mojo_public.gyp:mojo_application_bindings',
++ '../third_party/mojo/mojo_public.gyp:mojo_cpp_bindings',
++ 'content_common_mojo_bindings.gyp:content_common_mojo_bindings',
++ ],
++ 'export_dependent_settings': [
++ '../ui/accessibility/accessibility.gyp:ax_gen',
++ # The public content API headers directly include Blink API headers, so we
++ # have to export the blink header settings so that relative paths in these
++ # headers resolve correctly.
++ '../third_party/WebKit/public/blink_headers.gyp:blink_headers',
++ # The public render_widget_host.h needs to re-export skia defines.
++ '../skia/skia.gyp:skia',
++ 'content_common_mojo_bindings.gyp:content_common_mojo_bindings',
++ ],
++
++ 'actions': [
++ {
++ 'action_name': 'generate_webkit_version',
++ 'inputs': [
++ '<(script)',
++ '<(lastchange)',
++ '<(template)',
++ ],
++ 'outputs': [
++ '<(SHARED_INTERMEDIATE_DIR)/webkit_version.h',
++ ],
++ 'action': ['python',
++ '<(script)',
++ '-f', '<(lastchange)',
++ '<(template)',
++ '<@(_outputs)',
++ ],
++ 'variables': {
++ 'script': '<(DEPTH)/build/util/version.py',
++ 'lastchange': '<(DEPTH)/build/util/LASTCHANGE.blink',
++ 'template': 'webkit_version.h.in',
++ },
++ },
++ ],
++ },
++ ],
++
+ 'conditions': [
+ ['OS != "ios"', {
+ 'includes': [
+@@ -291,7 +349,7 @@
+ 'targets': [
+ {
+ # GN version: //content
+- 'target_name': 'content',
++ 'target_name': 'content_original',
+ 'type': 'shared_library',
+ 'variables': { 'enable_wexit_time_destructors': 1, },
+ 'dependencies': [
+--- src/content/content_common.gypi
++++ src/content/content_common.gypi
+@@ -569,30 +569,6 @@
+ '../ui/gl/gl.gyp:gl',
+ '../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu',
+ ],
+- 'actions': [
+- {
+- 'action_name': 'generate_webkit_version',
+- 'inputs': [
+- '<(script)',
+- '<(lastchange)',
+- '<(template)',
+- ],
+- 'outputs': [
+- '<(SHARED_INTERMEDIATE_DIR)/webkit_version.h',
+- ],
+- 'action': ['python',
+- '<(script)',
+- '-f', '<(lastchange)',
+- '<(template)',
+- '<@(_outputs)',
+- ],
+- 'variables': {
+- 'script': '<(DEPTH)/build/util/version.py',
+- 'lastchange': '<(DEPTH)/build/util/LASTCHANGE.blink',
+- 'template': 'webkit_version.h.in',
+- },
+- },
+- ],
+ }],
+ ['OS=="mac"', {
+ 'dependencies': [
+--- src/gpu/gpu.gyp
++++ src/gpu/gpu.gyp
+@@ -11,6 +11,17 @@
+ ],
+ 'targets': [
+ {
++ # GN version: //gpu
++ 'target_name': 'gpu',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lgpu',
++ ],
++ },
++ },
++
++ {
+ # Library emulates GLES2 using command_buffers.
+ # GN version: //gpu/command_buffer/client:gles2_implementation
+ 'target_name': 'gles2_implementation',
+@@ -522,7 +533,7 @@
+ },
+ {
+ # GN version: //gpu
+- 'target_name': 'gpu',
++ 'target_name': 'gpu_original',
+ 'type': 'shared_library',
+ 'includes': [
+ 'command_buffer_client.gypi',
+--- src/media/media.gyp
++++ src/media/media.gyp
+@@ -49,6 +49,22 @@
+ {
+ # GN version: //media
+ 'target_name': 'media',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lmedia',
++ ],
++ },
++ 'direct_dependent_settings': {
++ 'include_dirs': [
++ '..',
++ ],
++ },
++ },
++
++ {
++ # GN version: //media
++ 'target_name': 'media_original',
+ 'type': '<(component)',
+ 'dependencies': [
+ '../base/base.gyp:base',
+--- src/third_party/mojo/mojo_edk.gyp
++++ src/third_party/mojo/mojo_edk.gyp
+@@ -10,6 +10,21 @@
+ {
+ # GN version: //mojo/edk/system
+ 'target_name': 'mojo_system_impl',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lmojo_system_impl',
++ ],
++ },
++ 'all_dependent_settings': {
++ # Ensures that dependent projects import the core functions on Windows.
++ 'defines': ['MOJO_USE_SYSTEM_IMPL'],
++ },
++ },
++
++ {
++ # GN version: //mojo/edk/system
++ 'target_name': 'mojo_system_original',
+ 'type': '<(component)',
+ 'dependencies': [
+ '../base/base.gyp:base',
+--- src/net/net.gyp
++++ src/net/net.gyp
+@@ -44,6 +44,42 @@
+ ],
+ 'targets': [
+ {
++ 'target_name': 'net',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lnet',
++ ],
++ },
++ 'dependencies': [
++ '../base/base.gyp:base',
++ ],
++ 'export_dependent_settings': [
++ '../base/base.gyp:base',
++ ],
++ 'conditions': [
++ ['use_kerberos==1', {
++ 'conditions': [
++ ['linux_link_kerberos==1', {
++ 'link_settings': {
++ 'ldflags': [
++ '<!@(krb5-config --libs gssapi)',
++ ],
++ },
++ }],
++ ],
++ }],
++ ['posix_avoid_mmap==1', {
++ 'direct_dependent_settings': {
++ 'defines': [
++ 'POSIX_AVOID_MMAP',
++ ],
++ },
++ }],
++ ],
++ },
++
++ {
+ 'target_name': 'net_derived_sources',
+ 'type': 'none',
+ 'sources': [
+@@ -80,7 +116,7 @@
+ },
+ },
+ {
+- 'target_name': 'net',
++ 'target_name': 'net_original',
+ 'type': '<(component)',
+ 'variables': { 'enable_wexit_time_destructors': 1, },
+ 'dependencies': [
+@@ -1177,6 +1213,16 @@
+ 'targets': [
+ {
+ 'target_name': 'net_with_v8',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lnet_with_v8',
++ ],
++ },
++ },
++
++ {
++ 'target_name': 'net_with_v8_original',
+ 'type': '<(component)',
+ 'variables': { 'enable_wexit_time_destructors': 1, },
+ 'dependencies': [
+--- src/ppapi/ppapi_internal.gyp
++++ src/ppapi/ppapi_internal.gyp
+@@ -35,6 +35,38 @@
+ {
+ # GN version: //ppapi:ppapi_shared
+ 'target_name': 'ppapi_shared',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lppapi_shared',
++ ],
++ },
++ 'dependencies': [
++ '../base/base.gyp:base',
++ ],
++ 'export_dependent_settings': [
++ '../base/base.gyp:base',
++ ],
++ },
++ {
++ # GN version: //ppapi:ppapi_proxy
++ 'target_name': 'ppapi_proxy',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lppapi_proxy',
++ ],
++ },
++ 'all_dependent_settings': {
++ 'include_dirs': [
++ '..',
++ ],
++ },
++ },
++
++ {
++ # GN version: //ppapi:ppapi_shared
++ 'target_name': 'ppapi_shared_original',
+ 'type': '<(component)',
+ 'variables': {
+ # Set the ppapi_shared_target variable, so that we will pull in the
+@@ -164,7 +196,7 @@
+ 'targets': [
+ {
+ # GN version: //ppapi:ppapi_proxy
+- 'target_name': 'ppapi_proxy',
++ 'target_name': 'ppapi_proxy_original',
+ 'type': 'shared_library',
+ 'variables': {
+ # Setting both variables means we pull in the sources from both
+--- src/skia/skia.gyp
++++ src/skia/skia.gyp
+@@ -54,6 +54,46 @@
+ 'targets': [
+ {
+ 'target_name': 'skia',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lskia',
++ ],
++ },
++ 'includes': [
++ 'skia_common.gypi',
++ ],
++ 'direct_dependent_settings': {
++ 'defines': [
++ 'SKIA_DLL',
++ 'GR_GL_IGNORE_ES3_MSAA=0',
++
++ # From skia_common.gypi:
++ # For POSIX platforms, prefer the Mutex implementation provided
++ # by Skia since it does not generate static initializers.
++ 'SK_USE_POSIX_THREADS',
++
++ '<@(skia_export_defines)',
++ ],
++ 'include_dirs': [
++ #temporary until we can hide SkFontHost
++ '../third_party/skia/src/core',
++
++ '../third_party/skia/include/core',
++ '../third_party/skia/include/effects',
++ '../third_party/skia/include/pdf',
++ '../third_party/skia/include/gpu',
++ '../third_party/skia/include/lazy',
++ '../third_party/skia/include/pathops',
++ '../third_party/skia/include/pipe',
++ '../third_party/skia/include/ports',
++ '../third_party/skia/include/utils',
++ ],
++ },
++ },
++
++ {
++ 'target_name': 'skia_original',
+ 'type': 'shared_library',
+ 'includes': [
+ 'skia_library.gypi',
+--- src/storage/storage_browser.gyp
++++ src/storage/storage_browser.gyp
+@@ -10,6 +10,17 @@
+ {
+ # GN version: //storage/browser
+ 'target_name': 'storage',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lstorage',
++ ],
++ },
++ },
++
++ {
++ # GN version: //storage/browser
++ 'target_name': 'storage_original',
+ 'type': '<(component)',
+ 'variables': { 'enable_wexit_time_destructors': 1, },
+ 'dependencies': [
+--- src/storage/storage_common.gyp
++++ src/storage/storage_common.gyp
+@@ -10,6 +10,17 @@
+ {
+ # GN version: //storage/common
+ 'target_name': 'storage_common',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lstorage_common',
++ ],
++ },
++ },
++
++ {
++ # GN version: //storage/common
++ 'target_name': 'storage_common_original',
+ 'type': '<(component)',
+ 'variables': { 'enable_wexit_time_destructors': 1, },
+ 'dependencies': [
+--- src/sync/sync.gyp
++++ src/sync/sync.gyp
+@@ -27,12 +27,27 @@
+ 'sync_proto',
+ ],
+ },
++ {
++ 'target_name': 'sync_core',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lsync_core',
++ ],
++ },
++ 'dependencies': [
++ 'sync_proto',
++ ],
++ 'export_dependent_settings': [
++ 'sync_proto',
++ ],
++ },
+
+ # Contains everything related to sync implementation that does not depend
+ # on chrome/ or components/. Do not depend on this directly. Depend on
+ # the 'sync' target to get the sync protobufs, too.
+ {
+- 'target_name': 'sync_core',
++ 'target_name': 'sync_core_original',
+ 'type': '<(component)',
+ 'variables': { 'enable_wexit_time_desctructors': 1, },
+ 'defines': [
+--- src/third_party/WebKit/public/blink.gyp
++++ src/third_party/WebKit/public/blink.gyp
+@@ -36,17 +36,19 @@
+ # GN version: //third_party/WebKit/public:blink
+ 'target_name': 'blink',
+ 'type': 'none',
+- 'dependencies': [
+- '../Source/platform/blink_platform.gyp:blink_platform',
+- '../Source/web/web.gyp:blink_web',
+- 'blink_headers.gyp:blink_headers',
+- 'blink_minimal',
+- ],
+- 'export_dependent_settings': [
+- '../Source/web/web.gyp:blink_web',
+- '../Source/platform/blink_platform.gyp:blink_platform',
+- 'blink_minimal',
+- ],
++ 'direct_dependent_settings': {
++ 'include_dirs': [
++ '..',
++ '<(DEPTH)/v8/include',
++ ],
++ },
++ 'link_settings': {
++ 'libraries': [
++ '-lblink_common',
++ '-lblink_web',
++ '-lblink_platform',
++ ],
++ },
+ },
+ {
+ # This target provides a minimal set of Blink APIs such as WebString to use in
+--- src/third_party/angle/src/compiler.gypi
++++ src/third_party/angle/src/compiler.gypi
+@@ -236,6 +236,16 @@
+
+ {
+ 'target_name': 'translator',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-ltranslator',
++ ],
++ },
++ },
++
++ {
++ 'target_name': 'translator_original',
+ 'type': '<(component)',
+ 'dependencies': [ 'translator_lib' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+--- src/third_party/ffmpeg/ffmpeg.gyp
++++ src/third_party/ffmpeg/ffmpeg.gyp
+@@ -150,6 +150,12 @@
+ 'targets': [
+ {
+ 'target_name': 'ffmpegsumo',
++ 'type': 'none',
++ # No 'link_settings', ffmpegsumo is a 'loadable_module'.
++ },
++
++ {
++ 'target_name': 'ffmpegsumo_original',
+ 'type': 'loadable_module',
+ 'sources': [
+ '<@(c_sources)',
+@@ -429,6 +435,61 @@
+ 'targets': [
+ {
+ 'target_name': 'ffmpeg',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lffmpeg',
++ ],
++ },
++ 'direct_dependent_settings': {
++ 'defines': [
++ '__STDC_CONSTANT_MACROS', # FFmpeg uses INT64_C.
++ ],
++ 'include_dirs': [
++ '<(output_root)',
++ '../..', # The chromium 'src' directory.
++ '<(platform_config_root)',
++ '.',
++ ],
++ },
++ 'variables': {
++ 'outfile_type': 'posix_stubs',
++ 'stubs_filename_root': 'ffmpeg_stubs',
++ 'project_path': 'third_party/ffmpeg',
++ 'intermediate_dir': '<(INTERMEDIATE_DIR)',
++ 'output_root': '<(SHARED_INTERMEDIATE_DIR)/ffmpeg',
++ 'platform_config_root': 'chromium/config/<(ffmpeg_branding)/<(os_config)/<(ffmpeg_config)'
++ },
++ 'actions': [
++ {
++ 'action_name': 'generate_stubs',
++ 'inputs': [
++ '<(generate_stubs_script)',
++ '<(extra_header)',
++ '<@(sig_files)',
++ ],
++ 'outputs': [
++ '<(intermediate_dir)/<(stubs_filename_root).cc',
++ '<(output_root)/<(project_path)/<(stubs_filename_root).h',
++ ],
++ 'action': ['python',
++ '<(generate_stubs_script)',
++ '-i', '<(intermediate_dir)',
++ '-o', '<(output_root)/<(project_path)',
++ '-t', '<(outfile_type)',
++ '-e', '<(extra_header)',
++ '-s', '<(stubs_filename_root)',
++ '-p', '<(project_path)',
++ '<@(_inputs)',
++ ],
++ 'process_outputs_as_sources': 1,
++ 'message': 'Generating FFmpeg stubs for dynamic loading',
++ },
++ ],
++ },
++
++ {
++ 'target_name': 'ffmpeg_original',
+ 'sources': [
+ # Files needed for stub generation rules.
+ '<@(sig_files)',
+@@ -536,32 +597,6 @@
+ '.',
+ ],
+ },
+- 'actions': [
+- {
+- 'action_name': 'generate_stubs',
+- 'inputs': [
+- '<(generate_stubs_script)',
+- '<(extra_header)',
+- '<@(sig_files)',
+- ],
+- 'outputs': [
+- '<(intermediate_dir)/<(stubs_filename_root).cc',
+- '<(output_root)/<(project_path)/<(stubs_filename_root).h',
+- ],
+- 'action': ['python',
+- '<(generate_stubs_script)',
+- '-i', '<(intermediate_dir)',
+- '-o', '<(output_root)/<(project_path)',
+- '-t', '<(outfile_type)',
+- '-e', '<(extra_header)',
+- '-s', '<(stubs_filename_root)',
+- '-p', '<(project_path)',
+- '<@(_inputs)',
+- ],
+- 'process_outputs_as_sources': 1,
+- 'message': 'Generating FFmpeg stubs for dynamic loading',
+- },
+- ],
+ 'conditions': [
+ # Linux/Solaris need libdl for dlopen() and friends.
+ ['OS == "linux" or OS == "solaris"', {
+--- src/ui/base/ui_base.gyp
++++ src/ui/base/ui_base.gyp
+@@ -11,6 +11,26 @@
+ {
+ # GN version: //ui/base
+ 'target_name': 'ui_base',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lui_base',
++ ],
++ },
++ 'dependencies': [
++ '../../net/net.gyp:net',
++ '../gfx/gfx.gyp:gfx',
++ '../accessibility/accessibility.gyp:ax_gen',
++ ],
++ 'export_dependent_settings': [
++ '../../net/net.gyp:net',
++ '../gfx/gfx.gyp:gfx',
++ ],
++ },
++
++ {
++ # GN version: //ui/base
++ 'target_name': 'ui_base_original',
+ 'type': '<(component)',
+ 'dependencies': [
+ '../../base/base.gyp:base',
+--- src/ui/gfx/gfx.gyp
++++ src/ui/gfx/gfx.gyp
+@@ -8,6 +8,26 @@
+ },
+ 'targets': [
+ {
++ 'target_name': 'gfx',
++ 'type': 'none',
++ 'dependencies': [
++ '<(DEPTH)/skia/skia.gyp:skia',
++ '<(DEPTH)/third_party/icu/icu.gyp:icui18n',
++ '<(DEPTH)/third_party/icu/icu.gyp:icuuc',
++ ],
++ 'export_dependent_settings': [
++ '<(DEPTH)/skia/skia.gyp:skia',
++ '<(DEPTH)/third_party/icu/icu.gyp:icui18n',
++ '<(DEPTH)/third_party/icu/icu.gyp:icuuc',
++ ],
++ 'link_settings': {
++ 'libraries': [
++ '-lgfx',
++ ],
++ },
++ },
++
++ {
+ 'target_name': 'gfx_geometry',
+ 'type': '<(component)',
+ 'dependencies': [
+@@ -69,7 +89,7 @@
+ ],
+ },
+ {
+- 'target_name': 'gfx',
++ 'target_name': 'gfx_original',
+ 'type': '<(component)',
+ 'dependencies': [
+ '<(DEPTH)/base/base.gyp:base',
+--- src/ui/gl/gl.gyp
++++ src/ui/gl/gl.gyp
+@@ -10,6 +10,25 @@
+ 'targets': [
+ {
+ 'target_name': 'gl',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lgl_wrapper',
++ ],
++ },
++ 'product_name': 'gl_wrapper', # Avoid colliding with OS X's libGL.dylib
++ 'dependencies': [
++ '<(DEPTH)/third_party/mesa/mesa.gyp:mesa_headers',
++ ],
++ 'variables': {
++ 'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gl',
++ },
++ 'export_dependent_settings': [
++ '<(DEPTH)/third_party/mesa/mesa.gyp:mesa_headers',
++ ],
++ },
++ {
++ 'target_name': 'gl_original',
+ 'type': '<(component)',
+ 'product_name': 'gl_wrapper', # Avoid colliding with OS X's libGL.dylib
+ 'dependencies': [
+--- src/ui/wm/wm.gyp
++++ src/ui/wm/wm.gyp
+@@ -10,6 +10,17 @@
+ {
+ # GN version: //ui/wm
+ 'target_name': 'wm',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lwm',
++ ],
++ },
++ },
++
++ {
++ # GN version: //ui/wm
++ 'target_name': 'wm_original',
+ 'type': '<(component)',
+ 'dependencies': [
+ '../../base/base.gyp:base',
+--- src/v8/tools/gyp/v8.gyp
++++ src/v8/tools/gyp/v8.gyp
+@@ -35,6 +35,21 @@
+ 'targets': [
+ {
+ 'target_name': 'v8',
++ 'type': 'none',
++ 'link_settings': {
++ 'libraries': [
++ '-lv8',
++ ],
++ },
++ 'direct_dependent_settings': {
++ 'include_dirs': [
++ '../../include',
++ ],
++ },
++ },
++
++ {
++ 'target_name': 'v8_original',
+ 'dependencies_traverse': 1,
+ 'conditions': [
+ ['want_separate_host_toolset==1', {
--- /dev/null
+# adjust compression algorithm to speed up RPMS creation
+# source RPM and debug RPMS are big and take too much time
+# when using standard (lzma) compression
+%define _source_payload w3.gzdio
+%define _binary_payload w3.gzdio
+
+Name: crosswalk-bin
+Version: 14.42.333.0
+Release: 0
+Summary: Chromium-based app runtime
+License: (BSD-3-Clause and LGPL-2.1+)
+Group: Web Framework/Web Run Time
+Url: https://github.com/otcshare/crosswalk
+Source: %{name}-%{version}.tar.gz
+
+# Provided for compatibility for a while.
+Provides: crosswalk
+
+%if 0%{?nodebug}
+%global __debug_install_post %{nil}
+%global debug_package %{nil}
+%endif
+
+BuildRequires: binutils-gold
+BuildRequires: bison
+BuildRequires: bzip2-devel
+BuildRequires: chromium-efl-libs
+BuildRequires: elfutils
+BuildRequires: expat-devel
+BuildRequires: flex
+BuildRequires: gperf
+BuildRequires: libcap-devel
+BuildRequires: libelf-devel
+BuildRequires: ninja
+BuildRequires: perl
+BuildRequires: pkgconfig(ail)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(alsa)
+BuildRequires: pkgconfig(appcore-common)
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(cairo)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-location-manager)
+BuildRequires: pkgconfig(dbus-1)
+BuildRequires: pkgconfig(fontconfig)
+BuildRequires: pkgconfig(freetype2)
+BuildRequires: pkgconfig(gles20)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(haptic)
+BuildRequires: pkgconfig(icu-i18n)
+BuildRequires: pkgconfig(libdrm)
+BuildRequires: pkgconfig(libexif)
+BuildRequires: pkgconfig(libpci)
+BuildRequires: pkgconfig(libpulse)
+BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(libudev)
+BuildRequires: pkgconfig(libxml-2.0)
+BuildRequires: pkgconfig(libxslt)
+BuildRequires: pkgconfig(nss)
+BuildRequires: pkgconfig(pango)
+BuildRequires: pkgconfig(pkgmgr)
+BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgconfig(pkgmgr-installer)
+BuildRequires: pkgconfig(pkgmgr-parser)
+BuildRequires: pkgconfig(protobuf)
+BuildRequires: pkgconfig(secure-storage)
+BuildRequires: pkgconfig(sensor)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(xmlsec1)
+BuildRequires: python
+BuildRequires: python-xml
+BuildRequires: which
+BuildRequires: yasm
+Requires: ca-certificates-tizen
+Requires: ss-server
+
+BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-location-manager)
+BuildRequires: pkgconfig(capi-media-audio-io)
+BuildRequires: pkgconfig(capi-media-camera)
+BuildRequires: pkgconfig(capi-media-player)
+BuildRequires: pkgconfig(capi-media-tool)
+BuildRequires: pkgconfig(capi-system-sensor)
+BuildRequires: pkgconfig(capi-network-connection)
+BuildRequires: pkgconfig(capi-system-device)
+BuildRequires: pkgconfig(capi-system-system-settings)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(ecore-evas)
+BuildRequires: pkgconfig(ecore-imf)
+BuildRequires: pkgconfig(ecore-imf-evas)
+BuildRequires: pkgconfig(ecore-input)
+BuildRequires: pkgconfig(efl-assist)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(evas)
+BuildRequires: pkgconfig(feedback)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gstreamer-1.0)
+BuildRequires: pkgconfig(gstreamer-plugins-base-1.0)
+BuildRequires: pkgconfig(gstreamer-app-1.0)
+BuildRequires: pkgconfig(harfbuzz)
+BuildRequires: pkgconfig(libtbm)
+BuildRequires: pkgconfig(minizip)
+BuildRequires: pkgconfig(nspr)
+BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(scim)
+BuildRequires: pkgconfig(tts)
+BuildRequires: pkgconfig(vconf)
+# TODO(a1.gomes): these dependencies seem wrong.
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(flac)
+BuildRequires: pkgconfig(ui-gadget-1)
+BuildRequires: pkgconfig(speex)
+
+%description
+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).
+
+%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
+
+%prep
+%setup -q
+
+%build
+
+# Stop unconditionally passing -Wall to the compiler. Chromium has its own
+# mechanisms for deciding which parts of the code need -Wall and which need it
+# to be left out (since several pieces are built with -Werror). At least in
+# M39, this is preventing the "rtc_base" target from being built because it
+# does not expect -Wall to be passed to the compiler (see webrtc issue 3307).
+export CXXFLAGS=`echo $CXXFLAGS | sed s,-Wall,,g`
+
+# Do not use -finline-functions: it breaks the build because it causes -Wall to
+# warn about some conditions that cannot really be reached (ie. variables that
+# may be used uninitialized while in fact thay cannot be uninitialized). See
+# TC-2299.
+export CXXFLAGS=`echo $CXXFLAGS | sed s,-finline-functions,,g`
+
+# For ffmpeg on ia32. The original CFLAGS set by the gyp and config files in
+# src/third_party/ffmpeg already pass -O2 -fomit-frame-pointer, but Tizen's
+# CFLAGS end up appending -fno-omit-frame-pointer. See http://crbug.com/37246
+export CFLAGS=`echo $CFLAGS | sed s,-fno-omit-frame-pointer,,g`
+
+# Building the RPM in the GBS chroot fails with errors such as
+# /usr/lib/gcc/i586-tizen-linux/4.7/../../../../i586-tizen-linux/bin/ld:
+# failed to set dynamic section sizes: Memory exhausted
+# For now, work around it by passing a GNU ld-specific flag that optimizes the
+# linker for memory usage.
+export LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory"
+
+# Support building in a non-standard directory, possibly outside %{_builddir}.
+# Since the build root is erased every time a new build is performed, one way
+# to avoid losing the build directory is to specify a location outside the
+# build root to the BUILDDIR_NAME definition, such as "/var/tmp/xwalk-build"
+# (remember all paths are still inside the chroot):
+# gbs build --define 'BUILDDIR_NAME /some/path'
+BUILDDIR_NAME="%{?BUILDDIR_NAME}"
+if [ -n "${BUILDDIR_NAME}" ]; then
+ mkdir -p "${BUILDDIR_NAME}"
+ ln -s "${BUILDDIR_NAME}" "%{OUTPUT_FOLDER}"
+fi
+
+# For building for arm in OBS, we need :
+# -> to unset sysroot value.
+# sysroot variable is automatically set for cross compilation to use arm-sysroot provided by Chromium project
+# sysroot usage is not needed, we need to use arm libraries from the virtualized environment.
+#
+# Crosswalk build fails if the fpu selected in the gcc option is different from neon in case of arm7 compilation
+# So force it.
+%ifarch %{arm}
+export CFLAGS=`echo $CFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
+export CXXFLAGS=`echo $CXXFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
+export FFLAGS=`echo $FFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
+%endif
+
+# We are relying on our libraries already being installed, we need to pass -L
+# to avoid libraries with the same name from being picked up instead (and also
+# to tell GCC/ld where to look for them).
+export LDFLAGS="${LDFLAGS} -L%{_libdir}/chromium-efl-libs/lib"
+
+###### start of block copied/adapted from chromium-efl.spec
+
+tizen_src/build/apply_patches.sh --crosswalk-bin
+trap 'tizen_src/build/apply_patches.sh -r --crosswalk-bin' EXIT
+
+%if "%{tizen}" == "3.0"
+%define chromium_efl_tizen_version 3.0
+%endif
+%if "%{tizen}" == "2.3" || "%{tizen}" == "2.4"
+%define chromium_efl_tizen_version 2.4
+%endif
+%if "%{tizen}" == "2.0"
+%define chromium_efl_tizen_version 2.3
+%endif
+%if "%{tizen}" == "2.2.1"
+%define chromium_efl_tizen_version 2.2.1
+%endif
+
+%if %{!?TIZEN_PROFILE_TV:0}%{?TIZEN_PROFILE_TV:1} || "%{!?profile:0}%{?profile}" == "tv"
+%define chromium_efl_tizen_profile tv
+%else
+%define chromium_efl_tizen_profile mobile
+%endif
+
+%if 0%{?nodebug}
+ CFLAGS=$(echo $CFLAGS | sed 's/-g[0-9]*/ /g')
+ CXXFLAGS=$(echo $CXXFLAGS | sed 's/-g[0-9]*/ /g')
+%endif
+
+%if "%{!?chromium_efl_tizen_profile:0}%{?chromium_efl_tizen_profile}" == "mobile"
+ %define OUTPUT_BUILD_PROFILE_TARGET mobile
+%else
+ %define OUTPUT_BUILD_PROFILE_TARGET tv
+%endif
+
+# The variable chromium-efl_tizen_version and _repository are essentially needed for build.
+# Therefore, if the variable is not defined, it explicitly raises exception here.
+%define OUTPUT_BASE_FOLDER out.tz_v%{chromium_efl_tizen_version}.%{OUTPUT_BUILD_PROFILE_TARGET}.%{_repository}.libs
+export GYP_GENERATOR_OUTPUT=$PWD/%{OUTPUT_BASE_FOLDER}
+
+#set build mode
+%if 0%{?_debug_mode}
+ %global OUTPUT_FOLDER %{OUTPUT_BASE_FOLDER}/Debug
+%else
+ %global OUTPUT_FOLDER %{OUTPUT_BASE_FOLDER}/Release
+%endif
+%global XWALK_GEN %{OUTPUT_FOLDER}/xwalk_gen
+
+mkdir -p "%{XWALK_GEN}"
+sed "s/@VERSION@/%{version}/g" xwalk/packaging/crosswalk.xml.in > "%{XWALK_GEN}"/crosswalk.xml
+cp -a xwalk/packaging/crosswalk-bin.manifest "%{XWALK_GEN}/crosswalk.manifest"
+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
+
+export GYP_GENERATORS="ninja"
+
+%if %{?_skip_gyp:0}%{!?_skip_gyp:1}
+./tizen_src/build/gyp_chromiumefl.sh \
+ --xwalk \
+ -Dbuilding_crosswalk_bin=1 \
+ -Dcomponent=shared_library \
+%if 0%{?_remove_webcore_debug_symbols:1}
+ -Dremove_webcore_debug_symbols=1 \
+%endif
+%if 0%{?chromium_efl_tizen_version:1}
+ -Dchromium_efl_tizen_version=%{chromium_efl_tizen_version} \
+%endif
+%if "%{?_with_wayland}" == "1"
+ -Duse_wayland=1 \
+%endif
+%if "%{?_repository}" == "emulator" || "%{?_repository}" == "emulator32-x11"
+ -Dtizen_emulator_support=1 \
+%endif
+ -Dtizen_"%{OUTPUT_BUILD_PROFILE_TARGET}"=1 \
+ -Dbuilding_for_tizen_"%{OUTPUT_BUILD_PROFILE_TARGET}"=1
+%endif
+
+%if %{?_skip_ninja:0}%{!?_skip_ninja:1}
+NINJA_TARGETS="xwalk xwalk_application_tools"
+
+%ifarch %{arm}
+tizen_src/build/prebuild/ninja.arm %{_smp_mflags} -C"%{OUTPUT_FOLDER}" \
+%else
+%ifarch aarch64
+tizen_src/build/prebuild/ninja-linux64 -v %{_smp_mflags} -C"%{OUTPUT_FOLDER}" \
+%else
+tizen_src/build/prebuild/ninja %{_smp_mflags} -C"%{OUTPUT_FOLDER}" \
+%endif
+%endif
+ ${NINJA_TARGETS}
+%endif
+
+###### end of block copied/adapted from chromium-efl.spec
+
+%install
+# Binaries.
+install -m 0755 -p -D %{OUTPUT_FOLDER}/xwalk %{buildroot}%{_libdir}/xwalk/xwalk
+install -m 0755 -p -D %{OUTPUT_FOLDER}/xwalk_backend %{buildroot}%{_libdir}/xwalk/xwalk_backend
+
+%define CHROMIUM_EFL_LIBS_INSTALL_FOLDER chromium-efl-libs
+
+# Supporting libraries and resources.
+install -m 0644 -p -D %{OUTPUT_FOLDER}/lib/libxwalk_backend_lib.so %{buildroot}%{_libdir}/%{CHROMIUM_EFL_LIBS_INSTALL_FOLDER}/lib/libxwalk_backend_lib.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
+
+# 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
+
+%post
+mkdir -p %{_desktop_icondir_ro}
+mkdir -p %{_manifestdir_ro}
+
+ln -sf %{_libdir}/%{CHROMIUM_EFL_LIBS_INSTALL_FOLDER}/lib/libxwalk_backend_lib.so /etc/package-manager/backendlib/libxpk.so
+ln -sf %{_libdir}/%{CHROMIUM_EFL_LIBS_INSTALL_FOLDER}/lib/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
+
+%files
+%manifest %{XWALK_GEN}/crosswalk.manifest
+%license %{XWALK_GEN}/AUTHORS.chromium %{XWALK_GEN}/LICENSE.chromium %{XWALK_GEN}/LICENSE.xwalk
+%{_libdir}/%{CHROMIUM_EFL_LIBS_INSTALL_FOLDER}/lib/libxwalk_backend_lib.so
+%{_libdir}/xwalk/xwalk
+%{_libdir}/xwalk/xwalk.pak
+%{_libdir}/xwalk/xwalk_backend
+%{_manifestdir}/crosswalk.xml
+%{_desktop_icondir}/crosswalk.png
+%{_datadir}/xwalk/*