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