| OLD | NEW | 
 | (Empty) | 
|    1 # Copyright (c) 2008 The Chromium Authors. All rights reserved. |  | 
|    2 # Use of this source code is governed by a BSD-style license that can be |  | 
|    3 # found in the LICENSE file. |  | 
|    4  |  | 
|    5 # Notes: |  | 
|    6 # This is the main Gears SConscript file.  From here, we include sub-scripts |  | 
|    7 # that handle building various targets (third party libs, common exes, the |  | 
|    8 # browser plugins themselves, and installers).  Some sub-scripts return a |  | 
|    9 # dictionary of variables to be appended to the environment, so other |  | 
|   10 # sub-scripts can use them. |  | 
|   11 # |  | 
|   12 # To check out the Gears sources, you need to make sure this directory is in |  | 
|   13 # your .gclient file, so its DEPS get processed.  Example: |  | 
|   14 #   { "name"        : "src/gears", |  | 
|   15 #     "url"         : "svn://chrome-svn/chrome/trunk/src/gears", |  | 
|   16 #   }, |  | 
|   17 # |  | 
|   18 # This is a work-in-progress conversion of the current Gears set of Makefiles. |  | 
|   19 # A lot of the stuff doesn't translate to SCons-land well, and I'm not sure |  | 
|   20 # how faithful we want to be to the original. |  | 
|   21 # |  | 
|   22 # Questions: |  | 
|   23 # Should we flatten the output directory into |  | 
|   24 # Hammer/gears/platform/browser/*.obj like Gears does now?  If so, how? |  | 
|   25  |  | 
|   26 # Notes to self: |  | 
|   27 # - os.path.abspath('.') (the CWD) is variant_dir if it exists, else it's the |  | 
|   28 # toplevel_dir (which contains the SConstruct). |  | 
|   29 # - env.Entry('.') is the entry representing the variant_dir. |  | 
|   30 # - env.Entry('#') is the entry representing the toplevel_dir. |  | 
|   31 # - str(entry) gives the path relative to variant_dir, or abspath if the entry |  | 
|   32 # is outside the variant_dir. |  | 
|   33 # - entry.path gives the path relative to toplevel_dir. |  | 
|   34 # - entry.abspath gives the absolute path. |  | 
|   35  |  | 
|   36 import os |  | 
|   37  |  | 
|   38 Import('env') |  | 
|   39  |  | 
|   40 env = env.Clone( |  | 
|   41     OPEN_DIR = "gears", |  | 
|   42     PRIVATE_DIR = "gears_internal", |  | 
|   43     THIRD_PARTY_DIR = "third_party", |  | 
|   44     PRIVATE_THIRD_PARTY_DIR = "third_party_internal", |  | 
|   45 ) |  | 
|   46  |  | 
|   47 if not os.path.exists(env.Dir('#/$OPEN_DIR').abspath): |  | 
|   48   print 'Skipping Gears build: no perforce tree checked out.' |  | 
|   49   Return() |  | 
|   50  |  | 
|   51 # Argument switches |  | 
|   52  |  | 
|   53 # TODO: how do we detect linux vs osx? |  | 
|   54 os_guess = env['PLATFORM'] |  | 
|   55 if os_guess == 'posix': |  | 
|   56   os_guess = 'linux' |  | 
|   57 elif os_guess == 'darwin': |  | 
|   58   os_guess = 'osx' |  | 
|   59  |  | 
|   60 # Map of OS -> valid browser targets for that OS. |  | 
|   61 os_browsers_map = { |  | 
|   62     'win32': ['IE', 'FF2', 'FF3', 'NPAPI'], |  | 
|   63     'wince': ['IE'], |  | 
|   64     'linux': ['FF2', 'FF3'], |  | 
|   65     'osx': ['SF', 'FF2', 'FF3'], |  | 
|   66     'android': ['NPAPI'], |  | 
|   67     'symbian': ['NPAPI'], |  | 
|   68 } |  | 
|   69  |  | 
|   70 vars = Variables(None, ARGUMENTS) |  | 
|   71 vars.AddVariables( |  | 
|   72     EnumVariable('OS', |  | 
|   73         'Which OS is the target', os_guess, os_browsers_map.keys()), |  | 
|   74     EnumVariable('MODE', |  | 
|   75         'Type of binary to generate', 'dbg', ['dbg', 'opt']), |  | 
|   76     BoolVariable('OFFICIAL_BUILD', |  | 
|   77         'Create a binary suitable for public release', 0), |  | 
|   78     BoolVariable('GEARS_STATIC_LIB', |  | 
|   79         'Create a static library for linking with Chrome', 0), |  | 
|   80 ) |  | 
|   81 vars.Update(env) |  | 
|   82  |  | 
|   83 env['VALID_BROWSERS'] = os_browsers_map[env['OS']] |  | 
|   84  |  | 
|   85 # Add BROWSER last, since its valid inputs depend on $OS. |  | 
|   86 vars.Add( |  | 
|   87     EnumVariable('BROWSER', |  | 
|   88         'Which browser we want to build the plugin for.  "all" builds all ' |  | 
|   89         'browsers for this OS.', |  | 
|   90         'all', env['VALID_BROWSERS'] + ['all'])) |  | 
|   91 vars.Update(env) |  | 
|   92  |  | 
|   93 env.Replace( |  | 
|   94     USING_CCTESTS = (env['MODE'] == 'dbg' or not env['OFFICIAL_BUILD']) |  | 
|   95 ) |  | 
|   96  |  | 
|   97 # Version |  | 
|   98 env.Replace( |  | 
|   99     MAJOR = '0', |  | 
|  100     MINOR = '5', |  | 
|  101     BUILD = '7', |  | 
|  102     PATCH = '0', |  | 
|  103     VERSION = '${MAJOR}.${MINOR}.${BUILD}.${PATCH}', |  | 
|  104  |  | 
|  105     FRIENDLY_NAME = 'Google Gears', |  | 
|  106     SHORT_NAME = 'gears', |  | 
|  107 ) |  | 
|  108  |  | 
|  109 # Platform |  | 
|  110 # TODO: Symbian builds will override this value. |  | 
|  111 # For other platforms we set just one value. |  | 
|  112 if env['OS'] in ['wince', 'android']: |  | 
|  113   env.Replace(ARCH = 'arm') |  | 
|  114 elif env['OS'] == 'osx': |  | 
|  115   # On OSX we build a fat binary. |  | 
|  116   env.Replace(ARCH = 'i386+ppc') |  | 
|  117 else: |  | 
|  118   env.Replace(ARCH = 'i386') |  | 
|  119  |  | 
|  120 # Output dirs |  | 
|  121 env.Replace( |  | 
|  122     BASE_OUTDIR = '$GEARS_DIR/$OS-$ARCH-$MODE', |  | 
|  123     COMMON_OUTDIR = '$BASE_OUTDIR/common', |  | 
|  124     BROWSER_OUTDIR = '$BASE_OUTDIR/${BROWSER.lower()}', |  | 
|  125     IE_OUTDIR = '$BASE_OUTDIR/ie', |  | 
|  126     FF2_OUTDIR = '$BASE_OUTDIR/ff2', |  | 
|  127     FF3_OUTDIR = '$BASE_OUTDIR/ff3', |  | 
|  128     NPAPI_OUTDIR = '$BASE_OUTDIR/npapi', |  | 
|  129     SF_OUTDIR = '$BASE_OUTDIR/sf', |  | 
|  130  |  | 
|  131     GENFILES_DIR = "$BROWSER_OUTDIR/genfiles", |  | 
|  132     COMMON_GENFILES_DIR = "$COMMON_OUTDIR/genfiles", |  | 
|  133  |  | 
|  134     INSTALLER_OUTDIR = '$BASE_OUTDIR/installers', |  | 
|  135 ) |  | 
|  136  |  | 
|  137 # Outputs |  | 
|  138 env.Replace( |  | 
|  139     INSTALLER_BASENAME = 'gears-${OS}-${MODE}-${VERSION}', |  | 
|  140  |  | 
|  141     FF_XPI = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.xpi', |  | 
|  142     WIN32_INSTALLER_MSI = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.msi', |  | 
|  143     WINCE_INSTALLER_CAB = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.cab', |  | 
|  144     # Keyston SF Metapackage installer, bundled with Keystone as part of a |  | 
|  145     # DMG. |  | 
|  146     SF_KEYSTONE_INSTALLER_DMG = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.dmg', |  | 
|  147     SF_KEYSTONE_INSTALLER_MPKG = '$INSTALLER_OUTDIR/Safari/${FRIENDLY_NAME}.mpkg
     ', |  | 
|  148  |  | 
|  149     SF_INSTALLER_PLUGIN_BUNDLE = '$INSTALLER_OUTDIR/Safari/StatsPane.bundle', |  | 
|  150     SF_PLUGIN_BUNDLE = '$INSTALLER_OUTDIR/Safari/Gears.bundle', |  | 
|  151     SF_PLUGIN_PROXY_BUNDLE = '$INSTALLER_OUTDIR/Safari/Gears.plugin', |  | 
|  152     SF_INPUTMANAGER_BUNDLE = '$INSTALLER_OUTDIR/Safari/GearsEnabler', |  | 
|  153     SF_INSTALLER_PKG = '$INSTALLER_OUTDIR/Safari/Gears.pkg', |  | 
|  154 ) |  | 
|  155  |  | 
|  156 # Library flags |  | 
|  157 env.Replace( |  | 
|  158     MOZJS_INCLUDE_PATHS = [ |  | 
|  159         '$MOZJS_DIR', |  | 
|  160         '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include', |  | 
|  161         '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include/private', |  | 
|  162         '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include/obsolete', |  | 
|  163         '$OSX_SDK_ROOT/Developer/Headers/FlatCarbon/', |  | 
|  164     ], |  | 
|  165     MOZJS_DIR = '$THIRD_PARTY_DIR/spidermonkey', |  | 
|  166 ) |  | 
|  167  |  | 
|  168 # Add our tools to the PATH. |  | 
|  169 if env['OS'] in ['win32', 'wince']: |  | 
|  170   if os.path.exists(env.Dir('#/$PRIVATE_THIRD_PARTY_DIR').abspath): |  | 
|  171     # Clear out our environment so we don't accidentally use the system's |  | 
|  172     # libs. |  | 
|  173     env['ENV']['PATH'] = '' |  | 
|  174     env['ENV']['LIB'] = '' |  | 
|  175     env['ENV']['INCLUDE'] = '' |  | 
|  176  |  | 
|  177     paths = [] |  | 
|  178  |  | 
|  179     # Keep system32 for 'xcopy'. |  | 
|  180     paths += [env.subst('${ENV["SYSTEMROOT"]}/system32')] |  | 
|  181     if env['OS'] == 'win32': |  | 
|  182       env.Append( |  | 
|  183           VC80 = env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/vc_80/files').abspath) |  | 
|  184       paths += [ |  | 
|  185           env.subst('$VC80/common7/ide'), |  | 
|  186           env.subst('$VC80/vc/bin'), |  | 
|  187           env.subst('$VC80/common7/tools'), |  | 
|  188           env.subst('$VC80/common7/tools/bin'), |  | 
|  189           env.subst('$VC80/team_tools/performance_tools'), |  | 
|  190       ] |  | 
|  191     else:  # wince |  | 
|  192       env.Append( |  | 
|  193           VC80 = env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/vc_80ce/files').abspath) |  | 
|  194       paths += [ |  | 
|  195           env.subst('$VC80/bin/x86_arm'), |  | 
|  196           env.subst('$VC80/common7/ide'), |  | 
|  197           env.subst('$VC80/common7/tools'), |  | 
|  198           env.subst('$VC80/common7/tools/bin'), |  | 
|  199           env.subst('$VC80/vc/bin'), |  | 
|  200           env.subst('$VC80/smartdevices/sdktools'), |  | 
|  201       ] |  | 
|  202  |  | 
|  203     paths += [ |  | 
|  204         env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/wix/v3_0_2925/files').abspath] |  | 
|  205  |  | 
|  206     paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/gnu/files').abspath] |  | 
|  207     paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/python_24').abspath] |  | 
|  208  |  | 
|  209     # Prepend them so our tools come first. |  | 
|  210     for each in reversed(paths): |  | 
|  211       env.PrependENVPath('PATH', each) |  | 
|  212   else: |  | 
|  213     # If we don't have a private third_party dir, we expect the system |  | 
|  214     # environment to be set up correctly to point to tool paths. |  | 
|  215     env['ENV']['PATH'] = os.environ['PATH'] |  | 
|  216     env['ENV']['LIB'] = os.environ['LIB'] |  | 
|  217     env['ENV']['INCLUDE'] = os.environ['INCLUDE'] |  | 
|  218  |  | 
|  219   mtcom = 'echo Manifest creation disabled, since it breaks a lot.' |  | 
|  220   env['MANIFEST_COM'] = mtcom |  | 
|  221   env['SHMANIFEST_COM'] = mtcom |  | 
|  222  |  | 
|  223 # Building M4 files |  | 
|  224 env.Tool('m4') |  | 
|  225  |  | 
|  226 env.Append( |  | 
|  227     M4ARCH = (env['ARCH'] == 'i386' and 'x86' or '$ARCH'), |  | 
|  228     M4FLAGS = [ |  | 
|  229         '--prefix-builtins', |  | 
|  230         '-DPRODUCT_VERSION=$VERSION', |  | 
|  231         '-DPRODUCT_VERSION_MAJOR=$MAJOR', |  | 
|  232         '-DPRODUCT_VERSION_MINOR=$MINOR', |  | 
|  233         '-DPRODUCT_VERSION_BUILD=$BUILD', |  | 
|  234         '-DPRODUCT_VERSION_PATCH=$PATCH', |  | 
|  235         '-DPRODUCT_OS=$OS', |  | 
|  236         '-DPRODUCT_ARCH="$M4ARCH"', |  | 
|  237         '-DPRODUCT_GCC_VERSION="gcc3"', |  | 
|  238         '-DPRODUCT_MAINTAINER="google"', |  | 
|  239         '-DPRODUCT_FRIENDLY_NAME_UQ="$FRIENDLY_NAME"', |  | 
|  240         '-DPRODUCT_SHORT_NAME_UQ="$SHORT_NAME"', |  | 
|  241         '-DI18N_LANGUAGES="(${",".join(I18N_LANGS)})"', |  | 
|  242     ], |  | 
|  243     M4PATH = [ |  | 
|  244         '$OPEN_DIR', |  | 
|  245         '.', |  | 
|  246     ], |  | 
|  247 ) |  | 
|  248  |  | 
|  249 # SCons magic to make M4PATH work. |  | 
|  250 env.Replace( |  | 
|  251     M4INCPREFIX = '-I', |  | 
|  252     M4INCSUFFIX = '', |  | 
|  253     _M4INCFLAGS = ('${_concat(M4INCPREFIX, M4PATH, M4INCSUFFIX, ' |  | 
|  254                  '__env__, RDirs, TARGET, SOURCE)}'), |  | 
|  255     M4COM = '$M4 $M4FLAGS ${_M4INCFLAGS} $SOURCE > $TARGET', |  | 
|  256 ) |  | 
|  257  |  | 
|  258 # TODO: Dependency scanner for m4 files - doesn't work.  It can't detect files |  | 
|  259 # that don't exist! |  | 
|  260 #m4_include_re = re.compile(r'm4_include\((.*)\)', re.M) |  | 
|  261 #def m4_scan(node, env, path): |  | 
|  262 #  contents = node.get_contents() |  | 
|  263 #  includes = m4_include_re.findall(contents) |  | 
|  264 #  ret_includes = [] |  | 
|  265 #  for include in includes: |  | 
|  266 #    for dir in path: |  | 
|  267 #      file = os.path.join(dir, include) |  | 
|  268 #      if os.path.exists(file): |  | 
|  269 #        ret_includes.append(file) |  | 
|  270 #        break |  | 
|  271 #  return ret_includes |  | 
|  272 # |  | 
|  273 #m4_scanner = Scanner(function = m4_scan, skeys = ['.m4', '.html_m4']) |  | 
|  274 #env.Append(SCANNERS = m4_scanner) |  | 
|  275  |  | 
|  276  |  | 
|  277 # OS X Iceberg package builder |  | 
|  278  |  | 
|  279 env.Replace(ICEBERG = '/usr/local/bin/freeze') |  | 
|  280 if env.WhereIs('$ICEBERG'): |  | 
|  281   env.Replace(ICEBERGCOM = '"$ICEBERG" -v $SOURCE') |  | 
|  282 else: |  | 
|  283   env.Replace(ICEBERGCOM = |  | 
|  284       'echo To create a Safari installer for Gears, you must install Iceberg' |  | 
|  285       ' from http://s.sudre.free.fr/Software/Iceberg.html.  You can install' |  | 
|  286       ' the Safari version manually by running the' |  | 
|  287       ' $OPEN_DIR/tools/osx/install_gears.sh script.') |  | 
|  288  |  | 
|  289 iceberg_builder = Builder(action = '$ICEBERGCOM', |  | 
|  290     suffix = '.pkg', src_suffix = '.packproj') |  | 
|  291 env.Append(BUILDERS = {'Iceberg': iceberg_builder}) |  | 
|  292  |  | 
|  293  |  | 
|  294 # C++ build flags. |  | 
|  295  |  | 
|  296 # Clear out the inherited defines from Chrome's build.  I want to match Gears' |  | 
|  297 # current build as closely as possible until we switch everyone to SCons, then |  | 
|  298 # gradually integrate. |  | 
|  299 env.Replace( |  | 
|  300     CPPPATH = [ |  | 
|  301         '$OPEN_DIR', |  | 
|  302         '$OPEN_DIR/..', |  | 
|  303         '$THIRD_PARTY_DIR', |  | 
|  304         '$THIRD_PARTY_DIR/googleurl', |  | 
|  305         '$THIRD_PARTY_DIR/npapi', |  | 
|  306         '$THIRD_PARTY_DIR/zlib', |  | 
|  307         '$THIRD_PARTY_DIR/v8/bindings_local', |  | 
|  308         '.', |  | 
|  309         '$COMMON_OUTDIR', |  | 
|  310     ], |  | 
|  311     CFLAGS = [], |  | 
|  312     CCFLAGS = [], |  | 
|  313     CXXFLAGS = [], |  | 
|  314     CCPDBFLAGS = [], |  | 
|  315     CPPDEFINES = [ |  | 
|  316     # SpiderMonkey (the Firefox JS engine)'s JS_GET_CLASS macro in jsapi.h needs |  | 
|  317     # this defined to work with the gecko SDK that we've built. |  | 
|  318     # The definition of JS_THREADSAFE must be kept in sync with MOZJS_CPPFLAGS. |  | 
|  319         'JS_THREADSAFE' |  | 
|  320     ], |  | 
|  321     FRAMEWORKPATH = [], |  | 
|  322     FRAMEWORKS = [], |  | 
|  323     LIBS = [], |  | 
|  324     LIBPATH = ['$COMPONENT_LIBRARY_DIR'], |  | 
|  325     COMMON_LINKFLAGS = [],  # for both executables and shared libs |  | 
|  326     LINKFLAGS = ['$COMMON_LINKFLAGS'],  # for executables |  | 
|  327     SHLINKFLAGS = ['$COMMON_LINKFLAGS'],  # for shared libs |  | 
|  328     COMPONENT_LIBRARY_DIR = '$COMMON_OUTDIR/lib', |  | 
|  329 ) |  | 
|  330  |  | 
|  331 if env['MODE'] == 'dbg': |  | 
|  332   env.Append( |  | 
|  333       CPPDEFINES = [ |  | 
|  334           'DEBUG=1', |  | 
|  335           '_DEBUG=1', |  | 
|  336       ], |  | 
|  337       M4FLAGS = '-DDEBUG=1', |  | 
|  338   ) |  | 
|  339 else: |  | 
|  340   env.Append( |  | 
|  341       CPPDEFINES = 'NDEBUG=1', |  | 
|  342       M4FLAGS = '-DNDEBUG=1', |  | 
|  343   ) |  | 
|  344 if env['USING_CCTESTS']: |  | 
|  345   env.Append( |  | 
|  346       CPPDEFINES = 'USING_CCTESTS=1', |  | 
|  347       M4FLAGS = '-DUSING_CCTESTS=1', |  | 
|  348   ) |  | 
|  349 if env['OFFICIAL_BUILD']: |  | 
|  350   env.Append( |  | 
|  351       CPPDEFINES = 'OFFICIAL_BUILD=1', |  | 
|  352       M4FLAGS = '-DOFFICIAL_BUILD=1', |  | 
|  353   ) |  | 
|  354 if env['GEARS_STATIC_LIB']: |  | 
|  355   env.Append( |  | 
|  356       CPPDEFINES = 'GEARS_STATIC_LIB=1', |  | 
|  357   ) |  | 
|  358  |  | 
|  359 # TODO: if USING_LIBPNG |  | 
|  360 env.Append( |  | 
|  361     CPPDEFINES = [ |  | 
|  362         'PNG_USER_CONFIG', |  | 
|  363         'CHROME_PNG_WRITE_SUPPORT', |  | 
|  364     ] |  | 
|  365 ) |  | 
|  366 if not env['GEARS_STATIC_LIB']: |  | 
|  367   # If we're not linking with Chrome, don't prefix all the symbols with |  | 
|  368   # webkit_. |  | 
|  369   env.Append(CPPDEFINES = ['GEARS_PNG_BUILD']) |  | 
|  370  |  | 
|  371  |  | 
|  372 # TODO: if USING_ZLIB |  | 
|  373 env.Append( |  | 
|  374     CPPDEFINES = [ |  | 
|  375         'NO_GZIP', |  | 
|  376         'NO_GZCOMPRESS', |  | 
|  377     ] |  | 
|  378 ) |  | 
|  379 if env['OS'] == 'wince': |  | 
|  380   env.Append(CPPDEFINES = 'NO_ERRNO_H') |  | 
|  381  |  | 
|  382 # Languages |  | 
|  383  |  | 
|  384 env['I18N_LANGS'] = [ |  | 
|  385     'en-US', |  | 
|  386     'ar', |  | 
|  387     'bg', |  | 
|  388     'ca', |  | 
|  389     'cs', |  | 
|  390     'da', |  | 
|  391     'de', |  | 
|  392     'el', |  | 
|  393     'en-GB', |  | 
|  394     'es', |  | 
|  395     'et', |  | 
|  396     'fa', |  | 
|  397     'fi', |  | 
|  398     'fil', |  | 
|  399     'fr', |  | 
|  400     'he', |  | 
|  401     'hi', |  | 
|  402     'hr', |  | 
|  403     'hu', |  | 
|  404     'id', |  | 
|  405     'is', |  | 
|  406     'it', |  | 
|  407     'ja', |  | 
|  408     'ko', |  | 
|  409     'lt', |  | 
|  410     'lv', |  | 
|  411     'ms', |  | 
|  412     'nl', |  | 
|  413     'no', |  | 
|  414     'pl', |  | 
|  415     'pt-BR', |  | 
|  416     'pt-PT', |  | 
|  417     'ro', |  | 
|  418     'ru', |  | 
|  419     'sk', |  | 
|  420     'sl', |  | 
|  421     'sr', |  | 
|  422     'sv', |  | 
|  423     'th', |  | 
|  424     'tr', |  | 
|  425     'uk', |  | 
|  426     'ur', |  | 
|  427     'vi', |  | 
|  428     'zh-CN', |  | 
|  429     'zh-TW', |  | 
|  430     'ml', |  | 
|  431     'te', |  | 
|  432     'gu', |  | 
|  433     'kn', |  | 
|  434     'or', |  | 
|  435     'bn', |  | 
|  436     'ta', |  | 
|  437     'mr', |  | 
|  438 ] |  | 
|  439  |  | 
|  440 # Platform-specific flags follow. |  | 
|  441  |  | 
|  442 if env['OS'] in ['win32', 'wince']: |  | 
|  443   env.Replace(ARFLAGS = []) |  | 
|  444   env.Append( |  | 
|  445       CPPDEFINES = [ |  | 
|  446           'STRICT', |  | 
|  447           '_UNICODE', |  | 
|  448           'UNICODE', |  | 
|  449           '_USRDLL', |  | 
|  450           'WIN32', |  | 
|  451           '_WINDLL', |  | 
|  452           '_CRT_SECURE_NO_DEPRECATE', |  | 
|  453           'NOMINMAX', |  | 
|  454  |  | 
|  455 # In VC8, the way to disable exceptions is to remove all /EH* flags, and to |  | 
|  456 # define _HAS_EXCEPTIONS=0 (for C++ headers) and _ATL_NO_EXCEPTIONS (for ATL). |  | 
|  457           '_HAS_EXCEPTIONS=0', |  | 
|  458           '_ATL_NO_EXCEPTIONS', |  | 
|  459 # Do not export UTF functions. |  | 
|  460           'U_STATIC_IMPLEMENTATION', |  | 
|  461       ], |  | 
|  462 # Static lib flags. |  | 
|  463       ARFLAGS = [ |  | 
|  464           '/NOLOGO', |  | 
|  465       ], |  | 
|  466 # Shared lib and exe flags. |  | 
|  467       COMMON_LINKFLAGS = [ |  | 
|  468           '/NOLOGO', |  | 
|  469           '/DEBUG', |  | 
|  470           '/RELEASE', |  | 
|  471           '/PDB:${TARGET.base}.pdb', |  | 
|  472       ], |  | 
|  473       SHLINKFLAGS = [ |  | 
|  474           '/DLL', |  | 
|  475 # Set the preferred base address.  This value was chosen because (a) it's near |  | 
|  476 # the top of the valid address range, and (b) it doesn't conflict with other |  | 
|  477 # DLLs loaded by Chrome in either the browser or plugin process. |  | 
|  478           '/BASE:0x65000000', |  | 
|  479       ], |  | 
|  480       CPPFLAGS = [ |  | 
|  481           '/nologo', |  | 
|  482           '/c', |  | 
|  483           '/W3', |  | 
|  484           '/WX', |  | 
|  485           '/GR-', |  | 
|  486           '/Fd"${TARGET.base}.pdb"', |  | 
|  487       ], |  | 
|  488       CXXFLAGS = [ |  | 
|  489           '/TP', |  | 
|  490           '/J', |  | 
|  491       ], |  | 
|  492       CPPPATH = [ |  | 
|  493           '$VC80_CPPPATH', |  | 
|  494           '$THIRD_PARTY_DIR/breakpad/src', |  | 
|  495       ], |  | 
|  496       CCPDBFLAGS = [ |  | 
|  497           '/Zi',  # TODO: Chrome defines /Z7, no idea what these are. |  | 
|  498       ], |  | 
|  499       LIBPATH = [ |  | 
|  500           '$VC80_LIBPATH', |  | 
|  501       ], |  | 
|  502   ) |  | 
|  503   if env['OS'] == 'win32': |  | 
|  504     env.Append( |  | 
|  505         CPPDEFINES = [ |  | 
|  506 # We require APPVER=5.0 for things like HWND_MESSAGE. |  | 
|  507 # When APPVER=5.0, win32.mak in the Platform SDK sets: |  | 
|  508 #   C defines:  WINVER=0x0500 |  | 
|  509 #               _WIN32_WINNT=0x0500 |  | 
|  510 #               _WIN32_IE=0x0500 |  | 
|  511 #               _RICHEDIT_VER=0x0010 |  | 
|  512 #   RC defines: WINVER=0x0500 |  | 
|  513 #   MIDL flags: /target NT50 |  | 
|  514 # Note: _WIN32_WINDOWS was replaced by _WIN32_WINNT for post-Win95 builds. |  | 
|  515 # Note: XP_WIN is only used by Firefox headers |  | 
|  516             '_WINDOWS', |  | 
|  517             'WINVER=0x0500', |  | 
|  518             '_WIN32_WINNT=0x0500', |  | 
|  519             '_WIN32_IE=0x0500', |  | 
|  520             '_RICHEDIT_VER=0x0010', |  | 
|  521             '_MERGE_PROXYSTUB', |  | 
|  522             'BREAKPAD_AVOID_STREAMS', |  | 
|  523             'XP_WIN', |  | 
|  524         ], |  | 
|  525         ARFLAGS = [ |  | 
|  526             '/MACHINE:X86', |  | 
|  527         ], |  | 
|  528         COMMON_LINKFLAGS = [ |  | 
|  529             '/MACHINE:X86', |  | 
|  530             '/NODEFAULTLIB:msvcrt', |  | 
|  531 # Flags for security hardening (only available for win32, not wince). |  | 
|  532             '/DYNAMICBASE', |  | 
|  533             '/SAFESEH', |  | 
|  534         ], |  | 
|  535         SHLINKFLAGS = [ |  | 
|  536 # We only use /SUBSYSTEM on DLLs. For EXEs we omit the flag, and |  | 
|  537 # the presence of main() or WinMain() determines the subsystem. |  | 
|  538             '/SUBSYSTEM:WINDOWS', |  | 
|  539         ], |  | 
|  540         VC80_CPPPATH = [ |  | 
|  541 # TODO: switch over to Chrome's SDK. |  | 
|  542 # Note: these must come after $THIRD_PARTY_DIR/npapi because we want our own |  | 
|  543 # npapi.h to take precedence. |  | 
|  544             '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include', |  | 
|  545             '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/include', |  | 
|  546             '$PRIVATE_THIRD_PARTY_DIR/vc_80/files/vc/include', |  | 
|  547         ], |  | 
|  548         VC80_LIBPATH = [ |  | 
|  549             '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/lib', |  | 
|  550             '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/lib', |  | 
|  551             '$PRIVATE_THIRD_PARTY_DIR/vc_80/files/vc/lib', |  | 
|  552         ], |  | 
|  553     ) |  | 
|  554   else:  # OS=wince |  | 
|  555     env.Append( |  | 
|  556         CPPDEFINES = [ |  | 
|  557 # For Windows Mobile we need: |  | 
|  558 #   C defines:  _WIN32_WCE=0x0501 |  | 
|  559 #               _UNDER_CE=0x0501 |  | 
|  560             '_WIN32_WCE=0x501', |  | 
|  561             'WINVER=_WIN32_WCE', |  | 
|  562             'UNDER_CE=0x501', |  | 
|  563             'OS_WINCE', |  | 
|  564             'WIN32_PLATFORM_PSPC', |  | 
|  565             'ARM', |  | 
|  566             '_ARM_', |  | 
|  567             'POCKETPC2003_UI_MODEL', |  | 
|  568             '_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA', |  | 
|  569             '_CE_CRT_ALLOW_WIN_MINMAX', |  | 
|  570         ], |  | 
|  571         ARFLAGS = [ |  | 
|  572             '/MACHINE:THUMB', |  | 
|  573         ], |  | 
|  574         COMMON_LINKFLAGS = [ |  | 
|  575             '/MACHINE:THUMB', |  | 
|  576             '/NODEFAULTLIB:secchk.lib', |  | 
|  577             '/NODEFAULTLIB:oldnames.lib', |  | 
|  578         ], |  | 
|  579         SHLINKFLAGS = [ |  | 
|  580             '/SUBSYSTEM:WINDOWSCE,5.01', |  | 
|  581         ], |  | 
|  582         VC80_CPPPATH = [ |  | 
|  583             '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80ce/files/include', |  | 
|  584             '$PRIVATE_THIRD_PARTY_DIR/vc_80ce/files/include', |  | 
|  585 # Visual Studio must be setup before the PocketPC SDK. |  | 
|  586             '$PRIVATE_THIRD_PARTY_DIR/pocketpc_sdk_ce_50/files/include/armv4i', |  | 
|  587         ], |  | 
|  588         VC80_LIBPATH = [ |  | 
|  589             '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80ce/files/lib/armv4i', |  | 
|  590             '$PRIVATE_THIRD_PARTY_DIR/vc_80ce/files/lib/armv4i', |  | 
|  591             '$PRIVATE_THIRD_PARTY_DIR/pocketpc_sdk_ce_50/files/lib/armv4i', |  | 
|  592         ], |  | 
|  593     ) |  | 
|  594  |  | 
|  595   if env['MODE'] == 'dbg': |  | 
|  596     env.Append( |  | 
|  597         CPPFLAGS = [ |  | 
|  598           '/MTd', |  | 
|  599         ], |  | 
|  600     ) |  | 
|  601   else:  # MODE=opt |  | 
|  602     env.Append( |  | 
|  603         CPPFLAGS = [ |  | 
|  604           '/MT', |  | 
|  605           '/O2', |  | 
|  606         ], |  | 
|  607         COMMON_LINKFLAGS = [ |  | 
|  608           '/INCREMENTAL:NO', |  | 
|  609           '/OPT:REF', |  | 
|  610           '/OPT:ICF', |  | 
|  611         ], |  | 
|  612     ) |  | 
|  613   if not env['GEARS_STATIC_LIB']: |  | 
|  614     # Build with 2-byte wchar_t's only if we're building a DLL.  To link with |  | 
|  615     # Chrome, we need 4-byte wchar_t. |  | 
|  616     env.Append( |  | 
|  617         CPPFLAGS = [ |  | 
|  618           '/Zc:wchar_t-', |  | 
|  619         ], |  | 
|  620     ) |  | 
|  621          |  | 
|  622 #--------------------------- LINUX --------------------------- |  | 
|  623 elif env['OS'] == 'linux': |  | 
|  624   env.Append( |  | 
|  625       CPPDEFINES = [ |  | 
|  626           'LINUX', |  | 
|  627       ], |  | 
|  628       CPPPATH = [ |  | 
|  629           '$THIRD_PARTY_DIR/gtk/include/gtk-2.0', |  | 
|  630           '$THIRD_PARTY_DIR/gtk/include/atk-1.0', |  | 
|  631           '$THIRD_PARTY_DIR/gtk/include/glib-2.0', |  | 
|  632           '$THIRD_PARTY_DIR/gtk/include/pango-1.0', |  | 
|  633           '$THIRD_PARTY_DIR/gtk/include/cairo', |  | 
|  634           '$THIRD_PARTY_DIR/gtk/lib/gtk-2.0/include', |  | 
|  635           '$THIRD_PARTY_DIR/gtk/lib/glib-2.0/include', |  | 
|  636       ], |  | 
|  637       CCFLAGS = [ |  | 
|  638           '-fPIC', |  | 
|  639           '-fmessage-length=0', |  | 
|  640           '-Wall', |  | 
|  641           '-Werror', |  | 
|  642 # NS_LITERAL_STRING does not work properly without this compiler option |  | 
|  643           '-fshort-wchar', |  | 
|  644 # Additions to compile on hardy |  | 
|  645           '-Wno-unused-variable', |  | 
|  646           '-Wno-missing-braces', |  | 
|  647           '-Wno-address', |  | 
|  648           '-m32', |  | 
|  649       ], |  | 
|  650       CXXFLAGS = [ |  | 
|  651           '-fno-exceptions', |  | 
|  652           '-fno-rtti', |  | 
|  653           '-Wno-non-virtual-dtor', |  | 
|  654           '-Wno-ctor-dtor-privacy', |  | 
|  655           '-funsigned-char', |  | 
|  656           '-Wno-char-subscripts', |  | 
|  657       ], |  | 
|  658       COMMON_LINKFLAGS = [ |  | 
|  659           '-fPIC', |  | 
|  660           '-Bsymbolic', |  | 
|  661           '-pthread', |  | 
|  662       ], |  | 
|  663       SHLINKFLAGS = [ |  | 
|  664           '-shared', |  | 
|  665           '-Wl,--version-script', |  | 
|  666           '-Wl,$OPEN_DIR/tools/xpcom-ld-script', |  | 
|  667 # Additions to compile on hardy |  | 
|  668           '-m32', |  | 
|  669       ], |  | 
|  670   ) |  | 
|  671   if env['MODE'] == 'dbg': |  | 
|  672     env.Append( |  | 
|  673       CPPFLAGS = [ |  | 
|  674           '-g', |  | 
|  675           '-O0', |  | 
|  676       ], |  | 
|  677     ) |  | 
|  678   else:  # MODE=opt |  | 
|  679     env.Append( |  | 
|  680       CPPFLAGS = [ |  | 
|  681           '-O2', |  | 
|  682       ], |  | 
|  683     ) |  | 
|  684 #--------------------------- OSX --------------------------- |  | 
|  685 elif env['OS'] == 'osx': |  | 
|  686 # Gears uses the 10.4 SDK, so we need to build with g++-4.0. |  | 
|  687 # Chrome uses g++-4.2 so we override this here. |  | 
|  688   env['CC'] = 'gcc-4.0' |  | 
|  689   env['CXX'] = 'g++-4.0' |  | 
|  690 # Compile assembly files with the same command line as C files. |  | 
|  691   env['ASCOM'] = '$CCCOM' |  | 
|  692    |  | 
|  693   env.Append(OSX_SDK_ROOT = '/Developer/SDKs/MacOSX10.4u.sdk') |  | 
|  694  |  | 
|  695   env.Append( |  | 
|  696       CPPDEFINES = [ |  | 
|  697           'OSX', |  | 
|  698           'OS_MACOSX', |  | 
|  699 # for breakpad |  | 
|  700           'USE_PROTECTED_ALLOCATIONS=1', |  | 
|  701       ], |  | 
|  702       CPPPATH = [ |  | 
|  703 # Breakpad assumes it is in the include path |  | 
|  704           '$THIRD_PARTY_DIR/breakpad_osx/src', |  | 
|  705       ], |  | 
|  706       CCFLAGS = [ |  | 
|  707            '-mmacosx-version-min=10.4', |  | 
|  708           ('-arch', 'ppc'), |  | 
|  709           ('-arch', 'i386'), |  | 
|  710           '-fPIC', |  | 
|  711           '-fmessage-length=0', |  | 
|  712 # TODO |  | 
|  713 #          '-Wall', |  | 
|  714 # NS_LITERAL_STRING does not work properly without this compiler option |  | 
|  715           '-fshort-wchar', |  | 
|  716           '-fvisibility=hidden', |  | 
|  717 # Breakpad on OSX needs debug symbols to use the STABS format, rather than the |  | 
|  718 # default DWARF debug symbols format. Note that we enable gstabs for debug & |  | 
|  719 # opt; we strip them later in opt. |  | 
|  720           '-gstabs+', |  | 
|  721       ], |  | 
|  722       CXXFLAGS = [ |  | 
|  723           '-fvisibility-inlines-hidden', |  | 
|  724           '-fno-exceptions', |  | 
|  725           '-fno-rtti', |  | 
|  726           ('-Wall', |  | 
|  727            '-Wno-non-virtual-dtor', |  | 
|  728            '-Wno-ctor-dtor-privacy', |  | 
|  729            '-Wno-char-subscripts', |  | 
|  730 # When a function is deprecated in gcc, it stupidly warns about all functions |  | 
|  731 # and member functions that have the same name, regardless of signature. |  | 
|  732 # Example: Standard osx headers deprecate 'SetPort', which causes a warning for |  | 
|  733 # url_canon::Replacements::SetPort(). |  | 
|  734            '-Wno-deprecated-declarations', |  | 
|  735           ), |  | 
|  736           '-funsigned-char', |  | 
|  737           ('-include', env.File('#/$OPEN_DIR/base/safari/prefix_header.h').abspa
     th), |  | 
|  738           ('-isysroot', '$OSX_SDK_ROOT') |  | 
|  739       ], |  | 
|  740       COMMON_LINKFLAGS = [ |  | 
|  741            '-mmacosx-version-min=10.4', |  | 
|  742            '-fPIC', |  | 
|  743            '-Bsymbolic', |  | 
|  744            ('-arch', 'ppc'), |  | 
|  745            ('-arch', 'i386'), |  | 
|  746            ('-isysroot', '$OSX_SDK_ROOT'), |  | 
|  747            '-Wl,-dead_strip', |  | 
|  748       ], |  | 
|  749       SHLINKFLAGS = [ |  | 
|  750           '-bundle',  # DLLFLAGS |  | 
|  751       ], |  | 
|  752       FRAMEWORKS = [ |  | 
|  753           'Carbon', |  | 
|  754           'CoreServices', |  | 
|  755           'Cocoa', |  | 
|  756           'WebKit', |  | 
|  757       ], |  | 
|  758       M4FLAGS = [ |  | 
|  759           '-DGEARS_ENABLER_PATH="$SF_INPUTMANAGER_BUNDLE"', |  | 
|  760           '-DGEARS_PLUGIN_PATH="$SF_PLUGIN_PROXY_BUNDLE"', |  | 
|  761           '-DGEARS_INSTALLER_OUT_DIR="$INSTALLER_OUTDIR/Safari"', |  | 
|  762  |  | 
|  763           # Keystone |  | 
|  764           '-DKEYSTONE_BASE_DIR="$MAIN_DIR/$PRIVATE_THIRD_PARTY_DIR/googlemac/Rel
     eases/Keystone/"', |  | 
|  765           '-DGEARS_INSTALLER_PACKAGE="$SF_INSTALLER_PKG"', |  | 
|  766           '-DGEARS_GENFILES_DIR="$SF_OUTDIR/genfiles"', |  | 
|  767           '-DGEARS_TOOLS_DIR="$MAIN_DIR/$PRIVATE_DIR/tools"', |  | 
|  768       ], |  | 
|  769   ) |  | 
|  770   if env['MODE'] == 'dbg': |  | 
|  771     env.Append( |  | 
|  772         CPPFLAGS = [ |  | 
|  773             '-g', |  | 
|  774             '-O0', |  | 
|  775         ], |  | 
|  776     ) |  | 
|  777   else:  # MODE=opt |  | 
|  778     env.Append( |  | 
|  779         CPPFLAGS = [ |  | 
|  780             '-O2', |  | 
|  781         ], |  | 
|  782     ) |  | 
|  783 #--------------------------- ANDROID --------------------------- |  | 
|  784 elif env['OS'] == 'android': |  | 
|  785   if not os.environ['ANDROID_BUILD_TOP']: |  | 
|  786     print ("Please set ANDROID_BUILD_TOP to the top" |  | 
|  787            " level of your Android source.") |  | 
|  788     Return() |  | 
|  789  |  | 
|  790   if not os.environ['ANDROID_TOOLCHAIN']: |  | 
|  791     print ("Cannot determine location of the target toolchain." |  | 
|  792            " Please set ANDROID_TOOLCHAIN manually.") |  | 
|  793     Return() |  | 
|  794  |  | 
|  795   env['ANDROID_BUILD_TOP'] = os.environ['ANDROID_BUILD_TOP'] |  | 
|  796  |  | 
|  797   # Figure out the cross-compile prefix by finding the *-gcc executable |  | 
|  798   # and taking the '*' as the prefix for the rest. |  | 
|  799   cross_prefix_command = os.popen( |  | 
|  800     r"ls %s/*-gcc | sed 's|\(.*/.*\-\)gcc|\1|g'" % |  | 
|  801     os.environ['ANDROID_TOOLCHAIN']) |  | 
|  802   cross_prefix = cross_prefix_command.read().strip() |  | 
|  803   if cross_prefix_command.close() != None: |  | 
|  804     Return() |  | 
|  805  |  | 
|  806   # Find the output directory. Assume the only target output directory. |  | 
|  807   product_out_command = os.popen("ls %s/out/target/product/*" % |  | 
|  808                                  os.environ['ANDROID_BUILD_TOP']) |  | 
|  809   product_out = product_out_command.read().strip() |  | 
|  810   if product_out_command.close() != None: |  | 
|  811     Return() |  | 
|  812  |  | 
|  813   env['CC'] = cross_prefix + 'gcc' |  | 
|  814   env['CXX'] = cross_prefix + 'g++' |  | 
|  815  |  | 
|  816   env.Append( |  | 
|  817       CPPPATH = [ |  | 
|  818           '$OPEN_DIR/base/android', |  | 
|  819           '$THIRD_PARTY_DIR/stlport/stlport', |  | 
|  820           '$THIRD_PARTY_DIR/stlport/stlport/stl', |  | 
|  821           '$THIRD_PARTY_DIR/stlport/stlport/stl/config', |  | 
|  822           '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include', |  | 
|  823           '$ANDROID_BUILD_TOP/include', |  | 
|  824           '$ANDROID_BUILD_TOP/include/nativehelper', |  | 
|  825           '$ANDROID_BUILD_TOP/system', |  | 
|  826           '$ANDROID_BUILD_TOP/system/bionic/include', |  | 
|  827           '$ANDROID_BUILD_TOP/system/bionic/arch-arm/include', |  | 
|  828           '$ANDROID_BUILD_TOP/system/kernel_headers', |  | 
|  829           '$ANDROID_BUILD_TOP/system/bionic/kernel/arch-arm', |  | 
|  830           '$ANDROID_BUILD_TOP/system/bionic/kernel/common', |  | 
|  831           '$ANDROID_BUILD_TOP/system/libm/include ', |  | 
|  832           '$ANDROID_BUILD_TOP/bionic', |  | 
|  833           '$ANDROID_BUILD_TOP/bionic/libc/include', |  | 
|  834           '$ANDROID_BUILD_TOP/bionic/libc/arch-arm', |  | 
|  835           '$ANDROID_BUILD_TOP/bionic/libc/arch-arm/include', |  | 
|  836           '$ANDROID_BUILD_TOP/bionic/libc/kernel/arch-arm', |  | 
|  837           '$ANDROID_BUILD_TOP/bionic/libc/kernel/common', |  | 
|  838           '$ANDROID_BUILD_TOP/bionic/libm/include', |  | 
|  839           '$ANDROID_BUILD_TOP/dalvik/libnativehelper/include', |  | 
|  840           '$ANDROID_BUILD_TOP/extlibs', |  | 
|  841           '$ANDROID_BUILD_TOP/extlibs/icu4c-3.8/common', |  | 
|  842           '$ANDROID_BUILD_TOP/extlibs/icu4c-3.8/i18n', |  | 
|  843           '$ANDROID_BUILD_TOP/extlibs/jpeg-6b', |  | 
|  844           '$ANDROID_BUILD_TOP/extlibs/sqlite', |  | 
|  845           '$ANDROID_BUILD_TOP/extlibs/zlib-1.2.3', |  | 
|  846           '$ANDROID_BUILD_TOP/external', |  | 
|  847           '$ANDROID_BUILD_TOP/external/icu4c/common', |  | 
|  848           '$ANDROID_BUILD_TOP/external/icu4c/i18n', |  | 
|  849           '$ANDROID_BUILD_TOP/external/jpeg', |  | 
|  850           '$ANDROID_BUILD_TOP/external/sqlite/dist', |  | 
|  851           '$ANDROID_BUILD_TOP/external/zlib', |  | 
|  852           '$ANDROID_BUILD_TOP/frameworks/base/include', |  | 
|  853           '$ANDROID_BUILD_TOP/system/core/include', |  | 
|  854       ], |  | 
|  855       CPPFLAGS = [ |  | 
|  856           '-g', |  | 
|  857           '-c', |  | 
|  858           '-fPIC', |  | 
|  859           '-fmessage-length=0', |  | 
|  860           '-Wall', |  | 
|  861           '-fvisibility=hidden', |  | 
|  862 # NS_LITERAL_STRING does not work properly without this compiler option |  | 
|  863           '-fshort-wchar', |  | 
|  864           '-funsigned-char', |  | 
|  865           '-march=armv5te', |  | 
|  866           '-mtune=xscale', |  | 
|  867           '-mthumb-interwork', |  | 
|  868           '-ffunction-sections', |  | 
|  869           '-fdata-sections', |  | 
|  870           '-fno-exceptions', |  | 
|  871       ], |  | 
|  872       CXXFLAGS = [ |  | 
|  873           '-fno-rtti', |  | 
|  874           '-fvisibility-inlines-hidden', |  | 
|  875           '-Wno-non-virtual-dtor', |  | 
|  876           '-Wno-ctor-dtor-privacy', |  | 
|  877       ], |  | 
|  878       CPPDEFINES = [ |  | 
|  879           'OS_ANDROID', |  | 
|  880           'ANDROID', |  | 
|  881           'TARGET_OS=android', |  | 
|  882           'BUILD_OSNAME=android', |  | 
|  883           'OSNAME=android', |  | 
|  884           'COMPILER_NAME=gcc', |  | 
|  885           '__SGI_STL_INTERNAL_PAIR_H', |  | 
|  886           '_CPP_UTILITY', |  | 
|  887           '_LITTLE_ENDIAN=1234', |  | 
|  888           '_BIG_ENDIAN=4321', |  | 
|  889           '_PDP_ENDIAN=3412', |  | 
|  890           '_BYTE_ORDER=_LITTLE_ENDIAN', |  | 
|  891       ], |  | 
|  892       COMMON_LINKFLAGS = [ |  | 
|  893           '-g', |  | 
|  894           '-fPIC', |  | 
|  895           '-Bsymbolic', |  | 
|  896           '-nostdlib', |  | 
|  897       ], |  | 
|  898       SHLINKFLAGS = [ |  | 
|  899           '-shared', |  | 
|  900           '-Wl,--gc-sections', |  | 
|  901           '-L$ANDROID_PRODUCT_OUT/system/lib', |  | 
|  902 # Workaround for the Android C library not implementing |  | 
|  903 # __aeabi_atexit, which is used to destruct static C++ objects.  This |  | 
|  904 # causes all calls to be rewritten by the linker to |  | 
|  905 # __wrap___aeabi_atexit, which we then implement. |  | 
|  906           '-Wl,--wrap,__aeabi_atexit', |  | 
|  907       ], |  | 
|  908   ) |  | 
|  909   if env['MODE'] == 'dbg': |  | 
|  910     env.Append( |  | 
|  911       CPPFLAGS = [ |  | 
|  912           '-g', |  | 
|  913           '-O', |  | 
|  914           '-funwind-tables', |  | 
|  915           '-mapcs-frame', |  | 
|  916       ], |  | 
|  917     ) |  | 
|  918   else:  # MODE=opt |  | 
|  919     env.Append( |  | 
|  920       CPPFLAGS = [ |  | 
|  921           '-O2', |  | 
|  922           '-mthumb', |  | 
|  923           '-fomit-frame-pointer', |  | 
|  924       ], |  | 
|  925     ) |  | 
|  926  |  | 
|  927 # Custom builder to work around a scons and/or hammer bug.  ComponentLibrary |  | 
|  928 # tries to install the library to COMPONENT_LIBRARY_DIR, but since we overrode |  | 
|  929 # that value, scons gets confused.  I'm not sure who is at fault here. |  | 
|  930 # See http://code.google.com/p/chromium/issues/detail?id=4177. |  | 
|  931 def GearsStaticLibrary(env, *args, **kw): |  | 
|  932   lib = env.ChromeLibrary(*args, **kw) |  | 
|  933   env.Install('$COMPONENT_LIBRARY_DIR', lib[0]) |  | 
|  934   return lib |  | 
|  935 env.AddMethod(GearsStaticLibrary) |  | 
|  936  |  | 
|  937 # Load all the components |  | 
|  938  |  | 
|  939 sconscripts = [ |  | 
|  940     'SConscript.googleurl', |  | 
|  941     'SConscript.libjpeg', |  | 
|  942     'SConscript.libpng', |  | 
|  943     'SConscript.libmozjs', |  | 
|  944     'SConscript.sqlite', |  | 
|  945     'SConscript.zlib', |  | 
|  946     'SConscript.libbreakpad_osx', |  | 
|  947     'SConscript.libgd', |  | 
|  948 ] |  | 
|  949  |  | 
|  950 for each in sconscripts: |  | 
|  951   env.SConscript(each, |  | 
|  952                  exports=['env'], |  | 
|  953                  variant_dir='$COMMON_OUTDIR', |  | 
|  954                  duplicate=0) |  | 
|  955  |  | 
|  956 # Order of execution is important here.  Each sub-script adds to the |  | 
|  957 # environment, for use by later scripts. |  | 
|  958 env = env.SConscript('SConscript.inputs', exports=['env']) |  | 
|  959  |  | 
|  960 outputs = env.SConscript('SConscript.common', |  | 
|  961                exports=['env'], |  | 
|  962                variant_dir='$COMMON_OUTDIR', |  | 
|  963                duplicate=0) |  | 
|  964 env.Append(**outputs) |  | 
|  965  |  | 
|  966 browsers = [env['BROWSER']] |  | 
|  967 if browsers[0] == 'all': |  | 
|  968   browsers = env['VALID_BROWSERS'] |  | 
|  969 print 'Building:', browsers |  | 
|  970  |  | 
|  971 # We run the browser script once for each browser target we want to build. |  | 
|  972 # Each script adds variables to the environment in the form of |  | 
|  973 # '${BROWSER}_foo = bar' for use by the installers script. |  | 
|  974 for each in browsers: |  | 
|  975   env.Replace(BROWSER = each) |  | 
|  976   outputs = env.SConscript('SConscript.browser', |  | 
|  977                  exports=['env'], |  | 
|  978                  variant_dir='$BROWSER_OUTDIR', |  | 
|  979                  duplicate=0) |  | 
|  980   browser_outputs = {} |  | 
|  981   for key, value in outputs.iteritems(): |  | 
|  982     browser_outputs[each + '_' + key] = value |  | 
|  983   env.Append(**browser_outputs) |  | 
|  984  |  | 
|  985 # Note: even though the installers write to $INSTALLER_OUTDIR, they need to |  | 
|  986 # read files from other dirs, so we give them a variant_dir at the toplevel. |  | 
|  987 env.SConscript('SConscript.installers', |  | 
|  988                exports=['env'], |  | 
|  989                variant_dir='$BASE_OUTDIR', |  | 
|  990                duplicate=0) |  | 
|  991  |  | 
|  992 env.Alias('gears-installers', 'gears') |  | 
| OLD | NEW |