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.
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.
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",
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.
23 # Should we flatten the output directory into
24 # Hammer/gears/platform/browser/*.obj like Gears does now? If so, how?
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.
42 PRIVATE_DIR = "gears_internal",
43 THIRD_PARTY_DIR = "third_party",
44 PRIVATE_THIRD_PARTY_DIR = "third_party_internal",
47 if not os.path.exists(env.Dir('#/$OPEN_DIR').abspath):
48 print 'Skipping Gears build: no perforce tree checked out.'
53 # TODO: how do we detect linux vs osx?
54 os_guess = env['PLATFORM']
55 if os_guess == 'posix':
57 elif os_guess == 'darwin':
60 # Map of OS -> valid browser targets for that OS.
62 'win32': ['IE', 'FF2', 'FF3', 'NPAPI'],
64 'linux': ['FF2', 'FF3'],
65 'osx': ['SF', 'FF2', 'FF3'],
70 vars = Variables(None, ARGUMENTS)
73 'Which OS is the target', os_guess, os_browsers_map.keys()),
75 'Type of binary to generate', 'dbg', ['dbg', 'opt']),
76 BoolVariable('OFFICIAL_BUILD',
77 'Create a binary suitable for public release', 0)
81 env['VALID_BROWSERS'] = os_browsers_map[env['OS']]
83 # Add BROWSER last, since its valid inputs depend on $OS.
85 EnumVariable('BROWSER',
86 'Which browser we want to build the plugin for. "all" builds all '
87 'browsers for this OS.',
88 'all', env['VALID_BROWSERS'] + ['all']))
92 USING_CCTESTS = (env['MODE'] == 'dbg' or not env['OFFICIAL_BUILD'])
101 VERSION = '${MAJOR}.${MINOR}.${BUILD}.${PATCH}',
103 FRIENDLY_NAME = 'Google Gears',
104 SHORT_NAME = 'gears',
108 # TODO: Symbian builds will override this value.
109 # For other platforms we set just one value.
110 if env['OS'] in ['wince', 'android']:
111 env.Replace(ARCH = 'arm')
112 elif env['OS'] == 'osx':
113 # On OSX we build a fat binary.
114 env.Replace(ARCH = 'i386+ppc')
116 env.Replace(ARCH = 'i386')
120 BASE_OUTDIR = '$GEARS_DIR/$OS-$ARCH-$MODE',
121 COMMON_OUTDIR = '$BASE_OUTDIR/common',
122 BROWSER_OUTDIR = '$BASE_OUTDIR/${BROWSER.lower()}',
123 IE_OUTDIR = '$BASE_OUTDIR/ie',
124 FF2_OUTDIR = '$BASE_OUTDIR/ff2',
125 FF3_OUTDIR = '$BASE_OUTDIR/ff3',
126 NPAPI_OUTDIR = '$BASE_OUTDIR/npapi',
127 SF_OUTDIR = '$BASE_OUTDIR/sf',
129 GENFILES_DIR = "$BROWSER_OUTDIR/genfiles",
130 COMMON_GENFILES_DIR = "$COMMON_OUTDIR/genfiles",
132 INSTALLER_OUTDIR = '$BASE_OUTDIR/installers',
137 INSTALLER_BASENAME = 'gears-${OS}-${MODE}-${VERSION}',
139 FF_XPI = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.xpi',
140 WIN32_INSTALLER_MSI = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.msi',
141 WINCE_INSTALLER_CAB = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.cab',
142 # Keyston SF Metapackage installer, bundled with Keystone as part of a
144 SF_KEYSTONE_INSTALLER_DMG = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.dmg',
145 SF_KEYSTONE_INSTALLER_MPKG = '$INSTALLER_OUTDIR/Safari/${FRIENDLY_NAME}.mpkg',
147 SF_INSTALLER_PLUGIN_BUNDLE = '$INSTALLER_OUTDIR/Safari/StatsPane.bundle',
148 SF_PLUGIN_BUNDLE = '$INSTALLER_OUTDIR/Safari/Gears.bundle',
149 SF_PLUGIN_PROXY_BUNDLE = '$INSTALLER_OUTDIR/Safari/Gears.plugin',
150 SF_INPUTMANAGER_BUNDLE = '$INSTALLER_OUTDIR/Safari/GearsEnabler',
151 SF_INSTALLER_PKG = '$INSTALLER_OUTDIR/Safari/Gears.pkg',
156 MOZJS_INCLUDE_PATHS = [
158 '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include',
159 '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include/private',
160 '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include/obsolete',
161 '$OSX_SDK_ROOT/Developer/Headers/FlatCarbon/',
163 MOZJS_DIR = '$THIRD_PARTY_DIR/spidermonkey',
166 # Add our tools to the PATH.
167 if env['OS'] in ['win32', 'wince']:
168 if os.path.exists(env.Dir('#/$PRIVATE_THIRD_PARTY_DIR').abspath):
169 # Clear out our environment so we don't accidentally use the system's
171 env['ENV']['PATH'] = ''
172 env['ENV']['LIB'] = ''
173 env['ENV']['INCLUDE'] = ''
177 # Keep system32 for 'xcopy'.
178 paths += [env.subst('${ENV["SYSTEMROOT"]}/system32')]
179 if env['OS'] == 'win32':
181 VC80 = env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/vc_80/files').abspath)
183 env.subst('$VC80/common7/ide'),
184 env.subst('$VC80/vc/bin'),
185 env.subst('$VC80/common7/tools'),
186 env.subst('$VC80/common7/tools/bin'),
187 env.subst('$VC80/team_tools/performance_tools'),
191 VC80 = env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/vc_80ce/files').abspath)
193 env.subst('$VC80/bin/x86_arm'),
194 env.subst('$VC80/common7/ide'),
195 env.subst('$VC80/common7/tools'),
196 env.subst('$VC80/common7/tools/bin'),
197 env.subst('$VC80/vc/bin'),
198 env.subst('$VC80/smartdevices/sdktools'),
202 env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/wix/v3_0_2925/files').abspath]
204 paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/gnu/files').abspath]
205 paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/python_24').abspath]
207 # Prepend them so our tools come first.
208 for each in reversed(paths):
209 env.PrependENVPath('PATH', each)
211 # If we don't have a private third_party dir, we expect the system
212 # environment to be set up correctly to point to tool paths.
213 env['ENV']['PATH'] = os.environ['PATH']
214 env['ENV']['LIB'] = os.environ['LIB']
215 env['ENV']['INCLUDE'] = os.environ['INCLUDE']
217 mtcom = 'echo Manifest creation disabled, since it breaks a lot.'
218 env['MANIFEST_COM'] = mtcom
219 env['SHMANIFEST_COM'] = mtcom
225 M4ARCH = (env['ARCH'] == 'i386' and 'x86' or '$ARCH'),
228 '-DPRODUCT_VERSION=$VERSION',
229 '-DPRODUCT_VERSION_MAJOR=$MAJOR',
230 '-DPRODUCT_VERSION_MINOR=$MINOR',
231 '-DPRODUCT_VERSION_BUILD=$BUILD',
232 '-DPRODUCT_VERSION_PATCH=$PATCH',
234 '-DPRODUCT_ARCH="$M4ARCH"',
235 '-DPRODUCT_GCC_VERSION="gcc3"',
236 '-DPRODUCT_MAINTAINER="google"',
237 '-DPRODUCT_FRIENDLY_NAME_UQ="$FRIENDLY_NAME"',
238 '-DPRODUCT_SHORT_NAME_UQ="$SHORT_NAME"',
239 '-DI18N_LANGUAGES="(${",".join(I18N_LANGS)})"',
247 # SCons magic to make M4PATH work.
251 _M4INCFLAGS = ('${_concat(M4INCPREFIX, M4PATH, M4INCSUFFIX, '
252 '__env__, RDirs, TARGET, SOURCE)}'),
253 M4COM = '$M4 $M4FLAGS ${_M4INCFLAGS} $SOURCE > $TARGET',
256 # TODO: Dependency scanner for m4 files - doesn't work. It can't detect files
258 #m4_include_re = re.compile(r'm4_include\((.*)\)', re.M)
259 #def m4_scan(node, env, path):
260 # contents = node.get_contents()
261 # includes = m4_include_re.findall(contents)
263 # for include in includes:
265 # file = os.path.join(dir, include)
266 # if os.path.exists(file):
267 # ret_includes.append(file)
269 # return ret_includes
271 #m4_scanner = Scanner(function = m4_scan, skeys = ['.m4', '.html_m4'])
272 #env.Append(SCANNERS = m4_scanner)
275 # OS X Iceberg package builder
277 env.Replace(ICEBERG = '/usr/local/bin/freeze')
278 if env.WhereIs('$ICEBERG'):
279 env.Replace(ICEBERGCOM = '"$ICEBERG" -v $SOURCE')
281 env.Replace(ICEBERGCOM =
282 'echo To create a Safari installer for Gears, you must install Iceberg'
283 ' from http://s.sudre.free.fr/Software/Iceberg.html. You can install'
284 ' the Safari version manually by running the'
285 ' $OPEN_DIR/tools/osx/install_gears.sh script.')
287 iceberg_builder = Builder(action = '$ICEBERGCOM',
288 suffix = '.pkg', src_suffix = '.packproj')
289 env.Append(BUILDERS = {'Iceberg': iceberg_builder})
294 # Clear out the inherited defines from Chrome's build. I want to match Gears'
295 # current build as closely as possible until we switch everyone to SCons, then
296 # gradually integrate.
302 '$THIRD_PARTY_DIR/googleurl',
303 '$THIRD_PARTY_DIR/npapi',
304 '$THIRD_PARTY_DIR/zlib',
305 '$THIRD_PARTY_DIR/v8/bindings_local',
314 # SpiderMonkey (the Firefox JS engine)'s JS_GET_CLASS macro in jsapi.h needs
315 # this defined to work with the gecko SDK that we've built.
316 # The definition of JS_THREADSAFE must be kept in sync with MOZJS_CPPFLAGS.
322 LIBPATH = ['$COMPONENT_LIBRARY_DIR'],
323 COMMON_LINKFLAGS = [], # for both executables and shared libs
324 LINKFLAGS = ['$COMMON_LINKFLAGS'], # for executables
325 SHLINKFLAGS = ['$COMMON_LINKFLAGS'], # for shared libs
326 COMPONENT_LIBRARY_DIR = '$COMMON_OUTDIR/lib',
329 if env['MODE'] == 'dbg':
335 M4FLAGS = '-DDEBUG=1',
339 CPPDEFINES = 'NDEBUG=1',
340 M4FLAGS = '-DNDEBUG=1',
342 if env['USING_CCTESTS']:
344 CPPDEFINES = 'USING_CCTESTS=1',
345 M4FLAGS = '-DUSING_CCTESTS=1',
347 if env['OFFICIAL_BUILD']:
349 CPPDEFINES = 'OFFICIAL_BUILD=1',
350 M4FLAGS = '-DOFFICIAL_BUILD=1',
354 env.Append(CPPDEFINES = 'PNG_USER_CONFIG')
355 # TODO: if USING_ZLIB
362 if env['OS'] == 'wince':
363 env.Append(CPPDEFINES = 'NO_ERRNO_H')
367 env['I18N_LANGS'] = [
423 # Platform-specific flags follow.
425 if env['OS'] in ['win32', 'wince']:
426 env.Replace(ARFLAGS = [])
435 '_CRT_SECURE_NO_DEPRECATE',
438 # In VC8, the way to disable exceptions is to remove all /EH* flags, and to
439 # define _HAS_EXCEPTIONS=0 (for C++ headers) and _ATL_NO_EXCEPTIONS (for ATL).
441 '_ATL_NO_EXCEPTIONS',
442 # Do not export UTF functions.
443 'U_STATIC_IMPLEMENTATION',
449 # Shared lib and exe flags.
454 '/PDB:${TARGET.base}.pdb',
458 # Set the preferred base address. This value was chosen because (a) it's near
459 # the top of the valid address range, and (b) it doesn't conflict with other
460 # DLLs loaded by Chrome in either the browser or plugin process.
470 '/Fd"${TARGET.base}.pdb"',
478 '$THIRD_PARTY_DIR/breakpad/src',
481 '/Zi', # TODO: Chrome defines /Z7, no idea what these are.
487 if env['OS'] == 'win32':
490 # We require APPVER=5.0 for things like HWND_MESSAGE.
491 # When APPVER=5.0, win32.mak in the Platform SDK sets:
492 # C defines: WINVER=0x0500
493 # _WIN32_WINNT=0x0500
495 # _RICHEDIT_VER=0x0010
496 # RC defines: WINVER=0x0500
497 # MIDL flags: /target NT50
498 # Note: _WIN32_WINDOWS was replaced by _WIN32_WINNT for post-Win95 builds.
499 # Note: XP_WIN is only used by Firefox headers
502 '_WIN32_WINNT=0x0500',
504 '_RICHEDIT_VER=0x0010',
506 'BREAKPAD_AVOID_STREAMS',
514 '/NODEFAULTLIB:msvcrt',
515 # Flags for security hardening (only available for win32, not wince).
520 # We only use /SUBSYSTEM on DLLs. For EXEs we omit the flag, and
521 # the presence of main() or WinMain() determines the subsystem.
522 '/SUBSYSTEM:WINDOWS',
525 # TODO: switch over to Chrome's SDK.
526 # Note: these must come after $THIRD_PARTY_DIR/npapi because we want our own
527 # npapi.h to take precedence.
528 '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include',
529 '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/include',
530 '$PRIVATE_THIRD_PARTY_DIR/vc_80/files/vc/include',
533 '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/lib',
534 '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/lib',
535 '$PRIVATE_THIRD_PARTY_DIR/vc_80/files/vc/lib',
541 # For Windows Mobile we need:
542 # C defines: _WIN32_WCE=0x0501
548 'WIN32_PLATFORM_PSPC',
551 'POCKETPC2003_UI_MODEL',
552 '_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA',
553 '_CE_CRT_ALLOW_WIN_MINMAX',
560 '/NODEFAULTLIB:secchk.lib',
561 '/NODEFAULTLIB:oldnames.lib',
564 '/SUBSYSTEM:WINDOWSCE,5.01',
567 '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80ce/files/include',
568 '$PRIVATE_THIRD_PARTY_DIR/vc_80ce/files/include',
569 # Visual Studio must be setup before the PocketPC SDK.
570 '$PRIVATE_THIRD_PARTY_DIR/pocketpc_sdk_ce_50/files/include/armv4i',
573 '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80ce/files/lib/armv4i',
574 '$PRIVATE_THIRD_PARTY_DIR/vc_80ce/files/lib/armv4i',
575 '$PRIVATE_THIRD_PARTY_DIR/pocketpc_sdk_ce_50/files/lib/armv4i',
579 if env['MODE'] == 'dbg':
597 #--------------------------- LINUX ---------------------------
598 elif env['OS'] == 'linux':
604 '$THIRD_PARTY_DIR/gtk/include/gtk-2.0',
605 '$THIRD_PARTY_DIR/gtk/include/atk-1.0',
606 '$THIRD_PARTY_DIR/gtk/include/glib-2.0',
607 '$THIRD_PARTY_DIR/gtk/include/pango-1.0',
608 '$THIRD_PARTY_DIR/gtk/include/cairo',
609 '$THIRD_PARTY_DIR/gtk/lib/gtk-2.0/include',
610 '$THIRD_PARTY_DIR/gtk/lib/glib-2.0/include',
614 '-fmessage-length=0',
617 # NS_LITERAL_STRING does not work properly without this compiler option
619 # Additions to compile on hardy
620 '-Wno-unused-variable',
621 '-Wno-missing-braces',
628 '-Wno-non-virtual-dtor',
629 '-Wno-ctor-dtor-privacy',
631 '-Wno-char-subscripts',
640 '-Wl,--version-script',
641 '-Wl,$OPEN_DIR/tools/xpcom-ld-script',
642 # for PortAudio: need pthread and math
645 # Additions to compile on hardy
649 if env['MODE'] == 'dbg':
662 #--------------------------- OSX ---------------------------
663 elif env['OS'] == 'osx':
664 # Gears uses the 10.4 SDK, so we need to build with g++-4.0.
665 # Chrome uses g++-4.2 so we override this here.
666 env['CC'] = 'gcc-4.0'
667 env['CXX'] = 'g++-4.0'
668 # Compile assembly files with the same command line as C files.
669 env['ASCOM'] = '$CCCOM'
671 env.Append(OSX_SDK_ROOT = '/Developer/SDKs/MacOSX10.4u.sdk')
678 'USE_PROTECTED_ALLOCATIONS=1',
681 # Breakpad assumes it is in the include path
682 '$THIRD_PARTY_DIR/breakpad_osx/src',
685 '-mmacosx-version-min=10.4',
689 '-fmessage-length=0',
692 # NS_LITERAL_STRING does not work properly without this compiler option
694 '-fvisibility=hidden',
695 # Breakpad on OSX needs debug symbols to use the STABS format, rather than the
696 # default DWARF debug symbols format. Note that we enable gstabs for debug &
697 # opt; we strip them later in opt.
701 '-fvisibility-inlines-hidden',
705 '-Wno-non-virtual-dtor',
706 '-Wno-ctor-dtor-privacy',
707 '-Wno-char-subscripts',
708 # When a function is deprecated in gcc, it stupidly warns about all functions
709 # and member functions that have the same name, regardless of signature.
710 # Example: Standard osx headers deprecate 'SetPort', which causes a warning for
711 # url_canon::Replacements::SetPort().
712 '-Wno-deprecated-declarations',
715 ('-include', env.File('#/$OPEN_DIR/base/safari/prefix_header.h').abspath),
716 ('-isysroot', '$OSX_SDK_ROOT')
719 '-mmacosx-version-min=10.4',
724 ('-isysroot', '$OSX_SDK_ROOT'),
728 '-bundle', # DLLFLAGS
737 '-DGEARS_ENABLER_PATH="$SF_INPUTMANAGER_BUNDLE"',
738 '-DGEARS_PLUGIN_PATH="$SF_PLUGIN_PROXY_BUNDLE"',
739 '-DGEARS_INSTALLER_OUT_DIR="$INSTALLER_OUTDIR/Safari"',
742 '-DKEYSTONE_BASE_DIR="$MAIN_DIR/$PRIVATE_THIRD_PARTY_DIR/googlemac/Releases/Keystone/"',
743 '-DGEARS_INSTALLER_PACKAGE="$SF_INSTALLER_PKG"',
744 '-DGEARS_GENFILES_DIR="$SF_OUTDIR/genfiles"',
745 '-DGEARS_TOOLS_DIR="$MAIN_DIR/$PRIVATE_DIR/tools"',
748 if not env['OFFICIAL_BUILD']:
750 env.Append(FRAMEWORKS = [
755 if env['MODE'] == 'dbg':
768 #--------------------------- ANDROID ---------------------------
769 elif env['OS'] == 'android':
770 if not os.environ['ANDROID_BUILD_TOP']:
771 print ("Please set ANDROID_BUILD_TOP to the top"
772 " level of your Android source.")
775 if not os.environ['ANDROID_TOOLCHAIN']:
776 print ("Cannot determine location of the target toolchain."
777 " Please set ANDROID_TOOLCHAIN manually.")
780 env['ANDROID_BUILD_TOP'] = os.environ['ANDROID_BUILD_TOP']
782 # Figure out the cross-compile prefix by finding the *-gcc executable
783 # and taking the '*' as the prefix for the rest.
784 cross_prefix_command = os.popen(
785 r"ls %s/*-gcc | sed 's|\(.*/.*\-\)gcc|\1|g'" %
786 os.environ['ANDROID_TOOLCHAIN'])
787 cross_prefix = cross_prefix_command.read().strip()
788 if cross_prefix_command.close() != None:
791 # Find the output directory. Assume the only target output directory.
792 product_out_command = os.popen("ls %s/out/target/product/*" %
793 os.environ['ANDROID_BUILD_TOP'])
794 product_out = product_out_command.read().strip()
795 if product_out_command.close() != None:
798 env['CC'] = cross_prefix + 'gcc'
799 env['CXX'] = cross_prefix + 'g++'
803 '$OPEN_DIR/base/android',
804 '$THIRD_PARTY_DIR/stlport/stlport',
805 '$THIRD_PARTY_DIR/stlport/stlport/stl',
806 '$THIRD_PARTY_DIR/stlport/stlport/stl/config',
807 '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include',
808 '$ANDROID_BUILD_TOP/include',
809 '$ANDROID_BUILD_TOP/include/nativehelper',
810 '$ANDROID_BUILD_TOP/system',
811 '$ANDROID_BUILD_TOP/system/bionic/include',
812 '$ANDROID_BUILD_TOP/system/bionic/arch-arm/include',
813 '$ANDROID_BUILD_TOP/system/kernel_headers',
814 '$ANDROID_BUILD_TOP/system/bionic/kernel/arch-arm',
815 '$ANDROID_BUILD_TOP/system/bionic/kernel/common',
816 '$ANDROID_BUILD_TOP/system/libm/include ',
817 '$ANDROID_BUILD_TOP/bionic',
818 '$ANDROID_BUILD_TOP/bionic/libc/include',
819 '$ANDROID_BUILD_TOP/bionic/libc/arch-arm',
820 '$ANDROID_BUILD_TOP/bionic/libc/arch-arm/include',
821 '$ANDROID_BUILD_TOP/bionic/libc/kernel/arch-arm',
822 '$ANDROID_BUILD_TOP/bionic/libc/kernel/common',
823 '$ANDROID_BUILD_TOP/bionic/libm/include',
824 '$ANDROID_BUILD_TOP/dalvik/libnativehelper/include',
825 '$ANDROID_BUILD_TOP/extlibs',
826 '$ANDROID_BUILD_TOP/extlibs/icu4c-3.8/common',
827 '$ANDROID_BUILD_TOP/extlibs/icu4c-3.8/i18n',
828 '$ANDROID_BUILD_TOP/extlibs/jpeg-6b',
829 '$ANDROID_BUILD_TOP/extlibs/sqlite',
830 '$ANDROID_BUILD_TOP/extlibs/zlib-1.2.3',
831 '$ANDROID_BUILD_TOP/external',
832 '$ANDROID_BUILD_TOP/external/icu4c/common',
833 '$ANDROID_BUILD_TOP/external/icu4c/i18n',
834 '$ANDROID_BUILD_TOP/external/jpeg',
835 '$ANDROID_BUILD_TOP/external/sqlite/dist',
836 '$ANDROID_BUILD_TOP/external/zlib',
837 '$ANDROID_BUILD_TOP/frameworks/base/include',
838 '$ANDROID_BUILD_TOP/system/core/include',
844 '-fmessage-length=0',
846 '-fvisibility=hidden',
847 # NS_LITERAL_STRING does not work properly without this compiler option
853 '-ffunction-sections',
859 '-fvisibility-inlines-hidden',
860 '-Wno-non-virtual-dtor',
861 '-Wno-ctor-dtor-privacy',
867 'BUILD_OSNAME=android',
870 '__SGI_STL_INTERNAL_PAIR_H',
872 '_LITTLE_ENDIAN=1234',
875 '_BYTE_ORDER=_LITTLE_ENDIAN',
886 '-L$ANDROID_PRODUCT_OUT/system/lib',
887 # Workaround for the Android C library not implementing
888 # __aeabi_atexit, which is used to destruct static C++ objects. This
889 # causes all calls to be rewritten by the linker to
890 # __wrap___aeabi_atexit, which we then implement.
891 '-Wl,--wrap,__aeabi_atexit',
894 if env['MODE'] == 'dbg':
908 '-fomit-frame-pointer',
912 # Custom builder to work around a scons and/or hammer bug. ComponentLibrary
913 # tries to install the library to COMPONENT_LIBRARY_DIR, but since we overrode
914 # that value, scons gets confused. I'm not sure who is at fault here.
915 # See http://code.google.com/p/chromium/issues/detail?id=4177.
916 def GearsStaticLibrary(env, *args, **kw):
917 lib = env.ChromeStaticLibrary(*args, **kw)
918 env.Install('$COMPONENT_LIBRARY_DIR', lib[0])
920 env.AddMethod(GearsStaticLibrary)
922 # Load all the components
925 'SConscript.googleurl',
926 'SConscript.libjpeg',
928 'SConscript.libmozjs',
931 'SConscript.libbreakpad_osx',
933 'SConscript.portaudio',
936 for each in sconscripts:
939 variant_dir='$COMMON_OUTDIR',
942 # Order of execution is important here. Each sub-script adds to the
943 # environment, for use by later scripts.
944 env = env.SConscript('SConscript.inputs', exports=['env'])
946 outputs = env.SConscript('SConscript.common',
948 variant_dir='$COMMON_OUTDIR',
950 env.Append(**outputs)
952 browsers = [env['BROWSER']]
953 if browsers[0] == 'all':
954 browsers = env['VALID_BROWSERS']
955 print 'Building:', browsers
957 # We run the browser script once for each browser target we want to build.
958 # Each script adds variables to the environment in the form of
959 # '${BROWSER}_foo = bar' for use by the installers script.
960 for each in browsers:
961 env.Replace(BROWSER = each)
962 outputs = env.SConscript('SConscript.browser',
964 variant_dir='$BROWSER_OUTDIR',
967 for key, value in outputs.iteritems():
968 browser_outputs[each + '_' + key] = value
969 env.Append(**browser_outputs)
971 # Note: even though the installers write to $INSTALLER_OUTDIR, they need to
972 # read files from other dirs, so we give them a variant_dir at the toplevel.
973 env.SConscript('SConscript.installers',
975 variant_dir='$BASE_OUTDIR',
978 env.Alias('gears-installers', 'gears')