Chromium Code Reviews| 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.MSVSVersion | 9 import gyp.MSVSVersion |
| 10 import gyp.system_test | 10 import gyp.system_test |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 self.component_objs = None | 146 self.component_objs = None |
| 147 # Windows only. The import .lib is the output of a build step, but | 147 # Windows only. The import .lib is the output of a build step, but |
| 148 # because dependents only link against the lib (not both the lib and the | 148 # because dependents only link against the lib (not both the lib and the |
| 149 # dll) we keep track of the import library here. | 149 # dll) we keep track of the import library here. |
| 150 self.import_lib = None | 150 self.import_lib = None |
| 151 | 151 |
| 152 def Linkable(self): | 152 def Linkable(self): |
| 153 """Return true if this is a target that can be linked against.""" | 153 """Return true if this is a target that can be linked against.""" |
| 154 return self.type in ('static_library', 'shared_library') | 154 return self.type in ('static_library', 'shared_library') |
| 155 | 155 |
| 156 def SharedLinkable(self): | 156 def SharedLinkable(self, flavor): |
| 157 """Return true if this is a shared library/module.""" | 157 """Return true if this is a shared library/module.""" |
| 158 if flavor == 'win': | |
|
Ami GONE FROM CHROMIUM
2012/06/30 22:37:04
I almost did this in my CL but couldn't justify th
| |
| 159 return False | |
| 158 return self.type in ('shared_library', 'loadable_module') | 160 return self.type in ('shared_library', 'loadable_module') |
| 159 | 161 |
| 160 def PreActionInput(self, flavor): | 162 def PreActionInput(self, flavor): |
| 161 """Return the path, if any, that should be used as a dependency of | 163 """Return the path, if any, that should be used as a dependency of |
| 162 any dependent action step.""" | 164 any dependent action step.""" |
| 163 if self.SharedLinkable() and flavor not in ['mac', 'win']: | 165 if self.SharedLinkable(flavor): |
| 164 return self.FinalOutput() + '.TOC' | 166 return self.FinalOutput() + '.TOC' |
| 165 return self.FinalOutput() or self.preaction_stamp | 167 return self.FinalOutput() or self.preaction_stamp |
| 166 | 168 |
| 167 def PreCompileInput(self): | 169 def PreCompileInput(self): |
| 168 """Return the path, if any, that should be used as a dependency of | 170 """Return the path, if any, that should be used as a dependency of |
| 169 any dependent compile step.""" | 171 any dependent compile step.""" |
| 170 return self.actions_stamp or self.precompile_stamp | 172 return self.actions_stamp or self.precompile_stamp |
| 171 | 173 |
| 172 def FinalOutput(self): | 174 def FinalOutput(self): |
| 173 """Return the last output of the target, which depends on all prior | 175 """Return the last output of the target, which depends on all prior |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 833 if not target: | 835 if not target: |
| 834 continue | 836 continue |
| 835 linkable = target.Linkable() | 837 linkable = target.Linkable() |
| 836 if linkable: | 838 if linkable: |
| 837 if (self.flavor == 'win' and | 839 if (self.flavor == 'win' and |
| 838 target.component_objs and | 840 target.component_objs and |
| 839 self.msvs_settings.IsUseLibraryDependencyInputs(config_name)): | 841 self.msvs_settings.IsUseLibraryDependencyInputs(config_name)): |
| 840 extra_link_deps |= set(target.component_objs) | 842 extra_link_deps |= set(target.component_objs) |
| 841 elif self.flavor == 'win' and target.import_lib: | 843 elif self.flavor == 'win' and target.import_lib: |
| 842 extra_link_deps.add(target.import_lib) | 844 extra_link_deps.add(target.import_lib) |
| 843 elif target.SharedLinkable() and self.flavor not in ['mac', 'win']: | 845 elif target.SharedLinkable(self.flavor): |
| 844 solibs.add(target.binary) | 846 solibs.add(target.binary) |
| 845 implicit_deps.add(target.binary + '.TOC') | 847 implicit_deps.add(target.binary + '.TOC') |
| 846 else: | 848 else: |
| 847 extra_link_deps.add(target.binary) | 849 extra_link_deps.add(target.binary) |
| 848 | 850 |
| 849 final_output = target.FinalOutput() | 851 final_output = target.FinalOutput() |
| 850 if not linkable or final_output != target.binary: | 852 if not linkable or final_output != target.binary: |
| 851 implicit_deps.add(final_output) | 853 implicit_deps.add(final_output) |
| 852 | 854 |
| 853 link_deps.extend(list(extra_link_deps)) | 855 link_deps.extend(list(extra_link_deps)) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 888 self.target.binary = output | 890 self.target.binary = output |
| 889 | 891 |
| 890 if command in ('solink', 'solink_module'): | 892 if command in ('solink', 'solink_module'): |
| 891 extra_bindings.append(('soname', os.path.split(output)[1])) | 893 extra_bindings.append(('soname', os.path.split(output)[1])) |
| 892 extra_bindings.append(('lib', output)) | 894 extra_bindings.append(('lib', output)) |
| 893 if self.flavor == 'win': | 895 if self.flavor == 'win': |
| 894 self.target.import_lib = output + '.lib' | 896 self.target.import_lib = output + '.lib' |
| 895 extra_bindings.append(('dll', output)) | 897 extra_bindings.append(('dll', output)) |
| 896 extra_bindings.append(('implib', self.target.import_lib)) | 898 extra_bindings.append(('implib', self.target.import_lib)) |
| 897 output = [output, self.target.import_lib] | 899 output = [output, self.target.import_lib] |
| 898 elif self.flavor != 'mac': | 900 else: |
| 899 output = [output, output + '.TOC'] | 901 output = [output, output + '.TOC'] |
| 900 | 902 |
| 901 if len(solibs): | 903 if len(solibs): |
| 902 extra_bindings.append(('solibs', ' '.join(solibs))) | 904 extra_bindings.append(('solibs', ' '.join(solibs))) |
| 903 | 905 |
| 904 self.ninja.build(output, command, link_deps, | 906 self.ninja.build(output, command, link_deps, |
| 905 implicit=list(implicit_deps), | 907 implicit=list(implicit_deps), |
| 906 variables=extra_bindings) | 908 variables=extra_bindings) |
| 907 | 909 |
| 908 def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): | 910 def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1469 description='OBJCXX $out', | 1471 description='OBJCXX $out', |
| 1470 command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_objcc ' | 1472 command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_objcc ' |
| 1471 '$cflags_pch_objcc -c $in -o $out'), | 1473 '$cflags_pch_objcc -c $in -o $out'), |
| 1472 depfile='$out.d') | 1474 depfile='$out.d') |
| 1473 master_ninja.rule( | 1475 master_ninja.rule( |
| 1474 'alink', | 1476 'alink', |
| 1475 description='LIBTOOL-STATIC $out, POSTBUILDS', | 1477 description='LIBTOOL-STATIC $out, POSTBUILDS', |
| 1476 command='rm -f $out && ' | 1478 command='rm -f $out && ' |
| 1477 './gyp-mac-tool filter-libtool libtool -static -o $out $in' | 1479 './gyp-mac-tool filter-libtool libtool -static -o $out $in' |
| 1478 '$postbuilds') | 1480 '$postbuilds') |
| 1481 | |
| 1482 # Record the public interface of $lib in $lib.TOC. See the corresponding | |
| 1483 # comment in the posix section above for details. | |
| 1484 mtime_preserving_solink_base = ( | |
| 1485 'if [ ! -e $lib -o ! -e ${lib}.TOC ]; then ' | |
| 1486 '%(solink)s && %(extract_toc)s > ${lib}.TOC; else ' | |
| 1487 '%(solink)s && %(extract_toc)s > ${lib}.tmp && ' | |
| 1488 'if ! cmp -s ${lib}.tmp ${lib}.TOC; then mv ${lib}.tmp ${lib}.TOC ; ' | |
| 1489 'fi; fi' | |
| 1490 % { 'solink': | |
| 1491 '$ld -shared $ldflags -o $lib %(suffix)s', | |
| 1492 'extract_toc': | |
| 1493 ('{ ' #readelf -d ${lib} | grep SONAME ; ' | |
| 1494 'nm -U -P ${lib} |cut -f1-2 -d\' \' |grep \'[A-Z]$$\'; }')}) | |
|
Ami GONE FROM CHROMIUM
2012/06/30 22:37:04
I don't know what this means, but FTR in the other
| |
| 1495 | |
| 1479 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass | 1496 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass |
| 1480 # -bundle -single_module here (for osmesa.so). | 1497 # -bundle -single_module here (for osmesa.so). |
| 1481 master_ninja.rule( | 1498 master_ninja.rule( |
| 1482 'solink', | 1499 'solink', |
| 1483 description='SOLINK $out, POSTBUILDS', | 1500 description='SOLINK $lib, POSTBUILDS', |
| 1484 command=('$ld -shared $ldflags -o $out ' | 1501 restat=True, |
| 1485 '$in $libs$postbuilds')) | 1502 command=(mtime_preserving_solink_base % { |
| 1503 'suffix': '$in $solibs $libs$postbuilds'})) | |
| 1486 master_ninja.rule( | 1504 master_ninja.rule( |
| 1487 'solink_module', | 1505 'solink_module', |
| 1488 description='SOLINK(module) $out, POSTBUILDS', | 1506 description='SOLINK(module) $lib, POSTBUILDS', |
| 1489 command=('$ld -shared $ldflags -o $out ' | 1507 restat=True, |
| 1490 '$in $libs$postbuilds')) | 1508 command=(mtime_preserving_solink_base % { |
| 1509 'suffix': '$in $solibs $libs$postbuilds'})) | |
| 1510 | |
| 1491 master_ninja.rule( | 1511 master_ninja.rule( |
| 1492 'link', | 1512 'link', |
| 1493 description='LINK $out, POSTBUILDS', | 1513 description='LINK $out, POSTBUILDS', |
| 1494 command=('$ld $ldflags -o $out ' | 1514 command=('$ld $ldflags -o $out ' |
| 1495 '$in $libs$postbuilds')) | 1515 '$in $solibs $libs$postbuilds')) |
| 1496 master_ninja.rule( | 1516 master_ninja.rule( |
| 1497 'infoplist', | 1517 'infoplist', |
| 1498 description='INFOPLIST $out', | 1518 description='INFOPLIST $out', |
| 1499 command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && ' | 1519 command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && ' |
| 1500 'plutil -convert xml1 $out $out')) | 1520 'plutil -convert xml1 $out $out')) |
| 1501 master_ninja.rule( | 1521 master_ninja.rule( |
| 1502 'mac_tool', | 1522 'mac_tool', |
| 1503 description='MACTOOL $mactool_cmd $in', | 1523 description='MACTOOL $mactool_cmd $in', |
| 1504 command='$env $mac_tool $mactool_cmd $in $out') | 1524 command='$env $mac_tool $mactool_cmd $in $out') |
| 1505 master_ninja.rule( | 1525 master_ninja.rule( |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1597 | 1617 |
| 1598 user_config = params.get('generator_flags', {}).get('config', None) | 1618 user_config = params.get('generator_flags', {}).get('config', None) |
| 1599 if user_config: | 1619 if user_config: |
| 1600 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1620 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 1601 user_config) | 1621 user_config) |
| 1602 else: | 1622 else: |
| 1603 config_names = target_dicts[target_list[0]]['configurations'].keys() | 1623 config_names = target_dicts[target_list[0]]['configurations'].keys() |
| 1604 for config_name in config_names: | 1624 for config_name in config_names: |
| 1605 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1625 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 1606 config_name) | 1626 config_name) |
| OLD | NEW |