| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 | 761 |
| 762 include_dirs = config.get('include_dirs', []) | 762 include_dirs = config.get('include_dirs', []) |
| 763 if self.flavor == 'win': | 763 if self.flavor == 'win': |
| 764 include_dirs = self.msvs_settings.AdjustIncludeDirs(include_dirs, | 764 include_dirs = self.msvs_settings.AdjustIncludeDirs(include_dirs, |
| 765 config_name) | 765 config_name) |
| 766 env = self.GetSortedXcodeEnv() | 766 env = self.GetSortedXcodeEnv() |
| 767 self.WriteVariableList('includes', | 767 self.WriteVariableList('includes', |
| 768 [QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor) | 768 [QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor) |
| 769 for i in include_dirs]) | 769 for i in include_dirs]) |
| 770 | 770 |
| 771 library_dirs = config.get('library_dirs', []) |
| 772 if self.flavor == 'win': |
| 773 library_dirs = [ |
| 774 self.msvs_settings.ConvertVSMacros(library_dir, config_name) |
| 775 for library_dir in library_dirs] |
| 776 self.WriteVariableList('libdirs', |
| 777 [QuoteShellArgument('-LIBPATH:' + self.GypPathToNinja(l), self.flavor
) |
| 778 for l in library_dirs]) |
| 779 else: |
| 780 self.WriteVariableList('libdirs', |
| 781 [QuoteShellArgument('-L' + self.GypPathToNinja(l), self.flavor) |
| 782 for l in library_dirs]) |
| 783 |
| 771 pch_commands = precompiled_header.GetPchBuildCommands() | 784 pch_commands = precompiled_header.GetPchBuildCommands() |
| 772 if self.flavor == 'mac': | 785 if self.flavor == 'mac': |
| 773 self.WriteVariableList('cflags_pch_c', | 786 self.WriteVariableList('cflags_pch_c', |
| 774 [precompiled_header.GetInclude('c')]) | 787 [precompiled_header.GetInclude('c')]) |
| 775 self.WriteVariableList('cflags_pch_cc', | 788 self.WriteVariableList('cflags_pch_cc', |
| 776 [precompiled_header.GetInclude('cc')]) | 789 [precompiled_header.GetInclude('cc')]) |
| 777 self.WriteVariableList('cflags_pch_objc', | 790 self.WriteVariableList('cflags_pch_objc', |
| 778 [precompiled_header.GetInclude('m')]) | 791 [precompiled_header.GetInclude('m')]) |
| 779 self.WriteVariableList('cflags_pch_objcc', | 792 self.WriteVariableList('cflags_pch_objcc', |
| 780 [precompiled_header.GetInclude('mm')]) | 793 [precompiled_header.GetInclude('mm')]) |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 'extract_toc': | 1581 'extract_toc': |
| 1569 ('{ readelf -d ${lib} | grep SONAME ; ' | 1582 ('{ readelf -d ${lib} | grep SONAME ; ' |
| 1570 'nm -gD -f p ${lib} | cut -f1-2 -d\' \'; }')}) | 1583 'nm -gD -f p ${lib} | cut -f1-2 -d\' \'; }')}) |
| 1571 | 1584 |
| 1572 master_ninja.rule( | 1585 master_ninja.rule( |
| 1573 'solink', | 1586 'solink', |
| 1574 description='SOLINK $lib', | 1587 description='SOLINK $lib', |
| 1575 restat=True, | 1588 restat=True, |
| 1576 command=(mtime_preserving_solink_base % { | 1589 command=(mtime_preserving_solink_base % { |
| 1577 'suffix': '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive ' | 1590 'suffix': '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive ' |
| 1578 '$libs'})) | 1591 '$libdirs $libs'})) |
| 1579 master_ninja.rule( | 1592 master_ninja.rule( |
| 1580 'solink_module', | 1593 'solink_module', |
| 1581 description='SOLINK(module) $lib', | 1594 description='SOLINK(module) $lib', |
| 1582 restat=True, | 1595 restat=True, |
| 1583 command=(mtime_preserving_solink_base % { | 1596 command=(mtime_preserving_solink_base % { |
| 1584 'suffix': '-Wl,--start-group $in $solibs -Wl,--end-group $libs'})) | 1597 'suffix': '-Wl,--start-group $in $solibs -Wl,--end-group ' |
| 1598 '$libdirs $libs'})) |
| 1585 master_ninja.rule( | 1599 master_ninja.rule( |
| 1586 'link', | 1600 'link', |
| 1587 description='LINK $out', | 1601 description='LINK $out', |
| 1588 command=('$ld $ldflags -o $out ' | 1602 command=('$ld $ldflags -o $out ' |
| 1589 '-Wl,--start-group $in $solibs -Wl,--end-group $libs')) | 1603 '-Wl,--start-group $in $solibs -Wl,--end-group $libdirs $libs')) |
| 1590 elif flavor == 'win': | 1604 elif flavor == 'win': |
| 1591 master_ninja.rule( | 1605 master_ninja.rule( |
| 1592 'alink', | 1606 'alink', |
| 1593 description='LIB $out', | 1607 description='LIB $out', |
| 1594 command=('%s gyp-win-tool link-wrapper $arch ' | 1608 command=('%s gyp-win-tool link-wrapper $arch ' |
| 1595 '$ar /nologo /ignore:4221 /OUT:$out @$out.rsp' % | 1609 '$ar /nologo /ignore:4221 /OUT:$out @$out.rsp' % |
| 1596 sys.executable), | 1610 sys.executable), |
| 1597 rspfile='$out.rsp', | 1611 rspfile='$out.rsp', |
| 1598 rspfile_content='$in_newline $libflags') | 1612 rspfile_content='$in_newline $libflags') |
| 1599 dlldesc = 'LINK(DLL) $dll' | 1613 dlldesc = 'LINK(DLL) $dll' |
| 1600 dllcmd = ('%s gyp-win-tool link-wrapper $arch ' | 1614 dllcmd = ('%s gyp-win-tool link-wrapper $arch ' |
| 1601 '$ld /nologo $implibflag /DLL /OUT:$dll ' | 1615 '$ld /nologo $implibflag /DLL /OUT:$dll ' |
| 1602 '/PDB:$dll.pdb @$dll.rsp' % sys.executable) | 1616 '/PDB:$dll.pdb @$dll.rsp' % sys.executable) |
| 1603 dllcmd += (' && %s gyp-win-tool manifest-wrapper $arch ' | 1617 dllcmd += (' && %s gyp-win-tool manifest-wrapper $arch ' |
| 1604 'cmd /c if exist $dll.manifest del $dll.manifest' % | 1618 'cmd /c if exist $dll.manifest del $dll.manifest' % |
| 1605 sys.executable) | 1619 sys.executable) |
| 1606 dllcmd += (' && %s gyp-win-tool manifest-wrapper $arch ' | 1620 dllcmd += (' && %s gyp-win-tool manifest-wrapper $arch ' |
| 1607 '$mt -nologo -manifest $manifests -out:$dll.manifest' % | 1621 '$mt -nologo -manifest $manifests -out:$dll.manifest' % |
| 1608 sys.executable) | 1622 sys.executable) |
| 1609 master_ninja.rule('solink', description=dlldesc, command=dllcmd, | 1623 master_ninja.rule('solink', description=dlldesc, command=dllcmd, |
| 1610 rspfile='$dll.rsp', | 1624 rspfile='$dll.rsp', |
| 1611 rspfile_content='$libs $in_newline $ldflags', | 1625 rspfile_content='$libdirs $libs $in_newline $ldflags', |
| 1612 restat=True) | 1626 restat=True) |
| 1613 master_ninja.rule('solink_module', description=dlldesc, command=dllcmd, | 1627 master_ninja.rule('solink_module', description=dlldesc, command=dllcmd, |
| 1614 rspfile='$dll.rsp', | 1628 rspfile='$dll.rsp', |
| 1615 rspfile_content='$libs $in_newline $ldflags', | 1629 rspfile_content='$libdirs $libs $in_newline $ldflags', |
| 1616 restat=True) | 1630 restat=True) |
| 1617 # Note that ldflags goes at the end so that it has the option of | 1631 # Note that ldflags goes at the end so that it has the option of |
| 1618 # overriding default settings earlier in the command line. | 1632 # overriding default settings earlier in the command line. |
| 1619 master_ninja.rule( | 1633 master_ninja.rule( |
| 1620 'link', | 1634 'link', |
| 1621 description='LINK $out', | 1635 description='LINK $out', |
| 1622 command=('%s gyp-win-tool link-wrapper $arch ' | 1636 command=('%s gyp-win-tool link-wrapper $arch ' |
| 1623 '$ld /nologo /OUT:$out /PDB:$out.pdb @$out.rsp && ' | 1637 '$ld /nologo /OUT:$out /PDB:$out.pdb @$out.rsp && ' |
| 1624 '%s gyp-win-tool manifest-wrapper $arch ' | 1638 '%s gyp-win-tool manifest-wrapper $arch ' |
| 1625 'cmd /c if exist $out.manifest del $out.manifest && ' | 1639 'cmd /c if exist $out.manifest del $out.manifest && ' |
| 1626 '%s gyp-win-tool manifest-wrapper $arch ' | 1640 '%s gyp-win-tool manifest-wrapper $arch ' |
| 1627 '$mt -nologo -manifest $manifests -out:$out.manifest' % | 1641 '$mt -nologo -manifest $manifests -out:$out.manifest' % |
| 1628 (sys.executable, sys.executable, sys.executable)), | 1642 (sys.executable, sys.executable, sys.executable)), |
| 1629 rspfile='$out.rsp', | 1643 rspfile='$out.rsp', |
| 1630 rspfile_content='$in_newline $libs $ldflags') | 1644 rspfile_content='$in_newline $libdirs $libs $ldflags') |
| 1631 else: | 1645 else: |
| 1632 master_ninja.rule( | 1646 master_ninja.rule( |
| 1633 'objc', | 1647 'objc', |
| 1634 description='OBJC $out', | 1648 description='OBJC $out', |
| 1635 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_objc ' | 1649 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_objc ' |
| 1636 '$cflags_pch_objc -c $in -o $out'), | 1650 '$cflags_pch_objc -c $in -o $out'), |
| 1637 depfile='$out.d', | 1651 depfile='$out.d', |
| 1638 deps=deps) | 1652 deps=deps) |
| 1639 master_ninja.rule( | 1653 master_ninja.rule( |
| 1640 'objcxx', | 1654 'objcxx', |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1671 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' | 1685 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' |
| 1672 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) | 1686 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) |
| 1673 | 1687 |
| 1674 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass | 1688 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass |
| 1675 # -bundle -single_module here (for osmesa.so). | 1689 # -bundle -single_module here (for osmesa.so). |
| 1676 master_ninja.rule( | 1690 master_ninja.rule( |
| 1677 'solink', | 1691 'solink', |
| 1678 description='SOLINK $lib, POSTBUILDS', | 1692 description='SOLINK $lib, POSTBUILDS', |
| 1679 restat=True, | 1693 restat=True, |
| 1680 command=(mtime_preserving_solink_base % { | 1694 command=(mtime_preserving_solink_base % { |
| 1681 'suffix': '$in $solibs $libs$postbuilds'})) | 1695 'suffix': '$in $solibs $libdirs $libs$postbuilds'})) |
| 1682 master_ninja.rule( | 1696 master_ninja.rule( |
| 1683 'solink_module', | 1697 'solink_module', |
| 1684 description='SOLINK(module) $lib, POSTBUILDS', | 1698 description='SOLINK(module) $lib, POSTBUILDS', |
| 1685 restat=True, | 1699 restat=True, |
| 1686 command=(mtime_preserving_solink_base % { | 1700 command=(mtime_preserving_solink_base % { |
| 1687 'suffix': '$in $solibs $libs$postbuilds'})) | 1701 'suffix': '$in $solibs $libdirs $libs$postbuilds'})) |
| 1688 | 1702 |
| 1689 master_ninja.rule( | 1703 master_ninja.rule( |
| 1690 'link', | 1704 'link', |
| 1691 description='LINK $out, POSTBUILDS', | 1705 description='LINK $out, POSTBUILDS', |
| 1692 command=('$ld $ldflags -o $out ' | 1706 command=('$ld $ldflags -o $out ' |
| 1693 '$in $solibs $libs$postbuilds')) | 1707 '$in $solibs $libdirs $libs$postbuilds')) |
| 1694 master_ninja.rule( | 1708 master_ninja.rule( |
| 1695 'infoplist', | 1709 'infoplist', |
| 1696 description='INFOPLIST $out', | 1710 description='INFOPLIST $out', |
| 1697 command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && ' | 1711 command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && ' |
| 1698 'plutil -convert xml1 $out $out')) | 1712 'plutil -convert xml1 $out $out')) |
| 1699 master_ninja.rule( | 1713 master_ninja.rule( |
| 1700 'mac_tool', | 1714 'mac_tool', |
| 1701 description='MACTOOL $mactool_cmd $in', | 1715 description='MACTOOL $mactool_cmd $in', |
| 1702 command='$env ./gyp-mac-tool $mactool_cmd $in $out') | 1716 command='$env ./gyp-mac-tool $mactool_cmd $in $out') |
| 1703 master_ninja.rule( | 1717 master_ninja.rule( |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1828 arglists.append( | 1842 arglists.append( |
| 1829 (target_list, target_dicts, data, params, config_name)) | 1843 (target_list, target_dicts, data, params, config_name)) |
| 1830 pool.map(CallGenerateOutputForConfig, arglists) | 1844 pool.map(CallGenerateOutputForConfig, arglists) |
| 1831 except KeyboardInterrupt, e: | 1845 except KeyboardInterrupt, e: |
| 1832 pool.terminate() | 1846 pool.terminate() |
| 1833 raise e | 1847 raise e |
| 1834 else: | 1848 else: |
| 1835 for config_name in config_names: | 1849 for config_name in config_names: |
| 1836 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1850 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 1837 config_name) | 1851 config_name) |
| OLD | NEW |