# 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 = env.Clone() env_res = env.Clone() # We use the SCons addRepository() call (an internal API that will # at some point be made public) to "back" the build directory # hierarchy with the source directory hierarchies in which we want to # find the source .cpp and .h files. Think of this kind of like # Make's VPATH, but applied to entire directory hierarchies. The # upshot is that when searching for any file (source or target), # SCons will search the subdirectory hierarchies under the following # paths: # # webkit/Hammer/port/ # webkit/port/ # third_party/WebKit/WebCore # # SCons will replicate the compiler and linker -I and -L options so # that the tools will find the right .h and library files. This comes # at the cost of tripling the number of -I or -L options on a command # line, but with the benefit that the build should "just work" # regardless of which tree the file lives in, and regardless of whether # or not the file involved is a generated file or checked-in source. port_dir = env.Dir('$WEBKIT_DIR/port') port_dir.addRepository(env.Dir('$CHROME_SRC_DIR/webkit/port')) port_dir.addRepository(env.Dir('$CHROME_SRC_DIR/third_party/WebKit/WebCore')) if env['PLATFORM'] == 'win32': env['WEBKIT_PLATFORM_SUBDIR'] = 'win' env['JAVASCRIPTCORE_PLATFORM_SUBDIR'] = 'os-win32' elif env['PLATFORM'] == 'darwin': env['WEBKIT_PLATFORM_SUBDIR'] = 'mac' env['JAVASCRIPTCORE_PLATFORM_SUBDIR'] = 'TODO' elif env['PLATFORM'] == 'posix': env['JAVASCRIPTCORE_PLATFORM_SUBDIR'] = 'TODO' env.Append( CCFLAGS = [ '-Wno-parentheses', ], CPPDEFINES = [ # We want webkit to use pthreads rather than gthread. 'WTF_USE_PTHREADS=1', ], ) env.Prepend( CPPPATH = [ '$WEBKIT_DIR/build/localized_strings', '$WEBKIT_DIR/build/JSConfig/WebCore', # TODO(sgk): This directory was at this point in the /I list # in the Visual Studio build of the merged webkit. It breaks # the Linux build because of the pthread.h file there. # Leaving it out doesn't obviously break the Windows build, # but for now I'm leaving it commented out here in case it # introduced any hidden problems. #'$WEBKIT_DIR/build/JavaScriptCore', '$WEBKIT_DIR/build/WebCore', '$WEBKIT_DIR/port/platform/image-decoders', '$WEBKIT_DIR/port/platform/image-decoders/bmp', '$WEBKIT_DIR/port/platform/image-decoders/gif', '$WEBKIT_DIR/port/platform/image-decoders/ico', '$WEBKIT_DIR/port/platform/image-decoders/jpeg', '$WEBKIT_DIR/port/platform/image-decoders/png', '$WEBKIT_DIR/port/platform/image-decoders/xbm', '$ZLIB_DIR', '$LIBPNG_DIR', '$LIBJPEG_DIR', '$LIBXSLT_DIR', '$LIBXML_DIR/include', '$LIBXML_DIR/DerivedSources/include', '$ICU38_DIR/public/common', '$ICU38_DIR/public/i18n', '$SKIA_DIR/include', '$SKIA_DIR/include/corecg', '$SKIA_DIR/platform', '$NPAPI_DIR', '$V8_DIR/include', '$WEBKIT_DIR/V8Bindings/DerivedSources', '$WEBKIT_DIR/V8Bindings/SharedSources', '$WEBKIT_DIR/port/bindings/v8', '$WEBKIT_DIR/WebCore', '$WEBKIT_DIR/WebCore/JavaScriptHeaders', '$WEBKIT_DIR/WebCore/JavaScriptHeaders/JavaScriptCore', '$WEBKIT_DIR/pending', '$WEBKIT_DIR/pending/kjs', '$WEBKIT_DIR/pending/wtf', '$WEBKIT_DIR/port/bridge', '$WEBKIT_DIR/port/css', '$WEBKIT_DIR/port/dom', '$WEBKIT_DIR/port/editing', '$WEBKIT_DIR/port/history', '$WEBKIT_DIR/port/html', '$WEBKIT_DIR/port/loader', '$WEBKIT_DIR/port/loader/appcache', '$WEBKIT_DIR/port/loader/archive', '$WEBKIT_DIR/port/loader/icon', '$WEBKIT_DIR/port/page', '$WEBKIT_DIR/port/page/animation', '$WEBKIT_DIR/port/page/chromium', '$WEBKIT_DIR/port/platform', '$WEBKIT_DIR/port/platform/chromium', '$WEBKIT_DIR/port/platform/graphics', '$WEBKIT_DIR/port/platform/graphics/chromium', '$WEBKIT_DIR/port/platform/$WEBKIT_PLATFORM_SUBDIR', '$WEBKIT_DIR/port/svg/graphics', '$WEBKIT_DIR/port/platform/network', '$WEBKIT_DIR/port/platform/network/chromium', '$WEBKIT_DIR/port/platform/network/$WEBKIT_PLATFORM_SUBDIR', '$WEBKIT_DIR/port/platform/sql', '$WEBKIT_DIR/port/platform/text', '$WEBKIT_DIR/port/plugins', '$WEBKIT_DIR/port/plugins/chromium', '$WEBKIT_DIR/port/rendering', '$WEBKIT_DIR/port/rendering/style', '$WEBKIT_DIR/port/storage', '$WEBKIT_DIR/port/style', '$WEBKIT_DIR/port/xml', '$WEBKIT_DIR', '$WEBKIT_DIR/build/port', '$JAVASCRIPTCORE_DIR', '$JAVASCRIPTCORE_DIR/wtf', '$JAVASCRIPTCORE_DIR/$JAVASCRIPTCORE_PLATFORM_SUBDIR', '$WEBKIT_DIR/build', '$WEBKIT_DIR/port/DerivedSources', '$WEBKIT_DIR/port/svg', '$WEBKIT_DIR/port/svg/animation', '$WEBKIT_DIR/port/svg/graphics/filters', '$CHROME_SRC_DIR', ], ) env.Append( WEBCORE_DIR = "$THIRD_PARTY_WEBKIT_DIR/WebCore", PENDING_DIR = "$WEBKIT_DIR/pending", PORT_DIR = "$WEBKIT_DIR/port", JAVASCRIPTCORE_DIR = "$THIRD_PARTY_WEBKIT_DIR/JavaScriptCore", WTF_DIR = "$JAVASCRIPTCORE_DIR/wtf", KJS_DIR = "$JAVASCRIPTCORE_DIR/kjs", PCRE_DIR = "$JAVASCRIPTCORE_DIR/pcre", V8BINDINGS_DIR = "$WEBKIT_DIR/V8Bindings", DERIVED_DIR = env.Dir("$WEBKIT_DIR/V8Bindings/DerivedSources"), SHARED_DIR = env.Dir("$WEBKIT_DIR/V8Bindings/SharedSources"), # This is a stop gap to get linux building in time for the webkit # merge. The true fix is to move the above CPPPATH prepend under this # Append block and remove all the old pending directories (and add the new # upstream ones.) CPPPATH = [ '$WEBCORE_DIR/rendering', '$WEBCORE_DIR/rendering/style', '$WEBCORE_DIR/inspector', ], CPPDEFINES = [ 'U_STATIC_IMPLEMENTATION', '_SCL_SECURE_NO_DEPRECATE', '_SCL_SECURE_NO_WARNINGS', ['ENABLE_DATABASE', '0'], ['ENABLE_DASHBOARD_SUPPORT', '0'], ['ENABLE_JAVASCRIPT_DEBUGGER', '0'], ['ENABLE_JSC_MULTIPLE_THREADS', '0'], ['ENABLE_ICONDATABASE', '0'], ['ENABLE_XSLT', '1'], ['ENABLE_XPATH', '1'], ['ENABLE_SVG', '1'], ['ENABLE_SVG_ANIMATION', '1'], ['ENABLE_SVG_AS_IMAGE', '1'], ['ENABLE_SVG_USE', '1'], ['ENABLE_SVG_FOREIGN_OBJECT', '1'], ['ENABLE_SVG_FONTS', '1'], ['WEBCORE_NAVIGATOR_PLATFORM', '"\\"Win32\\""'], 'USE_GOOGLE_URL_LIBRARY', ['BUILDING_CHROMIUM__', '1'], 'CHROMIUM_BUILD', '_SECURE_ATL', 'LIBXSLT_STATIC', 'LIBXML_STATIC', 'PNG_USER_CONFIG', 'CHROME_PNG_WRITE_SUPPORT', ['__PRETTY_FUNCTION__', '__FUNCTION__'], 'DISABLE_ACTIVEX_TYPE_CONVERSION_MPLAYER2', '__STD_C', ['USE_SYSTEM_MALLOC', '1'], ], ) # This list is the SConscripts that work on Windows and Linux. sconscript_dirs = [ 'SConscript.port', 'SConscript.javascriptcore_pcre', 'build/JSConfig/SConscript', 'build/JavaScriptCore/SConscript', 'build/port/SConscript', 'build/V8Bindings/SConscript', 'build/WebCore/SConscript', 'default_plugin/SConscript', 'glue/SConscript', 'glue/plugins/test/SConscript', 'tools/npapi_layout_test_plugin/SConscript', 'tools/test_shell/SConscript', ] if env['PLATFORM'] == 'win32': # These extra dirs aren't win32-specific, they're just the dirs that # haven't yet been made portable. sconscript_dirs.extend([ 'activex_shim/SConscript', 'activex_shim_dll/SConscript', 'build/localized_strings/SConscript', ]) env.Append( CPPDEFINES = [ '_CRT_SECURE_NO_DEPRECATE', '_CRT_NONSTDC_NO_WARNINGS', '_CRT_NONSTDC_NO_DEPRECATE', ['CRASH', '__debugbreak'], '_WIN32_WINNT=0x0600', 'WINVER=0x0600', ]) env.Prepend( CPPPATH = [ '$WEBKIT_DIR/port/$JAVASCRIPTCORE_PLATFORM_SUBDIR', '$THIRD_PARTY_WEBKIT_DIR/JavaScriptCore/$JAVASCRIPTCORE_PLATFORM_SUBDIR', ]) else: env.Prepend( CPPPATH = ['$WEBKIT_DIR/build/JSConfig/WebCore/v8'], ) env.Append( CXXFLAGS = ['-Wno-multichar'], ) env.SConscript(sconscript_dirs, exports=['env', 'env_res']) # Setup alias for all webkit related targets. # We'd like to do this as follows, but it leads to out-of-memory # errors when SCons tries to use the entire contents of the # directory tree as a huge content-signature string. # Instead we're going to let all the subsidiary SConscript files # add their own individual targets to the 'webkit' Alias. #env.Alias('webkit', ['.', '$TARGET_ROOT/icudt38.dll']) if env['PLATFORM'] == 'win32': env.Alias('webkit', ['$TARGET_ROOT/icudt38.dll']) version = env.Command('$WEBKIT_DIR/build/WebCore/webkit_version.h', ['$WEBCORE_DIR/Configurations/Version.xcconfig', '$CHROME_SRC_DIR/webkit/build/webkit_version.py'], "$PYTHON ${SOURCES[1]} ${SOURCES[0]} ${TARGET.dir}") env.AlwaysBuild(version)