summaryrefslogtreecommitdiffstats
path: root/gears/SConscript.installers
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-19 22:38:46 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-19 22:38:46 +0000
commitf3f568b18078fa29f9b84cd66bd2d1029ce408a1 (patch)
tree2c1beb150a62dfce10470a5b2d922336611eb136 /gears/SConscript.installers
parent9eb12d18f96a72d8fa6d04988ea01448af2385a6 (diff)
downloadchromium_src-f3f568b18078fa29f9b84cd66bd2d1029ce408a1.zip
chromium_src-f3f568b18078fa29f9b84cd66bd2d1029ce408a1.tar.gz
chromium_src-f3f568b18078fa29f9b84cd66bd2d1029ce408a1.tar.bz2
Some cleanup work I did while adding more Safari builders. It got to be
extensive so I decided to just check it in. Changes: - Use Return() instead of Export() from SConscript.inputs to pass 'env' back. - Move some of the build vars around to fix builders that aren't in SConscript.browser. - Refactor SConscript.installers so that we now have DirBuilder, a generic builder that creates a directory tree (used to be FF-specific). This will be used for OSX bundles. Review URL: http://codereview.chromium.org/11261 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5722 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gears/SConscript.installers')
-rw-r--r--gears/SConscript.installers85
1 files changed, 54 insertions, 31 deletions
diff --git a/gears/SConscript.installers b/gears/SConscript.installers
index 665c4ec..52d81c6 100644
--- a/gears/SConscript.installers
+++ b/gears/SConscript.installers
@@ -10,11 +10,10 @@ import utils
Import('env')
env = env.Clone(
- INSTALLER_BASEDIR = 'installers',
- INSTALLER_BASENAME = 'gears-${OS}-${MODE}-${VERSION}',
FF_XPI = '$INSTALLER_BASEDIR/${INSTALLER_BASENAME}.xpi',
WIN32_INSTALLER_MSI = '$INSTALLER_BASEDIR/${INSTALLER_BASENAME}.msi',
WINCE_INSTALLER_CAB = '$INSTALLER_BASEDIR/${INSTALLER_BASENAME}.cab',
+ SF_INSTALLER_PLUGIN_BUNDLE = '$INSTALLER_BASEDIR/Safari/StatsPane.bundle',
FF2_MODULE = '${SHLIBPREFIX}gears_ff2${SHLIBSUFFIX}',
MODULE = '${SHLIBPREFIX}gears${SHLIBSUFFIX}',
@@ -139,6 +138,50 @@ def ToUnixPath(path):
"""Converts windows-style \ to unix-style /."""
return re.sub(r'\\', r'/', path)
+def DirBuilder(env, dirtarget, dirsrcs):
+ """Builder that makes a directory tree by copying source files to
+ corresponding locations inside 'dirtarget'. 'dirsrcs' specifies the list of
+ mappings from source file/directory to the target location. It's formatted
+ like:
+ (<target file or dir>, <list of source files>)
+
+ Note: source files that come from an output directory must be explicitly
+ specified relative to the toplevel dir '#'.
+ 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.
+ """
+
+ srcs = []
+ actions = [Delete('${TARGET.base}')]
+ for target, sources in dirsrcs:
+ # Strip output directory from the src, because builders expect srcs to
+ # be relative to the outdir already.
+ srcs += StripOutdir(sources)
+
+ is_dir = target.endswith('/')
+ if is_dir:
+ actions.append(SafeMkdir('${TARGET.base}/' + target))
+ else:
+ actions.append(SafeMkdir('${TARGET.base}/' + os.path.dirname(target)))
+ for source in sources:
+ if is_dir:
+ actions.append(
+ Copy('${TARGET.base}/' + target + os.path.basename(source),
+ source))
+ else:
+ actions.append(Copy('${TARGET.base}/' + target, source))
+
+ # Remove any .svn directories that were copied.
+ actions += ['rm -rf `find ${TARGET.base} -name .svn`']
+
+ # HACK: Workaround for bug in scons where directories aren't checked for
+ # dependency changes. Instead, we make a temp file the target, and ensure
+ # that that file changes everytime we execute these actions.
+ actions += ['date > ${TARGET}']
+ realtarget = env.Command(dirtarget + '.dir', srcs, actions)
+ return [dirtarget, realtarget]
+env.AddMethod(DirBuilder, 'DirBuilder')
+
def FirefoxInstaller(env):
# This step is a little hackish.
# Why: We want to copy files from both the build and source dirs. We have
@@ -149,10 +192,7 @@ def FirefoxInstaller(env):
# However, this won't work as an input to a builder, so we strip that off
# when passing to Command(). The Copy action, however, receives the full
# qualified path, since it knows nothing about variant build dirs.
- #
- # 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 = [
+ dirsrcs = [
('/', ['$FF3_OUTDIR/genfiles/install.rdf',
'$FF3_OUTDIR/genfiles/chrome.manifest']),
('lib/', ['$OPEN_DIR/base/firefox/static_files/lib/updater.js']),
@@ -167,48 +207,31 @@ def FirefoxInstaller(env):
]
if env['USING_CCTESTS']:
- copysrcs += [
+ dirsrcs += [
('components/', ['$COMMON_OUTDIR/ipc_test${PROGSUFFIX}']),
]
if env['OS'] != 'win32':
# TODO(playmobil): Inspector should be located in extensions dir on win32.
- copysrcs += [
+ dirsrcs += [
('resources/inspector', ['$OPEN_DIR/inspector']),
('resources/inspector/common/', ['$OPEN_DIR/sdk/gears_init.js',
'$OPEN_DIR/sdk/samples/sample.js']),
]
if env['MODE'] == 'dbg' and env['OS'] in ['win32', 'wince']:
- copysrcs += [
+ dirsrcs += [
('components/gears_ff2.pdb', ['$FF2_OUTDIR/gears.pdb']),
('components/gears.pdb', ['$FF3_OUTDIR/gears.pdb']),
]
# TODO: notifier, os x
- srcs = []
- actions = [Delete('${TARGET.base}')]
- for target, sources in copysrcs:
- srcs += StripOutdir(sources)
-
- is_dir = target.endswith('/')
- if is_dir:
- actions.append(SafeMkdir('${TARGET.base}/' + target))
- else:
- actions.append(SafeMkdir('${TARGET.base}/' + os.path.dirname(target)))
- for source in sources:
- if is_dir:
- actions.append(
- Copy('${TARGET.base}/' + target + os.path.basename(source),
- source))
- else:
- actions.append(Copy('${TARGET.base}/' + target, source))
-
- actions += [
+ dir = env.DirBuilder('$INSTALLER_BASEDIR/${INSTALLER_BASENAME}', dirsrcs)
+ actions = [
# Mark files writeable to allow .xpi rebuilds
- 'chmod -R 777 ${TARGET.base}',
- '(cd ${TARGET.base} && zip -r ../${TARGET.file} .)'
+ 'chmod -R 777 $SOURCE',
+ '(cd $SOURCE && zip -r ../${TARGET.file} .)'
]
- return env.Command('$FF_XPI', srcs, actions)
+ return env.Command('$FF_XPI', dir, actions)
env.AddMethod(FirefoxInstaller, 'FirefoxInstaller')
def Win32Installer(env):