# Copyright (c) 2008 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import re Import('env') env = env.Clone( # The source directory relative to the build directory. SRC_DIR = '../../../..', ) # TODO: move all these builders out to site_scons or somesuch. # Building M4 files i18n_langs = [ 'en-US', 'ar', 'bg', 'ca', 'cs', 'da', 'de', 'el', 'en-GB', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'he', 'hi', 'hr', 'hu', 'id', 'is', 'it', 'ja', 'ko', 'lt', 'lv', 'ms', 'nl', 'no', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sk', 'sl', 'sr', 'sv', 'th', 'tr', 'uk', 'ur', 'vi', 'zh-CN', 'zh-TW', 'ml', 'te', 'gu', 'kn', 'or', 'bn', 'ta', 'mr', ] env.Append( M4ARCH = (env['ARCH'] == 'i386' and 'x86' or '$ARCH'), M4FLAGS = [ '--prefix-builtins', '-DPRODUCT_VERSION=$VERSION', '-DPRODUCT_VERSION_MAJOR=$MAJOR', '-DPRODUCT_VERSION_MINOR=$MINOR', '-DPRODUCT_VERSION_BUILD=$BUILD', '-DPRODUCT_VERSION_PATCH=$PATCH', '-DPRODUCT_OS=$OS', '-DPRODUCT_ARCH="$M4ARCH"', '-DPRODUCT_GCC_VERSION="gcc3"', '-DPRODUCT_MAINTAINER="google"', '-DPRODUCT_FRIENDLY_NAME_UQ="$FRIENDLY_NAME"', '-DPRODUCT_SHORT_NAME_UQ="$SHORT_NAME"', '-DI18N_LANGUAGES="(' + ','.join(i18n_langs) + ')"', ], M4PATH = [ '$OPEN_DIR', '$GEARS_DIR', ], ) # SCons magic to make M4PATH work. env.Replace( M4INCPREFIX = '-I', M4INCSUFFIX = '', _M4INCFLAGS = ('${_concat(M4INCPREFIX, M4PATH, M4INCSUFFIX, ' '__env__, RDirs, TARGET, SOURCE)}'), M4COM = '$M4 $M4FLAGS ${_M4INCFLAGS} $SOURCE > $TARGET', ) # TODO: Dependency scanner for m4 files - doesn't work. It can't detect files # that don't exist! #m4_include_re = re.compile(r'm4_include\((.*)\)', re.M) #def m4_scan(node, env, path): # contents = node.get_contents() # includes = m4_include_re.findall(contents) # ret_includes = [] # for include in includes: # for dir in path: # file = os.path.join(dir, include) # if os.path.exists(file): # ret_includes.append(file) # break # return ret_includes # #m4_scanner = Scanner(function = m4_scan, skeys = ['.m4', '.html_m4']) #env.Append(SCANNERS = m4_scanner) # Building .stab files, using M4FLAGS. env.Replace( STAB = 'python $OPEN_DIR/tools/parse_stab.py', I18N_INPUTS_BASEDIR = '$OPEN_DIR/ui/generated', STABCOM = \ '$STAB $M4FLAGS ${_M4INCFLAGS} $TARGET $SOURCE $I18N_INPUTS_BASEDIR', ) stab_builder = Builder(action = '$STABCOM', src_suffix = '.stab') env.Append(BUILDERS = {'Stab': stab_builder}) # Building .from_bin.cc files. # Must be run from within the gears dir. More hoops to jump through to fix up # path names and arguments. env.Replace( # OPEN_DIR looks like "./foo/bar", but we want the length of "foo/bar/". # TODO: is there a better way to strip off $OPEN_DIR from $SOURCE? LEN_OPEN_DIR = len(env.subst('$OPEN_DIR')) - 1, BIN2CPP = 'cd $OPEN_DIR && python tools/bin2cpp.py', BIN2CPPCOM = '$BIN2CPP ${str(SOURCE)[LEN_OPEN_DIR:]} > ${TARGET.abspath}', ) bin2cpp_builder = Builder(action = '$BIN2CPPCOM') env.Append(BUILDERS = {'Bin2cpp': bin2cpp_builder}) # Building .idl files. # This is a total mess. MIDL needs to be run from $OPEN_DIR because it's too # stupid to apply its include paths to a relative path like "ui/ie/bla.idl" # (it only looks in the current dir). So we have to jump through hoops to fix # up our relative include paths and output files. env.Tool('midl') if env['BROWSER'] == 'IE': env.Replace( IDLINCPREFIX = '/I$SRC_DIR', IDLINCSUFFIX = '', _IDLINCFLAGS = ('${_concat(IDLINCPREFIX, CPPPATH, IDLINCSUFFIX, ' '__env__, RDirs, TARGET, SOURCE)}'), IDLDEFPREFIX = '/D', IDLDEFSUFFIX = '', _IDLDEFFLAGS = ('${_defines(IDLDEFPREFIX, CPPDEFINES, ' 'IDLDEFSUFFIX, __env__)}'), MIDLCOM = ( 'cd $OPEN_DIR && ' '$MIDL ${_IDLDEFFLAGS} ${_IDLINCFLAGS} -env win32 -Oicf ' '/tlb $SRC_DIR/${TARGET.base}.tlb ' '/h $SRC_DIR/${TARGET.base}.h ' '/iid $SRC_DIR/${TARGET.base}_i.c ' '/proxy $SRC_DIR/${TARGET.base}_p.c ' '/dlldata $SRC_DIR/${TARGET.base}_data.c ' '$SRC_DIR/$SOURCE' ), ) elif env['BROWSER'] in ['FF2', 'FF3']: env.Replace( GECKO_SDK = '$GECKO_BASE/$OS', GECKO_BIN = '$GECKO_SDK/gecko_sdk/bin', GECKO_LIB = '$GECKO_SDK/gecko_sdk/lib', MIDLCOM = ( 'xpidl -I $GECKO_SDK/gecko_sdk/idl -I $GECKO_BASE ' '-m header -o ${TARGET.base} $SOURCE && ' 'xpidl -I $GECKO_SDK/gecko_sdk/idl -I $GECKO_BASE ' '-m typelib -o ${TARGET.base} $SOURCE' ), ) if env['BROWSER'] == 'FF2': env['GECKO_BASE'] = '$THIRD_PARTY_DIR/gecko_1.8' else: env['GECKO_BASE'] = '$THIRD_PARTY_DIR/gecko_1.9' env.PrependENVPath('PATH', env.Dir('$SRC_DIR/$GECKO_BIN').abspath) import SCons.Builder def MyIdlEmitter(target, source, env): """Produce the list of outputs generated by our IDL compiler. Outputs differ depending on whether we're using xpidl (Firefox) or midl (IE).""" base = os.path.splitext(str(target[0]))[0] if 'xpidl' in env['MIDLCOM']: # Firefox's IDL compiler only generates .h and .xpt files. target = [base + '.h', base + '.xpt'] else: # MIDL generates the following. Depending on the IDL, a .tlb is # generated, but since we can't know, we'll just ignore that. target = [base + '.h', base + '_i.c', base + '_p.c', base + '_data.c'] return (target, source) # Copy the builder object so we don't overwrite everyone's # emitter with ours. import copy env['BUILDERS']['TypeLibrary'] = copy.copy(env['BUILDERS']['TypeLibrary']) env['BUILDERS']['TypeLibrary'].emitter = MyIdlEmitter # C++ defines env_common = env.Clone() env_common.Prepend( ) env_browser = env.Clone() env_browser.Prepend( CPPDEFINES = [ 'BROWSER_${BROWSER}=1', # SpiderMonkey (the Firefox JS engine)'s JS_GET_CLASS macro in jsapi.h needs # this defined to work with the gecko SDK that we've built. # The definition of JS_THREADSAFE must be kept in sync with MOZJS_CPPFLAGS. # TODO(mpcomplete): we only need this for FF and SF, I think. 'JS_THREADSAFE', ], ) if env['BROWSER'] in ['FF2', 'FF3']: env_browser.Prepend( CPPDEFINES = [ # TODO(cprince): Update source files so we don't need this compatibility define? 'BROWSER_FF=1', 'MOZILLA_STRICT_API', # SpiderMonkey (the Firefox JS engine)'s JS_GET_CLASS macro in jsapi.h needs # this defined to work with the gecko SDK that we've built. # The definition of JS_THREADSAFE must be kept in sync with MOZJS_CPPFLAGS. 'JS_THREADSAFE', ], CPPPATH = [ '$GECKO_BASE', '$GECKO_SDK', '$GECKO_SDK/gecko_sdk/include', ], ) elif env['BROWSER'] == 'NPAPI' and env['OS'] == 'win32': env_browser.Prepend( CPPDEFINES = [ 'BROWSER_CHROME=1', ], ) env_browser.Append( CPPPATH = [ # '$LIBPNG_DIR', # '$SKIA_DIR/include', # '$SKIA_DIR/include/corecg', # '$SKIA_DIR/platform', ], LIBS = [ # 'base', 'gd', 'googleurl-gears', # env_browser['ICU_LIBS'], # TODO(sgk): '$ICU_LIBS' when scons is fixed 'jpeg-gears', # 'modp_b64', 'png-gears', 'portaudio', 'sqlite-gears', # 'skia', 'zlib-gears', ], ) if env['BROWSER'] == 'IE': env_browser.Append( LIBS = [ 'kernel32.lib', 'user32.lib', 'gdi32.lib', 'uuid.lib', 'sensapi.lib', 'shlwapi.lib', 'shell32.lib', 'advapi32.lib', 'wininet.lib', 'comdlg32.lib', 'user32.lib', ], ) elif env['BROWSER'] in ['FF2', 'FF3']: env_browser.Append( LIBPATH = '$GECKO_LIB', LIBS = [ 'xpcom', 'xpcomglue_s', ], ) if env['OS'] == 'win32': env_browser.Append( LIBS = [ 'nspr4.lib', 'js3250.lib', 'ole32.lib', 'shell32.lib', 'shlwapi.lib', 'advapi32.lib', 'wininet.lib', 'comdlg32.lib', 'user32.lib', ], ) elif env['OS'] == 'linux': # Although the 1.9 SDK contains libnspr4, it is better to link against # libxul, which in turn depends on libnspr4. In Ubuntu 8.04, libnspr4 was # not listed in /usr/lib, only libxul was. env_browser.Append(LIBS = (env['BROWSER'] == 'FF2' and 'nspr4' or 'xul')) elif env['BROWSER'] == 'NPAPI': env_browser.Append( LIBS = [ 'delayimp.lib', 'comdlg32.lib', ], LINKFLAGS = [ '/DELAYLOAD:"comdlg32.dll"', ], ) # Building resources. env_res = env_browser.Clone() env_res.Replace( CPPDEFINES = [ '_UNICODE', 'UNICODE', 'BROWSER_${BROWSER}=1', ], CPPPATH = [ '$GENFILES_DIR/..', '$OPEN_DIR', '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include', ], ) if env['MODE'] == 'dbg': env_res.Append(CPPDEFINES = 'DEBUG=1') else: env_res.Append(CPPDEFINES = 'NDEBUG=1') if env['OS'] == 'win32': env_res.Append(RCFLAGS = ['/l', '0x409']) if env['OS'] == 'win32': env_browser.Append( CPPFLAGS = [ '/wd4018' # TODO: move to breakpad ], ) # Input file lists def NewInputs(): """Returns a new dictionary of input file lists. Browser-specific inputs are referenced by the browser name. All browsers include inputs from the 'all' list. 'common' inputs are built using env_common.""" return { 'all': [], 'common': [], 'IE': [], 'FF2': [], 'FF3': [], 'NPAPI': [], 'SF': [], } srcs = NewInputs() m4srcs = NewInputs() html_m4srcs = NewInputs() stabsrcs = NewInputs() idlsrcs = NewInputs() binsrcs = NewInputs() #----------------------------------------------------------------------------- # third_party/breakpad if env['OS'] == 'win32': srcs['NPAPI'] += [ '$THIRD_PARTY_DIR/breakpad/src/client/exception_handler_stub.cc', ] srcs['IE'] += [ '$THIRD_PARTY_DIR/breakpad/src/client/windows/handler/exception_handler.cc', '$THIRD_PARTY_DIR/breakpad/src/common/windows/guid_string.cc', '$OPEN_DIR/base/common/exception_handler_win32.cc', ] srcs['FF3'] += [ '$THIRD_PARTY_DIR/breakpad/src/client/windows/handler/exception_handler.cc', '$THIRD_PARTY_DIR/breakpad/src/common/windows/guid_string.cc', '$OPEN_DIR/base/common/exception_handler_win32.cc', ] #----------------------------------------------------------------------------- # third_party/v8/bindings srcs['NPAPI'] += [ '$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 srcs['all'] += [ '$THIRD_PARTY_DIR/convert_utf/ConvertUTF.c' ] #----------------------------------------------------------------------------- # third_party/jsoncpp srcs['all'] += [ '$THIRD_PARTY_DIR/jsoncpp/json_reader.cc', '$THIRD_PARTY_DIR/jsoncpp/json_value.cc', '$THIRD_PARTY_DIR/jsoncpp/json_writer.cc', ] #----------------------------------------------------------------------------- # third_party/modp_b64 srcs['all'] += [ '$THIRD_PARTY_DIR/modp_b64/modp_b64.cc', ] #----------------------------------------------------------------------------- # base/common m4srcs['common'] = [ '$OPEN_DIR/base/common/product_constants.h.m4', ] m4srcs['all'] = [ '$OPEN_DIR/base/common/product_version.rc.m4' ] srcs['all'] += [ '$OPEN_DIR/base/common/async_router.cc', '$OPEN_DIR/base/common/base_class.cc', '$OPEN_DIR/base/common/base64.cc', '$OPEN_DIR/base/common/byte_store.cc', '$OPEN_DIR/base/common/byte_store_test.cc', '$OPEN_DIR/base/common/circular_buffer_test.cc', '$OPEN_DIR/base/common/database_name_table.cc', '$OPEN_DIR/base/common/event.cc', '$OPEN_DIR/base/common/event_test.cc', '$OPEN_DIR/base/common/file.cc', '$OPEN_DIR/base/common/file_test.cc', '$OPEN_DIR/base/common/html_event_monitor.cc', '$OPEN_DIR/base/common/http_utils.cc', '$OPEN_DIR/base/common/js_dom_element.cc', '$OPEN_DIR/base/common/js_marshal.cc', '$OPEN_DIR/base/common/js_runner_utils.cc', '$OPEN_DIR/base/common/js_types.cc', '$OPEN_DIR/base/common/leak_counter.cc', '$OPEN_DIR/base/common/memory_buffer.cc', '$OPEN_DIR/base/common/memory_buffer_test.cc', '$OPEN_DIR/base/common/message_queue.cc', '$OPEN_DIR/base/common/message_service.cc', '$OPEN_DIR/base/common/message_service_test.cc', '$OPEN_DIR/base/common/mime_detect.cc', '$OPEN_DIR/base/common/mutex.cc', '$OPEN_DIR/base/common/mutex_posix.cc', '$OPEN_DIR/base/common/mutex_test.cc', '$OPEN_DIR/base/common/mutex_win32.cc', '$OPEN_DIR/base/common/name_value_table.cc', '$OPEN_DIR/base/common/name_value_table_test.cc', '$OPEN_DIR/base/common/paths.cc', '$OPEN_DIR/base/common/permissions_db.cc', '$OPEN_DIR/base/common/permissions_db_test.cc', '$OPEN_DIR/base/common/permissions_manager.cc', '$OPEN_DIR/base/common/position_table.cc', '$OPEN_DIR/base/common/process_utils_win32.cc', '$OPEN_DIR/base/common/png_utils.cc', '$OPEN_DIR/base/common/scoped_refptr_test.cc', '$OPEN_DIR/base/common/security_model.cc', '$OPEN_DIR/base/common/security_model_test.cc', '$OPEN_DIR/base/common/serialization.cc', '$OPEN_DIR/base/common/serialization_test.cc', '$OPEN_DIR/base/common/shortcut_table.cc', '$OPEN_DIR/base/common/sqlite_wrapper.cc', '$OPEN_DIR/base/common/sqlite_wrapper_test.cc', '$OPEN_DIR/base/common/stopwatch.cc', '$OPEN_DIR/base/common/stopwatch_posix.cc', '$OPEN_DIR/base/common/stopwatch_win32.cc', '$OPEN_DIR/base/common/string16.cc', '$OPEN_DIR/base/common/string_utils.cc', '$OPEN_DIR/base/common/string_utils_osx.cc', '$OPEN_DIR/base/common/string_utils_test.cc', '$OPEN_DIR/base/common/thread.cc', '$OPEN_DIR/base/common/thread_locals.cc', '$OPEN_DIR/base/common/thread_posix.cc', '$OPEN_DIR/base/common/thread_win32.cc', '$OPEN_DIR/base/common/timed_call.cc', '$OPEN_DIR/base/common/timed_call_test.cc', '$OPEN_DIR/base/common/url_utils.cc', '$OPEN_DIR/base/common/url_utils_test.cc', ] #----------------------------------------------------------------------------- # base/firefox m4srcs['FF3'] += [ '$OPEN_DIR/base/firefox/install.rdf.m4', ] idlsrcs['FF3'] += [ '$OPEN_DIR/base/firefox/interfaces.idl', ] srcs['FF3'] += [ '$OPEN_DIR/base/common/file_posix.cc', '$OPEN_DIR/base/common/file_win32.cc', '$OPEN_DIR/base/common/html_event_monitor_ff.cc', '$OPEN_DIR/base/common/ipc_message_queue_linux.cc', '$OPEN_DIR/base/common/ipc_message_queue_null.cc', '$OPEN_DIR/base/common/ipc_message_queue_test.cc', '$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/js_runner_ff.cc', '$OPEN_DIR/base/common/js_runner_ff_marshaling.cc', '$OPEN_DIR/base/common/message_queue_ff.cc', '$OPEN_DIR/base/common/paths_ff.cc', '$OPEN_DIR/base/common/time_utils_win32.cc', '$OPEN_DIR/base/firefox/dom_utils.cc', '$OPEN_DIR/base/firefox/module.cc', '$OPEN_DIR/base/firefox/ns_file_utils.cc', '$OPEN_DIR/base/firefox/xpcom_dynamic_load.cc', ] #----------------------------------------------------------------------------- # base/ie m4srcs['IE'] += [ '$OPEN_DIR/base/ie/bho.rgs.m4', '$OPEN_DIR/base/ie/interfaces.idl.m4', '$OPEN_DIR/base/ie/module.rgs.m4', ] idlsrcs['IE'] += [ '$GENFILES_DIR/interfaces.idl', ] srcs['IE'] += [ '$OPEN_DIR/base/ie/activex_utils.cc', '$OPEN_DIR/base/ie/bho.cc', '$OPEN_DIR/base/common/detect_version_collision_win32.cc', '$OPEN_DIR/base/ie/dispatcher_to_idispatch.cc', '$OPEN_DIR/base/common/ipc_message_queue_null.cc', '$OPEN_DIR/base/common/ipc_message_queue_test.cc', '$OPEN_DIR/base/common/ipc_message_queue_test_win32.cc', '$OPEN_DIR/base/common/ipc_message_queue_win32.cc', '$OPEN_DIR/base/common/js_runner_ie.cc', '$OPEN_DIR/base/common/message_queue_ie.cc', '$OPEN_DIR/base/ie/module.cc', '$OPEN_DIR/base/ie/module_wrapper.cc', '$OPEN_DIR/base/common/paths_ie.cc', '$OPEN_DIR/base/common/time_utils_win32.cc', '$OPEN_DIR/base/common/vista_utils.cc', ] if env['OS'] == 'win32': srcs['IE'] += [ '$OPEN_DIR/base/common/file_win32.cc', '$OPEN_DIR/base/common/html_event_monitor_ie.cc', '$OPEN_DIR/base/ie/ie_version.cc', ] elif env['OS'] == 'wince': srcs['IE'] += [ '$OPEN_DIR/base/common/common_ie.cc', '$OPEN_DIR/base/common/file_wince.cc', '$OPEN_DIR/base/common/wince_compatibility.cc', ] #----------------------------------------------------------------------------- # base/chrome + npapi srcs['NPAPI'] += [ '$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', '$OPEN_DIR/base/common/ipc_message_queue_test.cc', '$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', '$OPEN_DIR/base/npapi/npn_bindings.cc', '$OPEN_DIR/base/npapi/npp_bindings.cc', '$OPEN_DIR/base/npapi/plugin.cc', ] if env['OS'] == 'win32': srcs['NPAPI'] += [ '$OPEN_DIR/base/common/detect_version_collision_win32.cc', '$OPEN_DIR/base/common/file_win32.cc', '$OPEN_DIR/base/common/message_queue_cr.cc', '$OPEN_DIR/base/common/time_utils_win32.cc', '$OPEN_DIR/base/common/vista_utils.cc', '$OPEN_DIR/base/ie/ie_version.cc', ] #----------------------------------------------------------------------------- # console srcs['all'] += [ '$OPEN_DIR/console/console.cc', '$OPEN_DIR/console/js_callback_logging_backend.cc', ] #----------------------------------------------------------------------------- # canvas # The Canvas API is not yet enabled in official builds. if not env['OFFICIAL_BUILD'] and env['OS'] in ['win32', 'osx']: srcs['all'] += [ '$OPEN_DIR/canvas/blob_backed_skia_input_stream.cc', '$OPEN_DIR/canvas/blob_backed_skia_output_stream.cc', '$OPEN_DIR/canvas/canvas.cc', '$OPEN_DIR/canvas/canvas_rendering_context_2d.cc', ] #----------------------------------------------------------------------------- # database srcs['all'] += [ '$OPEN_DIR/database/database.cc', '$OPEN_DIR/database/database_utils.cc', '$OPEN_DIR/database/database_utils_test.cc', '$OPEN_DIR/database/result_set.cc', ] #----------------------------------------------------------------------------- # database2 srcs['all'] += [ '$OPEN_DIR/database2/connection.cc', '$OPEN_DIR/database2/commands.cc', '$OPEN_DIR/database2/database2.cc', '$OPEN_DIR/database2/database2_common.cc', '$OPEN_DIR/database2/database2_metadata.cc', '$OPEN_DIR/database2/interpreter.cc', '$OPEN_DIR/database2/manager.cc', '$OPEN_DIR/database2/result_set2.cc', '$OPEN_DIR/database2/statement.cc', '$OPEN_DIR/database2/transaction.cc', ] #----------------------------------------------------------------------------- # desktop srcs['all'] += [ '$OPEN_DIR/desktop/desktop.cc', '$OPEN_DIR/desktop/desktop_linux.cc', '$OPEN_DIR/desktop/desktop_osx.cc', '$OPEN_DIR/desktop/desktop_test.cc', '$OPEN_DIR/desktop/desktop_win32.cc', '$OPEN_DIR/desktop/dll_data_wince.cc', '$OPEN_DIR/desktop/drag_and_drop_registry.cc', '$OPEN_DIR/desktop/notification_message_orderer.cc', '$OPEN_DIR/desktop/shortcut_utils_win32.cc', ] srcs['NPAPI'] += [ '$OPEN_DIR/desktop/desktop_cr.cc', ] srcs['all'] += [ '$OPEN_DIR/desktop/file_dialog.cc', '$OPEN_DIR/desktop/file_dialog_gtk.cc', '$OPEN_DIR/desktop/file_dialog_osx.cc', '$OPEN_DIR/desktop/file_dialog_win32.cc', ] # The browser module also needs these files, to communicate with the notifier. srcs['all'] += [ '$OPEN_DIR/notifier/const_notifier.cc', '$OPEN_DIR/notifier/notifier_process_linux.cc', '$OPEN_DIR/notifier/notifier_process_posix.cc', '$OPEN_DIR/notifier/notifier_process_win32.cc', '$OPEN_DIR/notifier/notifier_proxy.cc', '$OPEN_DIR/notifier/notifier_utils_win32.cc', '$OPEN_DIR/notifier/notification.cc', ] srcs['FF3'] += [ '$OPEN_DIR/desktop/drop_target_ff.cc', ] srcs['IE'] += [ '$OPEN_DIR/desktop/drop_target_ie.cc', ] #----------------------------------------------------------------------------- # localserver/common srcs['all'] += [ '$OPEN_DIR/localserver/common/async_task_test.cc', '$OPEN_DIR/localserver/common/blob_store.cc', '$OPEN_DIR/localserver/common/capture_task.cc', '$OPEN_DIR/localserver/common/file_store.cc', '$OPEN_DIR/localserver/common/http_constants.cc', '$OPEN_DIR/localserver/common/localserver.cc', '$OPEN_DIR/localserver/common/localserver_db.cc', '$OPEN_DIR/localserver/common/localserver_perf_test.cc', '$OPEN_DIR/localserver/common/managed_resource_store.cc', '$OPEN_DIR/localserver/common/manifest.cc', '$OPEN_DIR/localserver/common/resource_store.cc', '$OPEN_DIR/localserver/common/update_task.cc', '$OPEN_DIR/localserver/common/update_task_single_process.cc', '$OPEN_DIR/localserver/file_submitter.cc', '$OPEN_DIR/localserver/localserver_module.cc', '$OPEN_DIR/localserver/managed_resource_store_module.cc', '$OPEN_DIR/localserver/resource_store_module.cc', ] srcs['IE'] += [ '$OPEN_DIR/localserver/common/http_cookies.cc', ] srcs['FF3'] += [ '$OPEN_DIR/localserver/common/http_cookies.cc', ] #----------------------------------------------------------------------------- # localserver/chrome + npapi # TODO: safari srcs['NPAPI'] += [ '$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/common/safe_http_request.cc', '$OPEN_DIR/localserver/npapi/async_task_np.cc', ] #----------------------------------------------------------------------------- # localserver/firefox srcs['FF3'] += [ '$OPEN_DIR/localserver/common/progress_event.cc', '$OPEN_DIR/localserver/common/safe_http_request.cc', '$OPEN_DIR/localserver/firefox/async_task_ff.cc', '$OPEN_DIR/localserver/firefox/cache_intercept.cc', '$OPEN_DIR/localserver/firefox/http_request_ff.cc', '$OPEN_DIR/localserver/firefox/progress_input_stream.cc', ] #----------------------------------------------------------------------------- # localserver/ie srcs['IE'] += [ '$OPEN_DIR/localserver/ie/async_task_ie.cc', '$OPEN_DIR/localserver/ie/file_submit_behavior.cc', '$OPEN_DIR/localserver/ie/http_handler_ie.cc', '$OPEN_DIR/localserver/ie/http_request_ie.cc', '$OPEN_DIR/localserver/common/progress_event.cc', '$OPEN_DIR/localserver/ie/progress_input_stream.cc', '$OPEN_DIR/localserver/ie/update_task_ie.cc', '$OPEN_DIR/localserver/ie/urlmon_utils.cc', ] #----------------------------------------------------------------------------- # installer m4srcs['common'] += [ '$OPEN_DIR/installer/npapi_msi.wxs.m4', ] #----------------------------------------------------------------------------- # dummy_module srcs['all'] += [ '$OPEN_DIR/dummy/dummy_module.cc', ] #----------------------------------------------------------------------------- # test srcs['all'] += [ '$OPEN_DIR/cctests/test.cc', ] #----------------------------------------------------------------------------- # ui/generated # # Anything with the _I18N suffix will be expanded for each language in # I18N_LANGS html_m4srcs['all'] += [ '$OPEN_DIR/ui/common/permissions_dialog.html_m4', '$OPEN_DIR/ui/common/settings_dialog.html_m4', '$OPEN_DIR/ui/common/shortcuts_dialog.html_m4', ] #TODO: $(IE_OUTDIR)/string_table.res #----------------------------------------------------------------------------- # ui/common (built for all browsers) srcs['all'] += [ '$OPEN_DIR/ui/common/html_dialog.cc', '$OPEN_DIR/ui/common/i18n_strings.cc', '$OPEN_DIR/ui/common/permissions_dialog.cc', '$OPEN_DIR/ui/common/window_utils.cc', ] srcs['IE'] += [ '$OPEN_DIR/ui/common/settings_dialog.cc', ] srcs['FF3'] += [ '$OPEN_DIR/ui/common/settings_dialog.cc', ] stabsrcs['all'] = [ '$OPEN_DIR/ui/common/permissions_dialog.js.stab', '$OPEN_DIR/ui/common/settings_dialog.js.stab', '$OPEN_DIR/ui/common/shortcuts_dialog.js.stab', ] #----------------------------------------------------------------------------- # ui/npapi # TODO: safari m4srcs['all'] += [ '$OPEN_DIR/ui/ie/ui_resources.rc.m4', ] #----------------------------------------------------------------------------- # ui/chrome srcs['NPAPI'] += [ '$OPEN_DIR/ui/chrome/settings_dialog_cr.cc', '$OPEN_DIR/ui/chrome/html_dialog_cr.cc', ] #----------------------------------------------------------------------------- # ui/factory m4srcs['FF3'] += [ '$OPEN_DIR/ui/firefox/browser-overlay.js.m4', '$OPEN_DIR/ui/firefox/browser-overlay.xul.m4', '$OPEN_DIR/ui/firefox/chrome.manifest.m4', ] idlsrcs['FF3'] += [ '$OPEN_DIR/ui/firefox/ui_utils.idl', ] srcs['FF3'] += [ '$OPEN_DIR/ui/firefox/html_dialog_ff.cc', '$OPEN_DIR/ui/firefox/ui_utils.cc', ] #----------------------------------------------------------------------------- # ui/ie m4srcs['IE'] += [ '$OPEN_DIR/ui/ie/tools_menu_item.rgs.m4', '$OPEN_DIR/ui/ie/ui_resources.rc.m4', ] idlsrcs['IE'] += [ '$OPEN_DIR/ui/ie/html_dialog_host.idl', ] srcs['IE'] += [ '$OPEN_DIR/ui/ie/html_dialog_ie.cc', '$OPEN_DIR/ui/ie/tools_menu_item.cc', ] stabsrcs['IE'] += [ '$OPEN_DIR/ui/ie/string_table.rc.stab', ] # Additional files specific to Win32 or WinCE. if env['OS'] == 'win32': srcs['IE'] += [ '$OPEN_DIR/ui/ie/html_dialog_host.cc', ] elif env['OS'] == 'wince': m4srcs['IE'] += [ '$OPEN_DIR/ui/ie/html_dialog_bridge_iemobile.rgs.m4', ] idlsrcs['IE'] += [ '$OPEN_DIR/ui/ie/html_dialog_host_iemobile.idl', '$OPEN_DIR/ui/ie/html_dialog_bridge_iemobile.idl', ] srcs['IE'] += [ '$OPEN_DIR/ui/ie/html_dialog_host_iemobile.cc', '$OPEN_DIR/ui/ie/html_dialog_bridge_iemobile.cc', ] #----------------------------------------------------------------------------- # workerpool/npapi # TODO: safari srcs['NPAPI'] += [ '$OPEN_DIR/workerpool/common/workerpool_utils.cc', '$OPEN_DIR/workerpool/npapi/pool_threads_manager.cc', '$OPEN_DIR/workerpool/workerpool.cc', ] #----------------------------------------------------------------------------- # workerpool/firefox srcs['FF3'] += [ '$OPEN_DIR/workerpool/common/workerpool_utils.cc', '$OPEN_DIR/workerpool/firefox/pool_threads_manager.cc', '$OPEN_DIR/workerpool/workerpool.cc', ] #----------------------------------------------------------------------------- # workerpool/ie srcs['IE'] += [ '$OPEN_DIR/workerpool/common/workerpool_utils.cc', '$OPEN_DIR/workerpool/ie/pool_threads_manager.cc', '$OPEN_DIR/workerpool/workerpool.cc', ] #----------------------------------------------------------------------------- # timer srcs['all'] += [ '$OPEN_DIR/timer/timer.cc', ] #----------------------------------------------------------------------------- # httprequest srcs['all'] += [ '$OPEN_DIR/httprequest/httprequest.cc', '$OPEN_DIR/httprequest/httprequest_upload.cc', ] #----------------------------------------------------------------------------- # blob srcs['all'] += [ '$OPEN_DIR/blob/blob.cc', '$OPEN_DIR/blob/blob_builder.cc', '$OPEN_DIR/blob/blob_builder_module.cc', '$OPEN_DIR/blob/blob_interface.cc', '$OPEN_DIR/blob/blob_test.cc', '$OPEN_DIR/blob/blob_utils.cc', '$OPEN_DIR/blob/buffer_blob.cc', '$OPEN_DIR/blob/fail_blob.cc', '$OPEN_DIR/blob/file_blob.cc', '$OPEN_DIR/blob/join_blob.cc', '$OPEN_DIR/blob/slice_blob.cc', ] # TODO(bpm): Make this cross-browser, not Firefox- or Safari-specific. srcs['FF3'] += [ '$OPEN_DIR/blob/blob_input_stream_ff.cc', '$OPEN_DIR/blob/blob_input_stream_ff_test.cc', ] srcs['SF'] += [ '$OPEN_DIR/blob/blob_input_stream_sf.mm', '$OPEN_DIR/blob/blob_input_stream_sf_test.mm', ] #----------------------------------------------------------------------------- # inspector if not env['OFFICIAL_BUILD']: srcs['all'] += [ '$OPEN_DIR/inspector/inspector_resources.cc', ] binsrcs['common'] += [ '$OPEN_DIR/inspector/console.html', '$OPEN_DIR/inspector/database.html', '$OPEN_DIR/inspector/index.html', '$OPEN_DIR/inspector/localserver.html', '$OPEN_DIR/inspector/common/alert-35.png', '$OPEN_DIR/inspector/common/database.gif', '$OPEN_DIR/inspector/common/error-35.png', '$OPEN_DIR/inspector/common/ie6hacks.css', '$OPEN_DIR/inspector/common/inspector_links.js', '$OPEN_DIR/inspector/common/lightbulb-35.png', '$OPEN_DIR/inspector/common/localserver.gif', '$OPEN_DIR/inspector/common/question-35.png', '$OPEN_DIR/inspector/common/styles.css', '$OPEN_DIR/inspector/common/workerpool.gif', '$OPEN_DIR/sdk/gears_init.js', '$OPEN_DIR/ui/common/base.js', '$OPEN_DIR/ui/common/dom.js', '$OPEN_DIR/ui/common/icon_32x32.png', ] #----------------------------------------------------------------------------- # image # The Image API is not yet enabled in official builds. if not env['OFFICIAL_BUILD'] and env['OS'] != 'wince': srcs['all'] += [ '$OPEN_DIR/image/backing_image.cc', '$OPEN_DIR/image/image.cc', '$OPEN_DIR/image/image_loader.cc', ] #----------------------------------------------------------------------------- # factory/npapi srcs['NPAPI'] += [ '$OPEN_DIR/factory/factory_impl.cc', '$OPEN_DIR/factory/factory_np.cc', '$OPEN_DIR/factory/factory_utils.cc', ] #----------------------------------------------------------------------------- # factory/firefox srcs['FF3'] += [ '$OPEN_DIR/factory/factory_impl.cc', '$OPEN_DIR/factory/factory_ff.cc', '$OPEN_DIR/factory/factory_utils.cc', ] #----------------------------------------------------------------------------- # factory/ie m4srcs['IE'] += [ '$OPEN_DIR/factory/factory_ie.rgs.m4', ] srcs['IE'] += [ '$OPEN_DIR/factory/factory_impl.cc', '$OPEN_DIR/factory/factory_ie.cc', '$OPEN_DIR/factory/factory_utils.cc', ] #----------------------------------------------------------------------------- # geolocation srcs['all'] += [ '$OPEN_DIR/geolocation/empty_device_data_provider.cc', '$OPEN_DIR/geolocation/geolocation.cc', '$OPEN_DIR/geolocation/geolocation_db.cc', '$OPEN_DIR/geolocation/geolocation_db_test.cc', '$OPEN_DIR/geolocation/geolocation_test.cc', '$OPEN_DIR/geolocation/gps_location_provider_wince.cc', '$OPEN_DIR/geolocation/location_provider.cc', '$OPEN_DIR/geolocation/location_provider_pool.cc', '$OPEN_DIR/geolocation/network_location_provider.cc', '$OPEN_DIR/geolocation/network_location_request.cc', '$OPEN_DIR/geolocation/radio_data_provider_wince.cc', '$OPEN_DIR/geolocation/timed_callback.cc', '$OPEN_DIR/geolocation/wifi_data_provider_android.cc', '$OPEN_DIR/geolocation/wifi_data_provider_common.cc', '$OPEN_DIR/geolocation/wifi_data_provider_linux.cc', '$OPEN_DIR/geolocation/wifi_data_provider_osx.cc', '$OPEN_DIR/geolocation/wifi_data_provider_win32.cc', '$OPEN_DIR/geolocation/wifi_data_provider_wince.cc', '$OPEN_DIR/geolocation/wifi_data_provider_windows_common.cc', ] #----------------------------------------------------------------------------- # media # The Audio API has not been finalized for official builds. if not env['OFFICIAL_BUILD']: srcs['all'] += [ '$OPEN_DIR/media/audio.cc', '$OPEN_DIR/media/audio_recorder.cc', '$OPEN_DIR/media/audio_recorder_test.cc', '$OPEN_DIR/media/base_audio_recorder.cc', '$OPEN_DIR/media/media.cc', '$OPEN_DIR/media/media_data.cc', '$OPEN_DIR/media/mock_audio_recorder.cc', '$OPEN_DIR/media/pa_audio_recorder.cc', '$OPEN_DIR/media/time_ranges.cc', ] #----------------------------------------------------------------------------- # resources dll_resources = [] if env['OS'] == 'win32': ui_res = env_res.RES('$GENFILES_DIR/ui_resources.rc'), module_res = None if env['BROWSER'] == 'NPAPI': module_res = env_res.RES('$OPEN_DIR/base/npapi/module.rc') elif env['BROWSER'] == 'IE': module_res = env_res.RES('$OPEN_DIR/base/ie/module.rc') dll_resources += [ui_res] if module_res: dll_resources += [module_res] #----------------------------------------------------------------------------- # libs libs = [] if env['OS'] == 'win32': libs += [ '$THIRD_PARTY_DIR/skia/skia-${MODE}-${OS}-${ARCH}.lib', ] if env['BROWSER'] == 'NPAPI': libs += [ '$THIRD_PARTY_DIR/v8/bin-${MODE}/libv8core.lib', '$THIRD_PARTY_DIR/v8/bin-${MODE}/no_snapshotv8.lib', '$THIRD_PARTY_DIR/v8/bin-${MODE}/libjscre.lib', '$OPEN_DIR/base/chrome/module.def' ] elif env['BROWSER'] == 'IE': libs += ['$OPEN_DIR/tools/mscom.def'] # TODO: all the other ports, including third-party libs # - SAFARI, android, symbian # - breakpad[_osx] # - glint # - growl # - spidermonkey # - libspeex # - libtremor # - vista broker # TODO: other targets # - installer # - notifier # - ipc_tests # Now build the dependency tree. # Add any hard-coded "FF3_" sources to the FF2_ sources. srcs['FF2'] += srcs['FF3'] m4srcs['FF2'] += m4srcs['FF3'] html_m4srcs['FF2'] += html_m4srcs['FF3'] stabsrcs['FF2'] += stabsrcs['FF3'] idlsrcs['FF2'] += idlsrcs['FF3'] binsrcs['FF2'] += binsrcs['FF3'] # Add the target browser's inputs to the list files to build. srcs['all'] += srcs[env['BROWSER']] m4srcs['all'] += m4srcs[env['BROWSER']] html_m4srcs['all'] += html_m4srcs[env['BROWSER']] stabsrcs['all'] += stabsrcs[env['BROWSER']] idlsrcs['all'] += idlsrcs[env['BROWSER']] binsrcs['all'] += binsrcs[env['BROWSER']] def PatternRule(target, source, env=env): """Apply env substitution to a target with $SOURCE included. Returns a list containing the new target and source to pass to a builder.""" target_sub = env.subst(target, source=env.File(source)) return [target_sub, source] # genfiles/%: %.m4 m4s = [] m4s = [env_common.M4( *PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src)) for src in m4srcs['common']] m4s += [env_browser.M4( *PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src)) for src in m4srcs['all']] # genfiles/%.html: %.html_m4 html_m4s = [env_browser.M4( *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.html', src)) for src in html_m4srcs['all']] # genfiles/%.js: %.js.stab stabs = [env_browser.Stab( *PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src)) for src in stabsrcs['all']] # genfiles/%.html: %.js for stab in stabs: env_browser.Depends(*PatternRule('${SOURCE.base}.html', stab)) # genfiles/%.from_bin.cc: % bins = [env_common.Bin2cpp( *PatternRule('$GENFILES_DIR/${SOURCE.file}.from_bin.cc', src)) for src in binsrcs['common']] srcs['all'] += bins # genfiles/%.tlb: %.idl if idlsrcs['all']: idls = [env_browser.TypeLibrary( *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.tlb', src)) for src in idlsrcs['all']] srcs['all'] += [x for x in idls[0] if str(x).endswith('_i.c')] # TODO: figure out why the .rc scanner doesn't notice these dependencies. if env['OS'] == 'win32': env_browser.Depends(ui_res, html_m4s) env_browser.Depends(module_res, m4s) lib = env_browser.ChromeSharedLibrary('gears', srcs['all'] + libs + dll_resources) env_browser.Alias('gears', lib)