From: SangYong Park Date: Mon, 19 Feb 2018 04:16:22 +0000 (+0900) Subject: Add build script X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b933d88e0f1e24a807c56088498f863080a7eaaf;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Add build script Build ./tizen/script/build -p <> or ./tizen/script/build -t <> Print profile/target list ./tizen/script/build -l Change-Id: I89d8ec12c538040188964270cc6369030d7d9e7e Signed-off-by: SangYong Park --- diff --git a/.gitignore b/.gitignore index 0e82dcf30..a86d15a28 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ /.idea/ /dist/ /external_binaries/ -/out/ +/out* /vendor/brightray/vendor/download/ /vendor/debian_wheezy_amd64-sysroot/ /vendor/debian_wheezy_arm-sysroot/ diff --git a/atom/app/atom_main.cc b/atom/app/atom_main.cc index 2b33586e7..7e2e41e15 100644 --- a/atom/app/atom_main.cc +++ b/atom/app/atom_main.cc @@ -32,11 +32,14 @@ #endif #include "atom/app/node_main.h" -#include "tizen/loader/prelauncher.h" #include "atom/common/atom_command_line.h" #include "base/at_exit.h" #include "base/i18n/icu_util.h" + +#if defined(OS_TIZEN) +#include "tizen/loader/prelauncher.h" #include "base/logging.h" +#endif namespace { @@ -129,7 +132,11 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) { #elif defined(OS_LINUX) // defined(OS_WIN) +#if defined(OS_TIZEN) 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; @@ -159,7 +166,6 @@ int real_main(int argc, char* argv[]) { #if defined(OS_TIZEN) __attribute__((visibility("default"))) -#endif int main(int argc, const char* argv[]) { if (strcmp(argv[0], "/usr/bin/wrt-loader") == 0) { LOG(INFO) << "run with wrt-loader"; @@ -174,6 +180,7 @@ int main(int argc, const char* argv[]) { return real_main(argc, const_cast(argv)); } } +#endif #else // defined(OS_LINUX) diff --git a/tizen/script/build b/tizen/script/build new file mode 100755 index 000000000..23aceb0c8 --- /dev/null +++ b/tizen/script/build @@ -0,0 +1,181 @@ +#!/usr/bin/env python + +import argparse +import math +import os +import shutil +import subprocess +import sys + +SCRIPT_PATH = os.path.dirname(__file__) +ROOT_PATH = os.path.abspath(os.path.dirname(os.path.dirname(SCRIPT_PATH))) + +TARGETS = { + 'mobile': 'tz_v4.0_standard_armv7l', + 'tv': 'tztv_v4.0_arm-kantm', + 'desktop': '-' +} + +def main(): + parser = argparse.ArgumentParser(description=('Build Programmable Web Runtime')) + parser.add_argument('-p', '--profile', help='Specify build profile') + target_group = parser.add_argument_group('target hint') + target_group.add_argument('-t', '--target', help='Specify build target', + choices=['mobile', 'tv', 'desktop']) + target_group.add_argument('-e', '--emul', action='store_true', help='Build for emulator') + target_group.add_argument('-m', '--mirror', action='store_true', help='Use mirror server') + parser.add_argument('-b', '--force_bootstrap', action='store_true', + help='Run bootstrapping script forcely') + parser.add_argument('-c', '--chromium_path', help='Specify chromium path used by desktop build') + parser.add_argument('-v', '--verbose', action='store_true', help='Print verbose output') + parser.add_argument('-l', '--print_list', action='store_true', help='Print profile/target list') + args = parser.parse_args() + + if args.target == 'desktop': + build_desktop(args.chromium_path, args.force_bootstrap, args.verbose) + elif args.profile or args.target or args.print_list: + command = ['grep', '-Po', r'(?<=\[profile\.).*(?=\])', os.path.join(SCRIPT_PATH, 'gbs.conf')] + profile_list = subprocess.check_output(command).strip().split('\n') + if args.print_list: + print_profile(profile_list) + print + print_target() + else: + if args.profile: + profile = args.profile + else: + profile = find_profile(args.target, args.emul, args.mirror) + if profile not in profile_list: + if profile: + print 'Error: %s is not valid profile (Please refer print_list option)' % profile + else: + print 'Error: Fail to find valid profile (Please refer print_list option)' + return 1 + build_gbs(profile, args.force_bootstrap, args.verbose) + else: + print 'Error: Cannot found any hint for build profile.' + parser.print_help() + return 1 + + return 0 + +def print_profile(profile_list): + profile_count = len(profile_list) + maxlength = max(len(profile) for profile in profile_list) + terminal_width = int(subprocess.check_output(['stty', 'size']).strip().split()[1]) + col = max(1, (terminal_width - maxlength + 1) / maxlength) + row = int(math.ceil(float(profile_count) / col)) + order = [0] * profile_count + last_col = (profile_count % col) if profile_count % col != 0 else col + start = 0 + for i in range(col): + end = start + (row if i < last_col else row - 1) + order[i:profile_count:col] = range(start, end) + start = end + + print 'Available Tizen Profile list' + print '-' * ((maxlength + 1) * col - 1) + for i in range(row): + col_count = col if i != row - 1 else last_col + for j in range(col_count): + formatted = ('%-' + str(maxlength) + 's') % profile_list[order[i * col + j]] + if j + 1 != col_count: + print formatted, + else: + print formatted + +def print_target(): + target_names = TARGETS.keys() + name_maxlength = max(len(name) for name in target_names) + profile_maxlength = max(len(profile) for profile in TARGETS.values()) + + print 'Target list (Name / Profile)' + print '-' * (name_maxlength + profile_maxlength + 1) + for name in target_names: + print ('%-' + str(name_maxlength) + 's %s') % (name, TARGETS[name]) + +def find_profile(target, emul, mirror): + if target not in TARGETS: + print target + ' is not exist in target list' + return None + + profile = TARGETS[target] + if emul: + if profile.find('standard') < 0: + print target + ' do not have emulator profile' + return None + profile = profile.replace('standard', 'emulator') + + if profile.endswith('armv7l'): + profile = profile.replace('armv7l', 'ia32') + elif profile.endswith('aarch64'): + profile = profile.replace('aarch64', 'x86_64') + + if mirror: + profile += '_mirror' + + return profile + +def build_gbs(profile, force_bootstrap, verbose): + arch = find_architecture(profile) + print 'Build : profile=' + profile + ' architecture=' + arch + command = ['gbs', '--conf', os.path.join(SCRIPT_PATH, 'gbs.conf'), 'build', + '-P', profile, '--include-all', '-A', arch, '--incremental'] + subprocess.call(command) + return True + +def find_architecture(profile): + if profile.startswith('tztv'): + return 'armv7l' + values = profile.split('_') + arch = values[-1] if values[-1] != 'mirror' else values[-2] + arch = arch if arch != 'ia32' else 'i586' + return arch + +def build_desktop(chromium_path, force_bootstrap, verbose): + if chromium_path is None: + parent_path = os.path.dirname(ROOT_PATH) + for entry in os.listdir(parent_path): + if entry.find('chromium-efl') >= 0 and os.path.isdir(os.path.join(parent_path, entry)): + chromium_path = os.path.join(parent_path, entry) + break + else: + chromium_path = os.path.abspath(chromium_path) + + if not run_bootstrap(chromium_path, verbose): + print('Fail to run bootstrap script') + return False + + subprocess.call([os.path.join(ROOT_PATH, 'script', 'build.py'), '-c', 'D']) + return True + +def run_bootstrap(chromium_path, verbose): + chromium_output_path = os.path.join(chromium_path, 'out.x64') + if not os.path.isdir(chromium_path) or not os.path.isdir(chromium_output_path): + print('chromium path (%s) is not valid.' % chromium_path) + return False + + os.putenv('PKG_CONFIG_PATH', os.path.join(chromium_output_path, + 'Dependencies', 'Root', 'lib64', 'pkgconfig')) + + defines = [ + 'libchromiumcontent_component=1', + 'desktop_linux=1', + 'use_efl=1' + ] + + args = ['--define', ' '.join(defines), '--dev', '--disable_clang', + '--libcc_chromium_efl_path=' + chromium_path] # FIXME + if verbose: + args += ['-v'] + + print('arguments ' + ' '.join(args)) + subprocess.call([os.path.join(ROOT_PATH, 'script', 'bootstrap.py')] + args) + + icudata_file = os.path.join(chromium_output_path, 'icudtl.dat') + shutil.copy(icudata_file, os.path.join(ROOT_PATH, 'out', 'D')) + + return True + +if __name__ == '__main__': + sys.exit(main()) diff --git a/tizen/script/gbs.conf b/tizen/script/gbs.conf new file mode 100755 index 000000000..f25aa885a --- /dev/null +++ b/tizen/script/gbs.conf @@ -0,0 +1,192 @@ +############################################### +# +# Tizen v4.0 unified +# +[obs.tizen_v4.0] +url = https://api.tizen.org + +[repo.tz_v4.0_standard] +url = http://download.tizen.org/snapshots/tizen/4.0-unified/latest/repos/standard/packages/ + +[repo.tz_v4.0_standard_mirror] +url = http://165.213.149.200/download/public_mirror/tizen/4.0-unified/latest/repos/standard/packages/ +user = blinkbot +passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ== + +[repo.tz_v4.0_emulator] +url = http://download.tizen.org/snapshots/tizen/4.0-unified/latest/repos/emulator/packages/ + +[repo.tz_v4.0_emulator_mirror] +url = http://165.213.149.200/download/public_mirror/tizen/4.0-unified/latest/repos/emulator/packages/ +user = blinkbot +passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ== + +[repo.public_4.0_base_arm] +url = http://download.tizen.org/snapshots/tizen/4.0-base/latest/repos/arm/packages/ + +[repo.public_4.0_base_arm_mirror] +url = http://165.213.149.200/download/public_mirror/tizen/4.0-base/latest/repos/arm/packages/ +user = blinkbot +passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ== + +[repo.public_4.0_base_arm64] +url = http://download.tizen.org/snapshots/tizen/4.0-base/latest/repos/arm64/packages/ + +[repo.public_4.0_base_arm64_mirror] +url = http://165.213.149.200/download/public_mirror/tizen/4.0-base/latest/repos/arm64/packages/ +user = blinkbot +passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ== + +[repo.public_4.0_base_ia32] +url = http://download.tizen.org/snapshots/tizen/4.0-base/latest/repos/ia32/packages/ + +[repo.public_4.0_base_ia32_mirror] +url = http://165.213.149.200/download/public_mirror/tizen/4.0-base/latest/repos/ia32/packages/ +user = blinkbot +passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ== + +[repo.public_4.0_base_x86_64] +url = http://download.tizen.org/snapshots/tizen/4.0-base/latest/repos/x86_64/packages/ + +[repo.public_4.0_base_x86_64_mirror] +url = http://165.213.149.200/download/public_mirror/tizen/4.0-base/latest/repos/x86_64/packages/ +user = blinkbot +passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ== + +[repo.electron_armv7l] +url = http://10.113.138.88/tizenrepo/electron_repo/armv7l/ + +############################################### +# +# Tizen v4.0 for standard (armv7l) +# +[profile.tz_v4.0_standard_armv7l] +obs = obs.tizen_v4.0 +repos = repo.electron_armv7l, repo.public_4.0_base_arm, repo.tz_v4.0_standard +buildroot = ~/GBS-ROOT-4.0-STANDARD-ARMV7L2 + +############################################### +# +# Tizen v4.0 for standard (armv7l), Mirroring Server for HQ developers +# +[profile.tz_v4.0_standard_armv7l_mirror] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_arm_mirror, repo.tz_v4.0_standard_mirror +buildroot = ~/GBS-ROOT-4.0-STANDARD-ARMV7L + +############################################### +# +# Tizen v4.0 for standard (aarch64) +# +[profile.tz_v4.0_standard_aarch64] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_arm64, repo.tz_v4.0_standard +buildroot = ~/GBS-ROOT-4.0-STANDARD-AARCH64 + +############################################### +# +# Tizen v4.0 for standard (aarch64), Mirroring Server for HQ developers +# +[profile.tz_v4.0_standard_aarch64_mirror] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_arm64_mirror, repo.tz_v4.0_standard_mirror +buildroot = ~/GBS-ROOT-4.0-STANDARD-AARCH64 + +############################################### +# +# Tizen v4.0 for standard (ix86) +# +[profile.tz_v4.0_standard_ia32] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_ia32, repo.tz_v4.0_standard +buildroot = ~/GBS-ROOT-4.0-STANDARD-IX86 + +############################################### +# +# Tizen v4.0 for standard (ix86), Mirroring Server for HQ developers +# +[profile.tz_v4.0_standard_ia32_mirror] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_ia32_mirror, repo.tz_v4.0_standard_mirror +buildroot = ~/GBS-ROOT-4.0-STANDARD-IX86 + +############################################### +# +# Tizen v4.0 for standard (x86_64) +# +[profile.tz_v4.0_standard_x86_64] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_x86_64, repo.tz_v4.0_standard +buildroot = ~/GBS-ROOT-4.0-STANDARD-X86_64 + +############################################### +# +# Tizen v4.0 for standard (x86_64), Mirroring Server for HQ developers +# +[profile.tz_v4.0_standard_x86_64_mirror] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_x86_64_mirror, repo.tz_v4.0_standard_mirror +buildroot = ~/GBS-ROOT-4.0-STANDARD-X86_64 + +############################################### +# +# Tizen v4.0 for emulator (ix86) +# +[profile.tz_v4.0_emulator_ia32] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_ia32, repo.tz_v4.0_emulator +buildroot = ~/GBS-ROOT-4.0-EMULATOR-IX86 + +############################################### +# +# Tizen v4.0 for emulator (ix86), Mirroring Server for HQ developers +# +[profile.tz_v4.0_emulator_ia32_mirror] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_ia32_mirror, repo.tz_v4.0_emulator_mirror +buildroot = ~/GBS-ROOT-4.0-EMULATOR-IX86 + +############################################### +# +# Tizen v4.0 for emulator (x86_64) +# +[profile.tz_v4.0_emulator_x86_64] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_x86_64, repo.tz_v4.0_emulator +buildroot = ~/GBS-ROOT-4.0-EMULATOR-X86_64 + +############################################### +# +# Tizen v4.0 for emulator (x86_64), Mirroring Server for HQ developers +# +[profile.tz_v4.0_emulator_x86_64_mirror] +obs = obs.tizen_v4.0 +repos = repo.public_4.0_base_x86_64_mirror, repo.tz_v4.0_emulator_mirror +buildroot = ~/GBS-ROOT-4.0-EMULATOR-X86_64 + +############################################### +# +# Tizen product tv +# +[obs.tizen_product_tv] +url = https://168.219.243.64/api +user = obs_viewer +passwdx = obs_viewer_64 + +############################################# +# +# Tizen v4.0 for product tv (KantM armv7l) +# +[profile.tztv_v4.0_arm-kantm] +obs = obs.tizen_product_tv +repos = repo.electron_tv, repo.tv_product_4.0_kantm, repo.tv_product_4.0_base +buildroot = ~/GBS-ROOT-4.0-TV-PRODUCT-KANTM + +[repo.tv_product_4.0_base] +url = http://168.219.244.109/tizen-rsa/tizen-4.0-base-main2018/standard/latest/repos/base/armv7l/packages/ + +[repo.tv_product_4.0_kantm] +url = http://168.219.244.109/products/tv/archive/2018/MAIN2018/KantM/latest/repos/product/armv7l/packages/ + +[repo.electron_tv] +url = http://10.113.138.88/tizenrepo/electron_repo/tv/ diff --git a/vendor/brightray/brightray.gyp b/vendor/brightray/brightray.gyp index f12da7abd..def490d90 100644 --- a/vendor/brightray/brightray.gyp +++ b/vendor/brightray/brightray.gyp @@ -8,7 +8,7 @@ }, { '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' + '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' } }] ], diff --git a/vendor/brightray/vendor/libchromiumcontent/tools/generate_filenames_gypi.py b/vendor/brightray/vendor/libchromiumcontent/tools/generate_filenames_gypi.py index 03e369ad5..b71aa9d6f 100755 --- a/vendor/brightray/vendor/libchromiumcontent/tools/generate_filenames_gypi.py +++ b/vendor/brightray/vendor/libchromiumcontent/tools/generate_filenames_gypi.py @@ -2,6 +2,7 @@ import glob import os +import re import sys @@ -84,11 +85,11 @@ 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) = searh_files( + (shared_libraries, shared_v8_libraries) = find_libraries( shared_dir, SHARED_LIBRARY_SUFFIX, EXCLUDE_SHARED_LIBRARIES) - (shared_root_libraries, shared_v8_libraries) = searh_files( + (shared_root_libraries, shared_v8_libraries) = find_libraries( '../../../../../out/Dependencies/Root/lib64', SHARED_LIBRARY_SUFFIX, EXCLUDE_SHARED_LIBRARIES) - (static_libraries, static_v8_libraries) = searh_files( + (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 % { @@ -117,11 +118,42 @@ def main(target_file, code_dir, shared_dir, static_dir): f.write(content) -def searh_files(src, suffix, exclude): - files = glob.glob(os.path.join(src, '*.' + suffix)) - files = [f for f in files if os.path.basename(f) not in exclude] - return ([os.path.abspath(f) for f in files if not is_v8_library(f)], - [os.path.abspath(f) for f in files if is_v8_library(f)]) +def find_libraries(dirpath, library_suffix, list_of_excludes): + libraries = glob.glob(os.path.join(dirpath, '*.' + library_suffix)) + if (library_suffix == 'so'): + # Handle "libname.so.123" +# libraries += find_files_by_regex(dirpath, re.compile('.*\.so\.[0-9]+')) + libraries += find_files_by_regex(dirpath, re.compile('.*\.so\.[0-9]+$')) + + libraries = [lib + for lib in libraries + if os.path.basename(lib) not in list_of_excludes + ] + + v8_libraries = [lib + for lib in libraries + if is_v8_library(lib) + ] + other_libraries = [lib + for lib in libraries + if lib not in v8_libraries + ] + + return ( + [os.path.abspath(l) for l in other_libraries], + [os.path.abspath(l) for l in v8_libraries] + ) + + +def find_files_by_regex(dirpath, regex): + files_found = [] + + for root, dirs, files in os.walk(dirpath): + for file in files: + if regex.match(file): + files_found.append(os.path.join(root, file)) + + return files_found def is_v8_library(p):