OLD | NEW |
1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 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 hashlib | 6 import hashlib |
7 import multiprocessing | 7 import multiprocessing |
8 import os.path | 8 import os.path |
9 import re | 9 import re |
10 import signal | 10 import signal |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 link_deps.extend(list(extra_link_deps)) | 891 link_deps.extend(list(extra_link_deps)) |
892 | 892 |
893 extra_bindings = [] | 893 extra_bindings = [] |
894 if self.is_mac_bundle: | 894 if self.is_mac_bundle: |
895 output = self.ComputeMacBundleBinaryOutput() | 895 output = self.ComputeMacBundleBinaryOutput() |
896 else: | 896 else: |
897 output = self.ComputeOutput(spec) | 897 output = self.ComputeOutput(spec) |
898 extra_bindings.append(('postbuilds', | 898 extra_bindings.append(('postbuilds', |
899 self.GetPostbuildCommand(spec, output, output))) | 899 self.GetPostbuildCommand(spec, output, output))) |
900 | 900 |
| 901 is_executable = spec['type'] == 'executable' |
901 if self.flavor == 'mac': | 902 if self.flavor == 'mac': |
902 ldflags = self.xcode_settings.GetLdflags(config_name, | 903 ldflags = self.xcode_settings.GetLdflags(config_name, |
903 self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']), | 904 self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']), |
904 self.GypPathToNinja) | 905 self.GypPathToNinja) |
905 elif self.flavor == 'win': | 906 elif self.flavor == 'win': |
906 is_executable = spec['type'] == 'executable' | |
907 manifest_name = self.GypPathToUniqueOutput( | 907 manifest_name = self.GypPathToUniqueOutput( |
908 self.ComputeOutputFileName(spec)) | 908 self.ComputeOutputFileName(spec)) |
909 ldflags, manifest_files = self.msvs_settings.GetLdflags(config_name, | 909 ldflags, manifest_files = self.msvs_settings.GetLdflags(config_name, |
910 self.GypPathToNinja, self.ExpandSpecial, manifest_name, is_executable) | 910 self.GypPathToNinja, self.ExpandSpecial, manifest_name, is_executable) |
911 self.WriteVariableList('manifests', manifest_files) | 911 self.WriteVariableList('manifests', manifest_files) |
912 else: | 912 else: |
913 ldflags = config.get('ldflags', []) | 913 ldflags = config.get('ldflags', []) |
| 914 if is_executable and len(solibs): |
| 915 ldflags.append('-Wl,-rpath=\$$ORIGIN/lib/') |
914 self.WriteVariableList('ldflags', | 916 self.WriteVariableList('ldflags', |
915 gyp.common.uniquer(map(self.ExpandSpecial, | 917 gyp.common.uniquer(map(self.ExpandSpecial, |
916 ldflags))) | 918 ldflags))) |
917 | 919 |
918 libraries = gyp.common.uniquer(map(self.ExpandSpecial, | 920 libraries = gyp.common.uniquer(map(self.ExpandSpecial, |
919 spec.get('libraries', []))) | 921 spec.get('libraries', []))) |
920 if self.flavor == 'mac': | 922 if self.flavor == 'mac': |
921 libraries = self.xcode_settings.AdjustLibraries(libraries) | 923 libraries = self.xcode_settings.AdjustLibraries(libraries) |
922 elif self.flavor == 'win': | 924 elif self.flavor == 'win': |
923 libraries = self.msvs_settings.AdjustLibraries(libraries) | 925 libraries = self.msvs_settings.AdjustLibraries(libraries) |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 '$libs'})) | 1550 '$libs'})) |
1549 master_ninja.rule( | 1551 master_ninja.rule( |
1550 'solink_module', | 1552 'solink_module', |
1551 description='SOLINK(module) $lib', | 1553 description='SOLINK(module) $lib', |
1552 restat=True, | 1554 restat=True, |
1553 command=(mtime_preserving_solink_base % { | 1555 command=(mtime_preserving_solink_base % { |
1554 'suffix': '-Wl,--start-group $in $solibs -Wl,--end-group $libs'})) | 1556 'suffix': '-Wl,--start-group $in $solibs -Wl,--end-group $libs'})) |
1555 master_ninja.rule( | 1557 master_ninja.rule( |
1556 'link', | 1558 'link', |
1557 description='LINK $out', | 1559 description='LINK $out', |
1558 command=('$ld $ldflags -o $out -Wl,-rpath=\$$ORIGIN/lib ' | 1560 command=('$ld $ldflags -o $out ' |
1559 '-Wl,--start-group $in $solibs -Wl,--end-group $libs')) | 1561 '-Wl,--start-group $in $solibs -Wl,--end-group $libs')) |
1560 elif flavor == 'win': | 1562 elif flavor == 'win': |
1561 master_ninja.rule( | 1563 master_ninja.rule( |
1562 'alink', | 1564 'alink', |
1563 description='LIB $out', | 1565 description='LIB $out', |
1564 command=('%s gyp-win-tool link-wrapper $arch ' | 1566 command=('%s gyp-win-tool link-wrapper $arch ' |
1565 '$ar /nologo /ignore:4221 /OUT:$out @$out.rsp' % | 1567 '$ar /nologo /ignore:4221 /OUT:$out @$out.rsp' % |
1566 sys.executable), | 1568 sys.executable), |
1567 rspfile='$out.rsp', | 1569 rspfile='$out.rsp', |
1568 rspfile_content='$in_newline $libflags') | 1570 rspfile_content='$in_newline $libflags') |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 arglists.append( | 1788 arglists.append( |
1787 (target_list, target_dicts, data, params, config_name)) | 1789 (target_list, target_dicts, data, params, config_name)) |
1788 pool.map(CallGenerateOutputForConfig, arglists) | 1790 pool.map(CallGenerateOutputForConfig, arglists) |
1789 except KeyboardInterrupt, e: | 1791 except KeyboardInterrupt, e: |
1790 pool.terminate() | 1792 pool.terminate() |
1791 raise e | 1793 raise e |
1792 else: | 1794 else: |
1793 for config_name in config_names: | 1795 for config_name in config_names: |
1794 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1796 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1795 config_name) | 1797 config_name) |
OLD | NEW |