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),
78 BoolVariable('GEARS_STATIC_LIB',
79 'Create a static library for linking with Chrome', 0),
83 env['VALID_BROWSERS'] = os_browsers_map[env['OS']]
85 # Add BROWSER last, since its valid inputs depend on $OS.
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']))
94 USING_CCTESTS = (env['MODE'] == 'dbg' or not env['OFFICIAL_BUILD'])
103 VERSION = '${MAJOR}.${MINOR}.${BUILD}.${PATCH}',
105 FRIENDLY_NAME = 'Google Gears',
106 SHORT_NAME = 'gears',
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')
118 env.Replace(ARCH = 'i386')
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',
131 GENFILES_DIR = "$BROWSER_OUTDIR/genfiles",
132 COMMON_GENFILES_DIR = "$COMMON_OUTDIR/genfiles",
134 INSTALLER_OUTDIR = '$BASE_OUTDIR/installers',
139 INSTALLER_BASENAME = 'gears-${OS}-${MODE}-${VERSION}',
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
146 SF_KEYSTONE_INSTALLER_DMG = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.dmg',
147 SF_KEYSTONE_INSTALLER_MPKG = '$INSTALLER_OUTDIR/Safari/${FRIENDLY_NAME}.mpkg',
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',
158 MOZJS_INCLUDE_PATHS = [
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/',
165 MOZJS_DIR = '$THIRD_PARTY_DIR/spidermonkey',
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
173 env['ENV']['PATH'] = ''
174 env['ENV']['LIB'] = ''
175 env['ENV']['INCLUDE'] = ''
179 # Keep system32 for 'xcopy'.
180 paths += [env.subst('${ENV["SYSTEMROOT"]}/system32')]
181 if env['OS'] == 'win32':
183 VC80 = env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/vc_80/files').abspath)
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'),
193 VC80 = env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/vc_80ce/files').abspath)
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'),
204 env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/wix/v3_0_2925/files').abspath]
206 paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/gnu/files').abspath]
207 paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/python_24').abspath]
209 # Prepend them so our tools come first.
210 for each in reversed(paths):
211 env.PrependENVPath('PATH', each)
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']
219 mtcom = 'echo Manifest creation disabled, since it breaks a lot.'
220 env['MANIFEST_COM'] = mtcom
221 env['SHMANIFEST_COM'] = mtcom
227 M4ARCH = (env['ARCH'] == 'i386' and 'x86' or '$ARCH'),
230 '-DPRODUCT_VERSION=$VERSION',
231 '-DPRODUCT_VERSION_MAJOR=$MAJOR',
232 '-DPRODUCT_VERSION_MINOR=$MINOR',
233 '-DPRODUCT_VERSION_BUILD=$BUILD',
234 '-DPRODUCT_VERSION_PATCH=$PATCH',
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)})"',
249 # SCons magic to make M4PATH work.
253 _M4INCFLAGS = ('${_concat(M4INCPREFIX, M4PATH, M4INCSUFFIX, '
254 '__env__, RDirs, TARGET, SOURCE)}'),
255 M4COM = '$M4 $M4FLAGS ${_M4INCFLAGS} $SOURCE > $TARGET',
258 # TODO: Dependency scanner for m4 files - doesn't work. It can't detect files
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)
265 # for include in includes:
267 # file = os.path.join(dir, include)
268 # if os.path.exists(file):
269 # ret_includes.append(file)
271 # return ret_includes
273 #m4_scanner = Scanner(function = m4_scan, skeys = ['.m4', '.html_m4'])
274 #env.Append(SCANNERS = m4_scanner)
277 # OS X Iceberg package builder
279 env.Replace(ICEBERG = '/usr/local/bin/freeze')
280 if env.WhereIs('$ICEBERG'):
281 env.Replace(ICEBERGCOM = '"$ICEBERG" -v $SOURCE')
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.')
289 iceberg_builder = Builder(action = '$ICEBERGCOM',
290 suffix = '.pkg', src_suffix = '.packproj')
291 env.Append(BUILDERS = {'Iceberg': iceberg_builder})
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.
304 '$THIRD_PARTY_DIR/googleurl',
305 '$THIRD_PARTY_DIR/npapi',
306 '$THIRD_PARTY_DIR/zlib',
307 '$THIRD_PARTY_DIR/v8/bindings_local',
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.
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',
331 if env['MODE'] == 'dbg':
337 M4FLAGS = '-DDEBUG=1',
341 CPPDEFINES = 'NDEBUG=1',
342 M4FLAGS = '-DNDEBUG=1',
344 if env['USING_CCTESTS']:
346 CPPDEFINES = 'USING_CCTESTS=1',
347 M4FLAGS = '-DUSING_CCTESTS=1',
349 if env['OFFICIAL_BUILD']:
351 CPPDEFINES = 'OFFICIAL_BUILD=1',
352 M4FLAGS = '-DOFFICIAL_BUILD=1',
354 if env['GEARS_STATIC_LIB']:
356 CPPDEFINES = 'GEARS_STATIC_LIB=1',
359 # TODO: if USING_LIBPNG
363 'CHROME_PNG_WRITE_SUPPORT',
366 if not env['GEARS_STATIC_LIB']:
367 # If we're not linking with Chrome, don't prefix all the symbols with
369 env.Append(CPPDEFINES = ['GEARS_PNG_BUILD'])
372 # TODO: if USING_ZLIB
379 if env['OS'] == 'wince':
380 env.Append(CPPDEFINES = 'NO_ERRNO_H')
384 env['I18N_LANGS'] = [
440 # Platform-specific flags follow.
442 if env['OS'] in ['win32', 'wince']:
443 env.Replace(ARFLAGS = [])
452 '_CRT_SECURE_NO_DEPRECATE',
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).
458 '_ATL_NO_EXCEPTIONS',
459 # Do not export UTF functions.
460 'U_STATIC_IMPLEMENTATION',
466 # Shared lib and exe flags.
471 '/PDB:${TARGET.base}.pdb',
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.
486 '/Fd"${TARGET.base}.pdb"',
494 '$THIRD_PARTY_DIR/breakpad/src',
497 '/Zi', # TODO: Chrome defines /Z7, no idea what these are.
503 if env['OS'] == 'win32':
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
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
518 '_WIN32_WINNT=0x0500',
520 '_RICHEDIT_VER=0x0010',
522 'BREAKPAD_AVOID_STREAMS',
530 '/NODEFAULTLIB:msvcrt',
531 # Flags for security hardening (only available for win32, not wince).
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',
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',
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',
557 # For Windows Mobile we need:
558 # C defines: _WIN32_WCE=0x0501
564 'WIN32_PLATFORM_PSPC',
567 'POCKETPC2003_UI_MODEL',
568 '_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA',
569 '_CE_CRT_ALLOW_WIN_MINMAX',
576 '/NODEFAULTLIB:secchk.lib',
577 '/NODEFAULTLIB:oldnames.lib',
580 '/SUBSYSTEM:WINDOWSCE,5.01',
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',
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',
595 if env['MODE'] == 'dbg':
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.
622 #--------------------------- LINUX ---------------------------
623 elif env['OS'] == 'linux':
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',
639 '-fmessage-length=0',
642 # NS_LITERAL_STRING does not work properly without this compiler option
644 # Additions to compile on hardy
645 '-Wno-unused-variable',
646 '-Wno-missing-braces',
653 '-Wno-non-virtual-dtor',
654 '-Wno-ctor-dtor-privacy',
656 '-Wno-char-subscripts',
665 '-Wl,--version-script',
666 '-Wl,$OPEN_DIR/tools/xpcom-ld-script',
667 # Additions to compile on hardy
671 if env['MODE'] == 'dbg':
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'
693 env.Append(OSX_SDK_ROOT = '/Developer/SDKs/MacOSX10.4u.sdk')
700 'USE_PROTECTED_ALLOCATIONS=1',
703 # Breakpad assumes it is in the include path
704 '$THIRD_PARTY_DIR/breakpad_osx/src',
707 '-mmacosx-version-min=10.4',
711 '-fmessage-length=0',
714 # NS_LITERAL_STRING does not work properly without this compiler option
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.
723 '-fvisibility-inlines-hidden',
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',
737 ('-include', env.File('#/$OPEN_DIR/base/safari/prefix_header.h').abspath),
738 ('-isysroot', '$OSX_SDK_ROOT')
741 '-mmacosx-version-min=10.4',
746 ('-isysroot', '$OSX_SDK_ROOT'),
750 '-bundle', # DLLFLAGS
759 '-DGEARS_ENABLER_PATH="$SF_INPUTMANAGER_BUNDLE"',
760 '-DGEARS_PLUGIN_PATH="$SF_PLUGIN_PROXY_BUNDLE"',
761 '-DGEARS_INSTALLER_OUT_DIR="$INSTALLER_OUTDIR/Safari"',
764 '-DKEYSTONE_BASE_DIR="$MAIN_DIR/$PRIVATE_THIRD_PARTY_DIR/googlemac/Releases/Keystone/"',
765 '-DGEARS_INSTALLER_PACKAGE="$SF_INSTALLER_PKG"',
766 '-DGEARS_GENFILES_DIR="$SF_OUTDIR/genfiles"',
767 '-DGEARS_TOOLS_DIR="$MAIN_DIR/$PRIVATE_DIR/tools"',
770 if env['MODE'] == 'dbg':
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.")
790 if not os.environ['ANDROID_TOOLCHAIN']:
791 print ("Cannot determine location of the target toolchain."
792 " Please set ANDROID_TOOLCHAIN manually.")
795 env['ANDROID_BUILD_TOP'] = os.environ['ANDROID_BUILD_TOP']
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:
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:
813 env['CC'] = cross_prefix + 'gcc'
814 env['CXX'] = cross_prefix + 'g++'
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',
859 '-fmessage-length=0',
861 '-fvisibility=hidden',
862 # NS_LITERAL_STRING does not work properly without this compiler option
868 '-ffunction-sections',
874 '-fvisibility-inlines-hidden',
875 '-Wno-non-virtual-dtor',
876 '-Wno-ctor-dtor-privacy',
882 'BUILD_OSNAME=android',
885 '__SGI_STL_INTERNAL_PAIR_H',
887 '_LITTLE_ENDIAN=1234',
890 '_BYTE_ORDER=_LITTLE_ENDIAN',
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',
909 if env['MODE'] == 'dbg':
923 '-fomit-frame-pointer',
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])
935 env.AddMethod(GearsStaticLibrary)
937 # Load all the components
940 'SConscript.googleurl',
941 'SConscript.libjpeg',
943 'SConscript.libmozjs',
946 'SConscript.libbreakpad_osx',
950 for each in sconscripts:
953 variant_dir='$COMMON_OUTDIR',
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'])
960 outputs = env.SConscript('SConscript.common',
962 variant_dir='$COMMON_OUTDIR',
964 env.Append(**outputs)
966 browsers = [env['BROWSER']]
967 if browsers[0] == 'all':
968 browsers = env['VALID_BROWSERS']
969 print 'Building:', browsers
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',
978 variant_dir='$BROWSER_OUTDIR',
981 for key, value in outputs.iteritems():
982 browser_outputs[each + '_' + key] = value
983 env.Append(**browser_outputs)
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',
989 variant_dir='$BASE_OUTDIR',
992 env.Alias('gears-installers', 'gears')