From 432bab3107083a2257cf3a3d3262e273d54bb610 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 1 Jul 2015 16:51:06 +0800 Subject: [PATCH 01/23] Only allow building on 64bit machine --- script/update.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/script/update.py b/script/update.py index 8d850905b529..2a0c044368a2 100755 --- a/script/update.py +++ b/script/update.py @@ -14,6 +14,10 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) def main(): os.chdir(SOURCE_ROOT) + if platform.architecture()[0] != '64bit': + print 'Electron is required to be built on a 64bit machine' + return 1 + update_external_binaries() return update_gyp() @@ -51,12 +55,5 @@ def run_gyp(target_arch, component): 'atom.gyp', '-Icommon.gypi'] + defines) -def get_host_arch(): - if platform.architecture()[0] == '32bit': - return 'ia32' - else: - return 'x64' - - if __name__ == '__main__': sys.exit(main()) From 1b3a8435e54d238d9ad2ee9049aa69440028cb08 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 1 Jul 2015 08:59:17 +0000 Subject: [PATCH 02/23] Define chromeos --- common.gypi | 1 + 1 file changed, 1 insertion(+) diff --git a/common.gypi b/common.gypi index 8d1742e96639..f1a77b6de958 100644 --- a/common.gypi +++ b/common.gypi @@ -6,6 +6,7 @@ 'variables': { # Required by breakpad. 'os_bsd': 0, + 'chromeos': 0, # Reflects node's config.gypi. 'component%': 'static_library', 'python': 'python', From af05f5b3292440d151aee39c19cff7575b257ffa Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 1 Jul 2015 09:17:44 +0000 Subject: [PATCH 03/23] Add function to get host_arch --- script/lib/util.py | 25 +++++++++++++++++++++++++ script/update.py | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/script/lib/util.py b/script/lib/util.py index b67bb8da0da8..a995b605613b 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -3,6 +3,8 @@ import atexit import contextlib import errno +import platform +import re import shutil import ssl import subprocess @@ -15,6 +17,29 @@ import zipfile from config import is_verbose_mode + +def get_host_arch(): + """Returns the host architecture with a predictable string.""" + host_arch = platform.machine() + + # Convert machine type to format recognized by gyp. + if re.match(r'i.86', host_arch) or host_arch == 'i86pc': + host_arch = 'ia32' + elif host_arch in ['x86_64', 'amd64']: + host_arch = 'x64' + elif host_arch.startswith('arm'): + host_arch = 'arm' + + # platform.machine is based on running kernel. It's possible to use 64-bit + # kernel with 32-bit userland, e.g. to give linker slightly more memory. + # Distinguish between different userland bitness by querying + # the python binary. + if host_arch == 'x64' and platform.architecture()[0] == '32bit': + host_arch = 'ia32' + + return host_arch + + def tempdir(prefix=''): directory = tempfile.mkdtemp(prefix=prefix) atexit.register(shutil.rmtree, directory) diff --git a/script/update.py b/script/update.py index 2a0c044368a2..ac9231c77645 100755 --- a/script/update.py +++ b/script/update.py @@ -6,6 +6,7 @@ import subprocess import sys from lib.config import get_target_arch +from lib.util import get_host_arch SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) @@ -48,7 +49,7 @@ def run_gyp(target_arch, component): defines = [ '-Dlibchromiumcontent_component={0}'.format(component), '-Dtarget_arch={0}'.format(target_arch), - '-Dhost_arch=x64', + '-Dhost_arch={0}'.format(get_host_arch()), '-Dlibrary=static_library', ] return subprocess.call([python, gyp, '-f', 'ninja', '--depth', '.', From 88eb5283a060cbd4877f4d20c921a5dc0f61f610 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 1 Jul 2015 09:22:40 +0000 Subject: [PATCH 04/23] Download debian arm sysroot image --- .gitignore | 1 + script/bootstrap.py | 9 ++ script/install-debian.wheezy.sysroot.py | 177 ++++++++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100755 script/install-debian.wheezy.sysroot.py diff --git a/.gitignore b/.gitignore index 4f9ae34599d1..204fce0d65b1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /external_binaries/ /out/ /vendor/brightray/vendor/download/ +/vendor/debian_wheezy_arm-sysroot/ /vendor/python_26/ /vendor/npm/ /vendor/llvm/ diff --git a/script/bootstrap.py b/script/bootstrap.py index 2281008e0f7f..0ac8646b1044 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -32,6 +32,9 @@ def main(): if PLATFORM != 'win32': update_clang() + if args.target_arch == 'arm': + download_arm_sysroot() + create_chrome_version_h() touch_config_gypi() run_update() @@ -113,6 +116,12 @@ def update_clang(): execute_stdout([os.path.join(SOURCE_ROOT, 'script', 'update-clang.sh')]) +def download_arm_sysroot(): + execute_stdout([os.path.join(SOURCE_ROOT, 'script', + 'install-debian.wheezy.sysroot.py'), + '--arch', 'arm']) + + def create_chrome_version_h(): version_file = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', 'libchromiumcontent', 'VERSION') diff --git a/script/install-debian.wheezy.sysroot.py b/script/install-debian.wheezy.sysroot.py new file mode 100755 index 000000000000..0c61154c9a62 --- /dev/null +++ b/script/install-debian.wheezy.sysroot.py @@ -0,0 +1,177 @@ +#!/usr/bin/env python +# Copyright (c) 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Script to install a Debian Wheezy sysroot for making official Google Chrome +# Linux builds. +# The sysroot is needed to make Chrome work for Debian Wheezy. +# This script can be run manually but is more often run as part of gclient +# hooks. When run from hooks this script should be a no-op on non-linux +# platforms. + +# The sysroot image could be constructed from scratch based on the current +# state or Debian Wheezy but for consistency we currently use a pre-built root +# image. The image will normally need to be rebuilt every time chrome's build +# dependancies are changed. + +import hashlib +import platform +import optparse +import os +import re +import shutil +import subprocess +import sys + +from lib.util import get_host_arch + + +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +URL_PREFIX = 'http://storage.googleapis.com' +URL_PATH = 'chrome-linux-sysroot/toolchain' +REVISION_AMD64 = 264817 +REVISION_I386 = 264817 +REVISION_ARM = 285950 +TARBALL_AMD64 = 'debian_wheezy_amd64_sysroot.tgz' +TARBALL_I386 = 'debian_wheezy_i386_sysroot.tgz' +TARBALL_ARM = 'debian_wheezy_arm_sysroot.tgz' +TARBALL_AMD64_SHA1SUM = '74b7231e12aaf45c5c5489d9aebb56bd6abb3653' +TARBALL_I386_SHA1SUM = 'fe3d284926839683b00641bc66c9023f872ea4b4' +TARBALL_ARM_SHA1SUM = 'fc2f54db168887c5190c4c6686c869bedf668b4e' +SYSROOT_DIR_AMD64 = 'debian_wheezy_amd64-sysroot' +SYSROOT_DIR_I386 = 'debian_wheezy_i386-sysroot' +SYSROOT_DIR_ARM = 'debian_wheezy_arm-sysroot' + +valid_archs = ('arm', 'i386', 'amd64') + + +def GetSha1(filename): + sha1 = hashlib.sha1() + with open(filename, 'rb') as f: + while True: + # Read in 1mb chunks, so it doesn't all have to be loaded into memory. + chunk = f.read(1024*1024) + if not chunk: + break + sha1.update(chunk) + return sha1.hexdigest() + + +def DetectArch(gyp_defines): + # Check for optional target_arch and only install for that architecture. + # If target_arch is not specified, then only install for the host + # architecture. + if 'target_arch=x64' in gyp_defines: + return 'amd64' + elif 'target_arch=ia32' in gyp_defines: + return 'i386' + elif 'target_arch=arm' in gyp_defines: + return 'arm' + + detected_host_arch = get_host_arch() + if detected_host_arch == 'x64': + return 'amd64' + elif detected_host_arch == 'ia32': + return 'i386' + elif detected_host_arch == 'arm': + return 'arm' + else: + print "Unknown host arch: %s" % detected_host_arch + + return None + + +def main(): + if options.linux_only: + # This argument is passed when run from the gclient hooks. + # In this case we return early on non-linux platforms. + if not sys.platform.startswith('linux'): + return 0 + + gyp_defines = os.environ.get('GYP_DEFINES', '') + + if options.arch: + target_arch = options.arch + else: + target_arch = DetectArch(gyp_defines) + if not target_arch: + print 'Unable to detect host architecture' + return 1 + + if options.linux_only and target_arch != 'arm': + # When run from runhooks, only install the sysroot for an Official Chrome + # Linux build, except on ARM where we always use a sysroot. + defined = ['branding=Chrome', 'buildtype=Official'] + undefined = ['chromeos=1'] + for option in defined: + if option not in gyp_defines: + return 0 + for option in undefined: + if option in gyp_defines: + return 0 + + # The sysroot directory should match the one specified in build/common.gypi. + # TODO(thestig) Consider putting this else where to avoid having to recreate + # it on every build. + linux_dir = os.path.join(SCRIPT_DIR, '..', 'vendor') + if target_arch == 'amd64': + sysroot = os.path.join(linux_dir, SYSROOT_DIR_AMD64) + tarball_filename = TARBALL_AMD64 + tarball_sha1sum = TARBALL_AMD64_SHA1SUM + revision = REVISION_AMD64 + elif target_arch == 'arm': + sysroot = os.path.join(linux_dir, SYSROOT_DIR_ARM) + tarball_filename = TARBALL_ARM + tarball_sha1sum = TARBALL_ARM_SHA1SUM + revision = REVISION_ARM + elif target_arch == 'i386': + sysroot = os.path.join(linux_dir, SYSROOT_DIR_I386) + tarball_filename = TARBALL_I386 + tarball_sha1sum = TARBALL_I386_SHA1SUM + revision = REVISION_I386 + else: + print 'Unknown architecture: %s' % target_arch + assert(False) + + url = '%s/%s/%s/%s' % (URL_PREFIX, URL_PATH, revision, tarball_filename) + + stamp = os.path.join(sysroot, '.stamp') + if os.path.exists(stamp): + with open(stamp) as s: + if s.read() == url: + print 'Debian Wheezy %s root image already up-to-date: %s' % \ + (target_arch, sysroot) + return 0 + + print 'Installing Debian Wheezy %s root image: %s' % (target_arch, sysroot) + if os.path.isdir(sysroot): + shutil.rmtree(sysroot) + os.mkdir(sysroot) + tarball = os.path.join(sysroot, tarball_filename) + print 'Downloading %s' % url + sys.stdout.flush() + sys.stderr.flush() + subprocess.check_call(['curl', '--fail', '-L', url, '-o', tarball]) + sha1sum = GetSha1(tarball) + if sha1sum != tarball_sha1sum: + print 'Tarball sha1sum is wrong.' + print 'Expected %s, actual: %s' % (tarball_sha1sum, sha1sum) + return 1 + subprocess.check_call(['tar', 'xf', tarball, '-C', sysroot]) + os.remove(tarball) + + with open(stamp, 'w') as s: + s.write(url) + return 0 + + +if __name__ == '__main__': + parser = optparse.OptionParser('usage: %prog [OPTIONS]') + parser.add_option('--linux-only', action='store_true', + default=False, help='Only install sysroot for official ' + 'Linux builds') + parser.add_option('--arch', type='choice', choices=valid_archs, + help='Sysroot architecture: %s' % ', '.join(valid_archs)) + options, _ = parser.parse_args() + sys.exit(main()) From 4214b6255108066e176109e7fa474b6c85d9bfea Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 1 Jul 2015 09:54:27 +0000 Subject: [PATCH 05/23] Set sysroot for arm build --- atom.gyp | 4 +- filenames.gypi | 1 - toolchain.gypi | 27 +++++++++ tools/linux/sysroot_ld_path.sh | 100 +++++++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+), 4 deletions(-) create mode 100755 tools/linux/sysroot_ld_path.sh diff --git a/atom.gyp b/atom.gyp index 423c59e862e5..cce72f16c467 100644 --- a/atom.gyp +++ b/atom.gyp @@ -5,8 +5,6 @@ 'company_name%': 'GitHub, Inc', 'company_abbr%': 'github', 'version%': '0.28.3', - - 'atom_source_root': '/dev/null 2>&1 ; then + for inc_file in $root$included_files; do + process_ld_so_conf "$root" "$inc_file" + done + fi + else + if ls $(pwd)/$included_files >/dev/null 2>&1 ; then + for inc_file in $(pwd)/$included_files; do + process_ld_so_conf "$root" "$inc_file" + done + fi + fi + continue + fi + + echo "$ENTRY" | grep -qs ^/ + if [ $? -eq 0 ]; then + process_entry "$root" "$ENTRY" + fi + done + + # popd is a bashism + cd "$saved_pwd" +} + +# Main + +if [ $# -ne 1 ]; then + echo Usage $0 /abspath/to/sysroot + exit 1 +fi + +echo $1 | grep -qs ' ' +if [ $? -eq 0 ]; then + log_error_and_exit $1 contains whitespace. +fi + +LD_SO_CONF="$1/etc/ld.so.conf" +LD_SO_CONF_D="$1/etc/ld.so.conf.d" + +if [ -e "$LD_SO_CONF" ]; then + process_ld_so_conf "$1" "$LD_SO_CONF" | xargs echo +elif [ -e "$LD_SO_CONF_D" ]; then + find "$LD_SO_CONF_D" -maxdepth 1 -name '*.conf' -print -quit > /dev/null + if [ $? -eq 0 ]; then + for entry in $LD_SO_CONF_D/*.conf; do + process_ld_so_conf "$1" "$entry" + done | xargs echo + fi +fi From a04bfbbc4b3194bc9f87db1c02a6b2364441184e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 00:46:10 +0000 Subject: [PATCH 06/23] Never send email notifications It is anonnying. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2d64c38e8484..dd6d518ca624 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,7 @@ os: - osx notifications: - email: - on_success: never - on_failure: change + email: false script: './script/cibuild' From 14bc544d897f57b473a536d597bc3aee05a46f13 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 00:47:14 +0000 Subject: [PATCH 07/23] Use our custom debian sysroot image --- script/bootstrap.py | 3 +-- ...nstall-debian.wheezy.sysroot.py => install-sysroot.py} | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) rename script/{install-debian.wheezy.sysroot.py => install-sysroot.py} (96%) diff --git a/script/bootstrap.py b/script/bootstrap.py index 0ac8646b1044..6314ea91c969 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -117,8 +117,7 @@ def update_clang(): def download_arm_sysroot(): - execute_stdout([os.path.join(SOURCE_ROOT, 'script', - 'install-debian.wheezy.sysroot.py'), + execute_stdout([os.path.join(SOURCE_ROOT, 'script', 'install-sysroot.py'), '--arch', 'arm']) diff --git a/script/install-debian.wheezy.sysroot.py b/script/install-sysroot.py similarity index 96% rename from script/install-debian.wheezy.sysroot.py rename to script/install-sysroot.py index 0c61154c9a62..50b0d6b7b634 100755 --- a/script/install-debian.wheezy.sysroot.py +++ b/script/install-sysroot.py @@ -28,17 +28,17 @@ from lib.util import get_host_arch SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) -URL_PREFIX = 'http://storage.googleapis.com' -URL_PATH = 'chrome-linux-sysroot/toolchain' +URL_PREFIX = 'https://github.com' +URL_PATH = 'atom/debian-sysroot-image-creator/releases/download' REVISION_AMD64 = 264817 REVISION_I386 = 264817 -REVISION_ARM = 285950 +REVISION_ARM = 'v0.1.0' TARBALL_AMD64 = 'debian_wheezy_amd64_sysroot.tgz' TARBALL_I386 = 'debian_wheezy_i386_sysroot.tgz' TARBALL_ARM = 'debian_wheezy_arm_sysroot.tgz' TARBALL_AMD64_SHA1SUM = '74b7231e12aaf45c5c5489d9aebb56bd6abb3653' TARBALL_I386_SHA1SUM = 'fe3d284926839683b00641bc66c9023f872ea4b4' -TARBALL_ARM_SHA1SUM = 'fc2f54db168887c5190c4c6686c869bedf668b4e' +TARBALL_ARM_SHA1SUM = '72e668c57b8591e108759584942ddb6f6cee1322' SYSROOT_DIR_AMD64 = 'debian_wheezy_amd64-sysroot' SYSROOT_DIR_I386 = 'debian_wheezy_i386-sysroot' SYSROOT_DIR_ARM = 'debian_wheezy_arm-sysroot' From 7b955fe82913ae1e07db36dacd4dad710f537a3c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 01:09:53 +0000 Subject: [PATCH 08/23] Update libchromiumcontent to get arm build --- script/lib/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/config.py b/script/lib/config.py index 3c171b5b5355..9050d646c3fc 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -7,7 +7,7 @@ import sys BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' -LIBCHROMIUMCONTENT_COMMIT = '3bfdfa28d2361c2242b89603b98f2509d3ebb859' +LIBCHROMIUMCONTENT_COMMIT = 'a4410de75315f3ecc00db2314bfab184dcd914f8' PLATFORM = { 'cygwin': 'win32', From 62a5159e726573aa77276a0308bbecc0577f5790 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 01:12:21 +0000 Subject: [PATCH 09/23] Don't install ubuntu test toolchain --- script/cibuild | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/script/cibuild b/script/cibuild index b5798a94df58..6772f3b26b69 100755 --- a/script/cibuild +++ b/script/cibuild @@ -15,8 +15,6 @@ LINUX_DEPS = [ 'libgnome-keyring-dev', 'libgtk2.0-dev', 'libnotify-dev', - 'gcc-4.8', - 'g++-4.8', 'gcc-multilib', 'g++-multilib', ] @@ -28,7 +26,6 @@ def main(): is_travis = (os.getenv('TRAVIS') == 'true') if is_travis and sys.platform == 'linux2': print 'Setup travis CI' - execute(['sudo', 'add-apt-repository', '-y', 'ppa:ubuntu-toolchain-r/test']) execute(['sudo', 'apt-get', 'update']) execute(['sudo', 'apt-get', 'install'] + LINUX_DEPS) @@ -44,9 +41,10 @@ def main(): 'libchromiumcontent')) if is_travis and sys.platform == 'linux2': - with scoped_env('CXX', 'g++-4.8'): - with scoped_env('CC', 'gcc-4.8'): - run_script('bootstrap.py', ['--dev']) + with scoped_env('GYP_DEFINES', 'clang=1'): + with scoped_env('CXX', 'clang++'): + with scoped_env('CC', 'clang'): + run_script('bootstrap.py', ['--dev']) run_script('update.py') else: run_script('bootstrap.py', ['--dev']) From 3a094e98024353cab5cf4350e277f549ab015d03 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 02:56:56 +0000 Subject: [PATCH 10/23] Use prebuild clang to build node modules --- script/bootstrap.py | 13 ++++++++++--- script/cibuild | 9 +-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/script/bootstrap.py b/script/bootstrap.py index 6314ea91c969..6d89dbe358e1 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -25,13 +25,14 @@ def main(): enable_verbose_mode() if sys.platform == 'cygwin': update_win32_python() - update_submodules() - update_node_modules('.') - bootstrap_brightray(args.dev, args.url, args.target_arch) if PLATFORM != 'win32': update_clang() + update_submodules() + update_node_modules('.') + bootstrap_brightray(args.dev, args.url, args.target_arch) + if args.target_arch == 'arm': download_arm_sysroot() @@ -91,6 +92,12 @@ def bootstrap_brightray(is_dev, url, target_arch): def update_node_modules(dirname, env=None): if env is None: env = os.environ + if PLATFORM == 'linux': + llvm_dir = os.path.join(SOURCE_ROOT, 'vendor', 'llvm-build', + 'Release+Asserts', 'bin') + env['CC'] = os.path.join(llvm_dir, 'clang') + env['CXX'] = os.path.join(llvm_dir, 'clang++') + env['npm_config_clang'] = '1' with scoped_cwd(dirname): if is_verbose_mode(): execute_stdout([NPM, 'install', '--verbose'], env) diff --git a/script/cibuild b/script/cibuild index 6772f3b26b69..8193908bfc15 100755 --- a/script/cibuild +++ b/script/cibuild @@ -40,14 +40,7 @@ def main(): rm_rf(os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', 'download', 'libchromiumcontent')) - if is_travis and sys.platform == 'linux2': - with scoped_env('GYP_DEFINES', 'clang=1'): - with scoped_env('CXX', 'clang++'): - with scoped_env('CC', 'clang'): - run_script('bootstrap.py', ['--dev']) - run_script('update.py') - else: - run_script('bootstrap.py', ['--dev']) + run_script('bootstrap.py', ['--dev']) run_script('cpplint.py') if sys.platform != 'win32': From 2de5ae999146e43a9803bc483249e5f18032e6f7 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 03:08:29 +0000 Subject: [PATCH 11/23] Add build matrix for arm and ia32 --- .travis.yml | 18 +++++++++++++----- script/cibuild | 6 +++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index dd6d518ca624..af27529cdc84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,21 @@ +git: + depth: 10 +notifications: + email: false + language: cpp compiler: clang os: - linux - osx +env: + - TARGET_ARCH=x64 -notifications: - email: false +matrix: + include: + - os: linux + env: TARGET_ARCH=arm + - os: linux + env: TARGET_ARCH=ia32 script: './script/cibuild' - -git: - depth: 10 diff --git a/script/cibuild b/script/cibuild index 8193908bfc15..2b7149db08aa 100755 --- a/script/cibuild +++ b/script/cibuild @@ -40,7 +40,11 @@ def main(): rm_rf(os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', 'download', 'libchromiumcontent')) - run_script('bootstrap.py', ['--dev']) + target_arch = 'x64' + if os.environ.has_key('TARGET_ARCH'): + target_arch = os.environ['TARGET_ARCH'] + + run_script('bootstrap.py', ['--dev', '--target_arch=' + target_arch]) run_script('cpplint.py') if sys.platform != 'win32': From 57262dd5efe7bf270f47516b225945ea53aa4e99 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 04:42:36 +0000 Subject: [PATCH 12/23] Install arm build dependencies --- script/cibuild | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/script/cibuild b/script/cibuild index 2b7149db08aa..f44bf61f5405 100755 --- a/script/cibuild +++ b/script/cibuild @@ -19,15 +19,28 @@ LINUX_DEPS = [ 'g++-multilib', ] +LINUX_ARM_DEPS = [ + 'libc6-dev-armhf-cross', + 'linux-libc-dev-armhf-cross', + 'g++-arm-linux-gnueabihf', +] + def main(): os.environ['CI'] = '1' + target_arch = 'x64' + if os.environ.has_key('TARGET_ARCH'): + target_arch = os.environ['TARGET_ARCH'] + is_travis = (os.getenv('TRAVIS') == 'true') if is_travis and sys.platform == 'linux2': print 'Setup travis CI' execute(['sudo', 'apt-get', 'update']) - execute(['sudo', 'apt-get', 'install'] + LINUX_DEPS) + deps = LINUX_DEPS + if target_arch == 'arm': + deps += LINUX_ARM_DEPS + execute(['sudo', 'apt-get', 'install'] + deps) os.environ['DISPLAY'] = ':99.0' execute(['sh', '-e', '/etc/init.d/xvfb', 'start']) @@ -40,10 +53,6 @@ def main(): rm_rf(os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', 'download', 'libchromiumcontent')) - target_arch = 'x64' - if os.environ.has_key('TARGET_ARCH'): - target_arch = os.environ['TARGET_ARCH'] - run_script('bootstrap.py', ['--dev', '--target_arch=' + target_arch]) run_script('cpplint.py') From 6088af623e054acbf74677961b7fa16ef3fba639 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 04:47:43 +0000 Subject: [PATCH 13/23] Install ia32 build dependencies --- script/cibuild | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/script/cibuild b/script/cibuild index f44bf61f5405..96e7690c9534 100755 --- a/script/cibuild +++ b/script/cibuild @@ -19,12 +19,21 @@ LINUX_DEPS = [ 'g++-multilib', ] -LINUX_ARM_DEPS = [ +LINUX_DEPS_ARM = [ 'libc6-dev-armhf-cross', 'linux-libc-dev-armhf-cross', 'g++-arm-linux-gnueabihf', ] +LINUX_DEPS_I386 = [ + 'linux-libc-dev:i386', + 'libdbus-1-dev:i386', + 'libgconf2-dev:i386', + 'libgnome-keyring-dev:i386', + 'libgtk2.0-dev:i386', + 'libnotify-dev:i386', +] + def main(): os.environ['CI'] = '1' @@ -39,7 +48,9 @@ def main(): execute(['sudo', 'apt-get', 'update']) deps = LINUX_DEPS if target_arch == 'arm': - deps += LINUX_ARM_DEPS + deps += LINUX_DEPS_ARM + elif target_arch == 'ia32': + deps += LINUX_DEPS_I386 execute(['sudo', 'apt-get', 'install'] + deps) os.environ['DISPLAY'] = ':99.0' From f2daeb9d70ca9311c0b035b7bde63f2e681d09cb Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 05:07:56 +0000 Subject: [PATCH 14/23] Build ia32 target with sysroot --- .gitignore | 1 + common.gypi | 2 -- script/bootstrap.py | 10 ++++++---- script/install-sysroot.py | 4 ++-- toolchain.gypi | 18 ++++++++++++++---- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 204fce0d65b1..0c6f4cb79dd0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /out/ /vendor/brightray/vendor/download/ /vendor/debian_wheezy_arm-sysroot/ +/vendor/debian_wheezy_i386-sysroot/ /vendor/python_26/ /vendor/npm/ /vendor/llvm/ diff --git a/common.gypi b/common.gypi index f1a77b6de958..84c2b6c9826a 100644 --- a/common.gypi +++ b/common.gypi @@ -33,8 +33,6 @@ 'V8_BASE': '', 'v8_postmortem_support': 'false', 'v8_enable_i18n_support': 'false', - # Required by Linux (empty for now, should support it in future). - 'sysroot': '', }, # Settings to compile node under Windows. 'target_defaults': { diff --git a/script/bootstrap.py b/script/bootstrap.py index 6d89dbe358e1..efe96eacbb39 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -33,8 +33,8 @@ def main(): update_node_modules('.') bootstrap_brightray(args.dev, args.url, args.target_arch) - if args.target_arch == 'arm': - download_arm_sysroot() + if args.target_arch in ['arm', 'ia32'] and PLATFORM == 'linux': + download_sysroot(args.target_arch) create_chrome_version_h() touch_config_gypi() @@ -123,9 +123,11 @@ def update_clang(): execute_stdout([os.path.join(SOURCE_ROOT, 'script', 'update-clang.sh')]) -def download_arm_sysroot(): +def download_sysroot(target_arch): + if target_arch == 'ia32': + target_arch = 'i386' execute_stdout([os.path.join(SOURCE_ROOT, 'script', 'install-sysroot.py'), - '--arch', 'arm']) + '--arch', target_arch]) def create_chrome_version_h(): diff --git a/script/install-sysroot.py b/script/install-sysroot.py index 50b0d6b7b634..69acfb13269a 100755 --- a/script/install-sysroot.py +++ b/script/install-sysroot.py @@ -31,13 +31,13 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) URL_PREFIX = 'https://github.com' URL_PATH = 'atom/debian-sysroot-image-creator/releases/download' REVISION_AMD64 = 264817 -REVISION_I386 = 264817 +REVISION_I386 = 'v0.2.0' REVISION_ARM = 'v0.1.0' TARBALL_AMD64 = 'debian_wheezy_amd64_sysroot.tgz' TARBALL_I386 = 'debian_wheezy_i386_sysroot.tgz' TARBALL_ARM = 'debian_wheezy_arm_sysroot.tgz' TARBALL_AMD64_SHA1SUM = '74b7231e12aaf45c5c5489d9aebb56bd6abb3653' -TARBALL_I386_SHA1SUM = 'fe3d284926839683b00641bc66c9023f872ea4b4' +TARBALL_I386_SHA1SUM = 'f5b2ceaeb3f7e6bc2058733585fe877d002b5fa7' TARBALL_ARM_SHA1SUM = '72e668c57b8591e108759584942ddb6f6cee1322' SYSROOT_DIR_AMD64 = 'debian_wheezy_amd64-sysroot' SYSROOT_DIR_I386 = 'debian_wheezy_i386-sysroot' diff --git a/toolchain.gypi b/toolchain.gypi index e2aa7de3fbed..aeed967782c2 100644 --- a/toolchain.gypi +++ b/toolchain.gypi @@ -8,6 +8,9 @@ # Set this to true when building with Clang. 'clang%': 1, + # Path to sysroot dir. + 'sysroot%': '', + 'variables': { # Set ARM architecture version. 'arm_version%': 7, @@ -90,11 +93,18 @@ }], # clang==1 # Setup sysroot environment. - ['OS=="linux" and target_arch=="arm"', { + ['OS=="linux" and target_arch in ["arm", "ia32"]', { 'variables': { - # sysroot needs to be an absolute path otherwise it generates - # incorrect results when passed to pkg-config - 'sysroot': '<(source_root)/vendor/debian_wheezy_arm-sysroot', + 'conditions': [ + ['target_arch=="arm"', { + # sysroot needs to be an absolute path otherwise it generates + # incorrect results when passed to pkg-config + 'sysroot': '<(source_root)/vendor/debian_wheezy_arm-sysroot', + }], + ['target_arch=="ia32"', { + 'sysroot': '<(source_root)/vendor/debian_wheezy_i386-sysroot', + }], + ], }, 'target_defaults': { 'target_conditions': [ From 88b71b9633230cbd2a509f73ba7ecd041319ee97 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 05:18:05 +0000 Subject: [PATCH 15/23] Only run tests for x64 target --- script/cibuild | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index 96e7690c9534..9a8fdf3f1b02 100755 --- a/script/cibuild +++ b/script/cibuild @@ -71,7 +71,8 @@ def main(): run_script('pylint.py') run_script('coffeelint.py') run_script('build.py', ['-c', 'Debug']) - run_script('test.py', ['--ci']) + if target_arch == 'x64': + run_script('test.py', ['--ci']) def run_script(script, args=[]): From f569617d246741a9be41f15cf7feda776b1ec274 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 05:19:53 +0000 Subject: [PATCH 16/23] Clean up the libraries to install --- script/cibuild | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/script/cibuild b/script/cibuild index 9a8fdf3f1b02..76c7bed1fdf8 100755 --- a/script/cibuild +++ b/script/cibuild @@ -10,13 +10,16 @@ from lib.util import execute, rm_rf, scoped_env SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) LINUX_DEPS = [ + 'gcc-multilib', + 'g++-multilib', +] + +LINUX_DEPS_AMD64 = [ 'libdbus-1-dev', 'libgconf2-dev', 'libgnome-keyring-dev', 'libgtk2.0-dev', 'libnotify-dev', - 'gcc-multilib', - 'g++-multilib', ] LINUX_DEPS_ARM = [ @@ -25,15 +28,6 @@ LINUX_DEPS_ARM = [ 'g++-arm-linux-gnueabihf', ] -LINUX_DEPS_I386 = [ - 'linux-libc-dev:i386', - 'libdbus-1-dev:i386', - 'libgconf2-dev:i386', - 'libgnome-keyring-dev:i386', - 'libgtk2.0-dev:i386', - 'libnotify-dev:i386', -] - def main(): os.environ['CI'] = '1' @@ -49,8 +43,8 @@ def main(): deps = LINUX_DEPS if target_arch == 'arm': deps += LINUX_DEPS_ARM - elif target_arch == 'ia32': - deps += LINUX_DEPS_I386 + elif target_arch == 'x64': + deps += LINUX_DEPS_AMD64 execute(['sudo', 'apt-get', 'install'] + deps) os.environ['DISPLAY'] = ':99.0' From b261c5f87c21ace53f157f8398cce7b7d174311c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 05:27:12 +0000 Subject: [PATCH 17/23] Libraries on host side is needed to make pkg-config work --- script/cibuild | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/script/cibuild b/script/cibuild index 76c7bed1fdf8..4e35675f3295 100755 --- a/script/cibuild +++ b/script/cibuild @@ -10,16 +10,13 @@ from lib.util import execute, rm_rf, scoped_env SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) LINUX_DEPS = [ - 'gcc-multilib', - 'g++-multilib', -] - -LINUX_DEPS_AMD64 = [ 'libdbus-1-dev', 'libgconf2-dev', 'libgnome-keyring-dev', 'libgtk2.0-dev', 'libnotify-dev', + 'gcc-multilib', + 'g++-multilib', ] LINUX_DEPS_ARM = [ @@ -43,8 +40,6 @@ def main(): deps = LINUX_DEPS if target_arch == 'arm': deps += LINUX_DEPS_ARM - elif target_arch == 'x64': - deps += LINUX_DEPS_AMD64 execute(['sudo', 'apt-get', 'install'] + deps) os.environ['DISPLAY'] = ':99.0' From 9bdefa6f1ffd10e49a4331c05b09f711d6055a76 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 06:31:10 +0000 Subject: [PATCH 18/23] Use clang's integrated as The system as is throwing error when compiling atom_api_web_contents.cc: /tmp/xxx.s: Assembler messages: /tmp/xxx.s:23559: Internal error! Assertion failure in get_line_subseg at ../../gas/dwarf2dbg.c line 262. --- toolchain.gypi | 5 ----- 1 file changed, 5 deletions(-) diff --git a/toolchain.gypi b/toolchain.gypi index aeed967782c2..eda53075a45f 100644 --- a/toolchain.gypi +++ b/toolchain.gypi @@ -175,11 +175,6 @@ }], ], }], - ['clang==1', { - 'cflags': [ - '-no-integrated-as', - ], - }], ['arm_tune!=""', { 'cflags': [ '-mtune=<(arm_tune)', From c76d87719de9e85efc4e24230c153ba62d1e6cd8 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 07:10:05 +0000 Subject: [PATCH 19/23] Build dump_syms for host arch --- atom.gyp | 5 ++++- script/dump-symbols.py | 4 ---- script/update.py | 7 +++++-- vendor/breakpad | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/atom.gyp b/atom.gyp index cce72f16c467..e70b65e78aa1 100644 --- a/atom.gyp +++ b/atom.gyp @@ -43,7 +43,6 @@ 'dependencies': [ '<(project_name)_framework', '<(project_name)_helper', - 'vendor/breakpad/breakpad.gyp:dump_syms', ], 'xcode_settings': { 'ATOM_BUNDLE_ID': 'com.<(company_abbr).<(project_name)', @@ -155,6 +154,10 @@ ] }, ], + }, { + 'dependencies': [ + 'vendor/breakpad/breakpad.gyp:dump_syms#host', + ], }], # OS=="win" ['OS=="linux"', { 'copies': [ diff --git a/script/dump-symbols.py b/script/dump-symbols.py index b69754548fb1..e072e5237b65 100755 --- a/script/dump-symbols.py +++ b/script/dump-symbols.py @@ -22,10 +22,6 @@ def main(destination): (project_name, product_name) = get_names_from_gyp() if PLATFORM in ['darwin', 'linux']: - # Generate the dump_syms tool. - build = os.path.join(SOURCE_ROOT, 'script', 'build.py') - execute([sys.executable, build, '-c', 'R', '-t', 'dump_syms']) - generate_breakpad_symbols = os.path.join(SOURCE_ROOT, 'tools', 'posix', 'generate_breakpad_symbols.py') if PLATFORM == 'darwin': diff --git a/script/update.py b/script/update.py index ac9231c77645..a03eb44f0d60 100755 --- a/script/update.py +++ b/script/update.py @@ -5,7 +5,7 @@ import platform import subprocess import sys -from lib.config import get_target_arch +from lib.config import get_target_arch, PLATFORM from lib.util import get_host_arch @@ -41,6 +41,9 @@ def update_gyp(): def run_gyp(target_arch, component): + env = os.environ.copy() + if PLATFORM == 'linux' and target_arch != get_host_arch(): + env['GYP_CROSSCOMPILE'] = '1' python = sys.executable if sys.platform == 'cygwin': # Force using win32 python on cygwin. @@ -53,7 +56,7 @@ def run_gyp(target_arch, component): '-Dlibrary=static_library', ] return subprocess.call([python, gyp, '-f', 'ninja', '--depth', '.', - 'atom.gyp', '-Icommon.gypi'] + defines) + 'atom.gyp', '-Icommon.gypi'] + defines, env=env) if __name__ == '__main__': diff --git a/vendor/breakpad b/vendor/breakpad index 4427c1170387..4ee7e1a703d0 160000 --- a/vendor/breakpad +++ b/vendor/breakpad @@ -1 +1 @@ -Subproject commit 4427c1170387afe46eb3fad259436f1f9f5efa86 +Subproject commit 4ee7e1a703d066861b7bf6fce28526f8ed07dcd6 From 8110f2f2213dac5be74efc46283604a1c16348eb Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 07:19:39 +0000 Subject: [PATCH 20/23] Call correct strip for arm target --- script/create-dist.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/create-dist.py b/script/create-dist.py index da2efb3ef1cf..5d52234b5681 100755 --- a/script/create-dist.py +++ b/script/create-dist.py @@ -129,9 +129,13 @@ def copy_license(): def strip_binaries(): + if get_target_arch() == 'arm': + strip = 'arm-linux-gnueabihf-strip' + else: + strip = 'strip' for binary in TARGET_BINARIES[PLATFORM]: if binary.endswith('.so') or '.' not in binary: - execute(['strip', os.path.join(DIST_DIR, binary)]) + execute([strip, os.path.join(DIST_DIR, binary)]) def copy_system_libraries(): From f0eac9d82851e799c38f4fc3c4b4f361d1ac8536 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 07:25:17 +0000 Subject: [PATCH 21/23] Don't upload arm version of chromedriver --- script/create-dist.py | 8 ++++++-- script/upload.py | 12 ++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/script/create-dist.py b/script/create-dist.py index 5d52234b5681..928430e22da1 100755 --- a/script/create-dist.py +++ b/script/create-dist.py @@ -80,6 +80,8 @@ def main(): rm_rf(DIST_DIR) os.makedirs(DIST_DIR) + target_arch = get_target_arch() + force_build() create_symbols() copy_binaries() @@ -89,11 +91,13 @@ def main(): if PLATFORM == 'linux': strip_binaries() - copy_system_libraries() + if target_arch != 'arm': + copy_system_libraries() create_version() create_dist_zip() - create_chrome_binary_zip('chromedriver', get_chromedriver_version()) + if target_arch != 'arm': + create_chrome_binary_zip('chromedriver', get_chromedriver_version()) create_chrome_binary_zip('mksnapshot', ATOM_SHELL_VERSION) create_symbols_zip() diff --git a/script/upload.py b/script/upload.py index 931eb92f7e06..03fbd33c6b9b 100755 --- a/script/upload.py +++ b/script/upload.py @@ -15,7 +15,6 @@ from lib.github import GitHub ATOM_SHELL_REPO = 'atom/electron' ATOM_SHELL_VERSION = get_atom_shell_version() -CHROMEDRIVER_VERSION = get_chromedriver_version() PROJECT_NAME = atom_gyp()['project_name%'] PRODUCT_NAME = atom_gyp()['product_name%'] @@ -31,9 +30,6 @@ SYMBOLS_NAME = '{0}-{1}-{2}-{3}-symbols.zip'.format(PROJECT_NAME, ATOM_SHELL_VERSION, PLATFORM, get_target_arch()) -CHROMEDRIVER_NAME = 'chromedriver-{0}-{1}-{2}.zip'.format(CHROMEDRIVER_VERSION, - PLATFORM, - get_target_arch()) MKSNAPSHOT_NAME = 'mksnapshot-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION, PLATFORM, get_target_arch()) @@ -79,11 +75,15 @@ def main(): # Upload chromedriver and mksnapshot for minor version update. if parse_version(args.version)[2] == '0': - upload_atom_shell(github, release_id, - os.path.join(DIST_DIR, CHROMEDRIVER_NAME)) upload_atom_shell(github, release_id, os.path.join(DIST_DIR, MKSNAPSHOT_NAME)) + if get_target_arch() != 'arm': + chromedriver = 'chromedriver-{0}-{1}-{2}.zip'.format( + get_chromedriver_version(), PLATFORM, get_target_arch()) + upload_atom_shell(github, release_id, + os.path.join(DIST_DIR, chromedriver)) + if PLATFORM == 'win32': # Upload node headers. execute([sys.executable, From 2078e5736e3b7384213dbbe789809b7aa290fe3b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 07:26:53 +0000 Subject: [PATCH 22/23] Don't upload arm version of mksnapshot too --- script/upload.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/script/upload.py b/script/upload.py index 03fbd33c6b9b..466b0dd88eca 100755 --- a/script/upload.py +++ b/script/upload.py @@ -74,16 +74,14 @@ def main(): upload_atom_shell(github, release_id, os.path.join(DIST_DIR, SYMBOLS_NAME)) # Upload chromedriver and mksnapshot for minor version update. - if parse_version(args.version)[2] == '0': + if get_target_arch() != 'arm' and parse_version(args.version)[2] == '0': + chromedriver = 'chromedriver-{0}-{1}-{2}.zip'.format( + get_chromedriver_version(), PLATFORM, get_target_arch()) + upload_atom_shell(github, release_id, + os.path.join(DIST_DIR, chromedriver)) upload_atom_shell(github, release_id, os.path.join(DIST_DIR, MKSNAPSHOT_NAME)) - if get_target_arch() != 'arm': - chromedriver = 'chromedriver-{0}-{1}-{2}.zip'.format( - get_chromedriver_version(), PLATFORM, get_target_arch()) - upload_atom_shell(github, release_id, - os.path.join(DIST_DIR, chromedriver)) - if PLATFORM == 'win32': # Upload node headers. execute([sys.executable, From a367934b956ed190642b5b9d3f0916ab6b530331 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 15:54:14 +0800 Subject: [PATCH 23/23] docs: Cross compilation --- docs/development/build-instructions-linux.md | 41 +++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/docs/development/build-instructions-linux.md b/docs/development/build-instructions-linux.md index 505cb4d5f046..8f0d9cea35f9 100644 --- a/docs/development/build-instructions-linux.md +++ b/docs/development/build-instructions-linux.md @@ -4,9 +4,9 @@ * 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. One can download -source code from [Node.js] (http://nodejs.org) and compile from source. -Doing so permits installing Node to your own home directory as a standard user. +* Node.js v0.12.x. There are various ways to install Node. One can download +source code from [Node.js] (http://nodejs.org) and compile from source. +Doing so permits installing Node to your own home directory as a standard user. Or try repositories such as [NodeSource] (https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories) * Clang 3.4 or later * Development headers of GTK+ and libnotify @@ -20,15 +20,13 @@ $ sudo apt-get install build-essential clang libdbus-1-dev libgtk2.0-dev \ libxss1 gcc-multilib g++-multilib ``` -Other distributions may offer similar packages for installation via package +Other distributions may offer similar packages for installation via package managers such as yum. 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. - +device container of at least 25 gigabytes in size. ## Getting the code @@ -39,8 +37,8 @@ $ git clone https://github.com/atom/electron.git ## Bootstrapping The bootstrap script will download all necessary build dependencies and create -build project files. You must have Python 2.7.x for the script to succeed. -Downloading certain files could take a long time. Notice that we are using +build project files. You must have Python 2.7.x for the script to succeed. +Downloading certain files could take a long time. Notice that we are using `ninja` to build Electron so there is no `Makefile` generated. ```bash @@ -48,6 +46,15 @@ $ cd electron $ ./script/bootstrap.py -v ``` +### Cross compilation + +If you want to cross compile for `arm` or `ia32` targets, you can pass the +`--target_arch` parameter to the `bootstrap.py` script: + +```bash +$ ./script/bootstrap.py -v --target_arch=arm +``` + ## Building If you would like to build both `Release` and `Debug` targets: @@ -57,16 +64,16 @@ $ ./script/build.py ``` This script will cause a very large Electron executable to be placed in -the directory `out/R`. The file size is in excess of 1.3 gigabytes. This -happens because the Release target binary contains debugging symbols. +the directory `out/R`. The file size is in excess of 1.3 gigabytes. This +happens because the Release target binary contains debugging symbols. To reduce the file size, run the `create-dist.py` script: ```bash $ ./script/create-dist.py ``` -This will put a working distribution with much smaller file sizes in -the `dist` directory. After running the create-dist.py script, you +This will put a working distribution with much smaller file sizes in +the `dist` directory. After running the create-dist.py script, you may want to remove the 1.3+ gigabyte binary which is still in out/R. You can also build the `Debug` target only: @@ -75,23 +82,19 @@ You can also build the `Debug` target only: $ ./script/build.py -c D ``` -After building is done, you can find the `electron` debug binary -under `out/D`. - +After building is done, you can find the `electron` debug binary under `out/D`. ## Cleaning - To clean the build files: ```bash $ ./script/clean.py ``` - ## Troubleshooting -Make sure you have installed all the build dependencies. +Make sure you have installed all the build dependencies. ## Tests