summaryrefslogtreecommitdiff
path: root/tools/gyp/pylib/gyp/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gyp/pylib/gyp/common.py')
-rw-r--r--tools/gyp/pylib/gyp/common.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/gyp/pylib/gyp/common.py b/tools/gyp/pylib/gyp/common.py
index d482a20df3..a1e1db5f12 100644
--- a/tools/gyp/pylib/gyp/common.py
+++ b/tools/gyp/pylib/gyp/common.py
@@ -425,13 +425,15 @@ def GetFlavor(params):
return 'freebsd'
if sys.platform.startswith('openbsd'):
return 'openbsd'
+ if sys.platform.startswith('netbsd'):
+ return 'netbsd'
if sys.platform.startswith('aix'):
return 'aix'
return 'linux'
-def CopyTool(flavor, out_path):
+def CopyTool(flavor, out_path, generator_flags={}):
"""Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it
to |out_path|."""
# aix and solaris just need flock emulation. mac and win use more complicated
@@ -451,11 +453,18 @@ def CopyTool(flavor, out_path):
with open(source_path) as source_file:
source = source_file.readlines()
+ # Set custom header flags.
+ header = '# Generated by gyp. Do not edit.\n'
+ mac_toolchain_dir = generator_flags.get('mac_toolchain_dir', None)
+ if flavor == 'mac' and mac_toolchain_dir:
+ header += "import os;\nos.environ['DEVELOPER_DIR']='%s'\n" \
+ % mac_toolchain_dir
+
# Add header and write it out.
tool_path = os.path.join(out_path, 'gyp-%s-tool' % prefix)
with open(tool_path, 'w') as tool_file:
tool_file.write(
- ''.join([source[0], '# Generated by gyp. Do not edit.\n'] + source[1:]))
+ ''.join([source[0], header] + source[1:]))
# Make file executable.
os.chmod(tool_path, 0755)