def webrtc_android_apk(c): if c.TARGET_PLATFORM != 'android': raise BadConf('Only "android" platform is supported (got: "%s")' % c.TARGET_PLATFORM) if c.TARGET_ARCH not in SUPPORTED_TARGET_ARCHS: raise BadConf('Only "%s" architectures are supported (got: "%s")' % (','.join(SUPPORTED_TARGET_ARCHS), c.TARGET_ARCH)) c.compile_py.default_targets = ['android_builder_webrtc'] c.gyp_env.GYP_GENERATOR_FLAGS['default_target'] = 'android_builder_webrtc' c.gyp_env.GYP_DEFINES['include_tests'] = 1
def libyuv_ios(c): if c.HOST_PLATFORM != 'mac': raise BadConf('Only "mac" host platform is supported for iOS (got: "%s")' % c.HOST_PLATFORM) if c.TARGET_PLATFORM != 'ios': raise BadConf('Only "ios" target platform is supported (got: "%s")' % c.TARGET_PLATFORM) c.build_config_fs = c.BUILD_CONFIG + '-iphoneos' gyp_defs = c.gyp_env.GYP_DEFINES gyp_defs['target_arch'] = 'armv7' gyp_defs['OS'] = c.TARGET_PLATFORM _libyuv_common(c)
def msvs(c): if c.HOST_PLATFORM != 'win': raise BadConf('can not use msvs on "%s"' % c.HOST_PLATFORM) c.gyp_env.GYP_GENERATORS.add('msvs') c.gyp_env.GYP_GENERATOR_FLAGS['msvs_error_on_missing_sources'] = 1 c.compile_py.build_tool = 'msvs' c.build_dir = Path('[CHECKOUT]', 'build')
def chromium_lkgr(c): s = c.solutions[0] safesync_url = 'https://chromium-status.appspot.com/lkgr' if c.GIT_MODE: safesync_url = 'https://chromium-status.appspot.com/git-lkgr' raise BadConf('Git has problems with safesync_url, crbug.com/109191.') s.safesync_url = safesync_url
def chromium_lkcr(c): # TODO(phajdan.jr): Add git hashes for LKCR crbug.com/349277. if c.GIT_MODE: raise BadConf('Git has problems with safesync_url and LKCR, ' 'crbug.com/349277 crbug.com/109191') s = c.solutions[0] s.safesync_url = 'https://build.chromium.org/p/chromium/lkcr-status/lkgr'
def tools_build(c): if not c.GIT_MODE: raise BadConf('tools_build only supports git') s = c.solutions.add() s.name = 'build' s.url = ChromiumGitURL(c, 'chromium', 'tools', 'build.git') m = c.got_revision_mapping m['build'] = 'got_revision'
def webrtc_ios(c): if c.HOST_PLATFORM != 'mac': raise BadConf('Only "mac" host platform is supported for iOS (got: "%s")' % c.HOST_PLATFORM) if c.TARGET_PLATFORM != 'ios': raise BadConf('Only "ios" target platform is supported (got: "%s")' % c.TARGET_PLATFORM) c.build_config_fs = c.BUILD_CONFIG + '-iphoneos' gyp_defs = c.gyp_env.GYP_DEFINES gyp_defs['build_with_libjingle'] = 1 gyp_defs['chromium_ios_signing'] = 0 gyp_defs['key_id'] = '' gyp_defs['target_arch'] = 'armv7' gyp_defs['OS'] = c.TARGET_PLATFORM _compiler_defaults(c)
def syzyasan(c): if c.gyp_env.GYP_DEFINES[ 'component'] != 'static_library': # pragma: no cover raise BadConf('SyzyASan requires component=static_library') gyp_defs = c.gyp_env.GYP_DEFINES gyp_defs['syzyasan'] = 1 gyp_defs['win_z7'] = 1 gyp_defs['chromium_win_pch'] = 0 c.gyp_env.GYP_USE_SEPARATE_MSPDBSRV = 1
def msvs(c): if c.HOST_PLATFORM != 'win': raise BadConf('can not use msvs on "%s"' % c.HOST_PLATFORM) # If compile.py is invoking devenv it needs to refer to a solution file. # For chrome this defaults to ['CHECKOUT']/build/all.sln. c.compile_py.solution = Path('[CHECKOUT]', 'build', 'all.sln') c.gyp_env.GYP_GENERATORS.add('msvs') c.compile_py.build_tool = 'vs' c.build_dir = Path('[CHECKOUT]', 'build')
def asan(c): if 'clang' not in c.compile_py.compiler: # pragma: no cover raise BadConf('asan requires clang') if c.TARGET_PLATFORM == 'linux': c.gyp_env.GYP_DEFINES['use_allocator'] = 'none' c.gyp_env.GYP_DEFINES['asan'] = 1 c.gyp_env.GYP_DEFINES['lsan'] = 1
def tsan2(c): if 'clang' not in c.compile_py.compiler: # pragma: no cover raise BadConf('tsan2 requires clang') gyp_defs = c.gyp_env.GYP_DEFINES gyp_defs['tsan'] = 1 gyp_defs['use_allocator'] = 'none' gyp_defs['use_aura'] = 1 gyp_defs['release_extra_cflags'] = '-gline-tables-only' gyp_defs['disable_nacl'] = 1
def asan(c): if 'clang' not in c.compile_py.compiler: # pragma: no cover raise BadConf('asan requires clang') c.runtests.lsan_suppressions_file = Path('[CHECKOUT]', 'tools', 'lsan', 'suppressions.txt') if c.TARGET_PLATFORM == 'linux': c.gyp_env.GYP_DEFINES['use_allocator'] = 'none' c.gyp_env.GYP_DEFINES['asan'] = 1 c.gyp_env.GYP_DEFINES['lsan'] = 1
def chromium_lkcr(c): # TODO(phajdan.jr): Add git hashes for LKCR crbug.com/349277. if c.GIT_MODE: raise BadConf('Git has problems with safesync_url and LKCR, ' 'crbug.com/349277 crbug.com/109191') s = c.solutions[0] s.safesync_url = 'https://build.chromium.org/p/chromium/lkcr-status/lkgr' # TODO(hinoka): Once lkcr exists and is a tag, it should just be lkcr # rather than origin/lkcr. s.revision = 'origin/lkcr'
def goma(c): if c.compile_py.build_tool == 'vs': # pragma: no cover raise BadConf('goma doesn\'t work with msvs') # TODO(iannucci): support clang and jsonclang if not c.compile_py.compiler: c.compile_py.compiler = 'goma' elif c.compile_py.compiler == 'clang': c.compile_py.compiler = 'goma-clang' else: # pragma: no cover raise BadConf('goma config dosen\'t understand %s' % c.compile_py.compiler) c.gyp_env.GYP_DEFINES['use_goma'] = 1 goma_dir = Path('[BUILD]', 'goma') c.gyp_env.GYP_DEFINES['gomadir'] = goma_dir c.compile_py.goma_dir = goma_dir if c.TARGET_PLATFORM == 'win': fastbuild(c) pch(c, invert=True)
def nacl(c): if c.GIT_MODE: raise BadConf('nacl only supports svn') s = c.solutions.add() s.name = 'native_client' s.url = ChromiumSvnSubURL(c, 'native_client', 'trunk', 'src', 'native_client') s.custom_vars = mirror_only(c, { 'webkit_trunk': BlinkURL(c), 'googlecode_url': 'svn://svn-mirror.golo.chromium.org/%s', 'sourceforge_url': 'svn://svn-mirror.golo.chromium.org/%(repo)s'}) s = c.solutions.add() s.name = 'supplement.DEPS' s.url = ChromiumSvnSubURL(c, 'native_client', 'trunk', 'deps', 'supplement.DEPS')
def oilpan(c): if c.GIT_MODE: raise BadConf("Oilpan requires SVN for now") c.solutions[0].custom_vars = { 'webkit_trunk': ChromiumSvnSubURL(c, 'blink', 'branches', 'oilpan') } c.solutions[0].custom_vars['sourceforge_url'] = mirror_only( c, 'svn://svn-mirror.golo.chromium.org/%(repo)s', 'svn://svn.chromium.org/%(repo)s') c.revisions['src/third_party/WebKit'] = 'HEAD' c.solutions[0].revision = '197341' c.solutions[0].custom_deps = { 'src/chrome/tools/test/reference_build/chrome_linux': ChromiumSvnSubURL(c, 'blink', 'branches', 'oilpan', 'Tools', 'reference_build', 'chrome_linux') } del c.got_revision_mapping['src'] c.got_revision_mapping['src/third_party/WebKit/Source'] = 'got_revision'
def v8_lkgr(c): if c.GIT_MODE: raise BadConf('Git has problems with safesync_url.') c.solutions[0].safesync_url = 'https://v8-status.appspot.com/lkgr'
def BASE(c): host_targ_tuples = [(c.HOST_PLATFORM, c.HOST_ARCH, c.HOST_BITS), (c.TARGET_PLATFORM, c.TARGET_ARCH, c.TARGET_BITS)] for (plat, arch, bits) in host_targ_tuples: if plat == 'ios': if arch != 'arm' or bits != 32: raise BadConf('iOS only supports arm/32') elif plat in ('win', 'mac'): if arch != 'intel': raise BadConf('%s arch is not supported on %s' % (arch, plat)) elif plat in ('chromeos', 'android', 'linux'): pass # no arch restrictions else: # pragma: no cover assert False, "Not covering a platform: %s" % plat potential_platforms = { # host -> potential target platforms 'win': ('win', ), 'mac': ('mac', 'ios'), 'linux': ('linux', 'chromeos', 'android'), }.get(c.HOST_PLATFORM) if not potential_platforms: # pragma: no cover raise BadConf('Cannot build on "%s"' % c.HOST_PLATFORM) if c.TARGET_PLATFORM not in potential_platforms: raise BadConf('Can not compile "%s" on "%s"' % (c.TARGET_PLATFORM, c.HOST_PLATFORM)) if c.HOST_PLATFORM != c.TARGET_PLATFORM: c.gyp_env.GYP_CROSSCOMPILE = 1 if c.HOST_BITS < c.TARGET_BITS: raise BadConf('host bits < targ bits') c.build_config_fs = c.BUILD_CONFIG if c.HOST_PLATFORM == 'win': if c.TARGET_BITS == 64: # Windows requires 64-bit builds to be in <dir>_x64. c.build_config_fs = c.BUILD_CONFIG + '_x64' c.memory_tests_runner = Path('[CHECKOUT]', 'tools', 'valgrind', 'chrome_tests', platform_ext={ 'win': '.bat', 'mac': '.sh', 'linux': '.sh' }) gyp_arch = { ('intel', 32): 'ia32', ('intel', 64): 'x64', ('arm', 32): 'arm', ('arm', 64): 'arm64', ('mipsel', 32): 'mipsel', ('mipsel', 64): 'mipsel', }.get((c.TARGET_ARCH, c.TARGET_BITS)) if gyp_arch: c.gyp_env.GYP_DEFINES['target_arch'] = gyp_arch if c.BUILD_CONFIG == 'Release': static_library(c, final=False) elif c.BUILD_CONFIG == 'Debug': shared_library(c, final=False) else: # pragma: no cover raise BadConf('Unknown build config "%s"' % c.BUILD_CONFIG)
def BASE(c): host_targ_tuples = [(c.HOST_PLATFORM, c.HOST_ARCH, c.HOST_BITS), (c.TARGET_PLATFORM, c.TARGET_ARCH, c.TARGET_BITS)] for (plat, arch, bits) in host_targ_tuples: if plat == 'ios': if arch not in ('arm', 'intel'): raise BadConf('%s/%s arch is not supported on %s' % (arch, bits, plat)) elif plat in ('win', 'mac'): if arch != 'intel': raise BadConf('%s arch is not supported on %s' % (arch, plat)) elif plat in ('chromeos', 'android', 'linux'): pass # no arch restrictions else: # pragma: no cover assert False, "Not covering a platform: %s" % plat potential_platforms = { # host -> potential target platforms 'win': ('win', ), 'mac': ('mac', 'ios'), 'linux': ('linux', 'chromeos', 'android'), }.get(c.HOST_PLATFORM) if not potential_platforms: # pragma: no cover raise BadConf('Cannot build on "%s"' % c.HOST_PLATFORM) if c.TARGET_PLATFORM not in potential_platforms: raise BadConf('Can not compile "%s" on "%s"' % (c.TARGET_PLATFORM, c.HOST_PLATFORM)) if c.TARGET_CROS_BOARD: if not c.TARGET_PLATFORM == 'chromeos': raise BadConf( "Cannot specify CROS board for non-'chromeos' platform") if c.HOST_PLATFORM != c.TARGET_PLATFORM: c.gyp_env.GYP_CROSSCOMPILE = 1 if c.HOST_BITS < c.TARGET_BITS: raise BadConf('host bits < targ bits') c.build_config_fs = c.BUILD_CONFIG if c.HOST_PLATFORM == 'win': if c.TARGET_BITS == 64: # Windows requires 64-bit builds to be in <dir>_x64. c.build_config_fs = c.BUILD_CONFIG + '_x64' # Test runner memory tools that are not compile-time based. c.runtests.memory_tests_runner = Path('[CHECKOUT]', 'tools', 'valgrind', 'chrome_tests', platform_ext={ 'win': '.bat', 'mac': '.sh', 'linux': '.sh' }) if c.project_generator.tool not in PROJECT_GENERATORS: # pragma: no cover raise BadConf('"%s" is not a supported project generator tool, the ' 'supported ones are: %s' % (c.project_generator.tool, ','.join(PROJECT_GENERATORS))) gyp_arch = { ('intel', 32): 'ia32', ('intel', 64): 'x64', ('arm', 32): 'arm', ('arm', 64): 'arm64', ('mipsel', 32): 'mipsel', ('mipsel', 64): 'mipsel', }.get((c.TARGET_ARCH, c.TARGET_BITS)) if gyp_arch: c.gyp_env.GYP_DEFINES['target_arch'] = gyp_arch if c.BUILD_CONFIG in ['Coverage', 'Release']: # The 'Coverage' target is not explicitly used by Chrome, but by some other # projects in the Chrome ecosystem (ie: Syzygy). static_library(c, final=False) elif c.BUILD_CONFIG == 'Debug': shared_library(c, final=False) else: # pragma: no cover raise BadConf('Unknown build config "%s"' % c.BUILD_CONFIG)
def _memory_tool(c, tool): if tool not in MEMORY_TOOLS: # pragma: no cover raise BadConf( '"%s" is not a supported memory tool, the supported ones ' 'are: %s' % (tool, ','.join(MEMORY_TOOLS))) c.runtests.memory_tool = tool
def xcode(c): if c.HOST_PLATFORM != 'mac': raise BadConf('can not use xcodebuild on "%s"' % c.HOST_PLATFORM) c.gyp_env.GYP_GENERATORS.add('xcode')
def msan(c): if 'clang' not in c.compile_py.compiler: # pragma: no cover raise BadConf('msan requires clang') c.gyp_env.GYP_DEFINES['msan'] = 1