diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-10 00:01:37 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-10 00:01:37 +0000 |
commit | 6b3531280db5c7a6080dee26a0637553ca4af642 (patch) | |
tree | e724570c5bc35a7fa5315b7245f2b695683fdb8c /gears | |
parent | 32cda29d0266751c764b043d8aaec6dccc646e29 (diff) | |
download | chromium_src-6b3531280db5c7a6080dee26a0637553ca4af642.zip chromium_src-6b3531280db5c7a6080dee26a0637553ca4af642.tar.gz chromium_src-6b3531280db5c7a6080dee26a0637553ca4af642.tar.bz2 |
Pull 'common' outputs out into their own SConscript so they have their own
variant dir. Add ipc_test as a common output.
Also fixed up some hackery around manipulating OUTDIRs.
Review URL: http://codereview.chromium.org/7037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gears')
-rw-r--r-- | gears/SConscript | 73 | ||||
-rw-r--r-- | gears/SConscript.common | 137 | ||||
-rw-r--r-- | gears/SConscript.dll | 193 | ||||
-rw-r--r-- | gears/SConscript.installers | 26 | ||||
-rw-r--r-- | gears/site_scons/utils.py | 9 |
5 files changed, 263 insertions, 175 deletions
diff --git a/gears/SConscript b/gears/SConscript index 55a0bff..c3b53c35 100644 --- a/gears/SConscript +++ b/gears/SConscript @@ -28,7 +28,6 @@ # - entry.path gives the path relative to toplevel_dir. # - entry.abspath gives the absolute path. -import sys import os Import('env') @@ -36,7 +35,6 @@ Import('env') env = env.Clone( OPEN_DIR = "googleclient/gears/opensource/gears", THIRD_PARTY_DIR = "googleclient/gears/opensource/third_party", - GENFILES_DIR = "genfiles", PRIVATE_THIRD_PARTY_DIR = "googleclient/third_party", ) @@ -104,13 +102,17 @@ env.Replace(ARCH = 'i386') # Output dirs env.Replace( - BASE_OUTDIR = env.subst('$MODE').lower(), + BASE_OUTDIR = '$GEARS_DIR/$MODE', COMMON_OUTDIR = '$BASE_OUTDIR/common', + BROWSER_OUTDIR = '$BASE_OUTDIR/${BROWSER.lower()}', IE_OUTDIR = '$BASE_OUTDIR/ie', FF2_OUTDIR = '$BASE_OUTDIR/ff2', FF3_OUTDIR = '$BASE_OUTDIR/ff3', NPAPI_OUTDIR = '$BASE_OUTDIR/npapi', SF_OUTDIR = '$BASE_OUTDIR/sf', + + GENFILES_DIR = "$BROWSER_OUTDIR/genfiles", + COMMON_GENFILES_DIR = "$COMMON_OUTDIR/genfiles", ) # Add our tools to the PATH. @@ -122,8 +124,60 @@ if env['OS'] in ['win32', 'wince']: env.PrependENVPath('PATH', env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/wix/v3_0_2925/files').abspath) +# Building M4 files env.Tool('m4') +env.Append( + M4ARCH = (env['ARCH'] == 'i386' and 'x86' or '$ARCH'), + M4FLAGS = [ + '--prefix-builtins', + '-DPRODUCT_VERSION=$VERSION', + '-DPRODUCT_VERSION_MAJOR=$MAJOR', + '-DPRODUCT_VERSION_MINOR=$MINOR', + '-DPRODUCT_VERSION_BUILD=$BUILD', + '-DPRODUCT_VERSION_PATCH=$PATCH', + '-DPRODUCT_OS=$OS', + '-DPRODUCT_ARCH="$M4ARCH"', + '-DPRODUCT_GCC_VERSION="gcc3"', + '-DPRODUCT_MAINTAINER="google"', + '-DPRODUCT_FRIENDLY_NAME_UQ="$FRIENDLY_NAME"', + '-DPRODUCT_SHORT_NAME_UQ="$SHORT_NAME"', + '-DI18N_LANGUAGES="(${",".join(I18N_LANGS)})"', + ], + M4PATH = [ + '$OPEN_DIR', + '.', + ], +) + +# SCons magic to make M4PATH work. +env.Replace( + M4INCPREFIX = '-I', + M4INCSUFFIX = '', + _M4INCFLAGS = ('${_concat(M4INCPREFIX, M4PATH, M4INCSUFFIX, ' + '__env__, RDirs, TARGET, SOURCE)}'), + M4COM = '$M4 $M4FLAGS ${_M4INCFLAGS} $SOURCE > $TARGET', +) + +# TODO: Dependency scanner for m4 files - doesn't work. It can't detect files +# that don't exist! +#m4_include_re = re.compile(r'm4_include\((.*)\)', re.M) +#def m4_scan(node, env, path): +# contents = node.get_contents() +# includes = m4_include_re.findall(contents) +# ret_includes = [] +# for include in includes: +# for dir in path: +# file = os.path.join(dir, include) +# if os.path.exists(file): +# ret_includes.append(file) +# break +# return ret_includes +# +#m4_scanner = Scanner(function = m4_scan, skeys = ['.m4', '.html_m4']) +#env.Append(SCANNERS = m4_scanner) + + # C++ build flags. # Clear out the inherited defines from Chrome's build. I want to match Gears' @@ -140,6 +194,7 @@ env.Replace( '$THIRD_PARTY_DIR/zlib', '$THIRD_PARTY_DIR/v8/bindings_local', '.', + '$COMMON_OUTDIR', ], LIBPATH = [ '$LIBS_DIR', @@ -431,16 +486,20 @@ for each in sconscripts: variant_dir='$COMMON_OUTDIR', duplicate=0) +# Must come before SConscript.dll because it Imports targets from this +# SConscript. +env.SConscript('SConscript.common', + exports=['env'], + variant_dir='$COMMON_OUTDIR', + duplicate=0) + browsers = [env['BROWSER']] if browsers[0] == 'all': browsers = env['VALID_BROWSERS'] print 'Building:', browsers for each in browsers: - env.Replace( - BROWSER = each, - BROWSER_OUTDIR = env.subst('$MODE/' + each).lower(), - ) + env.Replace(BROWSER = each) env.SConscript('SConscript.dll', exports=['env'], variant_dir='$BROWSER_OUTDIR', diff --git a/gears/SConscript.common b/gears/SConscript.common new file mode 100644 index 0000000..3946f6f --- /dev/null +++ b/gears/SConscript.common @@ -0,0 +1,137 @@ +# Copyright (c) 2008 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. + +import os + +import utils + +Import('env') + +env = env.Clone() + + +# Building .from_bin.cc files. + +# Must be run from within the gears dir. More hoops to jump through to fix up +# path names and arguments. +env.Replace( +# len() + 1 to include trailing '/' +# TODO: is there a better way to strip off $OPEN_DIR from $SOURCE? + LEN_OPEN_DIR = len(os.path.normpath(env.subst('$OPEN_DIR'))) + 1, + BIN2CPP = 'cd $OPEN_DIR && python tools/bin2cpp.py', + BIN2CPPCOM = '$BIN2CPP ${str(SOURCE)[LEN_OPEN_DIR:]} > ${TARGET.abspath}', +) +bin2cpp_builder = Builder(action = '$BIN2CPPCOM') +env.Append(BUILDERS = {'Bin2cpp': bin2cpp_builder}) + + +# C++ flags. + +env.Prepend( + CPPDEFINES = [ +# Common items, like notifier, is not related to any browser. + 'BROWSER_NONE=1', + ] +) + +m4srcs = [] +binsrcs = [] +ipc_test_srcs = [] + +#----------------------------------------------------------------------------- +# ipc_test + +m4srcs += [ + '$OPEN_DIR/base/common/product_constants.h.m4', +] + +ipc_test_srcs += [ + '$OPEN_DIR/base/common/event.cc', + '$OPEN_DIR/base/common/ipc_message_queue_linux.cc', + '$OPEN_DIR/base/common/ipc_message_queue_null.cc', + '$OPEN_DIR/base/common/ipc_message_queue_test.cc', + '$OPEN_DIR/base/common/ipc_message_queue_test_linux.cc', + '$OPEN_DIR/base/common/ipc_message_queue_test_win32.cc', + '$OPEN_DIR/base/common/ipc_message_queue_win32.cc', + '$OPEN_DIR/base/common/mutex.cc', + '$OPEN_DIR/base/common/mutex_posix.cc', + '$OPEN_DIR/base/common/mutex_win32.cc', + '$OPEN_DIR/base/common/serialization.cc', + '$OPEN_DIR/base/common/stopwatch.cc', + '$OPEN_DIR/base/common/stopwatch_posix.cc', + '$OPEN_DIR/base/common/stopwatch_win32.cc', + '$OPEN_DIR/base/common/string16.cc', + '$OPEN_DIR/base/common/string_utils.cc', + '$OPEN_DIR/base/common/string_utils_osx.cc', + '$OPEN_DIR/base/common/thread.cc', + '$OPEN_DIR/base/common/thread_posix.cc', + '$OPEN_DIR/base/common/thread_win32.cc', + '$OPEN_DIR/base/common/time_utils_win32.cc', +] + +if env['OS'] == 'osx': + ipc_test_srcs += [ + '$OPEN_DIR/base/common/common_osx.mm', + '$OPEN_DIR/base/common/ipc_message_queue_test_osx.mm', + ] + +ipc_test_srcs += [ + '$THIRD_PARTY_DIR/convert_utf/ConvertUTF.c' +] + +#----------------------------------------------------------------------------- +# inspector + +if not env['OFFICIAL_BUILD']: + binsrcs += [ + '$OPEN_DIR/inspector/console.html', + '$OPEN_DIR/inspector/database.html', + '$OPEN_DIR/inspector/index.html', + '$OPEN_DIR/inspector/localserver.html', + '$OPEN_DIR/inspector/common/alert-35.png', + '$OPEN_DIR/inspector/common/database.gif', + '$OPEN_DIR/inspector/common/error-35.png', + '$OPEN_DIR/inspector/common/ie6hacks.css', + '$OPEN_DIR/inspector/common/inspector_links.js', + '$OPEN_DIR/inspector/common/lightbulb-35.png', + '$OPEN_DIR/inspector/common/localserver.gif', + '$OPEN_DIR/inspector/common/question-35.png', + '$OPEN_DIR/inspector/common/styles.css', + '$OPEN_DIR/inspector/common/workerpool.gif', + '$OPEN_DIR/sdk/gears_init.js', + '$OPEN_DIR/ui/common/base.js', + '$OPEN_DIR/ui/common/dom.js', + '$OPEN_DIR/ui/common/icon_32x32.png', + ] + +#----------------------------------------------------------------------------- +# installer + +m4srcs += [ + '$OPEN_DIR/installer/npapi_msi.wxs.m4', + '$OPEN_DIR/installer/win32_msi.wxs.m4', + '$OPEN_DIR/installer/wince_cab.inf.m4', +] + +#----------------------------------------------------------------------------- +# Generate the dependency tree. + +common_targets = {} + +def PatternRule(t, s): return utils.PatternRule(t, s, env) + +# genfiles/%: %.m4 +common_targets['m4'] = \ + [env.M4(*PatternRule('$COMMON_GENFILES_DIR/${SOURCE.filebase}', src)) + for src in m4srcs] + +# genfiles/%.from_bin.cc: % +bins = [env.Bin2cpp(*PatternRule( + '$COMMON_GENFILES_DIR/${SOURCE.file}.from_bin.cc', src)) + for src in binsrcs] +common_targets['src'] = [env.SharedObject(bin) for bin in bins] + +Export('common_targets') + +env.Program('ipc_test', ipc_test_srcs) diff --git a/gears/SConscript.dll b/gears/SConscript.dll index 37f7813..6221420 100644 --- a/gears/SConscript.dll +++ b/gears/SConscript.dll @@ -3,65 +3,13 @@ # found in the LICENSE file. import os -import re +import utils Import('env') env = env.Clone() # TODO: move all these builders out to site_scons or somesuch. -# Building M4 files - -env.Append( - M4ARCH = (env['ARCH'] == 'i386' and 'x86' or '$ARCH'), - M4FLAGS = [ - '--prefix-builtins', - '-DPRODUCT_VERSION=$VERSION', - '-DPRODUCT_VERSION_MAJOR=$MAJOR', - '-DPRODUCT_VERSION_MINOR=$MINOR', - '-DPRODUCT_VERSION_BUILD=$BUILD', - '-DPRODUCT_VERSION_PATCH=$PATCH', - '-DPRODUCT_OS=$OS', - '-DPRODUCT_ARCH="$M4ARCH"', - '-DPRODUCT_GCC_VERSION="gcc3"', - '-DPRODUCT_MAINTAINER="google"', - '-DPRODUCT_FRIENDLY_NAME_UQ="$FRIENDLY_NAME"', - '-DPRODUCT_SHORT_NAME_UQ="$SHORT_NAME"', - '-DI18N_LANGUAGES="(${",".join(I18N_LANGS)})"', - ], - M4PATH = [ - '$OPEN_DIR', - '.', - ], -) - -# SCons magic to make M4PATH work. -env.Replace( - M4INCPREFIX = '-I', - M4INCSUFFIX = '', - _M4INCFLAGS = ('${_concat(M4INCPREFIX, M4PATH, M4INCSUFFIX, ' - '__env__, RDirs, TARGET, SOURCE)}'), - M4COM = '$M4 $M4FLAGS ${_M4INCFLAGS} $SOURCE > $TARGET', -) - -# TODO: Dependency scanner for m4 files - doesn't work. It can't detect files -# that don't exist! -#m4_include_re = re.compile(r'm4_include\((.*)\)', re.M) -#def m4_scan(node, env, path): -# contents = node.get_contents() -# includes = m4_include_re.findall(contents) -# ret_includes = [] -# for include in includes: -# for dir in path: -# file = os.path.join(dir, include) -# if os.path.exists(file): -# ret_includes.append(file) -# break -# return ret_includes -# -#m4_scanner = Scanner(function = m4_scan, skeys = ['.m4', '.html_m4']) -#env.Append(SCANNERS = m4_scanner) - # Building .stab files, using M4FLAGS. @@ -75,21 +23,6 @@ stab_builder = Builder(action = '$STABCOM', src_suffix = '.stab') env.Append(BUILDERS = {'Stab': stab_builder}) -# Building .from_bin.cc files. - -# Must be run from within the gears dir. More hoops to jump through to fix up -# path names and arguments. -env.Replace( -# len() + 1 to include trailing '/' -# TODO: is there a better way to strip off $OPEN_DIR from $SOURCE? - LEN_OPEN_DIR = len(os.path.normpath(env.subst('$OPEN_DIR'))) + 1, - BIN2CPP = 'cd $OPEN_DIR && python tools/bin2cpp.py', - BIN2CPPCOM = '$BIN2CPP ${str(SOURCE)[LEN_OPEN_DIR:]} > ${TARGET.abspath}', -) -bin2cpp_builder = Builder(action = '$BIN2CPPCOM') -env.Append(BUILDERS = {'Bin2cpp': bin2cpp_builder}) - - # Building .idl files. # This is a total mess. MIDL needs to be run from $OPEN_DIR because it's too # stupid to apply its include paths to a relative path like "ui/ie/bla.idl" @@ -170,16 +103,7 @@ if env['BROWSER'] in ['FF2', 'FF3']: # C++ defines -env_common = env.Clone() -env_common.Prepend( - CPPDEFINES = [ -# Common items, like notifier, is not related to any browser. - 'BROWSER_NONE=1', - ] -) - -env_browser = env.Clone() -env_browser.Prepend( +env.Prepend( CPPDEFINES = [ 'BROWSER_${BROWSER}=1', # SpiderMonkey (the Firefox JS engine)'s JS_GET_CLASS macro in jsapi.h needs @@ -191,7 +115,7 @@ env_browser.Prepend( ) if env['BROWSER'] in ['FF2', 'FF3']: - env_browser.Prepend( + env.Prepend( CPPDEFINES = [ # TODO(cprince): Update source files so we don't need this compatibility define? 'BROWSER_FF=1', @@ -208,13 +132,13 @@ if env['BROWSER'] in ['FF2', 'FF3']: ], ) elif env['BROWSER'] == 'NPAPI' and env['OS'] == 'win32': - env_browser.Prepend( + env.Prepend( CPPDEFINES = [ 'BROWSER_CHROME=1', ], ) -env_browser.Append( +env.Append( CPPPATH = [ # '$LIBPNG_DIR', # '$SKIA_DIR/include', @@ -225,7 +149,7 @@ env_browser.Append( # 'base', 'gd', 'googleurl-gears', -# env_browser['ICU_LIBS'], # TODO(sgk): '$ICU_LIBS' when scons is fixed +# env['ICU_LIBS'], # TODO(sgk): '$ICU_LIBS' when scons is fixed 'jpeg-gears', # 'modp_b64', 'png-gears', @@ -237,7 +161,7 @@ env_browser.Append( ) if env['BROWSER'] == 'IE': - env_browser.Append( + env.Append( LIBS = [ 'kernel32.lib', 'user32.lib', @@ -253,7 +177,7 @@ if env['BROWSER'] == 'IE': ], ) elif env['BROWSER'] in ['FF2', 'FF3']: - env_browser.Append( + env.Append( LIBPATH = '$GECKO_LIB', LIBS = [ 'xpcom', @@ -261,7 +185,7 @@ elif env['BROWSER'] in ['FF2', 'FF3']: ], ) if env['OS'] == 'win32': - env_browser.Append( + env.Append( LIBS = [ 'nspr4.lib', 'js3250.lib', @@ -278,9 +202,9 @@ elif env['BROWSER'] in ['FF2', 'FF3']: # Although the 1.9 SDK contains libnspr4, it is better to link against # libxul, which in turn depends on libnspr4. In Ubuntu 8.04, libnspr4 was # not listed in /usr/lib, only libxul was. - env_browser.Append(LIBS = (env['BROWSER'] == 'FF2' and 'nspr4' or 'xul')) + env.Append(LIBS = (env['BROWSER'] == 'FF2' and 'nspr4' or 'xul')) elif env['BROWSER'] == 'NPAPI': - env_browser.Append( + env.Append( LIBS = [ 'delayimp.lib', 'comdlg32.lib', @@ -292,7 +216,7 @@ elif env['BROWSER'] == 'NPAPI': # Building resources. -env_res = env_browser.Clone() +env_res = env.Clone() env_res.Replace( CPPDEFINES = [ '_UNICODE', @@ -300,6 +224,7 @@ env_res.Replace( 'BROWSER_${BROWSER}=1', ], CPPPATH = [ + '$COMMON_GENFILES_DIR/..', '$GENFILES_DIR/..', '$OPEN_DIR', '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include', @@ -315,7 +240,7 @@ if env['OS'] == 'win32': env_res.Append(RCFLAGS = ['/l', '0x409']) if env['OS'] == 'win32': - env_browser.Append( + env.Append( CPPFLAGS = [ '/wd4018' # TODO: move to breakpad ], @@ -327,12 +252,10 @@ def NewInputs(): """Returns a new dictionary of input file lists. Browser-specific inputs are referenced by the browser name. All browsers - include inputs from the 'all' list. 'common' inputs are built using - env_common.""" + include inputs from the 'all' list.""" return { 'all': [], - 'common': [], 'IE': [], 'FF2': [], 'FF3': [], @@ -346,7 +269,6 @@ html_m4srcs = NewInputs() i18n_m4srcs = NewInputs() stabsrcs = NewInputs() idlsrcs = NewInputs() -binsrcs = NewInputs() #----------------------------------------------------------------------------- # third_party/breakpad @@ -405,10 +327,6 @@ srcs['all'] += [ #----------------------------------------------------------------------------- # base/common -m4srcs['common'] = [ - '$OPEN_DIR/base/common/product_constants.h.m4', -] - m4srcs['all'] = [ '$OPEN_DIR/base/common/product_version.rc.m4' ] @@ -474,6 +392,8 @@ srcs['all'] += [ '$OPEN_DIR/base/common/timed_call_test.cc', '$OPEN_DIR/base/common/url_utils.cc', '$OPEN_DIR/base/common/url_utils_test.cc', + '$OPEN_DIR/base/common/user_config.cc', + '$OPEN_DIR/base/common/vista_utils.cc', ] #----------------------------------------------------------------------------- @@ -536,7 +456,6 @@ srcs['IE'] += [ '$OPEN_DIR/base/ie/module_wrapper.cc', '$OPEN_DIR/base/common/paths_ie.cc', '$OPEN_DIR/base/common/time_utils_win32.cc', - '$OPEN_DIR/base/common/vista_utils.cc', ] if env['OS'] == 'win32': @@ -747,15 +666,6 @@ srcs['IE'] += [ ] #----------------------------------------------------------------------------- -# installer - -m4srcs['common'] += [ - '$OPEN_DIR/installer/npapi_msi.wxs.m4', - '$OPEN_DIR/installer/win32_msi.wxs.m4', - '$OPEN_DIR/installer/wince_cab.inf.m4', -] - -#----------------------------------------------------------------------------- # dummy_module srcs['all'] += [ @@ -967,27 +877,6 @@ if not env['OFFICIAL_BUILD']: '$OPEN_DIR/inspector/inspector_resources.cc', ] - binsrcs['common'] += [ - '$OPEN_DIR/inspector/console.html', - '$OPEN_DIR/inspector/database.html', - '$OPEN_DIR/inspector/index.html', - '$OPEN_DIR/inspector/localserver.html', - '$OPEN_DIR/inspector/common/alert-35.png', - '$OPEN_DIR/inspector/common/database.gif', - '$OPEN_DIR/inspector/common/error-35.png', - '$OPEN_DIR/inspector/common/ie6hacks.css', - '$OPEN_DIR/inspector/common/inspector_links.js', - '$OPEN_DIR/inspector/common/lightbulb-35.png', - '$OPEN_DIR/inspector/common/localserver.gif', - '$OPEN_DIR/inspector/common/question-35.png', - '$OPEN_DIR/inspector/common/styles.css', - '$OPEN_DIR/inspector/common/workerpool.gif', - '$OPEN_DIR/sdk/gears_init.js', - '$OPEN_DIR/ui/common/base.js', - '$OPEN_DIR/ui/common/dom.js', - '$OPEN_DIR/ui/common/icon_32x32.png', - ] - #----------------------------------------------------------------------------- # image @@ -1034,6 +923,8 @@ srcs['IE'] += [ # geolocation srcs['all'] += [ + '$OPEN_DIR/geolocation/access_token_manager.cc', + '$OPEN_DIR/geolocation/backoff_manager.cc', '$OPEN_DIR/geolocation/empty_device_data_provider.cc', '$OPEN_DIR/geolocation/geolocation.cc', '$OPEN_DIR/geolocation/geolocation_db.cc', @@ -1045,6 +936,7 @@ srcs['all'] += [ '$OPEN_DIR/geolocation/network_location_provider.cc', '$OPEN_DIR/geolocation/network_location_request.cc', '$OPEN_DIR/geolocation/radio_data_provider_wince.cc', + '$OPEN_DIR/geolocation/reverse_geocoder.cc', '$OPEN_DIR/geolocation/timed_callback.cc', '$OPEN_DIR/geolocation/wifi_data_provider_android.cc', '$OPEN_DIR/geolocation/wifi_data_provider_common.cc', @@ -1122,10 +1014,10 @@ elif env['BROWSER'] == 'IE': # TODO: other targets # - installer # - notifier -# - ipc_tests # Now build the dependency tree. +def PatternRule(t, s): return utils.PatternRule(t, s, env) # Add any hard-coded "FF3_" sources to the FF2_ sources. srcs['FF2'] += srcs['FF3'] @@ -1134,7 +1026,6 @@ html_m4srcs['FF2'] += html_m4srcs['FF3'] i18n_m4srcs['FF2'] += i18n_m4srcs['FF3'] stabsrcs['FF2'] += stabsrcs['FF3'] idlsrcs['FF2'] += idlsrcs['FF3'] -binsrcs['FF2'] += binsrcs['FF3'] # Add the target browser's inputs to the list files to build. srcs['all'] += srcs[env['BROWSER']] @@ -1143,23 +1034,16 @@ html_m4srcs['all'] += html_m4srcs[env['BROWSER']] i18n_m4srcs['all'] += i18n_m4srcs[env['BROWSER']] stabsrcs['all'] += stabsrcs[env['BROWSER']] idlsrcs['all'] += idlsrcs[env['BROWSER']] -binsrcs['all'] += binsrcs[env['BROWSER']] -def PatternRule(target, source, env=env): - """Apply env substitution to a target with $SOURCE included. Returns a list - containing the new target and source to pass to a builder.""" - target_sub = env.subst(target, source=env.File(source)) - return [target_sub, source] +# Include the common targets generated by SConscript.common. +Import('common_targets') # genfiles/%: %.m4 -m4s = [] -m4s = [env_common.M4(*PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src)) - for src in m4srcs['common']] -m4s += [env_browser.M4(*PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src)) +m4s = [env.M4(*PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src)) for src in m4srcs['all']] # genfiles/%.html: %.html_m4 -html_m4s = [env_browser.M4( +html_m4s = [env.M4( *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.html', src)) for src in html_m4srcs['all']] @@ -1172,41 +1056,40 @@ def PathEnd(path, n): return os.sep.join(split_path[-n:]) env['PathEnd'] = PathEnd tmp_pattern = '$GENFILES_DIR/i18n/${PathEnd(str(SOURCE.base), 2)}' -i18n_m4s = [env_browser.M4(*PatternRule(tmp_pattern, src)) +i18n_m4s = [env.M4(*PatternRule(tmp_pattern, src)) for src in i18n_m4srcs['all']] # genfiles/%.js: %.js.stab -stabs = [env_browser.Stab( +stabs = [env.Stab( *PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src)) for src in stabsrcs['all']] # genfiles/%.html: %.js for stab in stabs: - env_browser.Depends(*PatternRule('${SOURCE.base}.html', stab)) - -# genfiles/%.from_bin.cc: % -bins = [env_common.Bin2cpp( - *PatternRule('$GENFILES_DIR/${SOURCE.file}.from_bin.cc', src)) - for src in binsrcs['common']] -srcs['all'] += bins + env.Depends(*PatternRule('${SOURCE.base}.html', stab)) # genfiles/%.tlb: %.idl xptsrcs = [] for src in idlsrcs['all']: - idl = env_browser.TypeLibrary( + idl = env.TypeLibrary( *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.tlb', src)) srcs['all'] += [x for x in idl if str(x).endswith('_i.c')] if env['BROWSER'] in ['FF2', 'FF3']: xptsrcs += [x for x in idl if str(x).endswith('.xpt')] if env['BROWSER'] in ['FF2', 'FF3']: - env_browser.XptLink('gears.xpt', xptsrcs) + env.XptLink('gears.xpt', xptsrcs) + +# Add common sources. +srcs['all'] += common_targets['src'] # TODO: figure out why the .rc scanner doesn't notice these dependencies. if env['OS'] == 'win32': - env_browser.Depends(ui_res, html_m4s) - env_browser.Depends(module_res, m4s) + env.Depends(ui_res, html_m4s) + env.Depends(module_res, m4s) + +Export('m4srcs') -module = env_browser.ChromeSharedLibrary('gears', +module = env.ChromeSharedLibrary('gears', srcs['all'] + libs + dll_resources) env.Alias('gears', module) diff --git a/gears/SConscript.installers b/gears/SConscript.installers index 9d81681..bf73301 100644 --- a/gears/SConscript.installers +++ b/gears/SConscript.installers @@ -17,17 +17,16 @@ env = env.Clone( FF2_MODULE = '${SHLIBPREFIX}gears_ff2${SHLIBSUFFIX}', MODULE = '${SHLIBPREFIX}gears${SHLIBSUFFIX}', - # Qualify our OUTDIRs relative to the SConscript files. This is for use - # with Copy(), which runs from that dir. - BASE_OUTDIR = env.Entry('$GEARS_DIR/$BASE_OUTDIR').path, + # Clean up the '#' in *_OUTDIR. + BASE_OUTDIR = env.Entry('$BASE_OUTDIR').path, ) ff3_resources = [ - '$FF3_OUTDIR/$GENFILES_DIR/browser-overlay.js', - '$FF3_OUTDIR/$GENFILES_DIR/browser-overlay.xul', - '$FF3_OUTDIR/$GENFILES_DIR/permissions_dialog.html', - '$FF3_OUTDIR/$GENFILES_DIR/settings_dialog.html', - '$FF3_OUTDIR/$GENFILES_DIR/shortcuts_dialog.html', + '$FF3_OUTDIR/genfiles/browser-overlay.js', + '$FF3_OUTDIR/genfiles/browser-overlay.xul', + '$FF3_OUTDIR/genfiles/permissions_dialog.html', + '$FF3_OUTDIR/genfiles/settings_dialog.html', + '$FF3_OUTDIR/genfiles/shortcuts_dialog.html', ] common_resources = [ @@ -165,13 +164,14 @@ def FirefoxInstaller(env): # Note: as shorthand, if the target ends with a '/', then the sources will # be placed into that dir. Otherwise, source is renamed into the target. copysrcs = [ - ('/', ['$FF3_OUTDIR/$GENFILES_DIR/install.rdf', - '$FF3_OUTDIR/$GENFILES_DIR/chrome.manifest']), + ('/', ['$FF3_OUTDIR/genfiles/install.rdf', + '$FF3_OUTDIR/genfiles/chrome.manifest']), ('lib/', ['$OPEN_DIR/base/firefox/static_files/lib/updater.js']), ('chrome/chromeFiles/content/', ff3_resources + common_resources), - ('chrome/chromeFiles/locale', ['$FF3_OUTDIR/$GENFILES_DIR/i18n']), + ('chrome/chromeFiles/locale', ['$FF3_OUTDIR/genfiles/i18n']), ('components/', ['$FF3_OUTDIR/gears.xpt', + '$COMMON_OUTDIR/ipc_test${PROGSUFFIX}', '$OPEN_DIR/base/firefox/static_files/components/bootstrap.js']), ('components/$FF2_MODULE', ['$FF2_OUTDIR/$MODULE']), ('components/$MODULE', ['$FF3_OUTDIR/$MODULE']), @@ -215,8 +215,8 @@ env.AddMethod(FirefoxInstaller, 'FirefoxInstaller') def Win32Installer(env): wxiobj = env.Command( - StripOutdir(['$IE_OUTDIR/$GENFILES_DIR/win32_msi.wxiobj']), - StripOutdir(['$IE_OUTDIR/$GENFILES_DIR/win32_msi.wxs']), + StripOutdir(['$COMMON_GENFILES_DIR/win32_msi.wxiobj']), + StripOutdir(['$COMMON_GENFILES_DIR/win32_msi.wxs']), '$CANDLECOM') # light.exe must be run from $OPEN_DIR msi = env.Command('$WIN32_INSTALLER_MSI', wxiobj, diff --git a/gears/site_scons/utils.py b/gears/site_scons/utils.py new file mode 100644 index 0000000..4bd4f93 --- /dev/null +++ b/gears/site_scons/utils.py @@ -0,0 +1,9 @@ +# Copyright (c) 2008 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. + +def PatternRule(target, source, env): + """Apply env substitution to a target with $SOURCE included. Returns a list + containing the new target and source to pass to a builder.""" + target_sub = env.subst(target, source=env.File(source)) + return [target_sub, source] |