Cleanup build script and gyp files 61/174061/1
authorSangYong Park <sy302.park@samsung.com>
Tue, 27 Mar 2018 12:52:19 +0000 (21:52 +0900)
committerSangYong Park <sy302.park@samsung.com>
Wed, 28 Mar 2018 01:17:22 +0000 (10:17 +0900)
Minimize change of electron's code
(Later patch will be fixed brightray's gyp files.)

Change-Id: I2cae341abeddd812c0997d91b90e94ff36aab46e
Signed-off-by: SangYong Park <sy302.park@samsung.com>
26 files changed:
atom/app/atom_main_delegate.cc
common.gypi
efl/build/system.gyp
electron.gyp
filenames.gypi
packaging/electron-efl.manifest
packaging/electron-efl.spec
script/bootstrap.py
script/build-libchromiumcontent.py
script/build.py
script/clean.py
script/update.py
tizen/common.gypi [new file with mode: 0644]
tizen/loader/wrt_loader.cc
tizen/script/build
tizen/src/wrt_main.cc [new file with mode: 0644]
tizen/src/wrt_main.h [new file with mode: 0644]
vendor/brightray/brightray.gyp
vendor/brightray/brightray.gypi
vendor/brightray/script/bootstrap
vendor/brightray/vendor/libchromiumcontent/script/build
vendor/brightray/vendor/libchromiumcontent/script/create-dist
vendor/brightray/vendor/libchromiumcontent/script/download
vendor/brightray/vendor/libchromiumcontent/script/update
vendor/brightray/vendor/libchromiumcontent/tools/generate_filenames_gypi.py
wrt.gyp [new file with mode: 0644]

index e102cc3..9f9ac69 100644 (file)
@@ -114,7 +114,7 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
 void AtomMainDelegate::PreSandboxStartup() {
   brightray::MainDelegate::PreSandboxStartup();
 
-  PathService::Override(base::FILE_EXE, base::FilePath("/usr/bin/electron"));
+  PathService::Override(base::FILE_EXE, base::FilePath("/usr/bin/wrt"));
 
   // Set google API key.
   std::unique_ptr<base::Environment> env(base::Environment::Create());
index 125bcb1..9f0a6f0 100644 (file)
@@ -1,7 +1,6 @@
 {
   'includes': [
     'vendor/brightray/brightray.gypi',
-    'efl/features.gypi',
   ],
   'conditions': [
     ['use_efl!=1', {
     'python': 'python',
     'openssl_fips': '',
     'openssl_no_asm': 1,
-    'use_efl%': 0,
-    'desktop_linux%': 0,
-    'is_tizen%': 0,
-    'tizen_product_tv%': 0,
     'use_openssl_def': 0,
     'OPENSSL_PRODUCT': 'libopenssl.a',
     'node_release_urlbase': 'https://atom.io/download/atom-shell',
       }],
       ['_target_name=="node"', {
         'include_dirs': [
-          '/usr/include/v8',
           '<(libchromiumcontent_src_dir)',
           '<(libchromiumcontent_src_dir)/third_party/icu/source/common',
           '<(libchromiumcontent_src_dir)/third_party/icu/source/i18n',
         },
       },
     }],  # OS=="mac"
-    ['is_tizen==1', {
-      'target_defaults': {
-        'defines': [
-          'OS_TIZEN',
-        ],
-      },
-    }],  # is_tizen==1
-    ['tizen_product_tv==1', {
-      'target_defaults': {
-        'defines': [
-          'OS_TIZEN_TV_PRODUCT',
-        ],
-      },
-    }],  # tizen_product_tv==1
-    ['use_efl==1', {
-      'target_defaults': {
-        'defines': [
-          'USE_EFL',
-        ],
-      },
-    }],  # is_tizen==1
   ],
 }
index 3e0f94f..32c429f 100644 (file)
@@ -32,7 +32,7 @@
       'target_name': 'ecore-x',
       'type': 'none',
       'conditions': [
-        ['desktop_linux==1', {
+        ['is_tizen!=1', {
           'direct_dependent_settings': {
             'cflags': [
               '<!@(<(pkg-config) --cflags ecore-x)',
@@ -53,7 +53,7 @@
       'target_name': 'elocation',
       'type': 'none',
       'conditions': [
-        ['desktop_linux==1', {
+        ['is_tizen!=1', {
           'direct_dependent_settings': {
             'cflags': [
               '<!@(<(pkg-config) --cflags elocation)',
index 7456cf9..ce3673a 100644 (file)
@@ -6,7 +6,6 @@
     'company_abbr%': 'github',
     'version%': '1.6.7',
     'js2c_input_dir': '<(SHARED_INTERMEDIATE_DIR)/js2c',
-    'clang%': 0,
   },
   'includes': [
     'filenames.gypi',
@@ -39,8 +38,6 @@
       ],
       'include_dirs': [
         '.',
-        '/usr/include/v8',
-        '<(libchromiumcontent_src_dir)/tizen_src/chromium_impl',
       ],
       'conditions': [
         ['OS=="mac"', {
                   }, {
                     'copied_libraries': [
                       '<(PRODUCT_DIR)/lib/libnode.so',
-#                      '<(libchromiumcontent_dir)/libffmpeg.so',
+                      '<(libchromiumcontent_dir)/libffmpeg.so',
                     ],
                   }],
                 ],
               },
               'destination': '<(PRODUCT_DIR)',
-              'conditions': [
-                ['desktop_linux==0', {
-                  'files': [
-                    '<@(copied_libraries)',
-                    '<(libchromiumcontent_dir)/chromium-efl/content_shell.pak',
-                    '<(libchromiumcontent_dir)/chromium-efl/natives_blob.bin',
-                    '<(libchromiumcontent_dir)/chromium-efl/snapshot_blob.bin',
-                  ],
-                }, {
-                  'files': [
-                    '<@(copied_libraries)',
-                    '<(libchromiumcontent_dir)/content_shell.pak',
-                    '<(libchromiumcontent_dir)/natives_blob.bin',
-                    '<(libchromiumcontent_dir)/snapshot_blob.bin',
-                  ],
-                }],
+              'files': [
+                '<@(copied_libraries)',
+                '<(libchromiumcontent_dir)/locales',
+                '<(libchromiumcontent_dir)/icudtl.dat',
+                '<(libchromiumcontent_dir)/blink_image_resources_200_percent.pak',
+                '<(libchromiumcontent_dir)/content_resources_200_percent.pak',
+                '<(libchromiumcontent_dir)/content_shell.pak',
+                '<(libchromiumcontent_dir)/ui_resources_200_percent.pak',
+                '<(libchromiumcontent_dir)/views_resources_200_percent.pak',
+                '<(libchromiumcontent_dir)/natives_blob.bin',
+                '<(libchromiumcontent_dir)/snapshot_blob.bin',
               ],
             },
           ],
         }],  # OS=="linux"
-        ['is_tizen==1', {
-          'includes': [
-            'tizen/build/common.gypi',
-          ],
-          'dependencies': [
-            'tizen/common/common.gyp:wrt_common',
-            'tizen/loader/loader.gyp:wrt-loader',
-            '<(DEPTH)/efl/build/system.gyp:ecore',
-            '<(DEPTH)/efl/build/system.gyp:launchpad',
-            '<(DEPTH)/efl/build/system.gyp:capi-appfw-application',
-            '<(DEPTH)/efl/build/system.gyp:elementary',
-          ],
-          'sources': [
-            'tizen/loader/prelauncher.h',
-            'tizen/loader/prelauncher.cc',
-          ],
-          'ldflags': [
-            '-pie',
-            '-export-dynamic',
-          ],
-          'cflags': [ '-fPIC' ],
-          'cflags_cc': [ '-fPIC' ],
-        }],  # is_tizen==1
       ],
     },  # target <(project_name)
     {
         '<(libchromiumcontent_src_dir)/third_party/',
         '<(libchromiumcontent_src_dir)/components/cdm',
         '<(libchromiumcontent_src_dir)/third_party/widevine',
-        '<(libchromiumcontent_src_dir)/tizen_src/chromium_impl',
       ],
       'direct_dependent_settings': {
         'include_dirs': [
             '<@(lib_sources_linux)',
             '<@(lib_sources_nss)',
           ],
+          'link_settings': {
+            'ldflags': [
+              # Make binary search for libraries under current directory, so we
+              # don't have to manually set $LD_LIBRARY_PATH:
+              # http://serverfault.com/questions/279068/cant-find-so-in-the-same-directory-as-the-executable
+              '-rpath \$$ORIGIN',
+              # Make native module dynamic loading work.
+              '-rdynamic',
+            ],
+          },
           # Required settings of using breakpad.
           'cflags_cc': [
             '-Wno-empty-body',
             'vendor/breakpad/breakpad.gyp:breakpad_client',
           ],
         }],  # OS=="linux"
-        ['is_tizen==1', {
-          'cflags': [ '-fPIC' ],
-          'cflags_cc': [ '-fPIC' ],
-        }],  # is_tizen==1
-        ['use_efl==1', {
-          'conditions': [
-            ['is_tizen==1', {
-              'dependencies': [
-                '<(DEPTH)/efl/build/system.gyp:elementary',
-                '<(DEPTH)/efl/build/system.gyp:efl-extension',
-                '<(DEPTH)/efl/build/system.gyp:evas',
-                '<(DEPTH)/efl/build/system.gyp:icu',
-                '<(DEPTH)/efl/build/system.gyp:capi-appfw-application',
-                'electron_shell_copy',
-              ],
-            }, {
-              'dependencies': [
-                '<(DEPTH)/efl/build/system.gyp:ecore-x',
-                '<(DEPTH)/efl/build/system.gyp:elocation',
-                '<(DEPTH)/efl/build/system.gyp:elementary',
-                '<(DEPTH)/efl/build/system.gyp:evas',
-                '<(DEPTH)/efl/build/system.gyp:icu',
-                'electron_shell_copy',
-              ],
-            }],
-            ['tizen_product_tv==1', {
-              'dependencies': [
-                '<(DEPTH)/efl/build/system.gyp:elementary',
-                '<(DEPTH)/efl/build/system.gyp:efl-extension',
-                '<(DEPTH)/efl/build/system.gyp:evas',
-                '<(DEPTH)/efl/build/system.gyp:icu',
-                '<(DEPTH)/efl/build/system.gyp:vd-win-util',
-                'electron_shell_copy',
-              ],
-            }],
-          ],
-          'defines': [
-            'USE_SYSTEM_ICU',
-          ],
-          'sources': [
-            'chromium_src/chrome/browser/icon_loader_efllinux.cc',
-          ],
-        }, {
-          'link_settings': {
-            'ldflags': [
-              # Make binary search for libraries under current directory, so we
-              # don't have to manually set $LD_LIBRARY_PATH:
-              # http://serverfault.com/questions/279068/cant-find-so-in-the-same-directory-as-the-executable
-              '-rpath \$$ORIGIN',
-              # Make native module dynamic loading work.
-              '-rdynamic',
-            ],
-          },
-        }],  # use_efl==1
-        ['desktop_linux==1 or is_tizen==1', {
-          'sources/': [
-            # chromium-efl supports only tizen webrtc using CAPI
-            # which is not working on desktop linux.
-            ['exclude', 'atom/browser/api/atom_api_desktop_capturer.cc'],
-            ['exclude', 'atom/browser/api/atom_api_desktop_capturer.h'],
-          ],
-        }],  # desktop_linux==1
       ],
     },  # target <(product_name)_lib
     {
-      'target_name': 'electron_shell_copy',
-      'type': 'none',
-      'copies': [
-        {
-          'destination': '<(PRODUCT_DIR)',
-          'files': [
-            '<(DEPTH)/efl/build/desktop/electron.sh',
-            '<(DEPTH)/efl/build/desktop/launch.sh',
-          ],
-        },
-      ],
-    },  # target atom_js2c_copy
-    {
       'target_name': 'js2asar',
       'type': 'none',
       'actions': [
index ee1dbbc..8408b27 100644 (file)
@@ -29,7 +29,6 @@
       'lib/browser/api/power-monitor.js',
       'lib/browser/api/power-save-blocker.js',
       'lib/browser/api/protocol.js',
-      'lib/browser/api/pwrt.js',
       'lib/browser/api/screen.js',
       'lib/browser/api/session.js',
       'lib/browser/api/system-preferences.js',
       'atom/app/atom_main_delegate_mac.mm',
       'atom/app/node_main.cc',
       'atom/app/node_main.h',
-      'atom/app/runtime.cc',
-      'atom/app/runtime.h',
-      'atom/app/ui_runtime.cc',
-      'atom/app/ui_runtime.h',
       'atom/app/uv_task_runner.cc',
       'atom/app/uv_task_runner.h',
       'atom/browser/api/atom_api_app.cc',
       'atom/browser/api/atom_api_global_shortcut.h',
       'atom/browser/api/atom_api_menu.cc',
       'atom/browser/api/atom_api_menu.h',
-      'atom/browser/api/atom_api_menu_efl.cc',
-      'atom/browser/api/atom_api_menu_efl.h',
       'atom/browser/api/atom_api_menu_mac.h',
       'atom/browser/api/atom_api_menu_mac.mm',
       'atom/browser/api/atom_api_menu_views.cc',
       'atom/browser/api/atom_api_power_save_blocker.h',
       'atom/browser/api/atom_api_protocol.cc',
       'atom/browser/api/atom_api_protocol.h',
-      'atom/browser/api/atom_api_pwrt.cc',
-      'atom/browser/api/atom_api_pwrt.h',
       'atom/browser/api/atom_api_render_process_preferences.cc',
       'atom/browser/api/atom_api_render_process_preferences.h',
       'atom/browser/api/atom_api_screen.cc',
       'atom/browser/api/atom_api_url_request.h',
       'atom/browser/api/atom_api_web_contents.cc',
       'atom/browser/api/atom_api_web_contents.h',
-      'atom/browser/api/atom_api_web_contents_efl.cc',
       'atom/browser/api/atom_api_web_contents_mac.mm',
       'atom/browser/api/atom_api_web_request.cc',
       'atom/browser/api/atom_api_web_request.h',
       'atom/browser/browser_mac.mm',
       'atom/browser/browser_win.cc',
       'atom/browser/browser_observer.h',
-      'atom/browser/common_web_contents_delegate_efl.cc',
       'atom/browser/common_web_contents_delegate_mac.mm',
       'atom/browser/common_web_contents_delegate_views.cc',
       'atom/browser/common_web_contents_delegate.cc',
       'atom/browser/mac/dict_util.mm',
       'atom/browser/native_browser_view.cc',
       'atom/browser/native_browser_view.h',
-      'atom/browser/native_browser_view_efl.cc',
-      'atom/browser/native_browser_view_efl.h',
       'atom/browser/native_browser_view_mac.h',
       'atom/browser/native_browser_view_mac.mm',
       'atom/browser/native_browser_view_views.h',
       'atom/browser/native_browser_view_views.cc',
       'atom/browser/native_window.cc',
       'atom/browser/native_window.h',
-      'atom/browser/native_window_efl.cc',
-      'atom/browser/native_window_efl.h',
       'atom/browser/native_window_views_win.cc',
       'atom/browser/native_window_views.cc',
       'atom/browser/native_window_views.h',
       'atom/browser/render_process_preferences.h',
       'atom/browser/ui/accelerator_util.cc',
       'atom/browser/ui/accelerator_util.h',
-      'atom/browser/ui/accelerator_util_efl.cc',
       'atom/browser/ui/accelerator_util_mac.mm',
       'atom/browser/ui/accelerator_util_views.cc',
       'atom/browser/ui/atom_menu_model.cc',
       'atom/browser/ui/cocoa/atom_touch_bar.h',
       'atom/browser/ui/cocoa/atom_touch_bar.mm',
       'atom/browser/ui/cocoa/touch_bar_forward_declarations.h',
-      'atom/browser/ui/drag_util_efl.cc',
       'atom/browser/ui/drag_util_mac.mm',
       'atom/browser/ui/drag_util_views.cc',
       'atom/browser/ui/drag_util.h',
       'atom/browser/ui/file_dialog.h',
-      'atom/browser/ui/file_dialog_efl.cc',
       'atom/browser/ui/file_dialog_gtk.cc',
       'atom/browser/ui/file_dialog_mac.mm',
       'atom/browser/ui/file_dialog_win.cc',
       'atom/browser/ui/message_box.h',
-      'atom/browser/ui/message_box_efl.cc',
       'atom/browser/ui/message_box_gtk.cc',
       'atom/browser/ui/message_box_mac.mm',
       'atom/browser/ui/message_box_win.cc',
       'atom/browser/ui/tray_icon.cc',
       'atom/browser/ui/tray_icon.h',
-      'atom/browser/ui/tray_icon_efl.cc',
-      'atom/browser/ui/tray_icon_efl.h',
       'atom/browser/ui/tray_icon_gtk.cc',
       'atom/browser/ui/tray_icon_gtk.h',
       'atom/browser/ui/tray_icon_cocoa.h',
       'chromium_src/chrome/browser/chrome_notification_types.h',
       'chromium_src/chrome/browser/extensions/global_shortcut_listener.cc',
       'chromium_src/chrome/browser/extensions/global_shortcut_listener.h',
-      'chromium_src/chrome/browser/extensions/global_shortcut_listener_ozone.cc',
-      'chromium_src/chrome/browser/extensions/global_shortcut_listener_ozone.h',
       'chromium_src/chrome/browser/extensions/global_shortcut_listener_mac.mm',
       'chromium_src/chrome/browser/extensions/global_shortcut_listener_mac.h',
       'chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.cc',
index 8fc4f2d..98bbcda 100644 (file)
@@ -4,6 +4,6 @@
     </request>
     <assign>
         <filesystem path="/usr/bin/wrt-loader" exec_label="User"/>
-        <filesystem path="/usr/bin/electron" exec_label="none"/>
+        <filesystem path="/usr/bin/wrt" exec_label="none"/>
     </assign>
 </manifest>
index 67b8cef..f26da7c 100755 (executable)
@@ -70,8 +70,7 @@ cp %{SOURCE1001} .
 %define _xmldir %TZ_SYS_RO_PACKAGES
 %define _out out.tizen/out/D
 
-export DEFINE_ARGS="
-    desktop_linux=0
+DEFINE_ARGS="
     libchromiumcontent_component=1
     use_efl=1
     is_tizen=1
@@ -84,14 +83,16 @@ DEFINE_ARGS+="
 
 %if "%{?skipbootstrap}" != "1"
 ./script/bootstrap.py \
-    --libcc_chromium_efl_path /usr/lib \
+    --libcc_source_path ./vendor/brightray/vendor/libchromiumcontent/src \
+    --libcc_shared_library_path /usr/lib \
+    --libcc_static_library_path /usr/lib \
     --define "${DEFINE_ARGS}" \
     --dev \
     --disable_clang \
     -v
 %endif
 
-./script/build.py -c D
+./script/build.py -c D -t wrt
 
 %install
 install -d %{_out}/packaging
@@ -116,18 +117,17 @@ install -d %{buildroot}/%{_icondir}
 install -d %{buildroot}/%{_libdir}
 install -d %{buildroot}/%{_bindir}
 install -m 0644 packaging/%{_pkgid}.png             %{buildroot}/%{_icondir}
-install -m 0755 %{_out}/libnode.so                  %{buildroot}/%{_libdir}
+install -m 0755 %{_out}/lib/libnode.so              %{buildroot}/%{_libdir}
 install -m 0755 %{_out}/wrt-loader                  %{buildroot}/%{_bindir}
-install -m 0755 %{_out}/electron                    %{buildroot}/%{_bindir}
+install -m 0755 %{_out}/wrt                         %{buildroot}/%{_bindir}
+
+ln -s %{_bindir}/wrt %{buildroot}%{_bindir}/wrt-client
+ln -s %{_bindir}/wrt %{buildroot}%{_bindir}/xwalk_runtime
 
 # install resource.
-mkdir -p %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl/wrt_release
+mkdir -p %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl
 install -m 0755 %{_out}/resources/electron.asar     %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl
 
-ln -s %{_bindir}/electron %{buildroot}%{_bindir}/wrt
-ln -s %{_bindir}/electron %{buildroot}%{_bindir}/wrt-client
-ln -s %{_bindir}/electron %{buildroot}%{_bindir}/xwalk_runtime
-
 ./node_modules/asar/bin/asar p wrt %{_out}/resources/app.asar
 install -m 0755 %{_out}/resources/app.asar          %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl
 
@@ -155,7 +155,6 @@ rm -fr %{buildroot}
 %{_icondir}/%{_pkgid}.png
 %{_libdir}/libnode.so
 %{_xmldir}/%{_pkgid}.xml
-%attr(755,root,root) %{_bindir}/electron
 %attr(755,root,root) %{_bindir}/wrt
 %attr(755,root,root) %{_bindir}/wrt-client
 %attr(755,root,root) %{_bindir}/wrt-loader
index ba7f31a..20de36b 100755 (executable)
@@ -31,7 +31,8 @@ def main():
   if sys.platform == 'cygwin':
     update_win32_python()
 
-  if args.libcc_chromium_efl_path == None:
+  use_efl = 'use_efl=1' in [d.strip() for d in defines.split(' ')]
+  if not use_efl:
     update_submodules()
 
   libcc_source_path = args.libcc_source_path
@@ -47,26 +48,26 @@ def main():
     libcc_shared_library_path = os.path.join(dist_dir, 'shared_library')
     libcc_static_library_path = os.path.join(dist_dir, 'static_library')
 
-  if PLATFORM != 'win32' and args.libcc_chromium_efl_path == None:
+  if PLATFORM != 'win32':
     if not args.disable_clang and args.clang_dir == '':
       # Download prebuilt clang binaries.
       update_clang()
 
-  if os.path.isfile('/etc/tizen-release') != True:
+  if PLATFORM != 'tizen':
     setup_python_libs()
-  if args.libcc_chromium_efl_path == None:
+  if not use_efl:
     update_node_modules('.')
   bootstrap_brightray(args.dev, args.url, args.target_arch,
                       libcc_source_path, libcc_shared_library_path,
-                      libcc_static_library_path, args.libcc_chromium_efl_path)
+                      libcc_static_library_path)
 
-  if PLATFORM == 'linux' and args.libcc_chromium_efl_path == None:
+  if PLATFORM == 'linux' and not use_efl:
     download_sysroot(args.target_arch)
 
   create_chrome_version_h()
   touch_config_gypi()
   run_update(defines, args.msvs)
-  if args.libcc_chromium_efl_path == None:
+  if not use_efl:
     update_electron_modules('spec', args.target_arch)
 
 
@@ -106,8 +107,6 @@ def parse_args():
                       help='The static library path of libchromiumcontent.')
   parser.add_argument('--defines', default='',
                       help='The build variables passed to gyp')
-  parser.add_argument('--libcc_chromium_efl_path', required=False,
-                      help='The shared library path of chromium-efl.')
   return parser.parse_args()
 
 
@@ -142,7 +141,7 @@ def setup_python_libs():
 
 def bootstrap_brightray(is_dev, url, target_arch, libcc_source_path,
                         libcc_shared_library_path,
-                        libcc_static_library_path, libcc_chromium_efl_path):
+                        libcc_static_library_path):
   bootstrap = os.path.join(VENDOR_DIR, 'brightray', 'script', 'bootstrap')
   args = [
     '--commit', LIBCHROMIUMCONTENT_COMMIT,
@@ -157,8 +156,6 @@ def bootstrap_brightray(is_dev, url, target_arch, libcc_source_path,
     args += ['--libcc_source_path', libcc_source_path,
              '--libcc_shared_library_path', libcc_shared_library_path,
              '--libcc_static_library_path', libcc_static_library_path]
-  if libcc_chromium_efl_path != None:
-    args += ['--libcc_chromium_efl_path', libcc_chromium_efl_path]
   execute_stdout([sys.executable, bootstrap] + args)
 
 
index e04a3b6..e0a95f6 100755 (executable)
@@ -29,7 +29,7 @@ def main():
   build = os.path.join(script_dir, 'build')
   create_dist = os.path.join(script_dir, 'create-dist')
   execute_stdout([sys.executable, bootstrap])
-  execute_stdout([sys.executable, update, '-t', args.target_arch, '-N',
+  execute_stdout([sys.executable, update, '-t', args.target_arch,
                   '--defines', args.defines])
   execute_stdout([sys.executable, build, '-R', '-t', args.target_arch])
   execute_stdout([sys.executable, create_dist, '-c', 'static_library',
index b130211..80f266d 100755 (executable)
@@ -5,7 +5,7 @@ import os
 import subprocess
 import sys
 
-from lib.config import get_target_arch
+from lib.config import PLATFORM, get_target_arch
 from lib.util import electron_gyp, import_vs_env
 
 
@@ -20,13 +20,14 @@ def main():
   import_vs_env(get_target_arch())
 
   ninja = os.path.join('vendor', 'depot_tools', 'ninja')
-  ninja = 'ninja'
   if sys.platform == 'win32':
     ninja += '.exe'
+  if PLATFORM == 'tizen':
+    ninja = 'ninja'
 
   args = parse_args()
   for config in args.configuration:
-    if os.path.isfile('/etc/tizen-release'):
+    if PLATFORM == 'tizen':
       build_path = os.path.join('out.tizen', 'out', config[0])
     else:
       build_path = os.path.join('out', config[0])
index 703a2b4..aaa77ea 100755 (executable)
@@ -4,6 +4,7 @@ import argparse
 import os
 import sys
 
+from lib.config import PLATFORM
 from lib.util import rm_rf
 
 
@@ -16,7 +17,7 @@ def main():
   args = parse_args()
 
   remove_directory('dist')
-  if os.path.isfile('/etc/tizen-release'):
+  if PLATFORM == 'tizen':
     remove_directory('out.tizen')
   else:
     remove_directory('out')
index e172c4c..5c9c957 100755 (executable)
@@ -41,7 +41,6 @@ def update_external_binaries():
 
 
 def update_gyp():
-  print 'update gyp !!!'
   # Since gyp doesn't support specify link_settings for each configuration,
   # we are not able to link to different libraries in  "Debug" and "Release"
   # configurations.
@@ -89,18 +88,18 @@ def run_gyp(target_arch, component):
 
   # Add the defines passed from command line.
   args = parse_args()
-  use_efl=0
   for define in [d.strip() for d in args.defines.split(' ')]:
     if define:
-      if define == 'use_efl=1':
-        use_efl=1
       defines += ['-D' + define]
 
   generator = 'ninja'
   if args.msvs:
     generator = 'msvs-ninja'
 
-  print "GYP defines ::: ", defines
+  if 'use_efl=1' in [d.strip() for d in args.defines.split(' ')]:
+    return subprocess.call([python, gyp, '-f', generator, '--depth', '.',
+                            'wrt.gyp', '-I' + os.path.join('tizen', 'common.gypi')] + defines, env=env)
+
   return subprocess.call([python, gyp, '-f', generator, '--depth', '.',
                           'electron.gyp', '-Icommon.gypi'] + defines, env=env)
 
diff --git a/tizen/common.gypi b/tizen/common.gypi
new file mode 100644 (file)
index 0000000..b0c2055
--- /dev/null
@@ -0,0 +1,43 @@
+{
+  'includes': [
+    '../common.gypi',
+    '../efl/features.gypi',
+  ],
+  'variables': {
+    'clang%': 0,
+    'use_efl%': 0,
+    'is_tizen%': 0,
+    'tizen_product_tv%': 0,
+  },
+  'conditions': [
+    ['use_efl==1', {
+      'target_defaults': {
+        'defines': [
+          'USE_EFL',
+        ],
+      },
+      'variables': {
+        'js_sources': [
+          '<(DEPTH)/lib/browser/api/pwrt.js',
+        ],
+      },
+    }],  # use_efl==1
+    ['is_tizen==1', {
+      'target_defaults': {
+        'defines': [
+          'OS_TIZEN',
+        ],
+      },
+      'variables': {
+        'libchromiumcontent_libraries': '/usr/lib/libchromium-ewk.so',
+      },
+    }],  # is_tizen==1
+    ['tizen_product_tv==1', {
+      'target_defaults': {
+        'defines': [
+          'OS_TIZEN_TV_PRODUCT',
+        ],
+      },
+    }],  # tizen_product_tv==1
+  ],
+}
index bb91449..1e756e0 100644 (file)
@@ -20,7 +20,7 @@
 // with "System::Privileged" label.
 int main(int argc, char* argv[]) {
   dlog_print(DLOG_INFO, "CHROMIUM", "Begin wrt-loader");
-  void* handle = dlopen("/usr/bin/electron", RTLD_NOW);
+  void* handle = dlopen("/usr/bin/wrt", RTLD_NOW);
   if (!handle) {
     dlog_print(DLOG_ERROR, "CHROMIUM", "Failed to load electorn");
     return false;
index 5ef809c..22091bd 100755 (executable)
@@ -172,7 +172,6 @@ def run_bootstrap(chromium_path, verbose):
 
   defines = [
     'libchromiumcontent_component=1',
-    'desktop_linux=1',
     'use_efl=1'
   ]
 
diff --git a/tizen/src/wrt_main.cc b/tizen/src/wrt_main.cc
new file mode 100644 (file)
index 0000000..799621c
--- /dev/null
@@ -0,0 +1,231 @@
+// Copyright (c) 2013 GitHub, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#include "wrt_main.h"
+
+#include <stdlib.h>
+
+#if defined(OS_WIN)
+#include <windows.h>  // windows.h must be included first
+
+#include <shellapi.h>
+#include <shellscalingapi.h>
+#include <tchar.h>
+
+#include "atom/app/atom_main_delegate.h"
+#include "atom/common/crash_reporter/win/crash_service_main.h"
+#include "base/environment.h"
+#include "base/process/launch.h"
+#include "base/win/windows_version.h"
+#include "content/public/app/sandbox_helper_win.h"
+#include "sandbox/win/src/sandbox_types.h"
+#elif defined(OS_LINUX)  // defined(OS_WIN)
+#include "atom/app/atom_main_delegate.h"  // NOLINT
+#include "content/public/app/content_main.h"
+#else  // defined(OS_LINUX)
+#include "atom/app/atom_library_main.h"
+#endif  // defined(OS_MACOSX)
+
+#if defined(USE_EFL)
+#include "efl/init.h"
+#endif
+
+#include "atom/app/node_main.h"
+#include "atom/common/atom_command_line.h"
+#include "base/at_exit.h"
+#include "base/i18n/icu_util.h"
+
+#if defined(OS_TIZEN)
+#include <Elementary.h>
+
+#include "atom/app/runtime.h"
+#include "base/logging.h"
+#include "tizen/common/application_data.h"
+#include "tizen/common/command_line.h"
+#include "tizen/loader/prelauncher.h"
+#endif
+
+namespace {
+
+const char* kRunAsNode = "ELECTRON_RUN_AS_NODE";
+
+// Default command line flags for all profiles and platforms
+const char* kDefaultCommandLineFlags[] = {
+  "allow-file-access-from-files",
+  "enable-tizen-app-container",
+};
+
+bool IsEnvSet(const char* name) {
+#if defined(OS_WIN)
+  size_t required_size;
+  getenv_s(&required_size, nullptr, 0, name);
+  return required_size != 0;
+#else
+  char* indicator = getenv(name);
+  return indicator && indicator[0] != '\0';
+#endif
+}
+
+}  // namespace
+
+#if defined(OS_WIN)
+int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
+  int argc = 0;
+  wchar_t** wargv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
+
+  bool run_as_node = IsEnvSet(kRunAsNode);
+
+  // Make sure the output is printed to console.
+  if (run_as_node || !IsEnvSet("ELECTRON_NO_ATTACH_CONSOLE"))
+    base::RouteStdioToConsole(false);
+
+  // Convert argv to to UTF8
+  char** argv = new char*[argc];
+  for (int i = 0; i < argc; i++) {
+    // Compute the size of the required buffer
+    DWORD size = WideCharToMultiByte(CP_UTF8,
+                                     0,
+                                     wargv[i],
+                                     -1,
+                                     NULL,
+                                     0,
+                                     NULL,
+                                     NULL);
+    if (size == 0) {
+      // This should never happen.
+      fprintf(stderr, "Could not convert arguments to utf8.");
+      exit(1);
+    }
+    // Do the actual conversion
+    argv[i] = new char[size];
+    DWORD result = WideCharToMultiByte(CP_UTF8,
+                                       0,
+                                       wargv[i],
+                                       -1,
+                                       argv[i],
+                                       size,
+                                       NULL,
+                                       NULL);
+    if (result == 0) {
+      // This should never happen.
+      fprintf(stderr, "Could not convert arguments to utf8.");
+      exit(1);
+    }
+  }
+
+  if (run_as_node) {
+    // Now that argv conversion is done, we can finally start.
+    base::AtExitManager atexit_manager;
+    base::i18n::InitializeICU();
+    return atom::NodeMain(argc, argv);
+  } else if (IsEnvSet("ELECTRON_INTERNAL_CRASH_SERVICE")) {
+    return crash_service::Main(cmd);
+  }
+
+  sandbox::SandboxInterfaceInfo sandbox_info = {0};
+  content::InitializeSandboxInfo(&sandbox_info);
+  atom::AtomMainDelegate delegate;
+
+  content::ContentMainParams params(&delegate);
+  params.instance = instance;
+  params.sandbox_info = &sandbox_info;
+  atom::AtomCommandLine::Init(argc, argv);
+  atom::AtomCommandLine::InitW(argc, wargv);
+  return content::ContentMain(params);
+}
+
+#elif defined(OS_LINUX)  // defined(OS_WIN)
+
+#if defined(OS_TIZEN)
+// For debug purpose only.
+// TODO: To be removed later
+bool hasTizenPackageID(int argc, const char* const* argv) {
+  if (argc > 3) {
+    if (0 == strncmp(argv[0], "/opt/usr/globalapps/", strlen("/opt/usr/globalapps/"))) {
+      return true;
+    }
+  }
+  return false;
+}
+
+int real_main(int argc, char* argv[]) {
+#else
+int main(int argc, char* argv[]) {
+#endif
+  if (IsEnvSet(kRunAsNode)) {
+    base::i18n::InitializeICU();
+    base::AtExitManager atexit_manager;
+    return atom::NodeMain(argc, const_cast<char**>(argv));
+  }
+
+#if defined(USE_EFL)
+  common::CommandLine::Init(argc, argv);
+  common::CommandLine* runtime_cmd = common::CommandLine::ForCurrentProcess();
+  std::string appid = runtime_cmd->GetAppIdFromCommandLine("/usr/bin/wrt");
+
+  // load manifest
+  if (appid != "wrt") { // TODO: Any better way to distinguish?
+    auto appdata_manager = common::ApplicationDataManager::GetInstance();
+    common::ApplicationData* appdata = appdata_manager->GetApplicationData(appid);
+    if (!appdata->LoadManifestData()) {
+      return false;
+    }
+  }
+
+  if (efl::Initialize(argc, const_cast<const char**>(argv)))
+    return 1;
+
+  // Add params for EFL port
+  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+
+  static std::vector<char*> flags;
+  for (auto arg : kDefaultCommandLineFlags)
+    command_line->AppendSwitch(const_cast<char*>(arg));
+  efl::AppendPortParams(*command_line);
+#endif
+
+  atom::AtomMainDelegate delegate;
+  content::ContentMainParams params(&delegate);
+  params.argc = argc;
+  params.argv = const_cast<const char**>(argv);
+  atom::AtomCommandLine::Init(argc, argv);
+#if defined(OS_TIZEN)
+  if (hasTizenPackageID(argc,argv)) { // TODO: Check to be removed later
+    elm_init(argc, argv);
+    std::unique_ptr<runtime::Runtime> runtime = runtime::Runtime::MakeRuntime(&params);
+    return runtime->Exec();
+  }
+#endif
+  return content::ContentMain(params);
+}
+
+#if defined(OS_TIZEN)
+__attribute__((visibility("default")))
+int main(int argc, const char* argv[]) {
+  if (strcmp(argv[0], "/usr/bin/wrt-loader") == 0) {
+    LOG(INFO) << "run with wrt-loader";
+    auto preload = [argv](void) {
+    };
+    auto did_launch = [](const std::string& app_path) {
+    };
+    auto prelaunch = runtime::PreLauncher::Prelaunch;
+    return prelaunch(argc, const_cast<char**>(argv), preload, did_launch, real_main);
+  } else {
+    LOG(INFO) << "run without wrt-loader";
+    return real_main(argc, const_cast<char**>(argv));
+  }
+}
+#endif
+
+#else  // defined(OS_LINUX)
+
+int main(int argc, const char* argv[]) {
+  if (IsEnvSet(kRunAsNode)) {
+    return AtomInitializeICUandStartNode(argc, const_cast<char**>(argv));
+  }
+
+  return AtomMain(argc, argv);
+}
+
+#endif  // defined(OS_MACOSX)
diff --git a/tizen/src/wrt_main.h b/tizen/src/wrt_main.h
new file mode 100644 (file)
index 0000000..30663a4
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright (c) 2013 GitHub, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#ifndef ATOM_APP_ATOM_MAIN_H_
+#define ATOM_APP_ATOM_MAIN_H_
+
+#include "content/public/app/content_main.h"
+
+#endif  // ATOM_APP_ATOM_MAIN_H_
index def490d..018a859 100644 (file)
@@ -1,6 +1,6 @@
 {
   'conditions': [
-    ['desktop_linux==0', {
+    ['is_tizen==1', {
       'variables': {
         # The libraries brightray will be compiled to.
         'linux_system_libraries': 'chromium-efl dbus-1 evas gmodule-2.0 nss icu-i18n icu-uc'
@@ -72,8 +72,6 @@
             'link_settings': {
               'libraries': [
                 '<@(libchromiumcontent_libraries)',
-                '<@(libchromiumcontent_shared_root_libraries)',
-#                '<!(<(echo <@(libchromiumcontent_libraries)))',
               ]
             },
           }
index f039d85..4d8a026 100644 (file)
             ],
           }, {
             'conditions': [
-              ['desktop_linux==1', {
-                'defines': [
-                  'DESKTOP_LINUX',
-                ],
-              }],
               ['use_efl==1', {
                 'defines': [
                   'USE_EFL',
index 88711dc..5fa2213 100755 (executable)
@@ -18,22 +18,18 @@ def main():
       args.libcc_shared_library_path != None and
       args.libcc_static_library_path != None):
     pass
-  elif (args.libcc_chromium_efl_path == None and
-        args.libcc_source_path != None or
+  elif (args.libcc_source_path != None or
         args.libcc_shared_library_path != None or
         args.libcc_static_library_path != None):
     print "Error: All options of libchromiumcontent are required OR let " \
           "brightray choose it"
     sys.exit(0)
-  if args.libcc_chromium_efl_path == None:
+  if not os.path.isfile('/etc/tizen-release'):
     update_submodules()
-#  if args.libcc_chromium_efl_path != None:
-#    args.libcc_shared_library_path = args.libcc_chromium_efl_path
   setup_libchromiumcontent(args.dev, args.commit, args.target_arch, args.url,
                            args.libcc_source_path,
                            args.libcc_shared_library_path,
-                           args.libcc_static_library_path,
-                           args.libcc_chromium_efl_path)
+                           args.libcc_static_library_path)
 
 
 def parse_args():
@@ -59,8 +55,6 @@ def parse_args():
                         help='The static library path of libchromiumcontent. ' \
                         'NOTE: All options of libchromiumcontent are ' \
                         'required OR let brightray choose it')
-  parser.add_argument('--libcc_chromium_efl_path', required=False,
-                        help='The chromiunm-efl is linked to electron.')
   return parser.parse_args()
 
 
@@ -74,16 +68,12 @@ def update_submodules():
 def setup_libchromiumcontent(is_dev, commit, target_arch, url,
                              libcc_source_path,
                              libcc_shared_library_path,
-                             libcc_static_library_path,
-                             libcc_chromium_efl_path):
+                             libcc_static_library_path):
   target_dir = os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')
   download = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script',
                           'download')
   args = ['-f', '-c', commit, '--target_arch', target_arch, url, target_dir]
-  if libcc_chromium_efl_path != None:
-    args += ['--libcc_chromium_efl_path', libcc_chromium_efl_path]
-    mkdir_p(target_dir)
-  elif (libcc_source_path != None and
+  if (libcc_source_path != None and
       libcc_shared_library_path != None and
       libcc_static_library_path != None):
     args += ['--libcc_source_path', libcc_source_path,
index 3780cb6..84982ca 100755 (executable)
@@ -32,8 +32,7 @@ def main():
 
   for component in COMPONENTS:
     if args.component == 'all' or args.component == component:
-#      if component == 'shared_library' and args.no_shared_library:
-      if component == 'static_library':
+      if component == 'shared_library' and args.no_shared_library:
         continue
       out_dir = get_output_dir(SOURCE_ROOT, target_arch, component)
       target = 'chromiumcontent:chromiumcontent'
index 24b5032..aec75e5 100755 (executable)
@@ -307,8 +307,7 @@ def main():
   os.makedirs(DIST_DIR)
 
   for component in COMPONENTS:
-#    if args.component == 'all' or args.component == component:
-    if args.component != 'static_library':
+    if args.component == 'all' or args.component == component:
       copy_binaries(target_arch, component, create_debug_archive)
       copy_generated_sources(target_arch, component)
       copy_locales(target_arch, component)
index aa02fd8..5fa3efb 100755 (executable)
@@ -32,18 +32,7 @@ class ProgramError(Exception):
 def main():
   try:
     args = parse_args()
-    if os.path.isfile('/etc/tizen-release'):
-      SRC_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../src')
-      generate_filenames_gypi(os.path.join(args.path, 'filenames.gypi'),
-                              os.path.join(os.path.dirname(os.path.abspath(__file__)), '../src'),
-                              args.libcc_chromium_efl_path,
-                              args.libcc_chromium_efl_path)
-    elif args.libcc_chromium_efl_path != None:
-      generate_filenames_gypi(os.path.join(args.path, 'filenames.gypi'),
-                              args.libcc_chromium_efl_path,
-                              os.path.join(args.libcc_chromium_efl_path, 'out.x64'),
-                              os.path.join(args.libcc_chromium_efl_path, 'out.x64'))
-    elif (args.libcc_source_path != None and
+    if (args.libcc_source_path != None and
         args.libcc_shared_library_path != None and
         args.libcc_static_library_path != None):
       if (not os.path.isdir(args.libcc_source_path)):
@@ -103,8 +92,6 @@ def parse_args():
                         help='The shared library path of libchromiumcontent. NOTE: All options of libchromiumcontent are required OR let libchromiumcontent choose it')
   parser.add_argument('--libcc_static_library_path', required=False,
                         help='The static library path of libchromiumcontent. NOTE: All options of libchromiumcontent are required OR let libchromiumcontent choose it')
-  parser.add_argument('--libcc_chromium_efl_path', required=False,
-                        help='The chromium-efl is linked to electron')
   return parser.parse_args()
 
 
index 85efd17..08e8cd4 100755 (executable)
@@ -39,18 +39,15 @@ def main():
   else:
     print "Skipping Chromium Source Tarball Download"
 
-  if sys.platform == 'linux2' and not args.no_download:
+  if sys.platform == 'linux2':
     install_sysroot()
   elif sys.platform in ['win32', 'cygwin']:
     update_toolchain_json()
 
   target_arch = args.target_arch
-#  return (apply_patches() or
-#          copy_chromiumcontent_files() or
-#          update_clang() or
-#          update_gn() or
-#          run_gn(target_arch, args.defines))
-  return (copy_chromiumcontent_files() or
+  return (apply_patches() or
+          copy_chromiumcontent_files() or
+          update_clang() or
           update_gn() or
           run_gn(target_arch, args.defines))
 
@@ -196,7 +193,6 @@ def run_gn(target_arch, defines):
     gn = os.path.join(SRC_DIR, 'buildtools', 'win', 'gn.exe')
   elif sys.platform == 'linux2':
     gn = os.path.join(SRC_DIR, 'buildtools', 'linux64', 'gn')
-#    os.chmod(gn, 775)
   elif sys.platform == 'darwin':
     gn = os.path.join(SRC_DIR, 'buildtools', 'mac', 'gn')
 
index b71aa9d..f6fac50 100755 (executable)
@@ -72,7 +72,6 @@ GYPI_TEMPLATE = """\
     'libchromiumcontent_shared_libraries_dir': %(shared_libraries_dir)s,
     'libchromiumcontent_static_libraries_dir': %(static_libraries_dir)s,
     'libchromiumcontent_shared_libraries': %(shared_libraries)s,
-    'libchromiumcontent_shared_root_libraries': %(shared_root_libraries)s,
     'libchromiumcontent_shared_v8_libraries': %(shared_v8_libraries)s,
     'libchromiumcontent_static_libraries': %(static_libraries)s,
     'libchromiumcontent_static_v8_libraries': %(static_v8_libraries)s,
@@ -82,37 +81,19 @@ GYPI_TEMPLATE = """\
 
 
 def main(target_file, code_dir, shared_dir, static_dir):
-  print "+ share_dir : ", shared_dir
-  print "+ code_dir : ", code_dir
-  print '+ is_tizen : ', os.path.isfile('/etc/tizen-release')
   (shared_libraries, shared_v8_libraries) = find_libraries(
       shared_dir, SHARED_LIBRARY_SUFFIX, EXCLUDE_SHARED_LIBRARIES)
-  (shared_root_libraries, shared_v8_libraries) = find_libraries(
-      '../../../../../out/Dependencies/Root/lib64', SHARED_LIBRARY_SUFFIX, EXCLUDE_SHARED_LIBRARIES)
   (static_libraries, static_v8_libraries) = find_libraries(
       static_dir, STATIC_LIBRARY_SUFFIX, EXCLUDE_STATIC_LIBRARIES)
-  if os.path.isfile('/etc/tizen-release'):
-    content = GYPI_TEMPLATE % {
-      'src': repr(os.path.abspath(code_dir)),
-      'shared_libraries_dir': repr(os.path.abspath(shared_dir)),
-      'static_libraries_dir': repr(os.path.abspath(static_dir)),
-      'shared_libraries': ['/usr/lib/libchromium-ewk.so'],
-      'shared_root_libraries': shared_root_libraries,
-      'shared_v8_libraries': shared_v8_libraries,
-      'static_libraries': static_libraries,
-      'static_v8_libraries': static_v8_libraries,
-    }
-  else:
-    content = GYPI_TEMPLATE % {
-      'src': repr(os.path.abspath(code_dir)),
-      'shared_libraries_dir': repr(os.path.abspath(shared_dir)),
-      'static_libraries_dir': repr(os.path.abspath(static_dir)),
-      'shared_libraries': shared_libraries,
-      'shared_root_libraries': shared_root_libraries,
-      'shared_v8_libraries': shared_v8_libraries,
-      'static_libraries': static_libraries,
-      'static_v8_libraries': static_v8_libraries,
-    }
+  content = GYPI_TEMPLATE % {
+    'src': repr(os.path.abspath(code_dir)),
+    'shared_libraries_dir': repr(os.path.abspath(shared_dir)),
+    'static_libraries_dir': repr(os.path.abspath(static_dir)),
+    'shared_libraries': shared_libraries,
+    'shared_v8_libraries': shared_v8_libraries,
+    'static_libraries': static_libraries,
+    'static_v8_libraries': static_v8_libraries,
+  }
 
   with open(target_file, 'wb+') as f:
     f.write(content)
diff --git a/wrt.gyp b/wrt.gyp
new file mode 100644 (file)
index 0000000..a24edb4
--- /dev/null
+++ b/wrt.gyp
@@ -0,0 +1,201 @@
+{
+  'includes': [
+    'filenames.gypi',
+    'vendor/native_mate/native_mate_files.gypi',
+  ],
+  'targets': [
+    {
+      'target_name': 'wrt',
+      'type': 'executable',
+      'dependencies': [
+        '<(DEPTH)/electron.gyp:js2asar',
+        '<(DEPTH)/electron.gyp:app2asar',
+        'wrt_lib',
+        '<(DEPTH)/tizen/common/common.gyp:wrt_common',
+        '<(DEPTH)/tizen/loader/loader.gyp:wrt-loader',
+        '<(DEPTH)/efl/build/system.gyp:ecore',
+        '<(DEPTH)/efl/build/system.gyp:launchpad',
+        '<(DEPTH)/efl/build/system.gyp:capi-appfw-application',
+        '<(DEPTH)/efl/build/system.gyp:elementary',
+        'electron_shell_copy',
+      ],
+      'sources': [
+        'tizen/src/wrt_main.cc',
+        'tizen/src/wrt_main.h',
+        'tizen/loader/prelauncher.h',
+        'tizen/loader/prelauncher.cc',
+      ],
+      'include_dirs': [
+        'tizen/src',
+      ],
+      'includes': [
+        'tizen/build/common.gypi',
+      ],
+      'ldflags': [
+        '-pie',
+        '-export-dynamic',
+      ],
+      'cflags': [ '-fPIC' ],
+      'cflags_cc': [ '-fPIC' ],
+    },  # target wrt
+    {
+      'target_name': 'wrt_lib',
+      'type': 'static_library',
+      'dependencies': [
+        'electron.gyp:atom_js2c',
+        'vendor/pdf_viewer/pdf_viewer.gyp:pdf_viewer',
+        'vendor/brightray/brightray.gyp:brightray',
+        'vendor/node/node.gyp:node',
+      ],
+      'defines': [
+        # We need to access internal implementations of Node.
+        'NODE_WANT_INTERNALS=1',
+        'NODE_SHARED_MODE',
+        # This is defined in skia/skia_common.gypi.
+        'SK_SUPPORT_LEGACY_GETTOPDEVICE',
+        # Disable warnings for g_settings_list_schemas.
+        'GLIB_DISABLE_DEPRECATION_WARNINGS',
+        # Defined in Chromium but not exposed in its gyp file.
+        'V8_USE_EXTERNAL_STARTUP_DATA',
+        'V8_SHARED',
+        'USING_V8_SHARED',
+        'USING_V8_PLATFORM_SHARED',
+        'USING_V8_BASE_SHARED',
+        # Remove this after enable_plugins becomes a feature flag.
+        'ENABLE_PLUGINS',
+        'USE_PROPRIETARY_CODECS',
+        'ATOM_PRODUCT_NAME="WRT"',
+        'ATOM_PROJECT_NAME="WRT"',
+        'USE_SYSTEM_ICU',
+      ],
+      'sources': [
+        '<@(lib_sources)',
+        'atom/app/runtime.cc',
+        'atom/app/runtime.h',
+        'atom/app/ui_runtime.cc',
+        'atom/app/ui_runtime.h',
+        'atom/browser/api/atom_api_menu_efl.cc',
+        'atom/browser/api/atom_api_menu_efl.h',
+        'atom/browser/api/atom_api_pwrt.cc',
+        'atom/browser/api/atom_api_pwrt.h',
+        'atom/browser/api/atom_api_web_contents_efl.cc',
+        'atom/browser/common_web_contents_delegate_efl.cc',
+        'atom/browser/native_browser_view_efl.cc',
+        'atom/browser/native_browser_view_efl.h',
+        'atom/browser/native_window_efl.cc',
+        'atom/browser/native_window_efl.h',
+        'atom/browser/ui/accelerator_util_efl.cc',
+        'atom/browser/ui/drag_util_efl.cc',
+        'atom/browser/ui/file_dialog_efl.cc',
+        'atom/browser/ui/message_box_efl.cc',
+        'atom/browser/ui/tray_icon_efl.cc',
+        'atom/browser/ui/tray_icon_efl.h',
+        'chromium_src/chrome/browser/extensions/global_shortcut_listener_ozone.cc',
+        'chromium_src/chrome/browser/extensions/global_shortcut_listener_ozone.h',
+        'chromium_src/chrome/browser/icon_loader_efllinux.cc',
+      ],
+      'sources/': [
+        # chromium-efl supports only tizen webrtc using CAPI
+        # which is not working on desktop linux.
+        ['exclude', 'atom/browser/api/atom_api_desktop_capturer.cc'],
+        ['exclude', 'atom/browser/api/atom_api_desktop_capturer.h'],
+      ],
+      'include_dirs': [
+        '.',
+        'chromium_src',
+        'vendor/brightray',
+        'vendor/native_mate',
+        # Include atom_natives.h.
+        '<(SHARED_INTERMEDIATE_DIR)',
+        # Include directories for uv and node.
+        'vendor/node/src',
+        'vendor/node/deps/http_parser',
+        'vendor/node/deps/uv/include',
+        # The `node.h` is using `#include"v8.h"`.
+        '<(libchromiumcontent_src_dir)/v8/include',
+        # The `node.h` is using `#include"ares.h"`.
+        'vendor/node/deps/cares/include',
+        # The `third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h` is using `platform/PlatformExport.h`.
+        '<(libchromiumcontent_src_dir)/third_party/WebKit/Source',
+        # The 'third_party/libyuv/include/libyuv/scale_argb.h' is using 'libyuv/basic_types.h'.
+        '<(libchromiumcontent_src_dir)/third_party/libyuv/include',
+        # The 'third_party/webrtc/modules/desktop_capture/desktop_frame.h' is using 'webrtc/base/scoped_ptr.h'.
+        '<(libchromiumcontent_src_dir)/third_party/',
+        '<(libchromiumcontent_src_dir)/components/cdm',
+        '<(libchromiumcontent_src_dir)/third_party/widevine',
+        '<(libchromiumcontent_src_dir)/tizen_src/chromium_impl',
+      ],
+      'direct_dependent_settings': {
+        'include_dirs': [
+          '.',
+        ],
+      },
+      'export_dependent_settings': [
+        'vendor/brightray/brightray.gyp:brightray',
+      ],
+      'conditions': [
+        ['libchromiumcontent_component', {
+          'link_settings': {
+            'libraries': [ '<@(libchromiumcontent_v8_libraries)' ],
+          },
+        }],
+        ['OS=="linux"', {
+          'sources': [
+            '<@(lib_sources_linux)',
+            '<@(lib_sources_nss)',
+          ],
+          'link_settings': {
+          },
+          # Required settings of using breakpad.
+          'cflags_cc': [
+            '-Wno-empty-body',
+            '-Wno-reserved-user-defined-literal',
+          ],
+          'include_dirs': [
+            'vendor/breakpad/src',
+          ],
+          'dependencies': [
+            'vendor/breakpad/breakpad.gyp:breakpad_client',
+          ],
+        }],  # OS=="linux"
+        ['is_tizen==1', {
+          'cflags': [ '-fPIC' ],
+          'cflags_cc': [ '-fPIC' ],
+          'dependencies': [
+            '<(DEPTH)/efl/build/system.gyp:capi-appfw-application',
+            '<(DEPTH)/efl/build/system.gyp:efl-extension',
+            '<(DEPTH)/efl/build/system.gyp:elementary',
+            '<(DEPTH)/efl/build/system.gyp:evas',
+            '<(DEPTH)/efl/build/system.gyp:icu',
+          ],
+        }, {
+          'dependencies': [
+            '<(DEPTH)/efl/build/system.gyp:ecore-x',
+            '<(DEPTH)/efl/build/system.gyp:elocation',
+            '<(DEPTH)/efl/build/system.gyp:elementary',
+            '<(DEPTH)/efl/build/system.gyp:evas',
+            '<(DEPTH)/efl/build/system.gyp:icu',
+          ],
+        }],
+        ['tizen_product_tv==1', {
+          'dependencies': [
+            '<(DEPTH)/efl/build/system.gyp:vd-win-util',
+          ],
+        }],
+      ],
+    },  # target wrt_lib
+    {
+      'target_name': 'electron_shell_copy',
+      'type': 'none',
+      'copies': [
+        {
+          'destination': '<(PRODUCT_DIR)',
+          'files': [
+            '<(DEPTH)/efl/build/desktop/electron.sh',
+            '<(DEPTH)/efl/build/desktop/launch.sh',
+          ],
+        },
+      ],
+    },  # target electron_shell_copy
+  ],
+}