# Copyright (c) 2006-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(['env']) env_res = env.Clone() env_test = env.Clone() env = env.Clone() install_targets = [] grit_files = [] env.Prepend( CPPPATH = [ 'app', '$CHROME_DIR/third_party/wtl/include', ], ) # TODO(port) if env_res['PLATFORM'] == 'win32': env_res.Append( CPPDEFINES = [ 'GOOGLE_CHROME_BUILD', ], CPPPATH = [ '.', '$CHROME_SRC_DIR', # For app/chrome_dll.res to #include installer_util_strings.rc. '$CHROME_DIR/installer/util', ], RCFLAGS = [ ['/l', '0x409'], ], ) browser_res = env_res.RES('browser/browser_resources.rc') chrome_dll_res = env_res.RES('app/chrome_dll.rc') common_res = env_res.RES('common/common_resources.rc') debugger_res = env_res.RES('browser/debugger/resources/debugger_resources.rc') renderer_res = env_res.RES('renderer/renderer_resources.rc') test_data_res = env_res.RES('test/data/resource.rc') webkit_res = env_res.RES('$WEBKIT_DIR/glue/webkit_resources.rc') net_res = '$NET_DIR/net_resources.res' dll_resources = [ browser_res, chrome_dll_res, common_res, debugger_res, net_res, renderer_res, webkit_res, ] env_test['BROWSER_RES'] = browser_res[0] env_test['TEST_DATA_RES'] = test_data_res[0] env_dll = env.Clone() env_dll.Prepend( CPPPATH = [ "..", ], CPPDEFINES = [ 'U_STATIC_IMPLEMENTATION', 'PNG_USER_CONFIG', 'CHROME_PNG_WRITE_SUPPORT', 'GOOGLE_CHROME_BUILD', 'LIBXSLT_STATIC', 'LIBXML_STATIC', '_WINDLL', 'BROWSER_DLL', 'RENDERER_DLL', 'PLUGIN_DLL', ], CCFLAGS = [ '/TP', '/Wp64', ], ) env_dll.Append( CPPPATH = [ '$CHROME_DIR/app', '$LIBPNG_DIR', '$SKIA_DIR/include', '$SKIA_DIR/include/corecg', '$SKIA_DIR/platform', '$LIBXSL_DIR', '$LIBXML_DIR/DerivedSources/include', '$LIBXML_DIR/include', '$BREAKPAD_DIR/src', ], LIBS = [ 'base', 'base_gfx', 'breakpad_handler', 'googleurl', 'net', 'skia', 'bzip2', env_dll['ICU_LIBS'], # TODO(sgk): '$ICU_LIBS' when scons is fixed 'libjpeg', 'libpng', 'libxml', 'libxslt', 'modp_b64', 'zlib', 'activex_shim', 'WTF', 'V8Bindings', 'WebCore', 'default_plugin', 'glue', 'JavaScriptCore_pcre', 'port', ], ) if env_dll['PLATFORM'] == 'win32': env_dll.Append( LIBS = [ # TODO(sgk): to be ported to Mac and Linux 'sdch', 'comctl32.lib', 'dwmapi.lib', 'rpcrt4.lib', 'shlwapi.lib', 'winmm.lib', 'wsock32.lib', ], LINKFLAGS = [ '/INCREMENTAL', '/DEBUG', '/DELAYLOAD:"comdlg32.dll"', '/DELAYLOAD:"crypt32.dll"', '/DELAYLOAD:"cryptui.dll"', '/DELAYLOAD:"dwmapi.dll"', '/DELAYLOAD:"imagehlp.dll"', '/DELAYLOAD:"imm32.dll"', '/DELAYLOAD:"oleacc.dll"', '/DELAYLOAD:"oleaut32.dll"', '/DELAYLOAD:"psapi.dll"', '/DELAYLOAD:"urlmon.dll"', '/DELAYLOAD:"uxtheme.dll"', '/DELAYLOAD:"winhttp.dll"', '/DELAYLOAD:"wininet.dll"', '/DELAYLOAD:"winspool.drv"', '/DELAYLOAD:"ws2_32.dll"', '/DELAYLOAD:"wsock32.dll"', '/SUBSYSTEM:WINDOWS', '/BASE:"0x01000000"', '/MACHINE:X86', '/FIXED:No', '/safeseh', '/dynamicbase', '/ignore:4199', '/nxcompat', '/PDB:${TARGETS[1]}', '/IMPLIB:${TARGETS[2]}', ], ) input_files = [] if env_dll['PLATFORM'] == 'win32': input_files.extend([ 'app/chrome_dll_main.cc', '$V8_DIR/snapshot-empty$OBJSUFFIX', ]) libs = [ 'browser/browser.lib', 'browser/views/browser_views.lib', 'browser/debugger/debugger.lib', 'common/common.lib', 'installer/util/util.lib', 'libjscre.lib', 'plugin/plugin.lib', 'renderer/renderer.lib', 'third_party/hunspell/hunspell.lib', # TODO(sgk): libevent isn't used on Windows, revisit when Linux gets here #'third_party/libevent/libevent.lib', 'third_party/sqlite/sqlite.lib', 'views/views.lib', '$V8_DIR/v8.lib', ] # TODO(sgk): make a pseudo-Builder for these import sys sys.path.append(env.Dir('$CHROME_SRC_DIR/tools/grit').abspath) env_grd = env.Clone() env_grd.Tool('scons', toolpath=[env_grd.Dir('$CHROME_SRC_DIR/tools/grit/grit')]) # NOTE: fake target gets replaced with real targets from reading .grd generated = env_grd.GRIT('app/resources/fake_generated_target', '$CHROME_SRC_DIR/chrome/app/generated_resources.grd') grit_files.extend(generated) # NOTE: fake target gets replaced with real targets from reading .grd chromium = env_grd.GRIT('app/resources/fake_chromium_target', '$CHROME_SRC_DIR/chrome/app/chromium_strings.grd') grit_files.extend(chromium) # NOTE: fake target gets replaced with real targets from reading .grd google_chrome = env_grd.GRIT('app/resources/fake_google_chrome_target', '$CHROME_SRC_DIR/chrome/app/google_chrome_strings.grd') grit_files.extend(google_chrome) # TODO(port) if env_dll['PLATFORM'] == 'win32': dll_targets = env_dll.ChromeSharedLibrary('chrome.dll', dll_resources + input_files + libs, PDB='chrome_dll.pdb') install_targets.extend(dll_targets) for g in [ g for g in grit_files if str(g).endswith('.rc') ]: env_res.RES(g) def chrome_version_emitter(target, source, env): source.append(env.File('$CHROME_SRC_DIR/chrome/VERSION')) # TODO(sgk): parameterize for chromium-vs.-google_chrome source.append(env.File('$CHROME_SRC_DIR/chrome/app/theme/google_chrome/BRANDING')) return target, source b = Builder(action = '$CHROME_VERSION_RC_COM', emitter = chrome_version_emitter) env['BUILDERS']['ChromeVersionRC'] = b env.Replace( CHROME_VERSION_RC_COM = '$VERSION_BAT $SOURCE $CHROME_SRC_DIR/chrome $PWD $TARGET', VERSION_BAT = env.File( '$CHROME_SRC_DIR/chrome/tools/build/win/version.bat'), PWD = Dir('.'), ) chrome_exe_version_rc = env.ChromeVersionRC( 'chrome_exe_version.rc', 'app/chrome_exe_version.rc.version' ) chrome_dll_version_rc = env.ChromeVersionRC( 'chrome_dll_version.rc', 'app/chrome_dll_version.rc.version', ) Depends(chrome_dll_res, chrome_dll_version_rc) chrome_exe_version_res = env_res.RES(chrome_exe_version_rc) chrome_dll_version_res = env_res.RES(chrome_dll_version_rc) install_targets.extend(chrome_exe_version_rc) install_targets.extend(chrome_exe_version_res) install_targets.extend(chrome_dll_version_rc) install_targets.extend(chrome_dll_version_res) env_exe = env.Clone() env_exe.Prepend( CPPPATH = [ '..', '$BREAKPAD_DIR/src', ], LIBS = [ 'base', 'breakpad_handler', 'icu', 'sandbox', 'util', ], ) env_exe.Append( LINKFLAGS = [ '/INCREMENTAL', '/DELAYLOAD:"dwmapi.dll"', '/DELAYLOAD:"uxtheme.dll"', '/SUBSYSTEM:WINDOWS', '/MACHINE:X86', '/FIXED:No', '/safeseh', '/dynamicbase', '/ignore:4199', '/nxcompat', '/PDB:${TARGETS[1]}', '/IMPLIB:${TARGETS[2]}', ], ) # TODO(port) if env['PLATFORM'] == 'win32': chrome_exe = env_exe.ChromeProgram( 'chrome', [ env_res.RES('app/chrome_exe.rc'), 'app/breakpad.cc', 'app/chrome_exe_main.cc', 'app/client_util.cc', 'app/google_update_client.cc', 'common/common.lib', '$CHROME_DIR/chrome_dll.lib', ] ) install_targets.extend(chrome_exe) env.Requires(chrome_exe[0], ['$TARGET_ROOT/chrome.dll', '$TARGET_ROOT/icudt38.dll', '$TARGET_ROOT/rlz.dll', '$TARGET_ROOT/First Run']) env.Command('$TARGET_ROOT/First Run', '$CHROME_DIR/app/FirstRun', Copy('$TARGET', '$SOURCE')) # For release we want to run dependencies.py, may look something like: #env.AddPostAction('$TARGET_ROOT/chrome.exe', # '$PYTHON tools/build/win/dependencies.py $(TargetPath) chrome.exe.deps') env_flat = env.Clone( BROWSER_RESOURCES = Dir('browser_resources'), HTML_INLINE = env.File( '$CHROME_SRC_DIR/chrome/tools/build/win/html_inline.py'), FLATTEN_HTML_COM = '$PYTHON $HTML_INLINE $SOURCE $TARGET', ) def FlatHtmlEmitter(target, source, env): # When we get the target, it will have the "_flat.html" suffix, # but will be next to the sourcefile. Replace it with a # string that puts it in the $BROWSER_RESOURCES directory. target = [env.File('$BROWSER_RESOURCES/' + target[0].name)] return target, source env_flat['BUILDERS']['FlatHtml'] = Builder(action='$FLATTEN_HTML_COM', suffix='_flat.html', source_suffix='.html', emitter=FlatHtmlEmitter) flats = [ 'browser/resources/about_credits.html', 'browser/resources/about_memory.html', 'browser/resources/about_version.html', 'browser/resources/incognito_tab.html', 'browser/resources/new_tab.html', 'browser/resources/safe_browsing_malware_block.html', 'browser/resources/safe_browsing_phishing_block.html', 'browser/security/resources/ssl_error.html', 'browser/security/resources/ssl_roadblock.html', ] # TODO(port) if env_flat['PLATFORM'] == 'win32': flats_out = [] for i in flats: flats_out.extend(env_flat.FlatHtml(i)) # TODO(sgk): Remove when we upgrade to SCons 1.1.0, which # determines implicit dependencies from .rc files. env_flat.Depends(browser_res, flats_out) # TODO(port) env_test.Object('test/test_file_util.cc', CPPPATH=['..'] + env['CPPPATH']) test_sconscript_files = [ 'SConscript.unit_tests', ] # TODO(port) if env['PLATFORM'] == 'win32': test_sconscript_files.extend([ 'SConscript.automated_ui_tests', 'SConscript.ui_tests', ]) env.SConscript(test_sconscript_files, exports=['env_test']) sconscript_files = [ 'browser/SConscript', 'common/SConscript', 'plugin/SConscript', 'renderer/SConscript', 'test/chrome_plugin/SConscript', 'third_party/hunspell/SConscript', '$THIRD_PARTY_DIR/sqlite/SConscript', ] # TODO(port) if env['PLATFORM'] == 'win32': sconscript_files.extend([ 'app/resources/SConscript', 'app/theme/SConscript', 'browser/views/SConscript', 'installer/mini_installer/SConscript', 'installer/setup/SConscript', 'installer/util/SConscript', 'test/activex_test_control/SConscript', 'test/automation/SConscript', 'test/interactive_ui/SConscript', 'test/memory_test/SConscript', 'test/mini_installer_test/SConscript', 'test/page_cycler/SConscript', 'test/plugin/SConscript', 'test/reliability/SConscript', 'test/security_tests/SConscript', 'test/selenium/SConscript', 'test/startup/SConscript', 'test/tab_switching/SConscript', 'tools/crash_service/SConscript', 'tools/perf/flush_cache/SConscript', 'tools/test/image_diff/SConscript', 'views/SConscript', ]) env.SConscript(sconscript_files, exports=['env', 'env_res', 'env_test']) # TODO(port) if env['PLATFORM'] == 'win32': env.InstallAs('libjscre.lib', '$WEBKIT_DIR/JavaScriptCore_pcre.lib') i = env.Install('$TARGET_ROOT', install_targets) env.Alias('chrome', i) gears_plugins = [ '$GEARS_DIR/binaries/gears.dll', '$GEARS_DIR/binaries/gears.pdb', ] # TODO(port) if env['PLATFORM'] == 'win32': i = env.Install('$TARGET_ROOT/plugins/gears', gears_plugins) env.Alias('chrome', i) i = env.Command('$TARGET_ROOT/resources/inspector', '$CHROME_SRC_DIR/webkit/port/page/inspector', Copy('$TARGET', '$SOURCE'), source_scanner=DirScanner) env.Alias('chrome', i) env.Alias('chrome', env.Alias('webkit'))