1617 "topDirArg must be the stx directory (where stc directory with stc-executable is found) |
1634 "topDirArg must be the stx directory (where stc directory with stc-executable is found) |
1618 notice: for now, can only initialize for borland+windows or linux; |
1635 notice: for now, can only initialize for borland+windows or linux; |
1619 visualC setup still fails." |
1636 visualC setup still fails." |
1620 |
1637 |
1621 |topDir topDirName vcTop sdkTop bccTop mingwTop |
1638 |topDir topDirName vcTop sdkTop bccTop mingwTop |
1622 borlandDir useBorlandC useVisualC useMingw32 useMingw64 |
1639 borlandDir useBorlandC useVisualC useMingw32 useMingw64 |
1623 programFiles archArg picArg| |
1640 programFiles archArg picArg| |
1624 |
1641 |
1625 topDir := topDirArg. |
1642 topDir := topDirArg. |
1626 OperatingSystem isMSWINDOWSlike ifTrue:[ |
1643 OperatingSystem isMSWINDOWSlike ifTrue:[ |
1627 topDirArg isString ifTrue:[ |
1644 topDirArg isString ifTrue:[ |
1628 topDir := topDirArg copyReplaceAll:$/ with:$\ ifNone:topDirArg. |
1645 topDir := topDirArg copyReplaceAll:$/ with:$\ ifNone:topDirArg. |
1629 ] |
1646 ] |
1630 ]. |
1647 ]. |
1631 topDir := topDir asFilename. |
1648 topDir := topDir asFilename. |
1632 topDirName := topDir name. |
1649 topDirName := topDir name. |
1633 |
1650 |
1634 "/ if in the development directory, use ./modules |
1651 "/ if in the development directory, use ./modules |
1635 Smalltalk isSmalltalkDevelopmentSystem ifTrue:[ |
1652 Smalltalk isSmalltalkDevelopmentSystem ifTrue:[ |
1636 STCModulePath := 'modules'. |
1653 STCModulePath := 'modules'. |
1637 ] ifFalse:[ |
1654 ] ifFalse:[ |
1638 STCModulePath := Filename tempDirectory constructString:'modules'. |
1655 STCModulePath := Filename tempDirectory constructString:'modules'. |
1639 ]. |
1656 ]. |
1640 |
1657 |
1641 (topDir construct:'stc') exists ifFalse:[ |
1658 (topDir construct:'stc') exists ifFalse:[ |
1642 ('ParserFlags [warning]: stc not found in "',topDirName,'"') infoPrintCR. |
1659 ('ParserFlags [warning]: stc not found in "',topDirName,'"') infoPrintCR. |
1643 'ParserFlags [warning]: stc-compiling (primitive code) will not work in the browser' infoPrintCR. |
1660 'ParserFlags [warning]: stc-compiling (primitive code) will not work in the browser' infoPrintCR. |
1644 STCCompilation := #never. |
1661 STCCompilation := #never. |
1645 ]. |
1662 ]. |
1646 |
1663 |
1647 OperatingSystem isMSWINDOWSlike ifTrue:[ |
1664 OperatingSystem isMSWINDOWSlike ifTrue:[ |
1648 useBorlandC := useVisualC := useMingw32 := useMingw64 := false. |
1665 useBorlandC := useVisualC := useMingw32 := useMingw64 := false. |
1649 programFiles := OperatingSystem getEnvironment:'ProgramFiles'. |
1666 programFiles := OperatingSystem getEnvironment:'ProgramFiles'. |
1650 programFiles isEmptyOrNil ifTrue:[ programFiles := 'C:\Program Files' ]. |
1667 programFiles isEmptyOrNil ifTrue:[ programFiles := 'C:\Program Files' ]. |
1651 |
1668 |
1652 STCCompilationIncludes := '-I',topDirName,'\include -I',topDirName,'\libopengl'. |
1669 STCCompilationIncludes := '-I',topDirName,'\include -I',topDirName,'\libopengl'. |
1653 |
1670 |
1654 ExternalAddress pointerSize == 4 ifFalse:[ |
1671 ExternalAddress pointerSize == 4 ifFalse:[ |
1655 bccTop := nil |
1672 bccTop := nil |
1656 ] ifTrue:[ |
1673 ] ifTrue:[ |
1657 (bccTop := BCCTop) isNil ifTrue:[ |
1674 (bccTop := BCCTop) isNil ifTrue:[ |
1658 borlandDir := OperatingSystem getEnvironment:'BCCDIR'. |
1675 borlandDir := OperatingSystem getEnvironment:'BCCDIR'. |
1659 borlandDir isEmptyOrNil ifTrue:[ borlandDir := 'C:\Borland\bcc55' ]. |
1676 borlandDir isEmptyOrNil ifTrue:[ borlandDir := 'C:\Borland\bcc55' ]. |
1660 bccTop := { |
1677 bccTop := { |
1661 (borlandDir) . |
1678 (borlandDir) . |
1662 (programFiles , '\Borland\bcc55') . |
1679 (programFiles , '\Borland\bcc55') . |
1663 (programFiles , '\bcc55') . |
1680 (programFiles , '\bcc55') . |
1664 } detect:[:path | path asFilename exists and:[(path asFilename construct:'include') exists]] |
1681 } detect:[:path | path asFilename exists and:[(path asFilename construct:'include') exists]] |
1665 ifNone:nil. |
1682 ifNone:nil. |
1666 ]. |
1683 ]. |
1667 ]. |
1684 ]. |
1668 |
1685 |
1669 STCCompilationDefines := '-DWIN32'. |
1686 STCCompilationDefines := '-DWIN32'. |
1670 |
1687 |
1671 (bccTop notNil and:[bccTop asFilename exists]) ifTrue:[ |
1688 (bccTop notNil and:[bccTop asFilename exists]) ifTrue:[ |
1672 STCCompilationIncludes := STCCompilationIncludes,' -I',bccTop,'\Include'. |
1689 STCCompilationIncludes := STCCompilationIncludes,' -I',bccTop,'\Include'. |
1673 LibDirectory := topDirName,'\lib\bc'. |
1690 LibDirectory := topDirName,'\lib\bc'. |
1674 LinkArgs := '-L',topDirName,'\lib\bc'. |
1691 LinkArgs := '-L',topDirName,'\lib\bc'. |
1675 LinkArgs := LinkArgs,' -L',bccTop,'\Lib -r -c -ap -Tpd -Gi -w-dup'. |
1692 LinkArgs := LinkArgs,' -L',bccTop,'\Lib -r -c -ap -Tpd -Gi -w-dup'. |
1676 CCPath := 'bcc32'. |
1693 CCPath := 'bcc32'. |
1677 MakeCommand := 'bmake'. |
1694 MakeCommand := 'bmake'. |
1678 LinkCommand := 'ilink32'. |
1695 LinkCommand := 'ilink32'. |
1679 CCCompilationOptions := '-w-'. |
1696 CCCompilationOptions := '-w-'. |
1680 useBorlandC := true. |
1697 useBorlandC := true. |
1681 ] ifFalse:[ |
1698 ] ifFalse:[ |
1682 ExternalAddress pointerSize == 4 ifFalse:[ |
1699 ExternalAddress pointerSize == 4 ifFalse:[ |
1683 vcTop := nil. |
1700 vcTop := nil. |
1684 ] ifTrue:[ |
1701 ] ifTrue:[ |
1685 (vcTop := VCTop) isNil ifTrue:[ |
1702 (vcTop := VCTop) isNil ifTrue:[ |
1686 vcTop := { |
1703 vcTop := { |
1687 (programFiles,'\Microsoft Visual Studio 13.0\VC') . |
1704 (programFiles,'\Microsoft Visual Studio 13.0\VC') . |
1688 (programFiles,'\Microsoft Visual Studio 12.0\VC') . |
1705 (programFiles,'\Microsoft Visual Studio 12.0\VC') . |
1689 (programFiles,'\Microsoft Visual Studio 11.0\VC') . |
1706 (programFiles,'\Microsoft Visual Studio 11.0\VC') . |
1690 (programFiles,'\Microsoft Visual Studio 10.0\VC') . |
1707 (programFiles,'\Microsoft Visual Studio 10.0\VC') . |
1691 (programFiles,'\Microsoft Visual Studio 9.0\VC' ) . |
1708 (programFiles,'\Microsoft Visual Studio 9.0\VC' ) . |
1692 } detect:[:path | path asFilename exists and:[(path asFilename construct:'bin/cl.exe') exists]] |
1709 } detect:[:path | path asFilename exists and:[(path asFilename construct:'bin/cl.exe') exists]] |
1693 ifNone:nil. |
1710 ifNone:nil. |
1694 ]. |
1711 ]. |
1695 ]. |
1712 ]. |
1696 (vcTop notNil and:[vcTop asFilename exists]) ifTrue:[ |
1713 (vcTop notNil and:[vcTop asFilename exists]) ifTrue:[ |
1697 useVisualC := true. |
1714 useVisualC := true. |
1698 STCCompilationIncludes := STCCompilationIncludes,' -I',vcTop,'include'. |
1715 STCCompilationIncludes := STCCompilationIncludes,' -I',vcTop,'include'. |
1699 |
1716 |
1700 (sdkTop := SDKTop) isNil ifTrue:[ |
1717 (sdkTop := SDKTop) isNil ifTrue:[ |
1701 sdkTop := { |
1718 sdkTop := { |
1702 (programFiles,'\Microsoft SDKs\Windows\v9.0A') . |
1719 (programFiles,'\Microsoft SDKs\Windows\v9.0A') . |
1703 (programFiles,'\Microsoft SDKs\Windows\v8.0A') . |
1720 (programFiles,'\Microsoft SDKs\Windows\v8.0A') . |
1704 (programFiles,'\Microsoft SDKs\Windows\v8.0A') . |
1721 (programFiles,'\Microsoft SDKs\Windows\v8.0A') . |
1705 (programFiles,'\Microsoft SDKs\Windows\v7.0A') . |
1722 (programFiles,'\Microsoft SDKs\Windows\v7.0A') . |
1706 (programFiles,'\Microsoft SDKs\Windows\v6.0A') . |
1723 (programFiles,'\Microsoft SDKs\Windows\v6.0A') . |
1707 } detect:[:path | path asFilename exists and:[(path asFilename construct:'include') exists]] ifNone:nil. |
1724 } detect:[:path | path asFilename exists and:[(path asFilename construct:'include') exists]] ifNone:nil. |
1708 ]. |
1725 ]. |
1709 (sdkTop notNil and:[sdkTop asFilename exists]) ifTrue:[ |
1726 (sdkTop notNil and:[sdkTop asFilename exists]) ifTrue:[ |
1710 STCCompilationIncludes := STCCompilationIncludes,' -I',sdkTop,'\include'. |
1727 STCCompilationIncludes := STCCompilationIncludes,' -I',sdkTop,'\include'. |
1711 ]. |
1728 ]. |
1712 LibDirectory := topDirName,'\lib\vc'. |
1729 LibDirectory := topDirName,'\lib\vc'. |
1713 LinkArgs := '-L',topDirName,'\lib\vc'. |
1730 LinkArgs := '-L',topDirName,'\lib\vc'. |
1714 LinkArgs := LinkArgs,' -r -c -ap -Tpd -Gi -w-dup'. |
1731 LinkArgs := LinkArgs,' -r -c -ap -Tpd -Gi -w-dup'. |
1715 CCPath := vcTop,'\bin\cl.exe'. |
1732 CCPath := vcTop,'\bin\cl.exe'. |
1716 LinkCommand := 'ilink32'. |
1733 LinkCommand := 'ilink32'. |
1717 MakeCommand := 'vcmake'. |
1734 MakeCommand := 'vcmake'. |
1718 CCCompilationOptions := '/nologo /ZI /w /GF /EHsc /FR.\objvc\'. |
1735 CCCompilationOptions := '/nologo /ZI /w /GF /EHsc /FR.\objvc\'. |
1719 ] ifFalse:[ |
1736 ] ifFalse:[ |
1720 "/ add definitions for lcc, mingc etc. |
1737 "/ add definitions for lcc, mingc etc. |
1721 "/ STCCompilationIncludes := STCCompilationIncludes,' -IC:\xxxxx\Include'. |
1738 "/ STCCompilationIncludes := STCCompilationIncludes,' -IC:\xxxxx\Include'. |
1722 ExternalAddress pointerSize == 4 ifTrue:[ |
1739 ExternalAddress pointerSize == 4 ifTrue:[ |
1723 (mingwTop := MingwTop) isNil ifTrue:[ |
1740 (mingwTop := MingwTop) isNil ifTrue:[ |
1724 mingwTop := { |
1741 mingwTop := { |
1725 (programFiles,'\mingw') . |
1742 (programFiles,'\mingw') . |
1726 (programFiles,'\mingw') . |
1743 (programFiles,'\mingw') . |
1727 ('c:\mingw32') . |
1744 ('c:\mingw32') . |
1728 ('c:\mingw') . |
1745 ('c:\mingw') . |
1729 } detect:[:path | path asFilename exists and:[(path asFilename construct:'bin/gcc.exe') exists]] |
1746 } detect:[:path | path asFilename exists and:[(path asFilename construct:'bin/gcc.exe') exists]] |
1730 ifNone:nil. |
1747 ifNone:nil. |
1731 ]. |
1748 ]. |
1732 (mingwTop notNil and:[mingwTop asFilename exists]) ifTrue:[ |
1749 (mingwTop notNil and:[mingwTop asFilename exists]) ifTrue:[ |
1733 useMingw32 := true. |
1750 useMingw32 := true. |
1734 STCCompilationDefines := STCCompilationDefines,' -D__MINGW32__'. |
1751 STCCompilationDefines := STCCompilationDefines,' -D__MINGW32__'. |
1735 CCCompilationOptions := '-w32'. |
1752 CCCompilationOptions := '-w32'. |
1736 ]. |
1753 ]. |
1737 ] ifFalse:[ |
1754 ] ifFalse:[ |
1738 (mingwTop := MingwTop) isNil ifTrue:[ |
1755 (mingwTop := MingwTop) isNil ifTrue:[ |
1739 mingwTop := { |
1756 mingwTop := { |
1740 (programFiles,'\mingw64') . |
1757 (programFiles,'\mingw64') . |
1741 (programFiles,'\mingw') . |
1758 (programFiles,'\mingw') . |
1742 ('c:\mingw64') . |
1759 ('c:\mingw64') . |
1743 ('c:\mingw') . |
1760 ('c:\mingw') . |
1744 } detect:[:path | path asFilename exists and:[(path asFilename construct:'bin/gcc.exe') exists]] |
1761 } detect:[:path | path asFilename exists and:[(path asFilename construct:'bin/gcc.exe') exists]] |
1745 ifNone:nil. |
1762 ifNone:nil. |
1746 ]. |
1763 ]. |
1747 (mingwTop notNil and:[mingwTop asFilename exists]) ifTrue:[ |
1764 (mingwTop notNil and:[mingwTop asFilename exists]) ifTrue:[ |
1748 STCCompilationDefines := STCCompilationDefines,' -D__MINGW64__'. |
1765 STCCompilationDefines := STCCompilationDefines,' -D__MINGW64__'. |
1749 "/ CCCompilationOptions := '-w64'. |
1766 "/ CCCompilationOptions := '-w64'. |
1750 ]. |
1767 ]. |
1751 ]. |
1768 ]. |
1752 (mingwTop notNil and:[mingwTop asFilename exists]) ifTrue:[ |
1769 (mingwTop notNil and:[mingwTop asFilename exists]) ifTrue:[ |
1753 STCCompilationDefines := STCCompilationDefines,' -D__MINGW__'. |
1770 STCCompilationDefines := STCCompilationDefines,' -D__MINGW__'. |
1754 CCPath := mingwTop,'\bin\gcc.exe'. |
1771 CCPath := mingwTop,'\bin\gcc.exe'. |
1755 LinkCommand := 'gcc'. |
1772 LinkCommand := 'gcc'. |
1756 MakeCommand := 'mingwmake'. |
1773 MakeCommand := 'mingwmake'. |
1757 LibDirectory := topDirName,'\lib\mingw'. |
1774 LibDirectory := topDirName,'\lib\mingw'. |
1758 LinkArgs := '-L',topDirName,'\lib\mingw'. |
1775 LinkArgs := '-L',topDirName,'\lib\mingw'. |
1759 "/ LinkArgs := LinkArgs,' -r -c -ap -Tpd -Gi -w-dup'. |
1776 "/ LinkArgs := LinkArgs,' -r -c -ap -Tpd -Gi -w-dup'. |
1760 ]. |
1777 ]. |
1761 ]. |
1778 ]. |
1762 ]. |
1779 ]. |
1763 STCCompilationOptions := '+optinline +inlineNew'. |
1780 STCCompilationOptions := '+optinline +inlineNew'. |
1764 (topDirName,'\stc\stc.exe') asFilename exists ifTrue:[ |
1781 (topDirName,'\stc\stc.exe') asFilename exists ifTrue:[ |
1765 STCPath := (topDirName,'\stc\stc.exe'). |
1782 STCPath := (topDirName,'\stc\stc.exe'). |
1766 ] ifFalse:[ |
1783 ] ifFalse:[ |
1767 STCPath := 'stc.exe'. |
1784 STCPath := 'stc.exe'. |
1768 ]. |
1785 ]. |
1769 LibPath := ''. |
1786 LibPath := ''. |
1770 SearchedLibraries := #('import32.lib'). |
1787 SearchedLibraries := #('import32.lib'). |
1771 "/ SearchedLibraries := #('import32.lib' 'glu32.lib' 'opengl32.lib'). |
1788 "/ SearchedLibraries := #('import32.lib' 'glu32.lib' 'opengl32.lib'). |
1772 ] ifFalse:[ |
1789 ] ifFalse:[ |
1773 STCCompilationIncludes := '-I',topDirName,'/include'. |
1790 STCCompilationIncludes := '-I',topDirName,'/include'. |
1774 STCCompilationDefines := ''. |
1791 STCCompilationDefines := ''. |
1775 STCCompilationOptions := '+optinline +inlineNew'. |
1792 STCCompilationOptions := '+optinline +inlineNew'. |
1776 STCPath := topDirName,'/stc/stc'. |
1793 STCPath := topDirName,'/stc/stc'. |
1777 |
1794 |
1778 archArg := picArg := ''. |
1795 archArg := picArg := ''. |
1779 (ExternalAddress pointerSize == 4) ifTrue:[ |
1796 (ExternalAddress pointerSize == 4) ifTrue:[ |
1780 archArg := ' -m32' |
1797 archArg := ' -m32' |
1781 ] ifFalse:[ |
1798 ] ifFalse:[ |
1782 archArg := ' -m64'. "gcc -m64 needs -fPIC to make a shared library" |
1799 archArg := ' -m64'. "gcc -m64 needs -fPIC to make a shared library" |
1783 picArg := ' -fPIC'. |
1800 picArg := ' -fPIC'. |
1784 ]. |
1801 ]. |
1785 CCCompilationOptions := OperatingSystem getCPUDefine, |
1802 CCCompilationOptions := OperatingSystem getCPUDefine, |
1786 ' -D', self usedCompilerDefine, |
1803 ' -D', self usedCompilerDefine, |
1787 ' ', OperatingSystem getOSDefine, |
1804 ' ', OperatingSystem getOSDefine, |
1788 ' ', '-O', archArg, picArg. |
1805 ' ', '-O', archArg, picArg. |
1789 ParserFlags useClang ifTrue:[ |
1806 ParserFlags useClang ifTrue:[ |
1790 CCPath := 'clang' |
1807 CCPath := 'clang' |
1791 ] ifFalse:[ |
1808 ] ifFalse:[ |
1792 ParserFlags useGnuC ifTrue:[ |
1809 ParserFlags useGnuC ifTrue:[ |
1793 CCPath := 'gcc' |
1810 CCPath := 'gcc' |
1794 ] ifFalse:[ |
1811 ] ifFalse:[ |
1795 CCPath := 'cc' |
1812 CCPath := 'cc' |
1796 ]. |
1813 ]. |
1797 ]. |
1814 ]. |
1798 LinkArgs := archArg. |
1815 LinkArgs := archArg. |
1799 LinkSharedArgs := '-shared'. |
1816 LinkSharedArgs := '-shared'. |
1800 LinkCommand := CCPath. |
1817 LinkCommand := CCPath. |
1801 LibPath := ''. |
1818 LibPath := ''. |
1802 SearchedLibraries := #(). |
1819 SearchedLibraries := #(). |
1803 MakeCommand := 'make'. |
1820 MakeCommand := 'make'. |
1804 ]. |
1821 ]. |
1805 |
1822 |
1806 Smalltalk infoPrinting ifTrue:[ |
1823 Smalltalk infoPrinting ifTrue:[ |
1807 'ParserFlags [info]:' infoPrintCR. |
1824 'ParserFlags [info]:' infoPrintCR. |
1808 ' STC Setup:' infoPrintCR. |
1825 ' STC Setup:' infoPrintCR. |
1809 (' STCCompilationDefines: ',STCCompilationDefines asString) infoPrintCR. |
1826 (' STCCompilationDefines: ',STCCompilationDefines asString) infoPrintCR. |
1810 (' CCPath: ',CCPath asString) infoPrintCR. |
1827 (' CCPath: ',CCPath asString) infoPrintCR. |
1811 (' CCCompilationOptions: ',CCCompilationOptions asString) infoPrintCR. |
1828 (' CCCompilationOptions: ',CCCompilationOptions asString) infoPrintCR. |
1812 (' LinkCommand: ',LinkCommand asString) infoPrintCR. |
1829 (' LinkCommand: ',LinkCommand asString) infoPrintCR. |
1813 (' MakeCommand: ',MakeCommand asString) infoPrintCR. |
1830 (' MakeCommand: ',MakeCommand asString) infoPrintCR. |
1814 (' LinkArgs: ',LinkArgs asString) infoPrintCR. |
1831 (' LinkArgs: ',LinkArgs asString) infoPrintCR. |
1815 ]. |
1832 ]. |
1816 |
1833 |
1817 " |
1834 " |
1818 ParserFlags initializeSTCFlagsForTopDirectory:'../..' |
1835 ParserFlags initializeSTCFlagsForTopDirectory:'../..' |
1819 " |
1836 " |