[Tizen] Add build configurations for Tizen target 70/157270/10
authorYoungsoo Choi <kenshin.choi@samsung.com>
Wed, 11 Oct 2017 08:20:51 +0000 (17:20 +0900)
committerSungsik Han <ss440.han@samsung.com>
Mon, 6 Nov 2017 02:47:24 +0000 (02:47 +0000)
This enables tizen build.

Change-Id: Ibba34f66bc1a0fae09d55e44c18e13e41e9c37c1
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
14 files changed:
common.gypi
efl/build/common.sh
efl/build/system.gyp
efl/features.gypi
electron.gyp
script/bootstrap.py
script/build.py
script/clean.py
script/lib/config.py
script/update.py
vendor/breakpad/breakpad.gyp
vendor/brightray/brightray.gyp
vendor/brightray/vendor/libchromiumcontent/script/download
vendor/brightray/vendor/libchromiumcontent/tools/generate_filenames_gypi.py

index ac3f21c..f56e491 100644 (file)
@@ -24,6 +24,7 @@
     'openssl_no_asm': 1,
     'use_efl%': 0,
     'desktop_linux%': 0,
+    'is_tizen%': 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
+    ['use_efl==1', {
+      'target_defaults': {
+        'defines': [
+          'USE_EFL',
+        ],
+      },
+    }],  # is_tizen==1
   ],
 }
index cf60c90..8c8ad13 100644 (file)
@@ -2,6 +2,7 @@
 
 export SCRIPTDIR=$(readlink -e $(dirname $0))
 export TOPDIR=$(readlink -f "${SCRIPTDIR}/../..")
+export LATEST_TIZEN_VERSION=4.0
 
 function error_report() {
   echo "Error: File:$1 Line:$2"
@@ -36,3 +37,45 @@ function hostGypElectronEfl() {
         $@
   fi
 }
+
+function setupAndExecuteTargetBuild() {
+  local platform="$1"
+  shift
+
+  local PROFILE
+  local ARCHITECTURE
+  local CONF_FLAG
+  local -a ARGS
+
+  local count=0
+  local exclusive_options=0
+  local RPMLINT=0
+  local NOINIT=0
+  local MIRROR=0
+
+  # "|| :" means "or always succeeding built-in command"
+  PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" || :)
+  ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" || :)
+
+  while [[ $# > 0 ]]; do
+    count=$(( $count + 1 ))
+    case "$1" in
+    --standard*)
+        PROFILE=tz_v${LATEST_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
+    ;;
+    --emulator*)
+        PROFILE=tz_v${LATEST_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
+    ;;
+    *)
+      ARGS[$count]="$1"
+    ;;
+    esac
+    shift;
+  done
+
+  if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
+    CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
+  fi
+
+  gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS $EXTRA_PACK_OPTS --incremental
+}
index 542bf0b..2461986 100644 (file)
     {
       'target_name': 'ecore-x',
       'type': 'none',
-      'direct_dependent_settings': {
-        'cflags': [
-          '<!@(<(pkg-config) --cflags ecore-x)',
-        ],
-      },
-      'link_settings': {
-        'ldflags': [
-          '<!@(<(pkg-config) --libs-only-L --libs-only-other ecore-x)',
-        ],
-        'libraries': [
-          '<!@(<(pkg-config) --libs-only-l ecore-x)',
-        ],
-      },
+      'conditions': [
+        ['desktop_linux==1', {
+          'direct_dependent_settings': {
+            'cflags': [
+              '<!@(<(pkg-config) --cflags ecore-x)',
+            ],
+          },
+          'link_settings': {
+            'ldflags': [
+              '<!@(<(pkg-config) --libs-only-L --libs-only-other ecore-x)',
+            ],
+            'libraries': [
+              '<!@(<(pkg-config) --libs-only-l ecore-x)',
+            ],
+          },
+        }],
+      ],
     }, # ecore-x
     {
       'target_name': 'elocation',
index 7a58de9..6fa056a 100644 (file)
@@ -7,5 +7,8 @@
         ],
       }]
     ],
+    'variables': {
+      'clang' : 0,
+    },
   },
 }
index 847870b..1925452 100644 (file)
@@ -6,6 +6,7 @@
     'company_abbr%': 'github',
     'version%': '1.6.7',
     'js2c_input_dir': '<(SHARED_INTERMEDIATE_DIR)/js2c',
+    'clang%': 0,
   },
   'includes': [
     'filenames.gypi',
@@ -38,6 +39,7 @@
       ],
       'include_dirs': [
         '.',
+        '/usr/include/v8',
         '<(libchromiumcontent_src_dir)/tizen_src/chromium_impl',
       ],
       'conditions': [
                 ],
               },
               'destination': '<(PRODUCT_DIR)',
-              'files': [
-#                '<!(<(echo <(libchromiumcontent_shared_v8_libraries)))',
-                '<@(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',
+              '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',
+                  ],
+                }],
               ],
             },
           ],
           ],
         }],  # OS=="linux"
         ['use_efl==1', {
-          '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',
+          'conditions': [
+            ['is_tizen==1', {
+              'dependencies': [
+                '<(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',
+              ],
+            }, {
+              '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',
+              ],
+            }],
           ],
           'defines': [
             'USE_SYSTEM_ICU',
index 030e1d3..ba7f31a 100755 (executable)
@@ -47,12 +47,13 @@ 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':
+  if PLATFORM != 'win32' and args.libcc_chromium_efl_path == None:
     if not args.disable_clang and args.clang_dir == '':
       # Download prebuilt clang binaries.
       update_clang()
 
-  setup_python_libs()
+  if os.path.isfile('/etc/tizen-release') != True:
+    setup_python_libs()
   if args.libcc_chromium_efl_path == None:
     update_node_modules('.')
   bootstrap_brightray(args.dev, args.url, args.target_arch,
index 1a7378b..b130211 100755 (executable)
@@ -20,12 +20,16 @@ def main():
   import_vs_env(get_target_arch())
 
   ninja = os.path.join('vendor', 'depot_tools', 'ninja')
+  ninja = 'ninja'
   if sys.platform == 'win32':
     ninja += '.exe'
 
   args = parse_args()
   for config in args.configuration:
-    build_path = os.path.join('out', config[0])
+    if os.path.isfile('/etc/tizen-release'):
+      build_path = os.path.join('out.tizen', 'out', config[0])
+    else:
+      build_path = os.path.join('out', config[0])
     ret = subprocess.call([ninja, '-C', build_path, args.target])
     if ret != 0:
       sys.exit(ret)
index c63bdbb..703a2b4 100755 (executable)
@@ -16,7 +16,10 @@ def main():
   args = parse_args()
 
   remove_directory('dist')
-  remove_directory('out')
+  if os.path.isfile('/etc/tizen-release'):
+    remove_directory('out.tizen')
+  else:
+    remove_directory('out')
 
   if not args.build:
     remove_directory('node_modules')
index 5818571..025139e 100644 (file)
@@ -18,6 +18,9 @@ PLATFORM = {
   'win32': 'win32',
 }[sys.platform]
 
+if os.path.isfile('/etc/tizen-release'):
+  PLATFORM = 'tizen'
+
 verbose_mode = False
 
 
index 2a0df3b..e172c4c 100755 (executable)
@@ -16,11 +16,13 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
 def main():
   os.chdir(SOURCE_ROOT)
 
-  if PLATFORM != 'win32' and platform.architecture()[0] != '64bit':
-    print 'Electron is required to be built on a 64bit machine'
-    return 1
+  if PLATFORM != 'tizen':
+    if PLATFORM != 'win32' and platform.architecture()[0] != '64bit':
+      print 'Electron is required to be built on a 64bit machine'
+      return 1
+
+    update_external_binaries()
 
-  update_external_binaries()
   return update_gyp()
 
 
@@ -39,6 +41,7 @@ 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.
@@ -59,6 +62,8 @@ def run_gyp(target_arch, component):
     env['GYP_CROSSCOMPILE'] = '1'
   elif PLATFORM == 'win32':
     env['GYP_MSVS_VERSION'] = '2015'
+  elif PLATFORM == 'tizen':
+    env['GYP_GENERATOR_OUTPUT'] = os.path.join(SOURCE_ROOT, 'out.tizen')
   python = sys.executable
   if sys.platform == 'cygwin':
     # Force using win32 python on cygwin.
index d9e23ea..ceebef8 100644 (file)
@@ -3,6 +3,9 @@
 # found in the LICENSE file.
 
 {
+  'variables' : {
+    'clang%': 0,
+  },
   'includes': [
     'breakpad_sender.gypi',
     'breakpad_handler.gypi',
index 972b432..21878a0 100644 (file)
@@ -1,8 +1,17 @@
 {
-  'variables': {
-    # The libraries brightray will be compiled to.
-    'linux_system_libraries': 'dbus-1 evas x11 x11-xcb xcb xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst xscrnsaver gconf-2.0 gmodule-2.0 nss icu-i18n icu-uc'
-  },
+  'conditions': [
+    ['desktop_linux==0', {
+      'variables': {
+        # The libraries brightray will be compiled to.
+        'linux_system_libraries': 'chromium-efl dbus-1 evas gmodule-2.0 nss icu-i18n icu-uc'
+      }
+    }, {
+      'variables': {
+        # The libraries brightray will be compiled to.
+        'linux_system_libraries': 'dbus-1 evas x11 x11-xcb xcb xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst xscrnsaver gconf-2.0 gmodule-2.0 nss icu-i18n icu-uc'
+      }
+    }]
+  ],
   'includes': [
     'filenames.gypi',
   ],
       'type': 'static_library',
       'include_dirs': [
         '.',
+        '/usr/include/v8',
         '<(libchromiumcontent_src_dir)',
+        '<(libchromiumcontent_src_dir)/tizen_src/chromium_impl',
         '<(libchromiumcontent_src_dir)/skia/config',
         '<(libchromiumcontent_src_dir)/third_party/boringssl/src/include',
         '<(libchromiumcontent_src_dir)/third_party/skia/include/core',
+        '<(libchromiumcontent_src_dir)/third_party/skia/include/config',
         '<(libchromiumcontent_src_dir)/third_party/mojo/src',
         '<(libchromiumcontent_src_dir)/third_party/WebKit',
         '<(libchromiumcontent_src_dir)/tizen_src/chromium_impl',
+        '<(libchromiumcontent_src_dir)/gen',
         '<(libchromiumcontent_dir)/gen',
       ],
       'direct_dependent_settings': {
         'include_dirs': [
           '.',
           '..',
+          '/usr/include/v8',
           '<(libchromiumcontent_src_dir)',
+          '<(libchromiumcontent_src_dir)/tizen_src/chromium_impl',
           '<(libchromiumcontent_src_dir)/gpu',
           '<(libchromiumcontent_src_dir)/skia/config',
           '<(libchromiumcontent_src_dir)/third_party/boringssl/src/include',
@@ -35,6 +50,7 @@
           '<(libchromiumcontent_src_dir)/third_party/mojo/src',
           '<(libchromiumcontent_src_dir)/third_party/khronos',
           '<(libchromiumcontent_src_dir)/third_party/WebKit',
+          '<(libchromiumcontent_src_dir)/gen',
           '<(libchromiumcontent_dir)/gen',
         ],
       },
@@ -68,7 +84,7 @@
                 'ldflags': [
                   '-Wl,--whole-archive',
                   '<@(libchromiumcontent_libraries)',
-                  '<!(<(echo <@(libchromiumcontent_libraries)))',
+#                  '<!(<(echo <@(libchromiumcontent_libraries)))',
                   '-Wl,--no-whole-archive',
                 ],
               }
@@ -76,7 +92,7 @@
               'link_settings': {
                 'libraries': [
                   '<@(libchromiumcontent_libraries)',
-                  '<!(<(echo <@(libchromiumcontent_libraries)))',
+#                  '<!(<(echo <@(libchromiumcontent_libraries)))',
                 ]
               },
             }],  # (Normal builds)
               },
             }, {
               'link_settings': {
-                'libraries': [
-                  # Link with ffmpeg.
-#                  '<(libchromiumcontent_dir)/libffmpeg.so',
-                  # Following libraries are required by libchromiumcontent:
-                  '-lasound',
-                  '-lcap',
-                  '-lcups',
-                  '-lrt',
-                  '-ldl',
-                  '-lresolv',
-                  '-lfontconfig',
-                  '-lfreetype',
-                  '-lexpat',
+                'conditions': [
+                  ['is_tizen==1', {
+                    'libraries': [
+                      # Following libraries are required by libchromiumcontent:
+                      '-lasound',
+                      '-lcap',
+                      '-lrt',
+                      '-ldl',
+                      '-lresolv',
+                      '-lfontconfig',
+                      '-lfreetype',
+                      '-lexpat',
+                    ],
+                  },{
+                    'libraries': [
+                      # Link with ffmpeg.
+    #                  '<(libchromiumcontent_dir)/libffmpeg.so',
+                      # Following libraries are required by libchromiumcontent:
+                      '-lasound',
+                      '-lcap',
+                      '-lcups',
+                      '-lrt',
+                      '-ldl',
+                      '-lresolv',
+                      '-lfontconfig',
+                      '-lfreetype',
+                      '-lexpat',
+                    ],
+                  }],
                 ],
               },
             }],
index c02e7d0..aa02fd8 100755 (executable)
@@ -32,7 +32,13 @@ class ProgramError(Exception):
 def main():
   try:
     args = parse_args()
-    if args.libcc_chromium_efl_path != None:
+    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'),
index 150999f..03e369a 100755 (executable)
@@ -81,23 +81,38 @@ GYPI_TEMPLATE = """\
 
 
 def main(target_file, code_dir, shared_dir, static_dir):
-  print "YSYS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", shared_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) = searh_files(
       shared_dir, SHARED_LIBRARY_SUFFIX, EXCLUDE_SHARED_LIBRARIES)
   (shared_root_libraries, shared_v8_libraries) = searh_files(
       '../../../../../out/Dependencies/Root/lib64', SHARED_LIBRARY_SUFFIX, EXCLUDE_SHARED_LIBRARIES)
   (static_libraries, static_v8_libraries) = searh_files(
       static_dir, STATIC_LIBRARY_SUFFIX, EXCLUDE_STATIC_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_root_libraries': shared_root_libraries,
-    'shared_v8_libraries': shared_v8_libraries,
-    'static_libraries': static_libraries,
-    'static_v8_libraries': static_v8_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,
+    }
+
   with open(target_file, 'wb+') as f:
     f.write(content)