diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 17:35:35 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 17:35:35 +0000 |
commit | c04558992dcba248ff8477021addf14b3b5b74f6 (patch) | |
tree | 7908abf3a882071017f2681c3fb97b8bd8d340e4 /gears | |
parent | 9333f1812b353233e6c492a6dfe7efb3a03717a3 (diff) | |
download | chromium_src-c04558992dcba248ff8477021addf14b3b5b74f6.zip chromium_src-c04558992dcba248ff8477021addf14b3b5b74f6.tar.gz chromium_src-c04558992dcba248ff8477021addf14b3b5b74f6.tar.bz2 |
First pass at adding support for building Android via scons.
Review URL: http://codereview.chromium.org/13644
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gears')
-rw-r--r-- | gears/SConscript | 147 | ||||
-rw-r--r-- | gears/SConscript.browser | 46 | ||||
-rwxr-xr-x | gears/SConscript.inputs | 51 | ||||
-rw-r--r-- | gears/SConscript.libmozjs | 64 |
4 files changed, 243 insertions, 65 deletions
diff --git a/gears/SConscript b/gears/SConscript index acf0723..9ad25c2 100644 --- a/gears/SConscript +++ b/gears/SConscript @@ -765,6 +765,149 @@ elif env['OS'] == 'osx': '-O2', ], ) +#--------------------------- ANDROID --------------------------- +elif env['OS'] == 'android': + if not os.environ['ANDROID_BUILD_TOP']: + print ("Please set ANDROID_BUILD_TOP to the top" + " level of your Android source.") + Return() + + if not os.environ['ANDROID_TOOLCHAIN']: + print ("Cannot determine location of the target toolchain." + " Please set ANDROID_TOOLCHAIN manually.") + Return() + + env['ANDROID_BUILD_TOP'] = os.environ['ANDROID_BUILD_TOP'] + + # Figure out the cross-compile prefix by finding the *-gcc executable + # and taking the '*' as the prefix for the rest. + cross_prefix_command = os.popen( + r"ls %s/*-gcc | sed 's|\(.*/.*\-\)gcc|\1|g'" % + os.environ['ANDROID_TOOLCHAIN']) + cross_prefix = cross_prefix_command.read().strip() + if cross_prefix_command.close() != None: + Return() + + # Find the output directory. Assume the only target output directory. + product_out_command = os.popen("ls %s/out/target/product/*" % + os.environ['ANDROID_BUILD_TOP']) + product_out = product_out_command.read().strip() + if product_out_command.close() != None: + Return() + + env['CC'] = cross_prefix + 'gcc' + env['CXX'] = cross_prefix + 'g++' + + env.Append( + CPPPATH = [ + '$OPEN_DIR/base/android', + '$THIRD_PARTY_DIR/stlport/stlport', + '$THIRD_PARTY_DIR/stlport/stlport/stl', + '$THIRD_PARTY_DIR/stlport/stlport/stl/config', + '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include', + '$ANDROID_BUILD_TOP/include', + '$ANDROID_BUILD_TOP/include/nativehelper', + '$ANDROID_BUILD_TOP/system', + '$ANDROID_BUILD_TOP/system/bionic/include', + '$ANDROID_BUILD_TOP/system/bionic/arch-arm/include', + '$ANDROID_BUILD_TOP/system/kernel_headers', + '$ANDROID_BUILD_TOP/system/bionic/kernel/arch-arm', + '$ANDROID_BUILD_TOP/system/bionic/kernel/common', + '$ANDROID_BUILD_TOP/system/libm/include ', + '$ANDROID_BUILD_TOP/bionic', + '$ANDROID_BUILD_TOP/bionic/libc/include', + '$ANDROID_BUILD_TOP/bionic/libc/arch-arm', + '$ANDROID_BUILD_TOP/bionic/libc/arch-arm/include', + '$ANDROID_BUILD_TOP/bionic/libc/kernel/arch-arm', + '$ANDROID_BUILD_TOP/bionic/libc/kernel/common', + '$ANDROID_BUILD_TOP/bionic/libm/include', + '$ANDROID_BUILD_TOP/dalvik/libnativehelper/include', + '$ANDROID_BUILD_TOP/extlibs', + '$ANDROID_BUILD_TOP/extlibs/icu4c-3.8/common', + '$ANDROID_BUILD_TOP/extlibs/icu4c-3.8/i18n', + '$ANDROID_BUILD_TOP/extlibs/jpeg-6b', + '$ANDROID_BUILD_TOP/extlibs/sqlite', + '$ANDROID_BUILD_TOP/extlibs/zlib-1.2.3', + '$ANDROID_BUILD_TOP/external', + '$ANDROID_BUILD_TOP/external/icu4c/common', + '$ANDROID_BUILD_TOP/external/icu4c/i18n', + '$ANDROID_BUILD_TOP/external/jpeg', + '$ANDROID_BUILD_TOP/external/sqlite/dist', + '$ANDROID_BUILD_TOP/external/zlib', + '$ANDROID_BUILD_TOP/frameworks/base/include', + '$ANDROID_BUILD_TOP/system/core/include', + ], + CPPFLAGS = [ + '-g', + '-c', + '-fPIC', + '-fmessage-length=0', + '-Wall', + '-fvisibility=hidden', +# NS_LITERAL_STRING does not work properly without this compiler option + '-fshort-wchar', + '-funsigned-char', + '-march=armv5te', + '-mtune=xscale', + '-mthumb-interwork', + '-ffunction-sections', + '-fdata-sections', + '-fno-exceptions', + ], + CXXFLAGS = [ + '-fno-rtti', + '-fvisibility-inlines-hidden', + '-Wno-non-virtual-dtor', + '-Wno-ctor-dtor-privacy', + ], + CPPDEFINES = [ + 'OS_ANDROID', + 'ANDROID', + 'TARGET_OS=android', + 'BUILD_OSNAME=android', + 'OSNAME=android', + 'COMPILER_NAME=gcc', + '__SGI_STL_INTERNAL_PAIR_H', + '_CPP_UTILITY', + '_LITTLE_ENDIAN=1234', + '_BIG_ENDIAN=4321', + '_PDP_ENDIAN=3412', + '_BYTE_ORDER=_LITTLE_ENDIAN', + ], + COMMON_LINKFLAGS = [ + '-g', + '-fPIC', + '-Bsymbolic', + '-nostdlib', + ], + SHLINKFLAGS = [ + '-shared', + '-Wl,--gc-sections', + '-L$ANDROID_PRODUCT_OUT/system/lib', +# Workaround for the Android C library not implementing +# __aeabi_atexit, which is used to destruct static C++ objects. This +# causes all calls to be rewritten by the linker to +# __wrap___aeabi_atexit, which we then implement. + '-Wl,--wrap,__aeabi_atexit', + ], + ) + if env['MODE'] == 'dbg': + env.Append( + CPPFLAGS = [ + '-g', + '-O', + '-funwind-tables', + '-mapcs-frame', + ], + ) + else: # MODE=opt + env.Append( + CPPFLAGS = [ + '-O2', + '-mthumb', + '-fomit-frame-pointer', + ], + ) # Custom builder to work around a scons and/or hammer bug. ComponentLibrary # tries to install the library to COMPONENT_LIBRARY_DIR, but since we overrode @@ -790,10 +933,6 @@ 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'], diff --git a/gears/SConscript.browser b/gears/SConscript.browser index f622603..fab0166 100644 --- a/gears/SConscript.browser +++ b/gears/SConscript.browser @@ -218,6 +218,20 @@ if not env['OFFICIAL_BUILD']: 'jpeg-gears', ]) +if env['OS'] == 'android': + env.Append(LIBS = [ + 'mozjs-gears', + ]) + env.FilterOut(LIBS = [ + 'googleurl-gears', + 'sqlite-gears', + 'portaudio', + 'png-gears', + 'zlib-gears', + 'jpeg-gears', + 'gd', + ]) + if env['BROWSER'] == 'IE': if env['OS'] == 'win32': env.Append( @@ -308,15 +322,16 @@ elif env['BROWSER'] in ['FF2', 'FF3']: FF3_LIBS = ['xpcomglue_s'], ) elif env['BROWSER'] == 'NPAPI': - env.Append( - LIBS = [ - 'delayimp.lib', - 'comdlg32.lib', - ], - SHLINKFLAGS = [ - '/DELAYLOAD:"comdlg32.dll"', - ], - ) + if env['OS'] == 'win32': + env.Append( + LIBS = [ + 'delayimp.lib', + 'comdlg32.lib', + ], + SHLINKFLAGS = [ + '/DELAYLOAD:"comdlg32.dll"', + ], + ) # Building resources. @@ -429,12 +444,13 @@ for src in GetInputs('$BROWSER_IDLSRCS'): if env['BROWSER'] in ['FF2', 'FF3']: outputs['MODULE_TYPELIB'] = env.XptLink('gears.xpt', xptsrcs) -# genfiles/%.res: %.rc -env.Append(BROWSER_SHLINKSRCS = [ - [env_res.RES( - *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.res', src)) - for src in GetInputs('$BROWSER_RESSRCS')] -]) +if env_res: + # genfiles/%.res: %.rc + env.Append(BROWSER_SHLINKSRCS = [ + [env_res.RES( + *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.res', src)) + for src in GetInputs('$BROWSER_RESSRCS')] + ]) # TODO: figure out why the .rc scanner doesn't notice these dependencies. if env['OS'] in ['win32', 'wince'] and env['BROWSER'] in ['NPAPI', 'IE']: diff --git a/gears/SConscript.inputs b/gears/SConscript.inputs index dac9884..1efe16b 100755 --- a/gears/SConscript.inputs +++ b/gears/SConscript.inputs @@ -196,13 +196,14 @@ env.Append(SF_CPPSRCS = [ #----------------------------------------------------------------------------- # third_party/v8/bindings -env.Append(NPAPI_CPPSRCS = [ - '$THIRD_PARTY_DIR/v8/bindings_local/npruntime.cc', - '$THIRD_PARTY_DIR/v8/bindings_local/np_v8object.cc', - '$THIRD_PARTY_DIR/v8/bindings_local/v8_helpers.cc', - '$THIRD_PARTY_DIR/v8/bindings_local/v8_np_utils.cc', - '$THIRD_PARTY_DIR/v8/bindings_local/v8_npobject.cc', -]) +if env['OS'] == 'win32': + env.Append(NPAPI_CPPSRCS = [ + '$THIRD_PARTY_DIR/v8/bindings_local/npruntime.cc', + '$THIRD_PARTY_DIR/v8/bindings_local/np_v8object.cc', + '$THIRD_PARTY_DIR/v8/bindings_local/v8_helpers.cc', + '$THIRD_PARTY_DIR/v8/bindings_local/v8_np_utils.cc', + '$THIRD_PARTY_DIR/v8/bindings_local/v8_npobject.cc', + ]) #----------------------------------------------------------------------------- # third_party/convert_utf @@ -394,8 +395,6 @@ elif env['OS'] == 'wince': # base/chrome + npapi env.Append(NPAPI_CPPSRCS = [ - '$OPEN_DIR/base/chrome/module_cr.cc', - '$OPEN_DIR/base/common/js_runner_cr.cc', '$OPEN_DIR/base/common/html_event_monitor_np.cc', '$OPEN_DIR/base/common/ipc_message_queue_linux.cc', '$OPEN_DIR/base/common/ipc_message_queue_null.cc', @@ -403,7 +402,6 @@ env.Append(NPAPI_CPPSRCS = [ '$OPEN_DIR/base/common/ipc_message_queue_test_linux.cc', '$OPEN_DIR/base/common/ipc_message_queue_test_win32.cc', '$OPEN_DIR/base/common/ipc_message_queue_win32.cc', - '$OPEN_DIR/base/common/paths_cr.cc', '$OPEN_DIR/base/npapi/browser_utils.cc', '$OPEN_DIR/base/npapi/module.cc', '$OPEN_DIR/base/npapi/np_utils.cc', @@ -414,6 +412,9 @@ env.Append(NPAPI_CPPSRCS = [ if env['OS'] == 'win32': env.Append(NPAPI_CPPSRCS = [ + '$OPEN_DIR/base/chrome/module_cr.cc', + '$OPEN_DIR/base/common/js_runner_cr.cc', + '$OPEN_DIR/base/common/paths_cr.cc', '$OPEN_DIR/base/common/detect_version_collision_win32.cc', '$OPEN_DIR/base/common/message_queue_cr.cc', '$OPEN_DIR/base/ie/ie_version.cc', @@ -509,9 +510,10 @@ env.Append(BROWSER_CPPSRCS = [ '$OPEN_DIR/desktop/shortcut_utils_win32.cc', ]) -env.Append(NPAPI_CPPSRCS = [ - '$OPEN_DIR/desktop/desktop_cr.cc', -]) +if env['OS'] == 'win32': + env.Append(NPAPI_CPPSRCS = [ + '$OPEN_DIR/desktop/desktop_cr.cc', + ]) env.Append(BROWSER_CPPSRCS = [ '$OPEN_DIR/desktop/file_dialog.cc', @@ -588,14 +590,18 @@ env.Append(SF_CPPSRCS = [ # localserver/chrome + npapi env.Append(NPAPI_CPPSRCS = [ - '$OPEN_DIR/localserver/chrome/gears_protocol_handler.cc', - '$OPEN_DIR/localserver/chrome/network_intercept_cr.cc', - '$OPEN_DIR/localserver/chrome/http_cookies_cr.cc', - '$OPEN_DIR/localserver/chrome/http_request_cr.cc', - '$OPEN_DIR/localserver/chrome/update_task_cr.cc', '$OPEN_DIR/localserver/npapi/async_task_np.cc', ]) +if env['OS'] == 'win32': + env.Append(NPAPI_CPPSRCS = [ + '$OPEN_DIR/localserver/chrome/gears_protocol_handler.cc', + '$OPEN_DIR/localserver/chrome/network_intercept_cr.cc', + '$OPEN_DIR/localserver/chrome/http_cookies_cr.cc', + '$OPEN_DIR/localserver/chrome/http_request_cr.cc', + '$OPEN_DIR/localserver/chrome/update_task_cr.cc', + ]) + #----------------------------------------------------------------------------- # localserver/safari @@ -710,10 +716,11 @@ env.Append(NPAPI_M4SRCS = [ #----------------------------------------------------------------------------- # ui/chrome -env.Append(NPAPI_CPPSRCS = [ - '$OPEN_DIR/ui/chrome/settings_dialog_cr.cc', - '$OPEN_DIR/ui/chrome/html_dialog_cr.cc', -]) +if env['OS'] == 'win32': + env.Append(NPAPI_CPPSRCS = [ + '$OPEN_DIR/ui/chrome/settings_dialog_cr.cc', + '$OPEN_DIR/ui/chrome/html_dialog_cr.cc', + ]) #----------------------------------------------------------------------------- # ui/safari diff --git a/gears/SConscript.libmozjs b/gears/SConscript.libmozjs index 0342b0f..23a311529 100644 --- a/gears/SConscript.libmozjs +++ b/gears/SConscript.libmozjs @@ -7,31 +7,49 @@ Import('env') env = env.Clone( ) -env.Append( - CPPDEFINES = [ - 'JS_THREADSAFE', - 'XP_UNIX', - 'DARWIN', - 'HAVE_BSD_FLOCK', - 'XP_MACOSX', - 'HAVE_LCHOWN', - 'HAVE_STRERROR', - 'FORCE_PR_LOG', - '_PR_PTHREADS', - 'UHAVE_CVAR_BUILT_ON_SEM', - '_NSPR_BUILD_', - 'OSARCH=Darwin', - 'STATIC_JS_API', - 'JS_USE_SAFE_ARENA', - 'TRIMMED', - 'JS_HAS_EXPORT_IMPORT' - ], - CPPPATH = '$MOZJS_INCLUDE_PATHS', -) +if env['OS'] == 'osx': + env.Append( + CPPDEFINES = [ + 'JS_THREADSAFE', + 'XP_UNIX', + 'DARWIN', + 'HAVE_BSD_FLOCK', + 'XP_MACOSX', + 'HAVE_LCHOWN', + 'HAVE_STRERROR', + 'FORCE_PR_LOG', + '_PR_PTHREADS', + 'UHAVE_CVAR_BUILT_ON_SEM', + '_NSPR_BUILD_', + 'OSARCH=Darwin', + 'STATIC_JS_API', + 'JS_USE_SAFE_ARENA', + 'TRIMMED', + 'JS_HAS_EXPORT_IMPORT' + ], + CPPPATH = '$MOZJS_INCLUDE_PATHS', + ) +elif env['OS'] == 'android': + env.Append( + CPPDEFINES = [ + 'JS_THREADSAFE', + 'XP_UNIX', + 'HAVE_STRERROR', + 'FORCE_PR_LOG', + '_PR_PTHREADS', + 'UHAVE_CVAR_BUILT_ON_SEM', + '_NSPR_BUILD_', + 'OSARCH=Android', + 'STATIC_JS_API', + 'JS_USE_SAFE_ARENA', + 'TRIMMED', + 'JS_HAS_EXPORT_IMPORT', + ], + CPPPATH = '$MOZJS_INCLUDE_PATHS', + ) input_files = [ # Common Files - '$MOZJS_DIR/nspr/pr/src/md/unix/darwin.c', '$MOZJS_DIR/js/src/jsapi.c', '$MOZJS_DIR/js/src/jsarena.c', '$MOZJS_DIR/js/src/jsarray.c', @@ -106,8 +124,6 @@ input_files = [ '$MOZJS_DIR/nspr/pr/src/md/unix/unix.c', '$MOZJS_DIR/nspr/pr/src/md/unix/unix_errors.c', '$MOZJS_DIR/nspr/pr/src/md/unix/uxproces.c', - '$MOZJS_DIR/nspr/pr/src/md/unix/os_Darwin_ppc.s', - '$MOZJS_DIR/nspr/pr/src/md/unix/os_Darwin_x86.s', ] if env['OS'] == 'osx': |