ParserFlags.st
branchjv
changeset 3700 264d6604a9f3
parent 3687 c71140c6d0a0
child 3707 4593eb11f9f5
equal deleted inserted replaced
3694:e89d2870030c 3700:264d6604a9f3
  1493 ! !
  1493 ! !
  1494 
  1494 
  1495 !ParserFlags class methodsFor:'class initialization'!
  1495 !ParserFlags class methodsFor:'class initialization'!
  1496 
  1496 
  1497 initialize
  1497 initialize
  1498     | executablePath |
  1498     | executablePath topDirectory stcExe |
  1499 
  1499 
  1500     Warnings := true.
  1500     Warnings := true.
  1501     WarnUndeclared := true.
  1501     WarnUndeclared := true.
  1502     WarnUnusedVars := true.
  1502     WarnUnusedVars := true.
  1503     WarnSTXSpecials := false.
  1503     WarnSTXSpecials := false.
  1586     DefineForMINGW := '__MINGW__'.
  1586     DefineForMINGW := '__MINGW__'.
  1587     DefineForMINGW32 := '__MINGW32__'.
  1587     DefineForMINGW32 := '__MINGW32__'.
  1588     DefineForMINGW64 := '__MINGW64__'.
  1588     DefineForMINGW64 := '__MINGW64__'.
  1589     DefineForCLANG := '__clang__'.
  1589     DefineForCLANG := '__clang__'.
  1590 
  1590 
       
  1591     stcExe := OperatingSystem isMSWINDOWSlike ifTrue:['stc.exe'] ifFalse:['stc'].
       
  1592 
  1591     (executablePath := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[
  1593     (executablePath := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[
  1592         executablePath := executablePath asFilename directory.
  1594         topDirectory := executablePath asFilename directory.
  1593         (((executablePath / 'include') exists and:[(executablePath / 'stc') exists])
  1595         (((topDirectory / 'include') exists and:[(topDirectory / 'stc') exists or:[(topDirectory / 'bin' / stcExe) exists]])
  1594           or:[
  1596           or:[
  1595             executablePath := executablePath directory.
  1597             topDirectory := topDirectory directory.
  1596             ((executablePath / 'include') exists and:[(executablePath / 'stc') exists])
  1598             ((topDirectory / 'include') exists and:[(topDirectory / 'stc') exists or:[(topDirectory / 'bin' / stcExe) exists]])
  1597               or:[
  1599               or:[
  1598                 executablePath := executablePath directory.
  1600                 topDirectory := topDirectory directory.
  1599                 ((executablePath / 'include') exists and:[(executablePath / 'stc') exists])
  1601                 ((topDirectory / 'include') exists and:[(topDirectory / 'stc') exists or:[(topDirectory / 'bin' / stcExe) exists]])
  1600               ]
  1602               ]
  1601            ]
  1603            ]
  1602         ) ifTrue:[
  1604         ) ifTrue:[
  1603             self initializeSTCFlagsForTopDirectory: executablePath.
  1605             self initializeSTCFlagsForTopDirectory: topDirectory.
  1604         ]
  1606         ]
  1605     ].
  1607     ].
  1606 
  1608 
  1607 
  1609 
  1608     self useGnuC ifTrue:[ 
  1610     self useGnuC ifTrue:[ 
  1622      ParserFlags initialize
  1624      ParserFlags initialize
  1623     "
  1625     "
  1624 
  1626 
  1625     "Modified: / 09-08-2006 / 18:47:18 / fm"
  1627     "Modified: / 09-08-2006 / 18:47:18 / fm"
  1626     "Modified: / 31-01-2012 / 12:06:32 / cg"
  1628     "Modified: / 31-01-2012 / 12:06:32 / cg"
  1627     "Modified: / 09-12-2015 / 22:24:10 / jv"
  1629     "Modified: / 06-01-2016 / 22:25:30 / jv"
  1628 !
  1630 !
  1629 
  1631 
  1630 initializeSTCFlagsForGCC
  1632 initializeSTCFlagsForGCC
  1631     self ccPath: 'gcc'.
  1633     self ccPath: 'gcc'.
  1632     self linkCommand: 'gcc'.
  1634     self linkCommand: 'gcc'.
  1633     ExternalAddress pointerSize == 4 ifTrue:[ 
  1635     self linkArgs: ''.
  1634         self linkArgs: '-m32'.
  1636     self linkSharedArgs: '-shared'
  1635         self linkSharedArgs: '-shared -m32'
       
  1636     ] ifFalse:[ 
       
  1637         self linkArgs: '-m64'.
       
  1638         self linkSharedArgs: '-shared -m64'
       
  1639     ].
       
  1640 
  1637 
  1641     "Created: / 09-12-2015 / 22:10:52 / jv"
  1638     "Created: / 09-12-2015 / 22:10:52 / jv"
  1642     "Modified: / 10-12-2015 / 09:33:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1643 !
  1639 !
  1644 
  1640 
  1645 initializeSTCFlagsForMINGW32
  1641 initializeSTCFlagsForMINGW32
  1646     | mingwDirs mingwDir |
  1642     | mingwDirs mingwDir |
  1647 
  1643 
  1677 initializeSTCFlagsForTopDirectory:topDirArg
  1673 initializeSTCFlagsForTopDirectory:topDirArg
  1678     "topDirArg must be the stx directory (where stc directory with stc-executable is found)
  1674     "topDirArg must be the stx directory (where stc directory with stc-executable is found)
  1679      notice: for now, can only initialize for borland+windows or linux;
  1675      notice: for now, can only initialize for borland+windows or linux;
  1680      visualC setup still fails."
  1676      visualC setup still fails."
  1681 
  1677 
  1682     |topDir topDirName|
  1678     |topDir topDirName stcExe stcPath |
  1683 
  1679 
  1684     topDir := topDirArg.
  1680     topDir := topDirArg.
  1685     OperatingSystem isMSWINDOWSlike ifTrue:[
  1681     OperatingSystem isMSWINDOWSlike ifTrue:[
  1686         topDirArg isString ifTrue:[
  1682         topDirArg isString ifTrue:[
  1687             topDir := topDirArg copyReplaceAll:$/ with:$\ ifNone:topDirArg.
  1683             topDir := topDirArg copyReplaceAll:$/ with:$\ ifNone:topDirArg.
  1695         STCModulePath := 'modules'.
  1691         STCModulePath := 'modules'.
  1696     ] ifFalse:[
  1692     ] ifFalse:[
  1697         STCModulePath := Filename tempDirectory constructString:'modules'.
  1693         STCModulePath := Filename tempDirectory constructString:'modules'.
  1698     ].
  1694     ].
  1699 
  1695 
  1700     (topDir construct:'stc') exists ifFalse:[
  1696     stcExe := OperatingSystem isMSWINDOWSlike ifTrue:['stc.exe'] ifFalse:['stc'].
  1701         ('ParserFlags [warning]: stc not found in "',topDirName,'"') infoPrintCR.
  1697 
  1702         'ParserFlags [warning]: stc-compiling (primitive code) will not work in the browser' infoPrintCR.
  1698     (stcPath := topDir / 'stc' / stcExe) exists ifTrue:[
  1703         STCCompilation := #never.
  1699         "/ build-tree environment
       
  1700         STCPath := stcPath pathName.        
       
  1701     ] ifFalse:[
       
  1702         (stcPath := topDir / 'bin' / stcExe) exists ifTrue:[
       
  1703             "/ Packaged environment
       
  1704             STCPath := stcPath pathName.        
       
  1705         ] ifFalse:[
       
  1706             Logger warning: 'stc not found in "%1"' with: topDirName.
       
  1707             Logger warning: 'stc-compiling (primitive code) will not work in the browser'. 
       
  1708             STCCompilation := #never.
       
  1709         ]
  1704     ].
  1710     ].
  1705 
  1711 
  1706     OperatingSystem isMSWINDOWSlike ifTrue:[
  1712 
  1707         STCCompilationOptions := '+optinline +inlineNew'.
  1713     STCCompilationOptions := '+optinline +inlineNew'.
  1708         (topDirName,'\stc\stc.exe') asFilename exists ifTrue:[
  1714     LibPath := ''.
  1709             STCPath := (topDirName,'\stc\stc.exe').
  1715     SearchedLibraries := #().
  1710         ] ifFalse:[
  1716     MakeCommand := 'make'
  1711             STCPath := 'stc.exe'.
  1717     .
  1712         ].
       
  1713         LibPath := ''.
       
  1714         SearchedLibraries := #().
       
  1715         MakeCommand := 'make'
       
  1716     ] ifFalse:[
       
  1717         STCCompilationOptions := '+optinline +inlineNew'.
       
  1718         STCPath := topDirName,'/stc/stc'.
       
  1719         LibPath := ''.
       
  1720         SearchedLibraries := #().
       
  1721         MakeCommand := 'make'.
       
  1722     ].
       
  1723 
       
  1724     "
  1718     "
  1725      ParserFlags initializeSTCFlagsForTopDirectory:'../..'
  1719      ParserFlags initializeSTCFlagsForTopDirectory:'../..'
  1726     "
  1720     "
  1727 
  1721 
  1728     "Modified: / 09-08-2006 / 18:47:18 / fm"
  1722     "Modified: / 09-08-2006 / 18:47:18 / fm"
  1729     "Created: / 06-08-2011 / 19:47:47 / cg"
  1723     "Created: / 06-08-2011 / 19:47:47 / cg"
  1730     "Modified: / 09-12-2015 / 17:03:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1724     "Modified: / 09-12-2015 / 17:03:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1731     "Modified: / 09-12-2015 / 22:28:59 / jv"
  1725     "Modified: / 06-01-2016 / 22:45:09 / jv"
  1732 !
  1726 !
  1733 
  1727 
  1734 old_initializeSTCFlagsForTopDirectory:topDirArg
  1728 old_initializeSTCFlagsForTopDirectory:topDirArg
  1735     "topDirArg must be the stx directory (where stc directory with stc-executable is found)
  1729     "topDirArg must be the stx directory (where stc directory with stc-executable is found)
  1736      notice: for now, can only initialize for borland+windows or linux;
  1730      notice: for now, can only initialize for borland+windows or linux;