STC interface cleanup: do not initialize stc settings in startup scripts
...instead, let the class (ParserFlags) initialize itself. This way, the default
values are computed on only one place.
--- a/h_win32.rc Tue Jan 05 10:12:26 2016 +0000
+++ b/h_win32.rc Tue Jan 05 10:16:00 2016 +0000
@@ -36,192 +36,4 @@
].
k close.
].
-!
-
-|incl libs tryPathesForBin path usedCompiler
- bccPath msvcPath mingw64Path mingw32Path
- searchedLibraries
- linkCommand linkArgs ccCommand ccCompilationOptions
- |
-
-false "Smalltalk wasStartedFromImage" ifFalse:[
-
- incl := #(
- '-I..\..\include'
- "/ '-I..\..\libopengl'
- ).
-
- tryPathesForBin := [:pathes |
- |foundPath|
- pathes do:[:eachPath |
- |thisPath|
-
- (thisPath := eachPath asFilename) exists ifTrue:[
- foundPath := thisPath
- ].
- ].
- foundPath
- ].
-
- "/
- "/ right now, stx can be used with one of:
- "/ - borland C-compiler (bcc32).
- "/ - visual studio C (actually: SDK) (msc)
- "/ - mingw64 gcc
-
- "/ uncomment one of the following
- bccPath := 'C:\borland\bcc55\bin'.
- msvcPath := 'C:\Programme\Microsoft Visual Studio 10.0\VC\bin'.
- mingw64Path := 'C:\mingw64\bin'.
-
- "/ or take a look what we find installed:
- path := (OperatingSystem getEnvironment:'PATH') asCollectionOfSubstringsSeparatedBy:$;.
- ExternalBytes sizeofPointer == 8 ifTrue:[
- mingw64Path := path detect:[:d | d asLowercase includesString:'mingw64'] ifNone:nil.
- mingw64Path isNil ifTrue:[
- mingw64Path := tryPathesForBin value:
- #(
- 'C:\Programme\mingw64\bin'
- 'C:\Programs\mingw64\bin'
- 'C:\Program Files\mingw64\bin'
- 'C:\mingw64\bin'
- ).
- ].
- ] ifFalse:[
- bccPath := path detect:[:d | d asLowercase includesString:'borland'] ifNone:nil.
- bccPath isNil ifTrue:[
- bccPath := tryPathesForBin value:
- #(
- 'C:\Programme\borland\bcc55\bin'
- 'C:\Programs\borland\bcc55\bin'
- 'C:\Program Files\borland\bcc55\bin'
- 'C:\borland\bcc55\bin'
- ).
- ].
-
- msvcPath isNil ifTrue:[
- msvcPath := tryPathesForBin value:
- #(
- 'C:\Programme\Microsoft Visual Studio 11.0\VC\bin'
- 'C:\Programme\Microsoft Visual Studio 10.0\VC\bin'
- 'C:\Programme\Microsoft Visual Studio 9.0\VC\bin'
- 'C:\Programme\Microsoft Visual Studio 8.0\VC\bin'
- 'C:\Program Files\Microsoft Visual Studio 11.0\VC\bin'
- 'C:\Program Files\Microsoft Visual Studio 10.0\VC\bin'
- 'C:\Program Files\Microsoft Visual Studio 9.0\VC\bin'
- 'C:\Program Files\Microsoft Visual Studio 8.0\VC\bin'
- ).
- ].
- ].
-
- bccPath notNil ifTrue:[
- "/ borland
- ExternalBytes sizeofPointer == 8 ifTrue:[
- 'host.rc [info]: ignore bcc32 compiler (cannot be used with 64 bit architecture)' infoPrintCR.
- ] ifFalse:[
- 'host.rc [info]: setup for borland bcc32 compiler' infoPrintCR.
- bccPath := bccPath asFilename.
- "/ 'host.rc [info]: bccPath=' infoPrint. bccPath infoPrintCR.
- ccCommand := (bccPath / 'bcc32') pathName.
- linkCommand := (bccPath / 'ilink32') pathName.
- bccPath := bccPath directory.
- 'host.rc [info]: bccPath=' infoPrint. bccPath pathName infoPrintCR.
-
- libs := #(
- '-L..\..\lib\bc'
- ).
-
- incl := incl copyWith: ( '-I',(bccPath / 'include') pathName ).
- libs := libs copyWith: ( '-L',(bccPath / 'lib') pathName ).
- (bccPath / 'lib' / 'psdk') exists ifTrue:[
- libs := libs copyWith: ( '-L',(bccPath / 'lib' / 'psdk') pathName ).
- ].
- ccCompilationOptions := '-w-'.
- searchedLibraries := #('import32.lib' 'odbc32.lib' 'glu32.lib' 'opengl32.lib').
-
- libs := libs asStringWith:Character space.
- linkArgs := (libs , ' -r -c -ap -Tpd -Gi -w-dup').
- incl := incl asStringWith:Character space.
- usedCompiler := 'bcc'.
- ].
- ].
-
- (usedCompiler isNil and:[msvcPath notNil]) ifTrue:[
- "/ msvc
- ExternalBytes sizeofPointer == 8 ifTrue:[
- 'host.rc [info]: ignore msvc compiler (cannot be used with 64 bit architecture)' infoPrintCR.
- ] ifFalse:[
- 'host.rc [info]: setup for msvc compiler' infoPrintCR.
- msvcPath := msvcPath asFilename.
- ccCommand := (msvcPath / 'cl') pathName.
- linkCommand := (msvcPath / 'ilink32') pathName.
- ccCompilationOptions := '/O1'.
- searchedLibraries := #('import32.lib' 'odbc32.lib' 'glu32.lib' 'opengl32.lib').
-
- libs := #(
- '-L..\..\lib\vc'
- ).
- libs := libs asStringWith:Character space.
- linkArgs := (libs).
- incl := incl asStringWith:Character space.
- usedCompiler := 'msvc'.
- ].
- ].
-
- usedCompiler isNil ifTrue:[
- ExternalBytes sizeofPointer == 8 ifTrue:[
- mingw64Path notNil ifTrue:[
- "/ mingw64
- 'host.rc [info]: setup for mingw64 compiler' infoPrintCR.
- mingw64Path := mingw64Path asFilename.
- ccCommand := (mingw64Path / 'gcc') pathName.
- linkCommand := (mingw64Path / 'gcc') pathName.
- mingw64Path := mingw64Path directory.
- ccCompilationOptions := ''.
- searchedLibraries := #('-lodbc32' '-lglu32' '-lopengl32').
-
- libs := {
- '-L..\..\lib\mingw' .
- ( '-L',(mingw64Path / 'lib') pathName ) .
- }.
- libs := libs asStringWith:Character space.
- linkArgs := (libs).
- incl := incl asStringWith:Character space.
- usedCompiler := 'mingw'.
- ].
- ] ifFalse:[
- mingw32Path notNil ifTrue:[
- "/ mingw32
- 'host.rc [info]: setup for mingw32 compiler' infoPrintCR.
- mingw32Path := mingw32Path asFilename.
- ccCommand := (mingw32Path / 'gcc') pathName.
- linkCommand := (mingw32Path / 'gcc') pathName.
- mingw32Path := mingw32Path directory.
- ccCompilationOptions := ''.
- searchedLibraries := #('-lodbc32' '-lglu32' '-lopengl32').
-
- libs := {
- '-L..\..\lib\mingw' .
- ( '-L',(mingw32Path / 'lib') pathName ) .
- }.
- libs := libs asStringWith:Character space.
- linkArgs := (libs).
- incl := incl asStringWith:Character space.
- usedCompiler := 'mingw'.
- ].
- ].
- ].
-
- usedCompiler notNil ifTrue:[
- ParserFlags ccPath:ccCommand.
- ParserFlags linkCommand:linkCommand.
- ParserFlags stcCompilationIncludes: incl.
- ParserFlags stcCompilationDefines: ''.
- ParserFlags stcCompilationOptions: '+optinline +inlineNew'.
- ParserFlags ccCompilationOptions: ccCompilationOptions.
- ParserFlags searchedLibraries:searchedLibraries.
- ParserFlags linkArgs: linkArgs.
- ]
-].
-
-!
+!
\ No newline at end of file
--- a/host.rc Tue Jan 05 10:12:26 2016 +0000
+++ b/host.rc Tue Jan 05 10:16:00 2016 +0000
@@ -33,81 +33,6 @@
].
].
-"------------------------------------------------------------------------"
-"/ default compiler setup;
-"/ can be rechanged in a h_xxx file.
-"/
-
-(Smalltalk wasStartedFromImage not and:[ Smalltalk isPlugin not ])
-ifTrue:[
- Compiler stcCompilation:#default.
- Compiler stcCompilationOptions:'+optinline +inlineNew'.
-
- "/
- "/ setup for gcc (which is OK for most systems);
- "/ Notice that this setup may be changed by an OS-specific h_xxx file
- "/
- conf := Smalltalk configuration.
- (conf includesString:'gcc') ifTrue:[
- Compiler ccPath:'gcc'
- ] ifFalse:[
- Compiler ccPath:'cc'
- ].
- Compiler ccCompilationOptions:'-O'.
-
- (conf includesString:'amd64_mode32') ifTrue:[
- ((ObjectFileLoader linkArgs ? '') includesString:'-m32') ifFalse:[
- ObjectFileLoader linkArgs:((ObjectFileLoader linkArgs ? '') , ' -m32 -m elf_i386').
- ].
- (Compiler ccCompilationOptions includesString:'-m32') ifFalse:[
- Compiler ccCompilationOptions:(Compiler ccCompilationOptions , ' -m32').
- ].
- ((Compiler stcCompilationDefines ? '') includesString:'-D__amd64_mode32__') ifFalse:[
- Compiler stcCompilationDefines:((Compiler stcCompilationDefines ? ''), ' -D__amd64_mode32__').
- ].
- ].
-
-
- includes := ''.
- incDir := Smalltalk getSystemFileName:'include/stc.h'.
- incDir notNil ifTrue:[ incDir := incDir asFilename directoryName ].
-
- incDir notNil ifTrue:[
- includes := includes , '-I' , incDir asFilename pathName , ' '
- ] ifFalse:[
- ('../../../stx/include' asFilename exists) ifTrue:[
- "/ running in a development environment...
- includes := includes , '-I../../../stx/include '.
- ] ifFalse:[
- ('../../include' asFilename exists) ifTrue:[
- "/ running in a development environment...
- includes := includes , '-I../../include '.
- ] ifFalse:[
- "/ if this is a production program, dont care for a warning
- (Smalltalk isStandAloneApp or:[Smalltalk isHeadless])
- ifFalse:[
- 'host.rc [warning]: no >>include<< directory found along your path.' infoPrintCR.
- 'host.rc [warning]: this might affect stc-compilation from within the browser.' infoPrintCR.
- ]
- ]
- ]
- ].
-
- Compiler stcCompilationIncludes:includes.
-
- "/
- "/ for myself: preset flags, so that we can accept GLXWorkstation code
- "/ You probably will never do this.
- "/
- (Display notNil and:[Display supportsGLDrawing]) ifTrue:[
- sysType = 'irix' ifTrue:[
- Compiler stcCompilationDefines:'-DGLX'.
- ] ifFalse:[
- Compiler stcCompilationIncludes:'-I../../include -I../../support/VGL/vogl/src'.
- Compiler stcCompilationDefines:'-DVGL'.
- ]
- ].
-].
"/
"/ try systemType-specific setup