Chromium Code Reviews| 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 766 | 766 |
| 767 include_dirs = config.get('include_dirs', []) | 767 include_dirs = config.get('include_dirs', []) |
| 768 if self.flavor == 'win': | 768 if self.flavor == 'win': |
| 769 include_dirs = self.msvs_settings.AdjustIncludeDirs(include_dirs, | 769 include_dirs = self.msvs_settings.AdjustIncludeDirs(include_dirs, |
| 770 config_name) | 770 config_name) |
| 771 env = self.GetSortedXcodeEnv() | 771 env = self.GetSortedXcodeEnv() |
| 772 self.WriteVariableList('includes', | 772 self.WriteVariableList('includes', |
| 773 [QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor) | 773 [QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor) |
| 774 for i in include_dirs]) | 774 for i in include_dirs]) |
| 775 | 775 |
| 776 library_dirs = config.get('library_dirs', []) | |
| 777 if self.flavor == 'win': | |
| 778 library_dirs = [ | |
| 779 self.msvs_settings.ConvertVSMacros(library_dir, config_name) | |
| 780 for library_dir in library_dirs] | |
| 781 self.WriteVariableList('libdirs', | |
| 782 [QuoteShellArgument('-LIBPATH:' + self.GypPathToNinja(l), | |
| 783 self.flavor) | |
| 784 for l in library_dirs]) | |
| 785 else: | |
| 786 self.WriteVariableList('libdirs', | |
| 787 [QuoteShellArgument('-L' + self.GypPathToNinja(l), self.flavor) | |
| 788 for l in library_dirs]) | |
| 789 | |
| 776 pch_commands = precompiled_header.GetPchBuildCommands() | 790 pch_commands = precompiled_header.GetPchBuildCommands() |
| 777 if self.flavor == 'mac': | 791 if self.flavor == 'mac': |
| 778 self.WriteVariableList('cflags_pch_c', | 792 self.WriteVariableList('cflags_pch_c', |
| 779 [precompiled_header.GetInclude('c')]) | 793 [precompiled_header.GetInclude('c')]) |
| 780 self.WriteVariableList('cflags_pch_cc', | 794 self.WriteVariableList('cflags_pch_cc', |
| 781 [precompiled_header.GetInclude('cc')]) | 795 [precompiled_header.GetInclude('cc')]) |
| 782 self.WriteVariableList('cflags_pch_objc', | 796 self.WriteVariableList('cflags_pch_objc', |
| 783 [precompiled_header.GetInclude('m')]) | 797 [precompiled_header.GetInclude('m')]) |
| 784 self.WriteVariableList('cflags_pch_objcc', | 798 self.WriteVariableList('cflags_pch_objcc', |
| 785 [precompiled_header.GetInclude('mm')]) | 799 [precompiled_header.GetInclude('mm')]) |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1420 | 1434 |
| 1421 rule_name_suffix = _GetWinLinkRuleNameSuffix(embed_manifest, link_incremental) | 1435 rule_name_suffix = _GetWinLinkRuleNameSuffix(embed_manifest, link_incremental) |
| 1422 dlldesc = 'LINK%s(DLL) $dll' % rule_name_suffix.upper() | 1436 dlldesc = 'LINK%s(DLL) $dll' % rule_name_suffix.upper() |
| 1423 dllcmd = ('%s gyp-win-tool link-wrapper $arch ' | 1437 dllcmd = ('%s gyp-win-tool link-wrapper $arch ' |
| 1424 '$ld /nologo $implibflag /DLL /OUT:$dll ' | 1438 '$ld /nologo $implibflag /DLL /OUT:$dll ' |
| 1425 '/PDB:$dll.pdb @$dll.rsp' % sys.executable) | 1439 '/PDB:$dll.pdb @$dll.rsp' % sys.executable) |
| 1426 dllcmd = FullLinkCommand(dllcmd, '$dll', 'dll') | 1440 dllcmd = FullLinkCommand(dllcmd, '$dll', 'dll') |
| 1427 master_ninja.rule('solink' + rule_name_suffix, | 1441 master_ninja.rule('solink' + rule_name_suffix, |
| 1428 description=dlldesc, command=dllcmd, | 1442 description=dlldesc, command=dllcmd, |
| 1429 rspfile='$dll.rsp', | 1443 rspfile='$dll.rsp', |
| 1430 rspfile_content='$libs $in_newline $ldflags', | 1444 rspfile_content='$libdirs $libs $in_newline $ldflags', |
| 1431 restat=True) | 1445 restat=True) |
| 1432 master_ninja.rule('solink_module' + rule_name_suffix, | 1446 master_ninja.rule('solink_module' + rule_name_suffix, |
| 1433 description=dlldesc, command=dllcmd, | 1447 description=dlldesc, command=dllcmd, |
| 1434 rspfile='$dll.rsp', | 1448 rspfile='$dll.rsp', |
| 1435 rspfile_content='$libs $in_newline $ldflags', | 1449 rspfile_content='$libdirs $libs $in_newline $ldflags', |
| 1436 restat=True) | 1450 restat=True) |
| 1437 # Note that ldflags goes at the end so that it has the option of | 1451 # Note that ldflags goes at the end so that it has the option of |
| 1438 # overriding default settings earlier in the command line. | 1452 # overriding default settings earlier in the command line. |
| 1439 exe_cmd = ('%s gyp-win-tool link-wrapper $arch ' | 1453 exe_cmd = ('%s gyp-win-tool link-wrapper $arch ' |
| 1440 '$ld /nologo /OUT:$out /PDB:$out.pdb @$out.rsp' % | 1454 '$ld /nologo /OUT:$out /PDB:$out.pdb @$out.rsp' % |
| 1441 sys.executable) | 1455 sys.executable) |
| 1442 exe_cmd = FullLinkCommand(exe_cmd, '$out', 'exe') | 1456 exe_cmd = FullLinkCommand(exe_cmd, '$out', 'exe') |
| 1443 master_ninja.rule('link' + rule_name_suffix, | 1457 master_ninja.rule('link' + rule_name_suffix, |
| 1444 description='LINK%s $out' % rule_name_suffix.upper(), | 1458 description='LINK%s $out' % rule_name_suffix.upper(), |
| 1445 command=exe_cmd, | 1459 command=exe_cmd, |
| 1446 rspfile='$out.rsp', | 1460 rspfile='$out.rsp', |
| 1447 rspfile_content='$in_newline $libs $ldflags') | 1461 rspfile_content='$in_newline $libdirs $libs $ldflags') |
| 1448 | 1462 |
| 1449 | 1463 |
| 1450 def GenerateOutputForConfig(target_list, target_dicts, data, params, | 1464 def GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 1451 config_name): | 1465 config_name): |
| 1452 options = params['options'] | 1466 options = params['options'] |
| 1453 flavor = gyp.common.GetFlavor(params) | 1467 flavor = gyp.common.GetFlavor(params) |
| 1454 generator_flags = params.get('generator_flags', {}) | 1468 generator_flags = params.get('generator_flags', {}) |
| 1455 | 1469 |
| 1456 # generator_dir: relative path from pwd to where make puts build files. | 1470 # generator_dir: relative path from pwd to where make puts build files. |
| 1457 # Makes migrating from make to ninja easier, ninja doesn't put anything here. | 1471 # Makes migrating from make to ninja easier, ninja doesn't put anything here. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1682 'extract_toc': | 1696 'extract_toc': |
| 1683 ('{ readelf -d ${lib} | grep SONAME ; ' | 1697 ('{ readelf -d ${lib} | grep SONAME ; ' |
| 1684 'nm -gD -f p ${lib} | cut -f1-2 -d\' \'; }')}) | 1698 'nm -gD -f p ${lib} | cut -f1-2 -d\' \'; }')}) |
| 1685 | 1699 |
| 1686 master_ninja.rule( | 1700 master_ninja.rule( |
| 1687 'solink', | 1701 'solink', |
| 1688 description='SOLINK $lib', | 1702 description='SOLINK $lib', |
| 1689 restat=True, | 1703 restat=True, |
| 1690 command=(mtime_preserving_solink_base % { | 1704 command=(mtime_preserving_solink_base % { |
| 1691 'suffix': '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive ' | 1705 'suffix': '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive ' |
| 1692 '$libs'}), | 1706 '$libdirs $libs'}), |
| 1693 pool='link_pool') | 1707 pool='link_pool') |
| 1694 master_ninja.rule( | 1708 master_ninja.rule( |
| 1695 'solink_module', | 1709 'solink_module', |
| 1696 description='SOLINK(module) $lib', | 1710 description='SOLINK(module) $lib', |
| 1697 restat=True, | 1711 restat=True, |
| 1698 command=(mtime_preserving_solink_base % { | 1712 command=(mtime_preserving_solink_base % { |
| 1699 'suffix': '-Wl,--start-group $in $solibs -Wl,--end-group $libs'}), | 1713 'suffix': '-Wl,--start-group $in $solibs -Wl,--end-group ' |
| 1714 '$libdirs $libs'}), | |
|
Nico
2013/07/02 01:20:15
Is it possible to just add these flags to the "lib
| |
| 1700 pool='link_pool') | 1715 pool='link_pool') |
| 1701 master_ninja.rule( | 1716 master_ninja.rule( |
| 1702 'link', | 1717 'link', |
| 1703 description='LINK $out', | 1718 description='LINK $out', |
| 1704 command=('$ld $ldflags -o $out ' | 1719 command=('$ld $ldflags -o $out ' |
| 1705 '-Wl,--start-group $in $solibs -Wl,--end-group $libs'), | 1720 '-Wl,--start-group $in $solibs -Wl,--end-group $libdirs $libs'), |
| 1706 pool='link_pool') | 1721 pool='link_pool') |
| 1707 elif flavor == 'win': | 1722 elif flavor == 'win': |
| 1708 master_ninja.rule( | 1723 master_ninja.rule( |
| 1709 'alink', | 1724 'alink', |
| 1710 description='LIB $out', | 1725 description='LIB $out', |
| 1711 command=('%s gyp-win-tool link-wrapper $arch ' | 1726 command=('%s gyp-win-tool link-wrapper $arch ' |
| 1712 '$ar /nologo /ignore:4221 /OUT:$out @$out.rsp' % | 1727 '$ar /nologo /ignore:4221 /OUT:$out @$out.rsp' % |
| 1713 sys.executable), | 1728 sys.executable), |
| 1714 rspfile='$out.rsp', | 1729 rspfile='$out.rsp', |
| 1715 rspfile_content='$in_newline $libflags') | 1730 rspfile_content='$in_newline $libflags') |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1762 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' | 1777 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' |
| 1763 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) | 1778 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) |
| 1764 | 1779 |
| 1765 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass | 1780 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass |
| 1766 # -bundle -single_module here (for osmesa.so). | 1781 # -bundle -single_module here (for osmesa.so). |
| 1767 master_ninja.rule( | 1782 master_ninja.rule( |
| 1768 'solink', | 1783 'solink', |
| 1769 description='SOLINK $lib, POSTBUILDS', | 1784 description='SOLINK $lib, POSTBUILDS', |
| 1770 restat=True, | 1785 restat=True, |
| 1771 command=(mtime_preserving_solink_base % { | 1786 command=(mtime_preserving_solink_base % { |
| 1772 'suffix': '$in $solibs $libs$postbuilds'}), | 1787 'suffix': '$in $solibs $libdirs $libs$postbuilds'}), |
| 1773 pool='link_pool') | 1788 pool='link_pool') |
| 1774 master_ninja.rule( | 1789 master_ninja.rule( |
| 1775 'solink_module', | 1790 'solink_module', |
| 1776 description='SOLINK(module) $lib, POSTBUILDS', | 1791 description='SOLINK(module) $lib, POSTBUILDS', |
| 1777 restat=True, | 1792 restat=True, |
| 1778 command=(mtime_preserving_solink_base % { | 1793 command=(mtime_preserving_solink_base % { |
| 1779 'suffix': '$in $solibs $libs$postbuilds'}), | 1794 'suffix': '$in $solibs $libdirs $libs$postbuilds'}), |
| 1780 pool='link_pool') | 1795 pool='link_pool') |
| 1781 | 1796 |
| 1782 master_ninja.rule( | 1797 master_ninja.rule( |
| 1783 'link', | 1798 'link', |
| 1784 description='LINK $out, POSTBUILDS', | 1799 description='LINK $out, POSTBUILDS', |
| 1785 command=('$ld $ldflags -o $out ' | 1800 command=('$ld $ldflags -o $out ' |
| 1786 '$in $solibs $libs$postbuilds'), | 1801 '$in $solibs $libdirs $libs$postbuilds'), |
| 1787 pool='link_pool') | 1802 pool='link_pool') |
| 1788 master_ninja.rule( | 1803 master_ninja.rule( |
| 1789 'infoplist', | 1804 'infoplist', |
| 1790 description='INFOPLIST $out', | 1805 description='INFOPLIST $out', |
| 1791 command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && ' | 1806 command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && ' |
| 1792 'plutil -convert xml1 $out $out')) | 1807 'plutil -convert xml1 $out $out')) |
| 1793 master_ninja.rule( | 1808 master_ninja.rule( |
| 1794 'mac_tool', | 1809 'mac_tool', |
| 1795 description='MACTOOL $mactool_cmd $in', | 1810 description='MACTOOL $mactool_cmd $in', |
| 1796 command='$env ./gyp-mac-tool $mactool_cmd $in $out') | 1811 command='$env ./gyp-mac-tool $mactool_cmd $in $out') |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1922 arglists.append( | 1937 arglists.append( |
| 1923 (target_list, target_dicts, data, params, config_name)) | 1938 (target_list, target_dicts, data, params, config_name)) |
| 1924 pool.map(CallGenerateOutputForConfig, arglists) | 1939 pool.map(CallGenerateOutputForConfig, arglists) |
| 1925 except KeyboardInterrupt, e: | 1940 except KeyboardInterrupt, e: |
| 1926 pool.terminate() | 1941 pool.terminate() |
| 1927 raise e | 1942 raise e |
| 1928 else: | 1943 else: |
| 1929 for config_name in config_names: | 1944 for config_name in config_names: |
| 1930 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1945 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 1931 config_name) | 1946 config_name) |
| OLD | NEW |