summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorbradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-29 19:17:42 +0000
committerbradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-29 19:17:42 +0000
commitff3b21b38056a0697f4a6b1dbb33efb3721f9cd0 (patch)
treedfc54a32d44a0b98b204f0eb14a62f38e10d386c /build
parent4509f39a591e170cb1efef0b5e21658d29a2f896 (diff)
downloadchromium_src-ff3b21b38056a0697f4a6b1dbb33efb3721f9cd0.zip
chromium_src-ff3b21b38056a0697f4a6b1dbb33efb3721f9cd0.tar.gz
chromium_src-ff3b21b38056a0697f4a6b1dbb33efb3721f9cd0.tar.bz2
Adding in BuildComponents to allow things like Defer and publishing.
Review URL: http://codereview.chromium.org/8666 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r--build/SConscript.main318
1 files changed, 173 insertions, 145 deletions
diff --git a/build/SConscript.main b/build/SConscript.main
index 6b2741c..b771915 100644
--- a/build/SConscript.main
+++ b/build/SConscript.main
@@ -32,7 +32,10 @@ root_env = Environment(
DESTINATION_ROOT = '$MAIN_DIR/Hammer',
TARGET_ROOT = '$DESTINATION_ROOT',
- LIBS_DIR = '$OBJ_ROOT/Libs',
+ LIBS_DIR = '$COMPONENT_LIBRARY_DIR',
+
+ # Disable running of tests thru scons for now.
+ COMPONENT_TEST_CMDLINE = '',
BASE_DIR = '$OBJ_ROOT/base',
BREAKPAD_DIR = '$OBJ_ROOT/breakpad',
@@ -79,17 +82,8 @@ root_env = Environment(
'__env__, RDirs, TARGET, SOURCE)}'),
)
-# We pre-resolve some common targets. We end up spending lots of time
-# resolving these over and over again.
-root_env.Replace(
- CHROME_SRC_DIR = str(root_env.Dir('$CHROME_SRC_DIR')),
- DESTINATION_ROOT = str(root_env.Dir('$DESTINATION_ROOT')),
- TARGET_ROOT = str(root_env.Dir('$TARGET_ROOT')),
- OBJ_ROOT = str(root_env.Dir('$OBJ_ROOT')),
- WEBKIT_DIR = str(root_env.Dir('$WEBKIT_DIR')),
-)
+root_env.Append(LIBPATH = ['$V8_DIR'])
-root_env.Append(LIBPATH = ['$LIBS_DIR'])
def ChromeProgram(env, *args, **kw):
@@ -139,13 +133,108 @@ if ARGUMENTS.get('VERBOSE') in (None, '0'):
root_env.Decider('MD5-timestamp')
+# The list of all leaf (fully described) environments.
+environment_list = []
+
+
+# --------------------------------------------------------------------------
+# Decide which things to load.
+# Don't put anything platform depended here, this is just to gate things
+# in or out for speed.
+
+included = [c for c in load if not c.startswith('-')]
+excluded = [c[1:] for c in load if c.startswith('-')]
+if not included:
+ included = ['all']
+
+components = ['all']
+
+def LoadComponent(c):
+ components.append(c)
+ return (not GetOption('help') and
+ c in included or
+ ('all' in included and not c in excluded))
+
+sconscripts = []
+
+if LoadComponent('base'):
+ sconscripts.append('$BASE_DIR/base.scons')
+
+if LoadComponent('breakpad'):
+ sconscripts.append('$BREAKPAD_DIR/SConscript')
+
+if LoadComponent('chrome'):
+ sconscripts.append('$CHROME_DIR/SConscript')
+
+if LoadComponent('gears'):
+ sconscripts.append('$GEARS_DIR/SConscript')
+
+if LoadComponent('google_update'):
+ sconscripts.append('$GOOGLE_UPDATE_DIR/SConscript')
+
+if LoadComponent('googleurl'):
+ # googleurl comes from a different repository so we provide the SConscript
+ # file.
+ sconscripts.append('$GOOGLEURL_DIR/googleurl.scons')
+
+if LoadComponent('net'):
+ sconscripts.append('$NET_DIR/net.scons')
+
+if LoadComponent('rlz'):
+ sconscripts.append('$RLZ_DIR/SConscript')
+
+if LoadComponent('sandbox'):
+ sconscripts.append('$SANDBOX_DIR/sandbox.scons')
+
+if LoadComponent('sdch'):
+ sconscripts.append('$SDCH_DIR/SConscript')
+
+if LoadComponent('skia'):
+ sconscripts.append('$SKIA_DIR/SConscript')
+
+if LoadComponent('testing'):
+ sconscripts.append('$TESTING_DIR/SConscript.gtest')
+
+if LoadComponent('third_party'):
+ sconscripts.extend([
+ '$BSDIFF_DIR/SConscript',
+ '$BZIP2_DIR/bzip2.scons',
+ '$ICU38_DIR/icu38.scons',
+ '$LIBPNG_DIR/libpng.scons',
+ '$LZMA_SDK_DIR/SConscript',
+ '$MODP_B64_DIR/modp_b64.scons',
+ '$ZLIB_DIR/zlib.scons',
+ '$LIBJPEG_DIR/SConscript',
+ '$LIBXML_DIR/SConscript',
+ '$LIBXSLT_DIR/SConscript',
+ '$BSPATCH_DIR/SConscript',
+ ])
+
+if LoadComponent('v8') and root_env.Dir('$CHROME_SRC_DIR/v8').exists():
+ sconscripts.append('build/SConscript.v8')
+
+if LoadComponent('webkit'):
+ sconscripts.append('$WEBKIT_DIR/SConscript')
+
+
+# Add the final list into the root environment to be build in BuildComponents.
+root_env.Append(BUILD_SCONSCRIPTS = sconscripts)
+
+
+
# --------------------------------------------------------------------------
# Windows specific
windows_env = root_env.Clone()
+environment_list.append(windows_env)
windows_env.Tool('target_platform_windows')
windows_env.Tool('target_debug')
windows_env.Tool('midl')
+windows_env.Replace(
+ BUILD_TYPE = 'debug-windows',
+ BUILD_TYPE_DESCRIPTION = 'Windows debug build',
+ BUILD_GROUPS = ['default'],
+)
# TODO(bradnelson): this is needed for now because target_platform_windows
# has OS_WINDOWS defined in a weird way.
@@ -305,9 +394,16 @@ windows_env.AppendENVPath('PATH', ';C:\\WINDOWS\\system32')
# Linux specific
linux_env = root_env.Clone()
+environment_list.append(linux_env)
linux_env.Tool('target_platform_linux')
linux_env.Tool('target_debug')
linux_env.Tool('yacc')
+linux_env.Replace(
+ BUILD_TYPE = 'debug-linux',
+ BUILD_TYPE_DESCRIPTION = 'Linux debug build',
+ BUILD_GROUPS = ['default'],
+)
+
# TODO(bradnelson): this is needed for now because target_platform_linux has
# OS_LINUX defined in a weird way.
@@ -325,33 +421,22 @@ for envvar in ('HOME', 'DISTCC_HOSTS', 'CCACHE_DIR'):
if envvar in os.environ:
linux_env['ENV'][envvar] = os.environ[envvar]
-# For now, linux only loads the components we know work on Linux, by default.
-if root_env['PLATFORM'] in ['linux', 'linux2', 'posix']:
- load = [
- 'base',
- 'breakpad',
- 'chrome',
- 'googleurl',
- 'net',
- 'sdch',
- 'skia',
- 'testing',
- 'third_party',
- 'v8',
- 'webkit',
- ]
-
excluded_warnings = [
# TODO: Clean up uses of ext/hash_map and remove this.
# (see unordered_map and base/hash_tables.h)
'-Wno-deprecated', # Needed for using ext/hash_map on GCC 4.3
'-Wno-unknown-pragmas', # In wtf's ref counting system
]
-linux_env.Replace(
+linux_env.Append(
+ BUILD_SCONSCRIPTS = [
+ '$LIBEVENT_DIR/libevent.scons',
+ ],
CCFLAGS = ['-m32', '-g', '-pthread'],
CXXFLAGS = ['-Wall', '-Werror'] + excluded_warnings,
LINKFLAGS = ['-m32', '-pthread'],
+)
+linux_env.Replace(
# We have several cases where archives depend on each other in a cyclic
# fashion. (V8Bindings, libport and WebCore being the most significant
# example.) Since the GNU linker does only a single pass over the archives
@@ -367,7 +452,9 @@ linux_env.Replace(
LINKCOM = ('$LINK -o $TARGET $LINKFLAGS $SOURCES '
'$_LIBDIRFLAGS '
'-Wl,--start-group $_LIBFLAGS -Wl,--end-group'),
+)
+linux_env.Replace(
PERL = '/usr/bin/perl',
PERL_INCLUDE_FLAG = '-I ',
PERL_INCLUDE_SUFFIX = '',
@@ -377,6 +464,17 @@ linux_env.Replace(
'__env__, RDirs, TARGET, SOURCE)}'),
)
+linux_env.FilterOut(
+ BUILD_SCONSCRIPTS = [
+ '$BSPATCH_DIR/SConscript',
+ '$BSDIFF_DIR/SConscript',
+ '$GEARS_DIR/SConscript',
+ '$GOOGLE_UPDATE_DIR/SConscript',
+ '$RLZ_DIR/SConscript',
+ '$SANDBOX_DIR/sandbox.scons',
+ ],
+)
+
linux_env.Append(
# We need rt for clock_gettime.
LIBS = ['rt'],
@@ -398,22 +496,14 @@ if root_env['PLATFORM'] in ['linux', 'linux2', 'posix']:
# Mac specific
mac_env = root_env.Clone()
+environment_list.append(mac_env)
mac_env.Tool('target_platform_mac')
mac_env.Tool('target_debug')
-
-# For now, mac only loads the components we know work on Mac, by default.
-if root_env['PLATFORM'] == 'darwin':
- load = [
- 'base',
- #'breakpad',
- 'googleurl',
- 'net',
- 'sdch',
- 'skia',
- 'testing',
- 'third_party',
- #'webkit',
- ]
+mac_env.Replace(
+ BUILD_TYPE = 'debug-mac',
+ BUILD_TYPE_DESCRIPTION = 'Mac debug build',
+ BUILD_GROUPS = ['default'],
+)
mac_env.Replace(
# Reproduce XCode's behavior of using gcc even to link C++,
@@ -423,7 +513,28 @@ mac_env.Replace(
LINK = '$CXX',
)
+mac_env.FilterOut(
+ BUILD_SCONSCRIPTS = [
+ '$BSPATCH_DIR/SConscript',
+ '$BSDIFF_DIR/SConscript',
+ '$LIBJPEG_DIR/SConscript',
+ '$LIBXML_DIR/SConscript',
+ '$LIBXSLT_DIR/SConscript',
+ '$BREAKPAD_DIR/SConscript',
+ '$CHROME_DIR/SConscript',
+ '$GEARS_DIR/SConscript',
+ '$GOOGLE_UPDATE_DIR/SConscript',
+ '$RLZ_DIR/SConscript',
+ '$SANDBOX_DIR/sandbox.scons',
+ 'build/SConscript.v8',
+ '$WEBKIT_DIR/SConscript',
+ ],
+)
+
mac_env.Append(
+ BUILD_SCONSCRIPTS = [
+ '$LIBEVENT_DIR/libevent.scons',
+ ],
CFLAGS = [
'-std=c99',
],
@@ -469,6 +580,8 @@ AddOption('--clobber', action='store_true', dest='clobber', default=False,
help='Delete build directory before building.')
if GetOption('clobber'):
shutil.rmtree(root_env.Dir('$DESTINATION_ROOT').abspath, True)
+ # sconsign file gets put here at the moment.
+ shutil.rmtree(root_env.Dir('$MAIN_DIR/scons-out').abspath, True)
@@ -476,118 +589,25 @@ if GetOption('clobber'):
# Overlay things from a layer below.
-for env in [windows_env, mac_env, linux_env]:
+for env in environment_list:
env.Dir('$OBJ_ROOT').addRepository(env.Dir('$CHROME_SRC_DIR'))
env.Dir('$OBJ_ROOT/googleurl').addRepository(env.Dir('$CHROME_SRC_DIR/build'))
-
-# Temporary gating until we call BuildComponents.
-if root_env['PLATFORM'] in ['win32', 'cygwin']:
- env = windows_env
-elif root_env['PLATFORM'] in ['darwin']:
- env = mac_env
-elif root_env['PLATFORM'] in ['linux', 'linux2', 'posix']:
- env = linux_env
-else:
- assert False
-
-included = [c for c in load if not c.startswith('-')]
-excluded = [c[1:] for c in load if c.startswith('-')]
-if not included:
- included = ['all']
-
-components = ['all']
-
-def LoadComponent(c):
- components.append(c)
- return (not GetOption('help') and
- c in included or
- ('all' in included and not c in excluded))
-
-sconscripts = []
-
-if LoadComponent('base'):
- sconscripts.append('$BASE_DIR/base.scons')
-
-if LoadComponent('breakpad'):
- sconscripts.append('$BREAKPAD_DIR/SConscript')
-
-if LoadComponent('chrome'):
- sconscripts.append('$CHROME_DIR/SConscript')
-
-if LoadComponent('gears'):
- sconscripts.append('$GEARS_DIR/SConscript')
-
-if LoadComponent('google_update'):
- sconscripts.append('$GOOGLE_UPDATE_DIR/SConscript')
-
-if LoadComponent('googleurl'):
- # googleurl comes from a different repository so we provide the SConscript
- # file.
- sconscripts.append('$GOOGLEURL_DIR/googleurl.scons')
-
-if LoadComponent('net'):
- sconscripts.append('$NET_DIR/net.scons')
-
-if LoadComponent('rlz'):
- sconscripts.append('$RLZ_DIR/SConscript')
-
-if LoadComponent('sandbox'):
- sconscripts.append('$SANDBOX_DIR/sandbox.scons')
-
-if LoadComponent('sdch'):
- sconscripts.append('$SDCH_DIR/SConscript')
-
-if LoadComponent('skia'):
- sconscripts.append('$SKIA_DIR/SConscript')
-
-if LoadComponent('testing'):
- sconscripts.append('$TESTING_DIR/SConscript.gtest')
-
-if LoadComponent('third_party'):
- sconscripts.extend([
- '$BSDIFF_DIR/SConscript',
- '$BZIP2_DIR/bzip2.scons',
- '$ICU38_DIR/icu38.scons',
- '$LIBPNG_DIR/libpng.scons',
- '$LZMA_SDK_DIR/SConscript',
- '$MODP_B64_DIR/modp_b64.scons',
- '$ZLIB_DIR/zlib.scons',
- ])
- # Temporary until we get these building on Mac.
- if env['PLATFORM'] != 'darwin':
- sconscripts.extend([
- '$LIBJPEG_DIR/SConscript',
- '$LIBXML_DIR/SConscript',
- '$LIBXSLT_DIR/SConscript',
- ])
- if env['PLATFORM'] in ('posix', 'darwin'):
- sconscripts.extend([
- '$LIBEVENT_DIR/libevent.scons',
- ])
- # This is temporary until we get this lib to build on other platforms.
- if env['PLATFORM'] == 'win32':
- sconscripts.extend([
- '$BSPATCH_DIR/SConscript',
- ])
-
-if LoadComponent('v8') and env.Dir('$CHROME_SRC_DIR/v8').exists():
- env.SConscript('SConscript.v8',
- exports=['env'])
-
-if LoadComponent('webkit'):
- sconscripts.append('$WEBKIT_DIR/SConscript')
-
-env.SConscript(sconscripts, exports=['env'])
+ # We pre-resolve some common targets. We end up spending lots of time
+ # resolving these over and over again.
+ env.Replace(
+ CHROME_SRC_DIR = str(env.Dir('$CHROME_SRC_DIR')),
+ DESTINATION_ROOT = str(env.Dir('$DESTINATION_ROOT')),
+ TARGET_ROOT = str(env.Dir('$TARGET_ROOT')),
+ OBJ_ROOT = str(env.Dir('$OBJ_ROOT')),
+ WEBKIT_DIR = str(env.Dir('$WEBKIT_DIR')),
+ )
help_fmt = """
Usage: hammer [SCONS_OPTIONS] [VARIABLES] [TARGET] ...
Supported build variables:
-
- BUILD_TYPE=type Build type. Also used as the subdirectory name
- in which the build occurs.
LOAD=[module,...] Comma-separated list of components to load in the
dependency graph ('-' prefix excludes):
%s
@@ -611,3 +631,11 @@ if GetOption('help'):
Import('build_component')
Default(build_component)
+
+# -------------------------------------------------------------------------
+
+# Invoke all the SConscripts in each of the environments that make sense on
+# this host-platform.
+BuildComponents(environment_list)
+
+# -------------------------------------------------------------------------