OLD | NEW |
1 # Copyright (c) 2011 Google Inc. All rights reserved. | 1 # Copyright (c) 2011 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 gyp | 5 import gyp |
6 import gyp.common | 6 import gyp.common |
7 import gyp.system_test | 7 import gyp.system_test |
8 import os.path | 8 import os.path |
9 import pprint | 9 import pprint |
10 import subprocess | 10 import subprocess |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 } | 548 } |
549 prefix = spec.get('product_prefix', DEFAULT_PREFIX.get(spec['type'], '')) | 549 prefix = spec.get('product_prefix', DEFAULT_PREFIX.get(spec['type'], '')) |
550 | 550 |
551 # Compute filename extension: the product extension, or a default | 551 # Compute filename extension: the product extension, or a default |
552 # for the product type. | 552 # for the product type. |
553 DEFAULT_EXTENSION = { | 553 DEFAULT_EXTENSION = { |
554 'static_library': 'a', | 554 'static_library': 'a', |
555 'loadable_module': 'so', | 555 'loadable_module': 'so', |
556 'shared_library': 'so', | 556 'shared_library': 'so', |
557 } | 557 } |
| 558 # TODO(thakis/jeremya): Remove once the mac path name computation is done |
| 559 # by XcodeSettings. |
| 560 if self.flavor == 'mac': |
| 561 DEFAULT_EXTENSION['shared_library'] = 'dylib' |
558 extension = spec.get('product_extension', | 562 extension = spec.get('product_extension', |
559 DEFAULT_EXTENSION.get(spec['type'], '')) | 563 DEFAULT_EXTENSION.get(spec['type'], '')) |
560 if extension: | 564 if extension: |
561 extension = '.' + extension | 565 extension = '.' + extension |
562 | 566 |
563 if 'product_name' in spec: | 567 if 'product_name' in spec: |
564 # If we were given an explicit name, use that. | 568 # If we were given an explicit name, use that. |
565 target = spec['product_name'] | 569 target = spec['product_name'] |
566 else: | 570 else: |
567 # Otherwise, derive a name from the target name. | 571 # Otherwise, derive a name from the target name. |
(...skipping 22 matching lines...) Expand all Loading... |
590 # Executables and loadable modules go into the output root, | 594 # Executables and loadable modules go into the output root, |
591 # libraries go into shared library dir, and everything else | 595 # libraries go into shared library dir, and everything else |
592 # goes into the normal place. | 596 # goes into the normal place. |
593 if spec['type'] in ('executable', 'loadable_module'): | 597 if spec['type'] in ('executable', 'loadable_module'): |
594 return filename | 598 return filename |
595 elif spec['type'] == 'shared_library': | 599 elif spec['type'] == 'shared_library': |
596 libdir = 'lib' | 600 libdir = 'lib' |
597 if self.toolset != 'target': | 601 if self.toolset != 'target': |
598 libdir = 'lib/%s' % self.toolset | 602 libdir = 'lib/%s' % self.toolset |
599 return os.path.join(libdir, filename) | 603 return os.path.join(libdir, filename) |
| 604 # TODO(thakis/jeremya): Remove once the mac path name computation is done |
| 605 # by XcodeSettings. |
| 606 elif spec['type'] == 'static_library' and self.flavor == 'mac': |
| 607 return filename |
600 else: | 608 else: |
601 return self.GypPathToUniqueOutput(filename, qualified=False) | 609 return self.GypPathToUniqueOutput(filename, qualified=False) |
602 | 610 |
603 def WriteVariableList(self, var, values): | 611 def WriteVariableList(self, var, values): |
604 if values is None: | 612 if values is None: |
605 values = [] | 613 values = [] |
606 self.ninja.variable(var, ' '.join(values)) | 614 self.ninja.variable(var, ' '.join(values)) |
607 | 615 |
608 def WriteNewNinjaRule(self, name, args, description): | 616 def WriteNewNinjaRule(self, name, args, description): |
609 """Write out a new ninja "rule" statement for a given command. | 617 """Write out a new ninja "rule" statement for a given command. |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 output, compile_depends = writer.WriteSpec(spec, config) | 828 output, compile_depends = writer.WriteSpec(spec, config) |
821 if output: | 829 if output: |
822 linkable = spec['type'] in ('static_library', 'shared_library') | 830 linkable = spec['type'] in ('static_library', 'shared_library') |
823 target_outputs[qualified_target] = (output, compile_depends, linkable) | 831 target_outputs[qualified_target] = (output, compile_depends, linkable) |
824 | 832 |
825 if qualified_target in all_targets: | 833 if qualified_target in all_targets: |
826 all_outputs.add(output) | 834 all_outputs.add(output) |
827 | 835 |
828 if all_outputs: | 836 if all_outputs: |
829 master_ninja.build('all', 'phony', list(all_outputs)) | 837 master_ninja.build('all', 'phony', list(all_outputs)) |
OLD | NEW |