OLD | NEW |
---|---|
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import copy | 5 import copy |
6 import gyp | 6 import gyp |
7 import gyp.common | 7 import gyp.common |
8 import gyp.msvs_emulation | 8 import gyp.msvs_emulation |
9 import gyp.system_test | 9 import gyp.system_test |
10 import gyp.xcode_emulation | 10 import gyp.xcode_emulation |
(...skipping 26 matching lines...) Expand all Loading... | |
37 # Special variables that may be used by gyp 'rule' targets. | 37 # Special variables that may be used by gyp 'rule' targets. |
38 # We generate definitions for these variables on the fly when processing a | 38 # We generate definitions for these variables on the fly when processing a |
39 # rule. | 39 # rule. |
40 'RULE_INPUT_ROOT': '${root}', | 40 'RULE_INPUT_ROOT': '${root}', |
41 'RULE_INPUT_DIRNAME': '${dirname}', | 41 'RULE_INPUT_DIRNAME': '${dirname}', |
42 'RULE_INPUT_PATH': '${source}', | 42 'RULE_INPUT_PATH': '${source}', |
43 'RULE_INPUT_EXT': '${ext}', | 43 'RULE_INPUT_EXT': '${ext}', |
44 'RULE_INPUT_NAME': '${name}', | 44 'RULE_INPUT_NAME': '${name}', |
45 } | 45 } |
46 | 46 |
47 # TODO: enable cross compiling once we figure out: | 47 # TODO: figure out how to not build extra host objects in the non-cross-compile |
48 # - how to not build extra host objects in the non-cross-compile case. | 48 # case when this is enabled, and enable unconditionally. |
49 # - how to decide what the host compiler is (should not just be $cc). | 49 generator_supports_multiple_toolsets = ( |
50 # - need ld_host as well. | 50 os.environ.get('AR_target') or os.environ.get('CC_target') or |
51 generator_supports_multiple_toolsets = False | 51 os.environ.get('CXX_target')) |
52 | 52 |
53 | 53 |
54 def StripPrefix(arg, prefix): | 54 def StripPrefix(arg, prefix): |
55 if arg.startswith(prefix): | 55 if arg.startswith(prefix): |
56 return arg[len(prefix):] | 56 return arg[len(prefix):] |
57 return arg | 57 return arg |
58 | 58 |
59 def QuoteShellArgument(arg, flavor): | 59 def QuoteShellArgument(arg, flavor): |
60 """Quote a string such that it will be interpreted as a single argument | 60 """Quote a string such that it will be interpreted as a single argument |
61 by the shell.""" | 61 by the shell.""" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
570 env = self.ComputeExportEnvString(env) | 570 env = self.ComputeExportEnvString(env) |
571 | 571 |
572 self.ninja.build(out, 'mac_tool', info_plist, | 572 self.ninja.build(out, 'mac_tool', info_plist, |
573 variables=[('mactool_cmd', 'copy-info-plist'), | 573 variables=[('mactool_cmd', 'copy-info-plist'), |
574 ('env', env)]) | 574 ('env', env)]) |
575 bundle_depends.append(out) | 575 bundle_depends.append(out) |
576 | 576 |
577 def WriteSources(self, config_name, config, sources, predepends, | 577 def WriteSources(self, config_name, config, sources, predepends, |
578 precompiled_header): | 578 precompiled_header): |
579 """Write build rules to compile all of |sources|.""" | 579 """Write build rules to compile all of |sources|.""" |
580 if self.toolset == 'host': | 580 if self.toolset == 'target': |
581 self.ninja.variable('cc', '$cc_host') | 581 self.ninja.variable('ar', '$ar_target') |
582 self.ninja.variable('cxx', '$cxx_host') | 582 self.ninja.variable('cc', '$cc_target') |
583 self.ninja.variable('cxx', '$cxx_target') | |
584 self.ninja.variable('ld', '$ld_target') | |
583 | 585 |
584 if self.flavor == 'mac': | 586 if self.flavor == 'mac': |
585 cflags = self.xcode_settings.GetCflags(config_name) | 587 cflags = self.xcode_settings.GetCflags(config_name) |
586 cflags_c = self.xcode_settings.GetCflagsC(config_name) | 588 cflags_c = self.xcode_settings.GetCflagsC(config_name) |
587 cflags_cc = self.xcode_settings.GetCflagsCC(config_name) | 589 cflags_cc = self.xcode_settings.GetCflagsCC(config_name) |
588 cflags_objc = ['$cflags_c'] + \ | 590 cflags_objc = ['$cflags_c'] + \ |
589 self.xcode_settings.GetCflagsObjC(config_name) | 591 self.xcode_settings.GetCflagsObjC(config_name) |
590 cflags_objcc = ['$cflags_cc'] + \ | 592 cflags_objcc = ['$cflags_cc'] + \ |
591 self.xcode_settings.GetCflagsObjCC(config_name) | 593 self.xcode_settings.GetCflagsObjCC(config_name) |
592 else: | 594 else: |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1055 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) | 1057 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) |
1056 make_global_settings = data[build_file].get('make_global_settings', []) | 1058 make_global_settings = data[build_file].get('make_global_settings', []) |
1057 build_to_root = InvertRelativePath(build_dir) | 1059 build_to_root = InvertRelativePath(build_dir) |
1058 for key, value in make_global_settings: | 1060 for key, value in make_global_settings: |
1059 if key == 'CC': cc = os.path.join(build_to_root, value) | 1061 if key == 'CC': cc = os.path.join(build_to_root, value) |
1060 if key == 'CXX': cxx = os.path.join(build_to_root, value) | 1062 if key == 'CXX': cxx = os.path.join(build_to_root, value) |
1061 | 1063 |
1062 flock = 'flock' | 1064 flock = 'flock' |
1063 if flavor == 'mac': | 1065 if flavor == 'mac': |
1064 flock = './gyp-mac-tool flock' | 1066 flock = './gyp-mac-tool flock' |
1067 master_ninja.variable('ar', os.environ.get('AR', 'ar')) | |
1065 master_ninja.variable('cc', os.environ.get('CC', cc)) | 1068 master_ninja.variable('cc', os.environ.get('CC', cc)) |
1066 master_ninja.variable('cxx', os.environ.get('CXX', cxx)) | 1069 master_ninja.variable('cxx', os.environ.get('CXX', cxx)) |
1067 if flavor == 'win': | 1070 if flavor == 'win': |
1068 master_ninja.variable('ld', 'link') | 1071 master_ninja.variable('ld', 'link') |
1069 else: | 1072 else: |
1070 master_ninja.variable('ld', flock + ' linker.lock $cxx') | 1073 master_ninja.variable('ld', flock + ' linker.lock $cxx') |
1071 master_ninja.variable('cc_host', '$cc') | 1074 |
1072 master_ninja.variable('cxx_host', '$cxx') | 1075 master_ninja.variable('ar_target', os.environ.get('AR_target', '$ar')) |
Ami GONE FROM CHROMIUM
2012/02/22 22:18:54
PS#2 just makes the changes in these three lines,
| |
1076 master_ninja.variable('cc_target', os.environ.get('CC_target', '$cc')) | |
1077 master_ninja.variable('cxx_target', os.environ.get('CXX_target', '$cxx')) | |
1078 if flavor == 'win': | |
1079 master_ninja.variable('ld_target', 'link') | |
1080 else: | |
1081 master_ninja.variable('ld_target', flock + ' linker.lock $cxx_target') | |
1082 | |
1073 if flavor == 'mac': | 1083 if flavor == 'mac': |
1074 master_ninja.variable('mac_tool', os.path.join('.', 'gyp-mac-tool')) | 1084 master_ninja.variable('mac_tool', os.path.join('.', 'gyp-mac-tool')) |
1075 master_ninja.newline() | 1085 master_ninja.newline() |
1076 | 1086 |
1077 if flavor != 'win': | 1087 if flavor != 'win': |
1078 master_ninja.rule( | 1088 master_ninja.rule( |
1079 'cc', | 1089 'cc', |
1080 description='CC $out', | 1090 description='CC $out', |
1081 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_c ' | 1091 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_c ' |
1082 '$cflags_pch_c -c $in -o $out'), | 1092 '$cflags_pch_c -c $in -o $out'), |
(...skipping 21 matching lines...) Expand all Loading... | |
1104 command=('cmd /c $cxx /nologo /showIncludes ' | 1114 command=('cmd /c $cxx /nologo /showIncludes ' |
1105 '$defines $includes $cflags $cflags_cc ' | 1115 '$defines $includes $cflags $cflags_cc ' |
1106 '$cflags_pch_cc /c $in /Fo$out ' | 1116 '$cflags_pch_cc /c $in /Fo$out ' |
1107 '| ninja-deplist-helper -f cl -o $out.dl'), | 1117 '| ninja-deplist-helper -f cl -o $out.dl'), |
1108 deplist='$out.dl') | 1118 deplist='$out.dl') |
1109 | 1119 |
1110 if flavor != 'mac' and flavor != 'win': | 1120 if flavor != 'mac' and flavor != 'win': |
1111 master_ninja.rule( | 1121 master_ninja.rule( |
1112 'alink', | 1122 'alink', |
1113 description='AR $out', | 1123 description='AR $out', |
1114 command='rm -f $out && ar rcsT $out $in') | 1124 command='rm -f $out && $ar rcsT $out $in') |
1115 master_ninja.rule( | 1125 master_ninja.rule( |
1116 'solink', | 1126 'solink', |
1117 description='SOLINK $out', | 1127 description='SOLINK $out', |
1118 command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' | 1128 command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' |
1119 '-Wl,--whole-archive $in -Wl,--no-whole-archive $libs')) | 1129 '-Wl,--whole-archive $in -Wl,--no-whole-archive $libs')) |
1120 master_ninja.rule( | 1130 master_ninja.rule( |
1121 'solink_module', | 1131 'solink_module', |
1122 description='SOLINK(module) $out', | 1132 description='SOLINK(module) $out', |
1123 command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' | 1133 command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' |
1124 '-Wl,--start-group $in -Wl,--end-group $libs')) | 1134 '-Wl,--start-group $in -Wl,--end-group $libs')) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1264 | 1274 |
1265 user_config = params.get('generator_flags', {}).get('config', None) | 1275 user_config = params.get('generator_flags', {}).get('config', None) |
1266 if user_config: | 1276 if user_config: |
1267 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1277 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1268 user_config) | 1278 user_config) |
1269 else: | 1279 else: |
1270 config_names = target_dicts[target_list[0]]['configurations'].keys() | 1280 config_names = target_dicts[target_list[0]]['configurations'].keys() |
1271 for config_name in config_names: | 1281 for config_name in config_names: |
1272 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1282 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1273 config_name) | 1283 config_name) |
OLD | NEW |