Chromium Code Reviews| Index: pylib/gyp/generator/ninja.py |
| diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py |
| index 4eafb71c198dd9fb728178350c1e49868e2b4438..3336a896ca1da794bf9321b638589fef2d8f2946 100644 |
| --- a/pylib/gyp/generator/ninja.py |
| +++ b/pylib/gyp/generator/ninja.py |
| @@ -805,6 +805,8 @@ class NinjaWriter: |
| self.ninja.variable('cxx', '$cxx_host') |
| self.ninja.variable('ld', '$ld_host') |
| self.ninja.variable('ldxx', '$ldxx_host') |
| + self.ninja.variable('nm', '$nm_host') |
| + self.ninja.variable('readelf', '$readelf_host') |
| if self.flavor != 'mac' or len(self.archs) == 1: |
| return self.WriteSourcesForArch( |
| @@ -1742,6 +1744,10 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, |
| cc_host_global_setting = None |
| cxx_host_global_setting = None |
| clang_cl = None |
| + nm = 'nm' |
| + nm_host = 'nm' |
| + readelf = 'readelf' |
| + readelf_host = 'readelf' |
| build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) |
| make_global_settings = data[build_file].get('make_global_settings', []) |
| @@ -1769,6 +1775,14 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, |
| ld = os.path.join(build_to_root, value) |
| if key == 'LD.host': |
| ld_host = os.path.join(build_to_root, value) |
| + if key == 'NM': |
| + nm = os.path.join(build_to_root, value) |
| + if key == 'NM.host': |
| + nm_host = os.path.join(build_to_root, value) |
| + if key == 'READELF': |
| + readelf = os.path.join(build_to_root, value) |
| + if key == 'READELF.host': |
| + readelf_host = os.path.join(build_to_root, value) |
| if key.endswith('_wrapper'): |
| wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value) |
| @@ -1816,6 +1830,13 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, |
| master_ninja.variable('ld', CommandWithWrapper('LINK', wrappers, ld)) |
| master_ninja.variable('ldxx', CommandWithWrapper('LINK', wrappers, ldxx)) |
| master_ninja.variable('ar', GetEnvironFallback(['AR_target', 'AR'], ar)) |
| + if flavor != 'mac': |
|
Nico
2014/08/27 23:53:06
yukawa: You could add a `or generator_supports_mul
|
| + # Mac does not use readelf/nm for .TOC generation, so avoiding polluting |
| + # the master ninja with extra unused variables. |
| + master_ninja.variable( |
| + 'nm', GetEnvironFallback(['NM_target', 'NM'], nm)) |
| + master_ninja.variable( |
| + 'readelf', GetEnvironFallback(['READELF_target', 'READELF'], readelf)) |
| if generator_supports_multiple_toolsets: |
| if not cc_host: |
| @@ -1824,6 +1845,9 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, |
| cxx_host = cxx |
| master_ninja.variable('ar_host', GetEnvironFallback(['AR_host'], ar_host)) |
| + master_ninja.variable('nm_host', GetEnvironFallback(['NM_host'], nm_host)) |
| + master_ninja.variable('readelf_host', |
| + GetEnvironFallback(['READELF_host'], readelf_host)) |
| cc_host = GetEnvironFallback(['CC_host'], cc_host) |
| cxx_host = GetEnvironFallback(['CXX_host'], cxx_host) |
| @@ -1945,8 +1969,8 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, |
| % { 'solink': |
| '$ld -shared $ldflags -o $lib -Wl,-soname=$soname %(suffix)s', |
| 'extract_toc': |
| - ('{ readelf -d $lib | grep SONAME ; ' |
| - 'nm -gD -f p $lib | cut -f1-2 -d\' \'; }')}) |
| + ('{ $readelf -d $lib | grep SONAME ; ' |
| + '$nm -gD -f p $lib | cut -f1-2 -d\' \'; }')}) |
| master_ninja.rule( |
| 'solink', |