Merge pull request #5366 from electron/bootstrap-libchromiumcontent

Add --build_libchromiumcontent command line switch
This commit is contained in:
Cheng Zhao 2016-05-02 19:07:22 +09:00
commit 7cbe6bc8bd
4 changed files with 99 additions and 12 deletions

View file

@ -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:
@ -136,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
```

View file

@ -33,15 +33,29 @@ 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
# 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()
update_submodules()
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 +85,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 +175,13 @@ def update_win32_python():
execute_stdout(['git', 'clone', PYTHON_26_URL])
def build_libchromiumcontent(verbose, target_arch):
args = [os.path.join(SOURCE_ROOT, 'script', 'build-libchromiumcontent.py')]
if verbose:
args += ['-v']
execute_stdout(args + ['--target_arch', target_arch])
def update_clang():
execute_stdout([os.path.join(SOURCE_ROOT, 'script', 'update-clang.sh')])

View file

@ -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())

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit 8dbaeed37b9c4fb8ae985670b142f659bb265fb4
Subproject commit 3d168efd1d27d4ac3869beac6290c5066c392721