summaryrefslogtreecommitdiffstats
path: root/build/gyp_chromium
diff options
context:
space:
mode:
authorthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-08 20:09:23 +0000
committerthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-08 20:09:23 +0000
commit677b264168cf3285c4c20d839f2ac252577fe0e9 (patch)
tree0fb311d467041a48d3bf154440b171eabc5776bc /build/gyp_chromium
parent8eebfc8b3702430d5e6b8b6179b19bd3df627eb9 (diff)
downloadchromium_src-677b264168cf3285c4c20d839f2ac252577fe0e9.zip
chromium_src-677b264168cf3285c4c20d839f2ac252577fe0e9.tar.gz
chromium_src-677b264168cf3285c4c20d839f2ac252577fe0e9.tar.bz2
Add support for a chromium.gyp_env at the top of the tree (peer of src) so you
don't have to set a bunch of independent variables and can instead set things in a group per tree. BUG=none TEST=none Review URL: http://codereview.chromium.org/4705001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65408 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/gyp_chromium')
-rwxr-xr-xbuild/gyp_chromium32
1 files changed, 32 insertions, 0 deletions
diff --git a/build/gyp_chromium b/build/gyp_chromium
index 174ea29..2171770 100755
--- a/build/gyp_chromium
+++ b/build/gyp_chromium
@@ -18,6 +18,33 @@ chrome_src = os.path.normpath(os.path.join(script_dir, os.pardir))
sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
import gyp
+def apply_gyp_environment(file_path=None):
+ """
+ Reads in a *.gyp_env file and applies the valid keys to os.environ.
+ """
+ if not file_path or not os.path.exists(file_path):
+ return
+ file_contents = open(file_path).read()
+ try:
+ file_data = eval(file_contents, {'__builtins__': None}, None)
+ except SyntaxError, e:
+ e.filename = os.path.abspath(file_path)
+ raise
+ supported_vars = ( 'CHROMIUM_GYP_FILE',
+ 'CHROMIUM_GYP_SYNTAX_CHECK',
+ 'GYP_DEFINES',
+ 'GYP_GENERATOR_FLAGS',
+ 'GYP_GENERATOR_OUTPUT', )
+ for var in supported_vars:
+ val = file_data.get(var)
+ if val:
+ if var in os.environ:
+ print 'INFO: Environment value for "%s" overrides value in %s.' % (
+ var, os.path.abspath(file_path)
+ )
+ else:
+ os.environ[var] = val
+
def additional_include_files(args=[]):
"""
Returns a list of additional (.gypi) files to include, without
@@ -51,6 +78,11 @@ def additional_include_files(args=[]):
if __name__ == '__main__':
args = sys.argv[1:]
+ if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ:
+ # Update the environment based on chromium.gyp_env
+ gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env')
+ apply_gyp_environment(gyp_env_path)
+
# This could give false positives since it doesn't actually do real option
# parsing. Oh well.
gyp_file_specified = False