From 26c0ad1c2fb917215d22df766ff50f4e1f7f82ca Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 2 May 2016 16:04:50 +0900 Subject: [PATCH 1/5] Add --build_libchromiumcontent option --- script/bootstrap.py | 26 ++++++++++++++-- script/build-libchromiumcontent.py | 48 ++++++++++++++++++++++++++++++ vendor/brightray | 2 +- 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100755 script/build-libchromiumcontent.py diff --git a/script/bootstrap.py b/script/bootstrap.py index 54f59c68f90f..3d61106f266f 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -33,6 +33,19 @@ def main(): if sys.platform == 'cygwin': update_win32_python() + libcc_source_path = args.libcc_source_path + libcc_shared_library_path = args.libcc_shared_library_path + libcc_static_library_path = args.libcc_static_library_path + + # Redirect to use local libchromiumcontent build. + if args.build_libchromiumcontent: + build_libchromiumcontent(args.verbose, args.target_arch) + dist_dir = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', + 'libchromiumcontent', 'dist', 'main') + libcc_source_path = os.path.join(dist_dir, 'src') + 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': update_clang() @@ -40,8 +53,8 @@ def main(): setup_python_libs() update_node_modules('.') bootstrap_brightray(args.dev, args.url, args.target_arch, - args.libcc_source_path, args.libcc_shared_library_path, - args.libcc_static_library_path) + libcc_source_path, libcc_shared_library_path, + libcc_static_library_path) if PLATFORM == 'linux': download_sysroot(args.target_arch) @@ -71,6 +84,8 @@ def parse_args(): 'prompts.') parser.add_argument('--target_arch', default=get_target_arch(), help='Manually specify the arch to build for') + parser.add_argument('--build_libchromiumcontent', action='store_true', + help='Build local version of libchromiumcontent') parser.add_argument('--libcc_source_path', required=False, help='The source path of libchromiumcontent. ' \ 'NOTE: All options of libchromiumcontent are ' \ @@ -159,6 +174,13 @@ def update_win32_python(): execute_stdout(['git', 'clone', PYTHON_26_URL]) +def build_libchromiumcontent(is_verbose_mode, target_arch): + args = [os.path.join(SOURCE_ROOT, 'script', 'build-libchromiumcontent.py')] + if is_verbose_mode: + args += ['-v'] + execute_stdout(args + ['--target_arch', target_arch]) + + def update_clang(): execute_stdout([os.path.join(SOURCE_ROOT, 'script', 'update-clang.sh')]) diff --git a/script/build-libchromiumcontent.py b/script/build-libchromiumcontent.py new file mode 100755 index 000000000000..2409d0125c3f --- /dev/null +++ b/script/build-libchromiumcontent.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +import argparse +import os +import sys + +from lib.config import enable_verbose_mode, get_target_arch +from lib.util import execute_stdout + + +SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + + +def main(): + os.chdir(SOURCE_ROOT) + + args = parse_args() + if args.verbose: + enable_verbose_mode() + + # ./script/bootstrap + # ./script/update -t x64 + # ./script/build --no_shared_library -t x64 + # ./script/create-dist -c static_library -t x64 --no_zip + script_dir = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', + 'libchromiumcontent', 'script') + bootstrap = os.path.join(script_dir, 'bootstrap') + update = os.path.join(script_dir, 'update') + 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]) + execute_stdout([sys.executable, build, '-R', '-t', args.target_arch]) + execute_stdout([sys.executable, create_dist, '-c', 'static_library', + '--no_zip', '-t', args.target_arch]) + + +def parse_args(): + parser = argparse.ArgumentParser(description='Build libchromiumcontent') + parser.add_argument('--target_arch', + help='Specify the arch to build for') + parser.add_argument('-v', '--verbose', action='store_true', + help='Prints the output of the subprocesses') + return parser.parse_args() + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/vendor/brightray b/vendor/brightray index 8dbaeed37b9c..3d168efd1d27 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 8dbaeed37b9c4fb8ae985670b142f659bb265fb4 +Subproject commit 3d168efd1d27d4ac3869beac6290c5066c392721 From 64abae0b3c43e150f2007fe864ff0c8fbe9a6086 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 2 May 2016 16:26:18 +0900 Subject: [PATCH 2/5] docs: Cleanup unnecessary parts in build-instructions-linux.md --- docs/development/build-instructions-linux.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docs/development/build-instructions-linux.md b/docs/development/build-instructions-linux.md index 79fbc5014896..49a78ba3ccb7 100644 --- a/docs/development/build-instructions-linux.md +++ b/docs/development/build-instructions-linux.md @@ -4,6 +4,7 @@ Follow the guidelines below for building Electron on Linux. ## Prerequisites +* At least 25GB disk space and 8GB RAM. * Python 2.7.x. Some distributions like CentOS still use Python 2.6.x so you may need to check your Python version with `python -V`. * Node.js v0.12.x. There are various ways to install Node. You can download @@ -33,11 +34,6 @@ $ sudo yum install clang dbus-devel gtk2-devel libnotify-devel libgnome-keyring- Other distributions may offer similar packages for installation via package managers such as pacman. Or one can compile from source code. -## If You Use Virtual Machines For Building - -If you plan to build Electron on a virtual machine you will need a fixed-size -device container of at least 25 gigabytes in size. - ## Getting the Code ```bash @@ -112,8 +108,6 @@ $ ./script/clean.py ## Troubleshooting -Make sure you have installed all of the build dependencies. - ### Error While Loading Shared Libraries: libtinfo.so.5 Prebulit `clang` will try to link to `libtinfo.so.5`. Depending on the host @@ -128,7 +122,7 @@ $ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5 Test your changes conform to the project coding style using: ```bash -$ ./script/cpplint.py +$ npm run lint ``` Test functionality using: From 459a65d296aff06a9a6183ed4499a70f8f669cd4 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 2 May 2016 16:35:33 +0900 Subject: [PATCH 3/5] docs: the --build_libchromiumcontent switch --- docs/development/build-instructions-linux.md | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/development/build-instructions-linux.md b/docs/development/build-instructions-linux.md index 49a78ba3ccb7..870f4fca61f1 100644 --- a/docs/development/build-instructions-linux.md +++ b/docs/development/build-instructions-linux.md @@ -130,3 +130,25 @@ Test functionality using: ```bash $ ./script/test.py ``` + +## Advanced topics + +The default building configuration is targeted for major desktop Linux +distributions, to build for a specific distribution or device, following +information may help you. + +### Build libchromiumcontent locally + +To avoid using the prebuilt binaries of libchromiumcontent, you can pass the +`--build_libchromiumcontent` switch to `bootstrap.py` script: + +```bash +$ ./script/bootstrap.py -v --build_libchromiumcontent +``` + +Note that by default the `shared_library` configuration is not built, so you can +only build `Release` version of Electron if you use this mode: + +```bash +$ ./script/build.py -c D +``` From cc24bea813305dc8a13e58aa4ff437550c4f4b84 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 2 May 2016 16:38:58 +0900 Subject: [PATCH 4/5] Fix pylint warnings --- script/bootstrap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/bootstrap.py b/script/bootstrap.py index 3d61106f266f..1138ead01e4c 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -174,9 +174,9 @@ def update_win32_python(): execute_stdout(['git', 'clone', PYTHON_26_URL]) -def build_libchromiumcontent(is_verbose_mode, target_arch): +def build_libchromiumcontent(verbose, target_arch): args = [os.path.join(SOURCE_ROOT, 'script', 'build-libchromiumcontent.py')] - if is_verbose_mode: + if verbose: args += ['-v'] execute_stdout(args + ['--target_arch', target_arch]) From bd70d9008f8f2b32084b057188a5d21567701e47 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 2 May 2016 07:45:48 +0000 Subject: [PATCH 5/5] Update modules before calling build_libchromiumcontent --- script/bootstrap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/bootstrap.py b/script/bootstrap.py index 1138ead01e4c..2aba23ba82f2 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -33,6 +33,8 @@ def main(): if sys.platform == 'cygwin': update_win32_python() + update_submodules() + libcc_source_path = args.libcc_source_path libcc_shared_library_path = args.libcc_shared_library_path libcc_static_library_path = args.libcc_static_library_path @@ -49,7 +51,6 @@ def main(): if PLATFORM != 'win32': update_clang() - update_submodules() setup_python_libs() update_node_modules('.') bootstrap_brightray(args.dev, args.url, args.target_arch,