summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 23:23:52 +0000
committerevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 23:23:52 +0000
commit2c22c19660813c683eae115604c282c1f4044e6d (patch)
tree9e4b8b2c85830f66f77f977bc39ceefd006eac50
parent4f2ad3f5ab8550a404d4c70c29938c19110b3ecb (diff)
downloadchromium_src-2c22c19660813c683eae115604c282c1f4044e6d.zip
chromium_src-2c22c19660813c683eae115604c282c1f4044e6d.tar.gz
chromium_src-2c22c19660813c683eae115604c282c1f4044e6d.tar.bz2
Allow chromium to be built with some system libs by introducing
a variable called SYSTEM_LIBS, consisting of a comma-separated list of system libraries. So far, bzip2, libpng, libjpeg, libxml, libxslt, lzma_sdk, zlib, hunspell, sqlite, libevent are recognized. BUG=4321 Review URL: http://codereview.chromium.org/10626 Patch from Fabien Tassin <fta@sofaraway.org>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5320 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--AUTHORS1
-rw-r--r--build/SConscript.main73
-rw-r--r--chrome/SConscript7
-rw-r--r--chrome/tools/test/image_diff/SConscript2
-rw-r--r--third_party/bzip2/using_bzip2.scons2
-rw-r--r--third_party/libxml/using_libxml.scons4
-rw-r--r--webkit/tools/test_shell/SConscript4
7 files changed, 75 insertions, 18 deletions
diff --git a/AUTHORS b/AUTHORS
index 0df32b5..925742d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -20,3 +20,4 @@ Comodo CA Limited
Torchmobile Inc.
Craig Schlenter <craig.schlenter@gmail.com>
Ibrar Ahmed <ibrar.ahmad@gmail.com>
+Fabien Tassin <fta@sofaraway.org>
diff --git a/build/SConscript.main b/build/SConscript.main
index 0209417..60e86a9 100644
--- a/build/SConscript.main
+++ b/build/SConscript.main
@@ -29,6 +29,12 @@ else:
root_env = Environment(
tools = ['component_setup'],
+ # Requested list of system (shared) libraries, from the comma separated
+ # SYSTEM_LIBS command-line argument
+ req_system_libs = [],
+ # All supported system libraries, for the help message
+ all_system_libs = [],
+
CHROME_SRC_DIR = '$MAIN_DIR/..',
DESTINATION_ROOT = '$MAIN_DIR/Hammer',
TARGET_ROOT = '$DESTINATION_ROOT',
@@ -96,6 +102,16 @@ root_env = Environment(
'__env__, RDirs, TARGET, SOURCE)}'),
)
+root_env['req_system_libs'] = ARGUMENTS.get('SYSTEM_LIBS', '').split(',')
+
+def WantSystemLib(env, lib):
+ """
+ Return true if lib has been requested as a system library in SYSTEM_LIBS.
+ """
+ if lib not in env['all_system_libs']:
+ env['all_system_libs'].append(lib)
+ return (lib in env['req_system_libs'])
+root_env.AddMethod(WantSystemLib, "WantSystemLib")
def ChromeProgram(env, *args, **kw):
return env.ComponentProgram(*args, **kw)
@@ -209,18 +225,34 @@ if LoadComponent('testing'):
sconscripts.append('$TESTING_DIR/SConscript.gtest')
if LoadComponent('third_party'):
+ if not root_env.WantSystemLib('bzip2'):
+ sconscripts.append('$BZIP2_DIR/bzip2.scons')
+ root_env.Append(BZIP2_LIB = ['bzip2'])
+ else:
+ root_env.Append(BZIP2_LIB = ['bz2'])
+ if not root_env.WantSystemLib('libpng'):
+ sconscripts.append('$LIBPNG_DIR/libpng.scons')
+ if not root_env.WantSystemLib('libjpeg'):
+ sconscripts.append('$LIBJPEG_DIR/SConscript')
+ if not root_env.WantSystemLib('libxml'):
+ sconscripts.append('$LIBXML_DIR/SConscript')
+ root_env.Append(XML_LIB = ['libxml'])
+ else:
+ root_env.Append(XML_LIB = ['xml2'])
+ if not root_env.WantSystemLib('libxslt'):
+ sconscripts.append('$LIBXSLT_DIR/SConscript')
+ if not root_env.WantSystemLib('lzma_sdk'):
+ sconscripts.append('$LZMA_SDK_DIR/SConscript')
+ if not root_env.WantSystemLib('zlib'):
+ sconscripts.append('$ZLIB_DIR/zlib.scons')
+ root_env.Append(ZLIB_LIB = ['zlib'])
+ else:
+ root_env.Append(ZLIB_LIB = ['z'])
sconscripts.extend([
'$BSDIFF_DIR/SConscript',
- '$BZIP2_DIR/bzip2.scons',
'$DMG_FP_DIR/dmg_fp.scons',
'$ICU38_DIR/icu38.scons',
- '$LIBPNG_DIR/libpng.scons',
- '$LZMA_SDK_DIR/SConscript',
'$MODP_B64_DIR/modp_b64.scons',
- '$ZLIB_DIR/zlib.scons',
- '$LIBJPEG_DIR/SConscript',
- '$LIBXML_DIR/SConscript',
- '$LIBXSLT_DIR/SConscript',
'$BSPATCH_DIR/SConscript',
])
@@ -519,7 +551,20 @@ if root_env['PLATFORM'] in ['linux', 'linux2', 'posix']:
'#Software_Requirements')
sys.exit(1)
-
+ if root_env.WantSystemLib('libxml'):
+ try:
+ linux_env.ParseConfig('pkg-config --cflags --libs libxml-2.0')
+ except OSError, e:
+ print ('\n'
+ 'libxml requested in SYSTEM_LIBS but not found\n')
+ sys.exit(1)
+ if root_env.WantSystemLib('libxslt'):
+ try:
+ linux_env.ParseConfig('pkg-config --cflags --libs libxslt')
+ except OSError, e:
+ print ('\n'
+ 'libxslt requested in SYSTEM_LIBS but not found\n')
+ sys.exit(1)
# --------------------------------------------------------------------------
# Mac specific
@@ -560,10 +605,13 @@ mac_env.FilterOut(
],
)
-mac_env.Append(
+if not root_env.WantSystemLib('libevent'):
+ mac_env.Append(
BUILD_SCONSCRIPTS = [
'$LIBEVENT_DIR/libevent.scons',
],
+ )
+mac_env.Append(
CFLAGS = [
'-std=c99',
],
@@ -640,6 +688,10 @@ Supported build variables:
LOAD=[module,...] Comma-separated list of components to load in the
dependency graph ('-' prefix excludes):
%s
+ SYSTEM_LIBS=[lib,...] Comma-separated list of system libraries to link
+ dynamically (by default they are built in from
+ included sources):
+%s
PROGRESS=type Display a progress indicator:
name: print each evaluated target name
spinner: print a spinner every 5 targets
@@ -654,8 +706,9 @@ if GetOption('help'):
subsequent_indent = ' '*32,
)
components = tw.fill(', '.join(components))
+ all_system_libs = tw.fill(', '.join(env['all_system_libs']))
- Help(help_fmt % components)
+ Help(help_fmt % (components, all_system_libs))
Import('build_component')
diff --git a/chrome/SConscript b/chrome/SConscript
index d691dd9..e87e38d 100644
--- a/chrome/SConscript
+++ b/chrome/SConscript
@@ -392,10 +392,13 @@ if env_flat['PLATFORM'] == 'win32':
sconscript_files = [
'test/chrome_plugin/SConscript',
'tools/test/image_diff/SConscript',
- 'third_party/hunspell/SConscript',
- '$THIRD_PARTY_DIR/sqlite/SConscript',
]
+if not env.WantSystemLib('hunspell'):
+ sconscript_files.append('third_party/hunspell/SConscript')
+if not env.WantSystemLib('sqlite'):
+ sconscript_files.append('$THIRD_PARTY_DIR/sqlite/SConscript')
+
# TODO(port)
if env['PLATFORM'] == 'win32':
sconscript_files.extend([
diff --git a/chrome/tools/test/image_diff/SConscript b/chrome/tools/test/image_diff/SConscript
index 4a77cc2..b1cccf5 100644
--- a/chrome/tools/test/image_diff/SConscript
+++ b/chrome/tools/test/image_diff/SConscript
@@ -23,7 +23,7 @@ env_test.Prepend(
'libpng',
'base_gfx',
env_test['ICU_LIBS'], # TODO(sgk): '$ICU_LIBS' when scons is fixed
- 'zlib',
+ env_test['ZLIB_LIB'],
'base',
],
)
diff --git a/third_party/bzip2/using_bzip2.scons b/third_party/bzip2/using_bzip2.scons
index a7706f5..b41bca2 100644
--- a/third_party/bzip2/using_bzip2.scons
+++ b/third_party/bzip2/using_bzip2.scons
@@ -10,6 +10,6 @@ Import("env")
env.Append(
LIBS = [
- 'bzip2',
+ env['BZIP2_LIB'],
],
)
diff --git a/third_party/libxml/using_libxml.scons b/third_party/libxml/using_libxml.scons
index 7c7d7da..4a5c1329 100644
--- a/third_party/libxml/using_libxml.scons
+++ b/third_party/libxml/using_libxml.scons
@@ -17,7 +17,7 @@ env.Append(
'LIBXML_STATIC',
],
LIBS = [
- 'libxml',
+ env['XML_LIB'],
],
)
# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
@@ -39,6 +39,6 @@ env.Append(
'LIBXML_STATIC',
],
LIBS = [
- 'libxml',
+ env['XML_LIB'],
],
)
diff --git a/webkit/tools/test_shell/SConscript b/webkit/tools/test_shell/SConscript
index 66b252d..640e5b2 100644
--- a/webkit/tools/test_shell/SConscript
+++ b/webkit/tools/test_shell/SConscript
@@ -38,14 +38,14 @@ env.Append(
'sdch',
'skia',
'gtest',
- 'bzip2',
+ env['BZIP2_LIB'],
'V8Bindings',
'WebCore',
'WTF',
env['ICU_LIBS'], # TODO(sgk): '$ICU_LIBS' when scons is fixed
'libjpeg',
'libpng',
- 'libxml',
+ env['XML_LIB'],
'libxslt',
'modp_b64',
'zlib',