diff options
-rw-r--r-- | gears/SConscript | 24 | ||||
-rw-r--r-- | gears/SConscript.browser | 20 | ||||
-rw-r--r-- | gears/SConscript.common | 16 | ||||
-rwxr-xr-x | gears/SConscript.inputs | 9 | ||||
-rw-r--r-- | gears/SConscript.installers | 85 |
5 files changed, 100 insertions, 54 deletions
diff --git a/gears/SConscript b/gears/SConscript index 4bdb0c7..83cfa9c 100644 --- a/gears/SConscript +++ b/gears/SConscript @@ -36,6 +36,7 @@ Import('env') env = env.Clone( OPEN_DIR = "gears", + PRIVATE_DIR = "gears_internal", THIRD_PARTY_DIR = "third_party", PRIVATE_THIRD_PARTY_DIR = "third_party_internal", SYMBIAN_DIR = "symbian_internal", @@ -125,6 +126,9 @@ env.Replace( GENFILES_DIR = "$BROWSER_OUTDIR/genfiles", COMMON_GENFILES_DIR = "$COMMON_OUTDIR/genfiles", + + INSTALLER_BASEDIR = 'installers', + INSTALLER_BASENAME = 'gears-${OS}-${MODE}-${VERSION}', ) # Library flags @@ -675,8 +679,22 @@ elif env['OS'] == 'osx': ('-arch', 'i386'), ('-isysroot', '$OSX_SDK_ROOT'), '-Wl,-dead_strip', + '-bundle', # DLLFLAGS + ], + FRAMEWORKS = [ + 'Carbon', + 'CoreServices', + 'Cocoa', + 'WebKit', ], ) + if not env['OFFICIAL_BUILD']: + # For PortAudio: + env.Append(FRAMEWORKS = [ + 'CoreAudio', + 'AudioToolbox', + 'AudioUnit', + ]) if env['MODE'] == 'dbg': env.Append( CPPFLAGS = [ @@ -721,6 +739,10 @@ sconscripts = [ 'SConscript.portaudio', ] +#if os.path.exists(env.Entry('#/$PRIVATE_DIR/SConscript').abspath): +# env = env.SConscript('#/$PRIVATE_DIR/SConscript', +# exports=['env', 'env_res']) + for each in sconscripts: env.SConscript(each, exports=['env'], @@ -746,6 +768,8 @@ for each in browsers: variant_dir='$BROWSER_OUTDIR', duplicate=0) +# Note: even though the installers write to $INSTALLER_OUTDIR, they need to +# read files from other dirs, so we give them a variant_dir at the toplevel. env.SConscript('SConscript.installers', exports=['env'], variant_dir='$BASE_OUTDIR', diff --git a/gears/SConscript.browser b/gears/SConscript.browser index 090bab7..1fa2400 100644 --- a/gears/SConscript.browser +++ b/gears/SConscript.browser @@ -188,9 +188,6 @@ env.Append( if env['OS'] == 'osx': env.Append( - LINKFLAGS = [ - '-bundle' - ], LIBS = [ 'mozjs-gears', 'curl', @@ -201,20 +198,7 @@ if env['OS'] == 'osx': LIBPATH = [ '$OPEN_DIR/tools/osx' ], - FRAMEWORKS = [ - 'Carbon', - 'CoreServices', - 'Cocoa', - 'WebKit', - ] ) - if not env['OFFICIAL_BUILD']: - # For PortAudio: - env.Append(FRAMEWORKS = [ - 'CoreAudio', - 'AudioToolbox', - 'AudioUnit', - ]) # Add in libraries for in-development APIs for non-official builds. if not env['OFFICIAL_BUILD']: @@ -392,9 +376,7 @@ if env['OS'] == 'win32': # env.SharedObject('$OPEN_DIR/base/safari/resource_archive.cc') # Include the input file list. -env.SConscript('SConscript.inputs', exports=['env', 'env_res']) -Import('env_inputs') -env = env_inputs +env = env.SConscript('SConscript.inputs', exports=['env', 'env_res']) #----------------------------------------------------------------------------- diff --git a/gears/SConscript.common b/gears/SConscript.common index 4c6ad5c..5df142b 100644 --- a/gears/SConscript.common +++ b/gears/SConscript.common @@ -35,10 +35,14 @@ env.Prepend( ] ) +# OS X needs to be 'LINUX' in common sources. +# TODO(nigeltao): Should we instead have a UNIX flag, rather than calling +# Mac OS X a "flavor of Linux"?? +if env['OS'] == 'osx': + env.Append(CPPDEFINES = ['LINUX']) + # Include the input file list. -env.SConscript('SConscript.inputs', exports={'env': env, 'env_res': None}) -Import('env_inputs') -env = env_inputs +env = env.SConscript('SConscript.inputs', exports={'env': env, 'env_res': None}) #----------------------------------------------------------------------------- @@ -80,3 +84,9 @@ elif env['OS'] == 'osx': # FRAMEWORKS = Split('Carbon Cocoa Foundation IOKit SystemConfiguration'), # LIBS='stdc++') env.Alias('gears', crash_sender) + +if env['OS'] == 'osx': + # SF_INSTALLER_PLUGIN_EXE + env.ChromeProgram('stats_pane', + GetInputs('$SF_INSTALLER_PLUGIN_CPPSRCS'), + FRAMEWORKS = env['FRAMEWORKS'] + Split('Cocoa InstallerPlugins')) diff --git a/gears/SConscript.inputs b/gears/SConscript.inputs index ff5ff4b..b63f6da 100755 --- a/gears/SConscript.inputs +++ b/gears/SConscript.inputs @@ -947,6 +947,13 @@ if env_res: ]) #----------------------------------------------------------------------------- +# Safari Installer Plugin + +env.Append(SF_INSTALLER_PLUGIN_CPPSRCS = [ + '$OPEN_DIR/base/safari/advanced_stats_sheet.m', +]) + +#----------------------------------------------------------------------------- # resources if env_res and env['OS'] in ['win32', 'wince']: @@ -1001,4 +1008,4 @@ if env['OS'] == 'win32': '$OPEN_DIR/tools/mscom.def', ]) -Export({'env_inputs': env}) +Return('env') 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): |