| 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 collections | 5 import collections |
| 6 import copy | 6 import copy |
| 7 import hashlib | 7 import hashlib |
| 8 import json | 8 import json |
| 9 import multiprocessing | 9 import multiprocessing |
| 10 import os.path | 10 import os.path |
| (...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 'alink_thin', | 1860 'alink_thin', |
| 1861 description='AR $out', | 1861 description='AR $out', |
| 1862 command='rm -f $out && $ar rcsT $out $in') | 1862 command='rm -f $out && $ar rcsT $out $in') |
| 1863 | 1863 |
| 1864 # This allows targets that only need to depend on $lib's API to declare an | 1864 # This allows targets that only need to depend on $lib's API to declare an |
| 1865 # order-only dependency on $lib.TOC and avoid relinking such downstream | 1865 # order-only dependency on $lib.TOC and avoid relinking such downstream |
| 1866 # dependencies when $lib changes only in non-public ways. | 1866 # dependencies when $lib changes only in non-public ways. |
| 1867 # The resulting string leaves an uninterpolated %{suffix} which | 1867 # The resulting string leaves an uninterpolated %{suffix} which |
| 1868 # is used in the final substitution below. | 1868 # is used in the final substitution below. |
| 1869 mtime_preserving_solink_base = ( | 1869 mtime_preserving_solink_base = ( |
| 1870 'if [ ! -e $lib -o ! -e ${lib}.TOC ]; then ' | 1870 'if [ ! -e $lib -o ! -e $lib.TOC ]; then ' |
| 1871 '%(solink)s && %(extract_toc)s > ${lib}.TOC; else ' | 1871 '%(solink)s && %(extract_toc)s > $lib.TOC; else ' |
| 1872 '%(solink)s && %(extract_toc)s > ${lib}.tmp && ' | 1872 '%(solink)s && %(extract_toc)s > $lib.tmp && ' |
| 1873 'if ! cmp -s ${lib}.tmp ${lib}.TOC; then mv ${lib}.tmp ${lib}.TOC ; ' | 1873 'if ! cmp -s $lib.tmp $lib.TOC; then mv $lib.tmp $lib.TOC ; ' |
| 1874 'fi; fi' | 1874 'fi; fi' |
| 1875 % { 'solink': | 1875 % { 'solink': |
| 1876 '$ld -shared $ldflags -o $lib -Wl,-soname=$soname %(suffix)s', | 1876 '$ld -shared $ldflags -o $lib -Wl,-soname=$soname %(suffix)s', |
| 1877 'extract_toc': | 1877 'extract_toc': |
| 1878 ('{ readelf -d ${lib} | grep SONAME ; ' | 1878 ('{ readelf -d $lib | grep SONAME ; ' |
| 1879 'nm -gD -f p ${lib} | cut -f1-2 -d\' \'; }')}) | 1879 'nm -gD -f p $lib | cut -f1-2 -d\' \'; }')}) |
| 1880 | 1880 |
| 1881 master_ninja.rule( | 1881 master_ninja.rule( |
| 1882 'solink', | 1882 'solink', |
| 1883 description='SOLINK $lib', | 1883 description='SOLINK $lib', |
| 1884 restat=True, | 1884 restat=True, |
| 1885 command=(mtime_preserving_solink_base % { | 1885 command=(mtime_preserving_solink_base % { |
| 1886 'suffix': '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive ' | 1886 'suffix': '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive ' |
| 1887 '$libs'}), | 1887 '$libs'}), |
| 1888 pool='link_pool') | 1888 pool='link_pool') |
| 1889 master_ninja.rule( | 1889 master_ninja.rule( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 '$postbuilds') | 1935 '$postbuilds') |
| 1936 master_ninja.rule( | 1936 master_ninja.rule( |
| 1937 'lipo', | 1937 'lipo', |
| 1938 description='LIPO $out, POSTBUILDS', | 1938 description='LIPO $out, POSTBUILDS', |
| 1939 command='rm -f $out && lipo -create $in -output $out$postbuilds') | 1939 command='rm -f $out && lipo -create $in -output $out$postbuilds') |
| 1940 | 1940 |
| 1941 # Record the public interface of $lib in $lib.TOC. See the corresponding | 1941 # Record the public interface of $lib in $lib.TOC. See the corresponding |
| 1942 # comment in the posix section above for details. | 1942 # comment in the posix section above for details. |
| 1943 solink_base = '$ld %(type)s $ldflags -o $lib %(suffix)s' | 1943 solink_base = '$ld %(type)s $ldflags -o $lib %(suffix)s' |
| 1944 mtime_preserving_solink_base = ( | 1944 mtime_preserving_solink_base = ( |
| 1945 'if [ ! -e $lib -o ! -e ${lib}.TOC ] || ' | 1945 'if [ ! -e $lib -o ! -e $lib.TOC ] || ' |
| 1946 # Always force dependent targets to relink if this library | 1946 # Always force dependent targets to relink if this library |
| 1947 # reexports something. Handling this correctly would require | 1947 # reexports something. Handling this correctly would require |
| 1948 # recursive TOC dumping but this is rare in practice, so punt. | 1948 # recursive TOC dumping but this is rare in practice, so punt. |
| 1949 'otool -l $lib | grep -q LC_REEXPORT_DYLIB ; then ' | 1949 'otool -l $lib | grep -q LC_REEXPORT_DYLIB ; then ' |
| 1950 '%(solink)s && %(extract_toc)s > ${lib}.TOC; ' | 1950 '%(solink)s && %(extract_toc)s > $lib.TOC; ' |
| 1951 'else ' | 1951 'else ' |
| 1952 '%(solink)s && %(extract_toc)s > ${lib}.tmp && ' | 1952 '%(solink)s && %(extract_toc)s > $lib.tmp && ' |
| 1953 'if ! cmp -s ${lib}.tmp ${lib}.TOC; then ' | 1953 'if ! cmp -s $lib.tmp $lib.TOC; then ' |
| 1954 'mv ${lib}.tmp ${lib}.TOC ; ' | 1954 'mv $lib.tmp $lib.TOC ; ' |
| 1955 'fi; ' | 1955 'fi; ' |
| 1956 'fi' | 1956 'fi' |
| 1957 % { 'solink': solink_base, | 1957 % { 'solink': solink_base, |
| 1958 'extract_toc': | 1958 'extract_toc': |
| 1959 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' | 1959 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' |
| 1960 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) | 1960 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) |
| 1961 | 1961 |
| 1962 solink_suffix = '$in $solibs $libs$postbuilds' | 1962 solink_suffix = '$in $solibs $libs$postbuilds' |
| 1963 master_ninja.rule( | 1963 master_ninja.rule( |
| 1964 'solink', | 1964 'solink', |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2151 arglists.append( | 2151 arglists.append( |
| 2152 (target_list, target_dicts, data, params, config_name)) | 2152 (target_list, target_dicts, data, params, config_name)) |
| 2153 pool.map(CallGenerateOutputForConfig, arglists) | 2153 pool.map(CallGenerateOutputForConfig, arglists) |
| 2154 except KeyboardInterrupt, e: | 2154 except KeyboardInterrupt, e: |
| 2155 pool.terminate() | 2155 pool.terminate() |
| 2156 raise e | 2156 raise e |
| 2157 else: | 2157 else: |
| 2158 for config_name in config_names: | 2158 for config_name in config_names: |
| 2159 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2159 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 2160 config_name) | 2160 config_name) |
| OLD | NEW |