| 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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 extra_bindings.append(('soname', os.path.split(output)[1])) | 1050 extra_bindings.append(('soname', os.path.split(output)[1])) |
| 1051 extra_bindings.append(('lib', | 1051 extra_bindings.append(('lib', |
| 1052 gyp.common.EncodePOSIXShellArgument(output))) | 1052 gyp.common.EncodePOSIXShellArgument(output))) |
| 1053 if self.flavor == 'win': | 1053 if self.flavor == 'win': |
| 1054 extra_bindings.append(('dll', output)) | 1054 extra_bindings.append(('dll', output)) |
| 1055 if '/NOENTRY' not in ldflags: | 1055 if '/NOENTRY' not in ldflags: |
| 1056 self.target.import_lib = output + '.lib' | 1056 self.target.import_lib = output + '.lib' |
| 1057 extra_bindings.append(('implibflag', | 1057 extra_bindings.append(('implibflag', |
| 1058 '/IMPLIB:%s' % self.target.import_lib)) | 1058 '/IMPLIB:%s' % self.target.import_lib)) |
| 1059 output = [output, self.target.import_lib] | 1059 output = [output, self.target.import_lib] |
| 1060 elif not self.is_mac_bundle: |
| 1061 output = [output, output + '.TOC'] |
| 1060 else: | 1062 else: |
| 1061 output = [output, output + '.TOC'] | 1063 command = command + '_notoc' |
| 1062 | 1064 |
| 1063 if len(solibs): | 1065 if len(solibs): |
| 1064 extra_bindings.append(('solibs', gyp.common.EncodePOSIXShellList(solibs))) | 1066 extra_bindings.append(('solibs', gyp.common.EncodePOSIXShellList(solibs))) |
| 1065 | 1067 |
| 1066 ninja_file.build(output, command + command_suffix, link_deps, | 1068 ninja_file.build(output, command + command_suffix, link_deps, |
| 1067 implicit=list(implicit_deps), | 1069 implicit=list(implicit_deps), |
| 1068 variables=extra_bindings) | 1070 variables=extra_bindings) |
| 1069 return linked_binary | 1071 return linked_binary |
| 1070 | 1072 |
| 1071 def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): | 1073 def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 './gyp-mac-tool filter-libtool libtool $libtool_flags ' | 1870 './gyp-mac-tool filter-libtool libtool $libtool_flags ' |
| 1869 '-static -o $out $in' | 1871 '-static -o $out $in' |
| 1870 '$postbuilds') | 1872 '$postbuilds') |
| 1871 master_ninja.rule( | 1873 master_ninja.rule( |
| 1872 'lipo', | 1874 'lipo', |
| 1873 description='LIPO $out, POSTBUILDS', | 1875 description='LIPO $out, POSTBUILDS', |
| 1874 command='rm -f $out && lipo -create $in -output $out$postbuilds') | 1876 command='rm -f $out && lipo -create $in -output $out$postbuilds') |
| 1875 | 1877 |
| 1876 # Record the public interface of $lib in $lib.TOC. See the corresponding | 1878 # Record the public interface of $lib in $lib.TOC. See the corresponding |
| 1877 # comment in the posix section above for details. | 1879 # comment in the posix section above for details. |
| 1880 solink_base = '$ld -shared $ldflags -o $lib %(suffix)s' |
| 1878 mtime_preserving_solink_base = ( | 1881 mtime_preserving_solink_base = ( |
| 1879 'if [ ! -e $lib -o ! -e ${lib}.TOC ] || ' | 1882 'if [ ! -e $lib -o ! -e ${lib}.TOC ] || ' |
| 1880 # Always force dependent targets to relink if this library | 1883 # Always force dependent targets to relink if this library |
| 1881 # reexports something. Handling this correctly would require | 1884 # reexports something. Handling this correctly would require |
| 1882 # recursive TOC dumping but this is rare in practice, so punt. | 1885 # recursive TOC dumping but this is rare in practice, so punt. |
| 1883 'otool -l $lib | grep -q LC_REEXPORT_DYLIB ; then ' | 1886 'otool -l $lib | grep -q LC_REEXPORT_DYLIB ; then ' |
| 1884 '%(solink)s && %(extract_toc)s > ${lib}.TOC; ' | 1887 '%(solink)s && %(extract_toc)s > ${lib}.TOC; ' |
| 1885 'else ' | 1888 'else ' |
| 1886 '%(solink)s && %(extract_toc)s > ${lib}.tmp && ' | 1889 '%(solink)s && %(extract_toc)s > ${lib}.tmp && ' |
| 1887 'if ! cmp -s ${lib}.tmp ${lib}.TOC; then ' | 1890 'if ! cmp -s ${lib}.tmp ${lib}.TOC; then ' |
| 1888 'mv ${lib}.tmp ${lib}.TOC ; ' | 1891 'mv ${lib}.tmp ${lib}.TOC ; ' |
| 1889 'fi; ' | 1892 'fi; ' |
| 1890 'fi' | 1893 'fi' |
| 1891 % { 'solink': '$ld -shared $ldflags -o $lib %(suffix)s', | 1894 % { 'solink': solink_base, |
| 1892 'extract_toc': | 1895 'extract_toc': |
| 1893 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' | 1896 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' |
| 1894 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) | 1897 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) |
| 1895 | 1898 |
| 1896 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass | 1899 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass |
| 1897 # -bundle -single_module here (for osmesa.so). | 1900 # -bundle -single_module here (for osmesa.so). |
| 1901 solink_suffix = '$in $solibs $libs$postbuilds' |
| 1898 master_ninja.rule( | 1902 master_ninja.rule( |
| 1899 'solink', | 1903 'solink', |
| 1900 description='SOLINK $lib, POSTBUILDS', | 1904 description='SOLINK $lib, POSTBUILDS', |
| 1901 restat=True, | 1905 restat=True, |
| 1902 command=(mtime_preserving_solink_base % { | 1906 command=mtime_preserving_solink_base % {'suffix':solink_suffix}, |
| 1903 'suffix': '$in $solibs $libs$postbuilds'}), | |
| 1904 pool='link_pool') | 1907 pool='link_pool') |
| 1905 master_ninja.rule( | 1908 master_ninja.rule( |
| 1909 'solink_notoc', |
| 1910 description='SOLINK $lib, POSTBUILDS', |
| 1911 restat=True, |
| 1912 command=solink_base % {'suffix':solink_suffix}, |
| 1913 pool='link_pool') |
| 1914 |
| 1915 solink_module_suffix = '$in $solibs $libs$postbuilds' |
| 1916 master_ninja.rule( |
| 1906 'solink_module', | 1917 'solink_module', |
| 1907 description='SOLINK(module) $lib, POSTBUILDS', | 1918 description='SOLINK(module) $lib, POSTBUILDS', |
| 1908 restat=True, | 1919 restat=True, |
| 1909 command=(mtime_preserving_solink_base % { | 1920 command=mtime_preserving_solink_base % {'suffix':solink_module_suffix}, |
| 1910 'suffix': '$in $solibs $libs$postbuilds'}), | 1921 pool='link_pool') |
| 1922 master_ninja.rule( |
| 1923 'solink_module_notoc', |
| 1924 description='SOLINK(module) $lib, POSTBUILDS', |
| 1925 restat=True, |
| 1926 command=solink_base % {'suffix':solink_module_suffix}, |
| 1911 pool='link_pool') | 1927 pool='link_pool') |
| 1912 | 1928 |
| 1913 master_ninja.rule( | 1929 master_ninja.rule( |
| 1914 'link', | 1930 'link', |
| 1915 description='LINK $out, POSTBUILDS', | 1931 description='LINK $out, POSTBUILDS', |
| 1916 command=('$ld $ldflags -o $out ' | 1932 command=('$ld $ldflags -o $out ' |
| 1917 '$in $solibs $libs$postbuilds'), | 1933 '$in $solibs $libs$postbuilds'), |
| 1918 pool='link_pool') | 1934 pool='link_pool') |
| 1919 master_ninja.rule( | 1935 master_ninja.rule( |
| 1920 'infoplist', | 1936 'infoplist', |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2053 arglists.append( | 2069 arglists.append( |
| 2054 (target_list, target_dicts, data, params, config_name)) | 2070 (target_list, target_dicts, data, params, config_name)) |
| 2055 pool.map(CallGenerateOutputForConfig, arglists) | 2071 pool.map(CallGenerateOutputForConfig, arglists) |
| 2056 except KeyboardInterrupt, e: | 2072 except KeyboardInterrupt, e: |
| 2057 pool.terminate() | 2073 pool.terminate() |
| 2058 raise e | 2074 raise e |
| 2059 else: | 2075 else: |
| 2060 for config_name in config_names: | 2076 for config_name in config_names: |
| 2061 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2077 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 2062 config_name) | 2078 config_name) |
| OLD | NEW |