Wire up build for new brightray location

This commit is contained in:
Kevin Sawicki 2017-05-09 13:38:14 -07:00
parent 4dab62dfcf
commit 5ea20b5b54
10 changed files with 50 additions and 158 deletions

2
.gitignore vendored
View file

@ -5,7 +5,7 @@
/dist/ /dist/
/external_binaries/ /external_binaries/
/out/ /out/
/vendor/brightray/vendor/download/ /vendor/download/
/vendor/debian_wheezy_amd64-sysroot/ /vendor/debian_wheezy_amd64-sysroot/
/vendor/debian_wheezy_arm-sysroot/ /vendor/debian_wheezy_arm-sysroot/
/vendor/debian_wheezy_i386-sysroot/ /vendor/debian_wheezy_i386-sysroot/

View file

@ -23,7 +23,7 @@
'direct_dependent_settings': { 'direct_dependent_settings': {
'include_dirs': [ 'include_dirs': [
'.', '.',
'..', '../vendor',
'<(libchromiumcontent_src_dir)', '<(libchromiumcontent_src_dir)',
'<(libchromiumcontent_src_dir)/gpu', '<(libchromiumcontent_src_dir)/gpu',
'<(libchromiumcontent_src_dir)/skia/config', '<(libchromiumcontent_src_dir)/skia/config',

View file

@ -1,6 +1,6 @@
{ {
'includes': [ 'includes': [
'vendor/download/libchromiumcontent/filenames.gypi', '../vendor/download/libchromiumcontent/filenames.gypi',
], ],
'variables': { 'variables': {
'libchromiumcontent_component%': 1, 'libchromiumcontent_component%': 1,

View file

@ -1,99 +0,0 @@
#!/usr/bin/env python
import argparse
import errno
import os
import subprocess
import sys
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
DOWNLOAD_DIR = os.path.join(VENDOR_DIR, 'download')
def main():
args = parse_args()
if (args.libcc_source_path != None and
args.libcc_shared_library_path != None and
args.libcc_static_library_path != None):
pass
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)
update_submodules()
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)
def parse_args():
parser = argparse.ArgumentParser(description='Bootstrap this project')
parser.add_argument('-c', '--commit', required=True,
help='The commit of libchromiumcontent to download.')
parser.add_argument('-d', '--dev', action='store_true',
help='Do not download static_library build')
parser.add_argument('--target_arch', required=True,
help='The arch of libchromiumcontent to download.')
parser.add_argument('url', help='The base URL from which to download '
'libchromiumcontent (i.e., the URL you passed to '
'libchromiumcontent\'s script/upload script')
parser.add_argument('--libcc_source_path', required=False,
help='The source path of libchromiumcontent. ' \
'NOTE: All options of libchromiumcontent are '
'required OR let brightray choose it')
parser.add_argument('--libcc_shared_library_path', required=False,
help='The shared library path of libchromiumcontent. ' \
'NOTE: All options of libchromiumcontent are ' \
'required OR let brightray 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 brightray choose it')
return parser.parse_args()
def update_submodules():
return (subprocess.call(['git', 'submodule', 'sync', '--quiet'],
cwd=SOURCE_ROOT) or
subprocess.call(['git', 'submodule', 'update', '--init',
'--recursive'], cwd=SOURCE_ROOT))
def setup_libchromiumcontent(is_dev, commit, target_arch, url,
libcc_source_path,
libcc_shared_library_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_source_path != None and
libcc_shared_library_path != None and
libcc_static_library_path != None):
args += ['--libcc_source_path', libcc_source_path,
'--libcc_shared_library_path', libcc_shared_library_path,
'--libcc_static_library_path', libcc_static_library_path]
mkdir_p(target_dir)
else:
mkdir_p(DOWNLOAD_DIR)
if is_dev:
subprocess.check_call([sys.executable, download] + args)
else:
subprocess.check_call([sys.executable, download, '-s'] + args)
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise
if __name__ == '__main__':
sys.exit(main())

View file

@ -1,40 +0,0 @@
#!/usr/bin/env python
import os
import subprocess
import sys
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
GYP = os.path.join(SOURCE_ROOT, 'vendor', 'gyp', 'gyp_main.py')
def main():
os.chdir(SOURCE_ROOT)
return (run_gyp() or build())
def run_gyp():
env = os.environ.copy()
gyp_pylib = os.path.join(os.path.dirname(GYP), 'pylib')
env['PYTHONPATH'] = os.path.pathsep.join([gyp_pylib,
env.get('PYTHONPATH', '')])
env['GYP_DEFINES'] = 'libchromiumcontent_component=static_library'
return subprocess.call([sys.executable, GYP, '--depth', '.',
'-Ibrightray.gypi', 'brightray.gyp'], env=env)
def build():
if sys.platform == 'darwin':
return subprocess.call(['xcodebuild'])
if sys.platform == 'linux2':
return subprocess.call(['make'])
assert sys.platform == 'win32', sys.platform
program_files = os.environ.get('PROGRAMFILES(X86)', os.environ['PROGRAMFILES'])
msbuild = os.path.join(program_files, 'MSBuild', '12.0', 'Bin', 'MSBuild.exe')
return subprocess.call([msbuild, 'brightray.sln'])
if __name__ == '__main__':
sys.exit(main())

View file

@ -1,7 +1,7 @@
{ {
'includes': [ 'includes': [
'toolchain.gypi', 'toolchain.gypi',
'vendor/brightray/brightray.gypi', 'brightray/brightray.gypi',
], ],
'variables': { 'variables': {
# Tell crashpad to build as external project. # Tell crashpad to build as external project.

View file

@ -81,7 +81,7 @@
# is marked for no PIE (ASLR). # is marked for no PIE (ASLR).
'postbuild_name': 'Make More Helpers', 'postbuild_name': 'Make More Helpers',
'action': [ 'action': [
'vendor/brightray/tools/mac/make_more_helpers.sh', 'brightray/tools/mac/make_more_helpers.sh',
'Frameworks', 'Frameworks',
'<(product_name)', '<(product_name)',
], ],
@ -220,7 +220,7 @@
'dependencies': [ 'dependencies': [
'atom_js2c', 'atom_js2c',
'vendor/pdf_viewer/pdf_viewer.gyp:pdf_viewer', 'vendor/pdf_viewer/pdf_viewer.gyp:pdf_viewer',
'vendor/brightray/brightray.gyp:brightray', 'brightray/brightray.gyp:brightray',
'vendor/node/node.gyp:node', 'vendor/node/node.gyp:node',
], ],
'defines': [ 'defines': [
@ -244,7 +244,7 @@
'include_dirs': [ 'include_dirs': [
'.', '.',
'chromium_src', 'chromium_src',
'vendor/brightray', 'brightray',
'vendor/native_mate', 'vendor/native_mate',
# Include atom_natives.h. # Include atom_natives.h.
'<(SHARED_INTERMEDIATE_DIR)', '<(SHARED_INTERMEDIATE_DIR)',
@ -271,7 +271,7 @@
], ],
}, },
'export_dependent_settings': [ 'export_dependent_settings': [
'vendor/brightray/brightray.gyp:brightray', 'brightray/brightray.gyp:brightray',
], ],
'conditions': [ 'conditions': [
['libchromiumcontent_component', { ['libchromiumcontent_component', {

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import argparse import argparse
import errno
import os import os
import subprocess import subprocess
import sys import sys
@ -12,6 +13,7 @@ from lib.util import execute_stdout, get_electron_version, scoped_cwd
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor') VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
DOWNLOAD_DIR = os.path.join(VENDOR_DIR, 'download')
PYTHON_26_URL = 'https://chromium.googlesource.com/chromium/deps/python_26' PYTHON_26_URL = 'https://chromium.googlesource.com/chromium/deps/python_26'
NPM = 'npm' NPM = 'npm'
@ -40,8 +42,7 @@ def main():
# Redirect to use local libchromiumcontent build. # Redirect to use local libchromiumcontent build.
if args.build_libchromiumcontent: if args.build_libchromiumcontent:
build_libchromiumcontent(args.verbose, args.target_arch, defines) build_libchromiumcontent(args.verbose, args.target_arch, defines)
dist_dir = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', dist_dir = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'dist', 'main')
'libchromiumcontent', 'dist', 'main')
libcc_source_path = os.path.join(dist_dir, 'src') libcc_source_path = os.path.join(dist_dir, 'src')
libcc_shared_library_path = os.path.join(dist_dir, 'shared_library') libcc_shared_library_path = os.path.join(dist_dir, 'shared_library')
libcc_static_library_path = os.path.join(dist_dir, 'static_library') libcc_static_library_path = os.path.join(dist_dir, 'static_library')
@ -53,9 +54,9 @@ def main():
setup_python_libs() setup_python_libs()
update_node_modules('.') update_node_modules('.')
bootstrap_brightray(args.dev, args.url, args.target_arch, setup_libchromiumcontent(args.dev, args.target_arch, args.url,
libcc_source_path, libcc_shared_library_path, libcc_source_path, libcc_shared_library_path,
libcc_static_library_path) libcc_static_library_path)
if PLATFORM == 'linux': if PLATFORM == 'linux':
download_sysroot(args.target_arch) download_sysroot(args.target_arch)
@ -135,10 +136,33 @@ def setup_python_libs():
execute_stdout([sys.executable, 'setup.py', 'build']) execute_stdout([sys.executable, 'setup.py', 'build'])
def setup_libchromiumcontent(is_dev, target_arch, url,
libcc_source_path,
libcc_shared_library_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', LIBCHROMIUMCONTENT_COMMIT, '--target_arch', target_arch,
url, target_dir]
if (libcc_source_path != None and
libcc_shared_library_path != None and
libcc_static_library_path != None):
args += ['--libcc_source_path', libcc_source_path,
'--libcc_shared_library_path', libcc_shared_library_path,
'--libcc_static_library_path', libcc_static_library_path]
mkdir_p(target_dir)
else:
mkdir_p(DOWNLOAD_DIR)
if is_dev:
subprocess.check_call([sys.executable, download] + args)
else:
subprocess.check_call([sys.executable, download, '-s'] + args)
def bootstrap_brightray(is_dev, url, target_arch, libcc_source_path, def bootstrap_brightray(is_dev, url, target_arch, libcc_source_path,
libcc_shared_library_path, libcc_shared_library_path,
libcc_static_library_path): libcc_static_library_path):
bootstrap = os.path.join(VENDOR_DIR, 'brightray', 'script', 'bootstrap') bootstrap = os.path.join(SOURCE_ROOT, 'brightray', 'script', 'bootstrap')
args = [ args = [
'--commit', LIBCHROMIUMCONTENT_COMMIT, '--commit', LIBCHROMIUMCONTENT_COMMIT,
'--target_arch', target_arch, '--target_arch', target_arch,
@ -225,8 +249,7 @@ def download_sysroot(target_arch):
'--arch', target_arch]) '--arch', target_arch])
def create_chrome_version_h(): def create_chrome_version_h():
version_file = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', version_file = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'VERSION')
'libchromiumcontent', 'VERSION')
target_file = os.path.join(SOURCE_ROOT, 'atom', 'common', 'chrome_version.h') target_file = os.path.join(SOURCE_ROOT, 'atom', 'common', 'chrome_version.h')
template_file = os.path.join(SOURCE_ROOT, 'script', 'chrome_version.h.in') template_file = os.path.join(SOURCE_ROOT, 'script', 'chrome_version.h.in')
@ -271,5 +294,13 @@ def create_node_headers():
'--version', get_electron_version()]) '--version', get_electron_version()])
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())

View file

@ -22,8 +22,8 @@ def main():
remove_directory('node_modules') remove_directory('node_modules')
remove_directory('spec/node_modules') remove_directory('spec/node_modules')
remove_directory('vendor/brightray/vendor/download/libchromiumcontent') remove_directory('vendor/download/libchromiumcontent')
remove_directory('vendor/brightray/vendor/libchromiumcontent/src') remove_directory('vendor/libchromiumcontent/src')
remove_directory(os.path.expanduser('~/.node-gyp')) remove_directory(os.path.expanduser('~/.node-gyp'))

View file

@ -63,7 +63,7 @@ def run_gyp(target_arch, component):
if sys.platform == 'cygwin': if sys.platform == 'cygwin':
# Force using win32 python on cygwin. # Force using win32 python on cygwin.
python = os.path.join('vendor', 'python_26', 'python.exe') python = os.path.join('vendor', 'python_26', 'python.exe')
gyp = os.path.join('vendor', 'brightray', 'vendor', 'gyp', 'gyp_main.py') gyp = os.path.join('vendor', 'gyp', 'gyp_main.py')
gyp_pylib = os.path.join(os.path.dirname(gyp), 'pylib') gyp_pylib = os.path.join(os.path.dirname(gyp), 'pylib')
# Avoid using the old gyp lib in system. # Avoid using the old gyp lib in system.
env['PYTHONPATH'] = os.path.pathsep.join([gyp_pylib, env['PYTHONPATH'] = os.path.pathsep.join([gyp_pylib,