"*
* Encoding: iso8859-1
*
* $Header$
*
* MIMEType: application/x-smalltalk-source
*
* ST/X startup configuration file - for win95, win98 and winNT OS.
*
* DONT add site specific things here - use your own h_xxx.rc file instead
* where xxx stands for your hostname(s)
*"
!
"/ look in registry for LibDir ...
|k rel curr libDir|
rel := Smalltalk versionString.
k := Win32OperatingSystem registryEntry key:('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\',rel).
k isNil ifTrue:[
k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
k notNil ifTrue:[
curr := k valueNamed:'CurrentVersion'.
curr isString ifTrue:[
k close.
k := Win32OperatingSystem registryEntry key:('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\',curr).
]
]
].
k notNil ifTrue:[
libDir := k valueNamed:'LibDir'.
(libDir notNil and:[libDir asFilename exists]) ifTrue:[
(Smalltalk systemPath includes:(libDir asFilename pathName)) ifFalse:[
Smalltalk systemPath addFirst:(libDir asFilename pathName).
Smalltalk flushPathCaches
]
].
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 to enforce a compiler
"/ bccPath := 'C:\borland\bcc55\bin'.
"/ msvcPath := 'C:\Programme\Microsoft Visual Studio 10.0\VC\bin'.
"/ mingw64Path := 'C:\mingw64\bin'.
"/ mingw32Path := 'C:\mingw\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:'mingw'] ifNone:nil.
mingw64Path isNil ifTrue:[
mingw64Path := tryPathesForBin value:
#(
'C:\Programme\mingw64\bin'
'C:\Programme\mingw-w64\mingw64\bin'
'C:\Programme\mingw-w64\mingw\bin'
'C:\Programs\mingw64\bin'
'C:\Programs\mingw-w64\mingw64\bin'
'C:\Programs\mingw-w64\mingw\bin'
'C:\Program Files\mingw64\bin'
'C:\Program Files\mingw-w64\mingw64\bin'
'C:\Program Files\mingw-w64\mingw\bin'
'C:\mingw64\bin'
'C:\mingw-w64\mingw64\bin'
).
].
] ifFalse:[
mingw32Path := path detect:[:d | d asLowercase includesString:'mingw'] ifNone:nil.
mingw32Path isNil ifTrue:[
mingw32Path := tryPathesForBin value:
#(
'C:\Programme\mingw\bin'
'C:\Programme\mingw-w32\mingw32\bin'
'C:\Programme\mingw-w32\mingw\bin'
'C:\Programs\mingw\bin'
'C:\Programs\mingw-w32\mingw32\bin'
'C:\Programs\mingw-w32\mingw\bin'
'C:\Program Files\mingw\bin'
'C:\Program Files\mingw-w32\mingw32\bin'
'C:\Program Files\mingw-w32\mingw\bin'
'C:\mingw\bin'
'C:\mingw-w32\mingw32\bin'
'C:\mingw-w32\mingw\bin'
).
].
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'
'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin'
'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin'
'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin'
'C:\Program Files (x86)\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 := #('-lkernel32' '-luser32' '-lodbc32' '-lglu32' '-lopengl32' '-lwsock32' '-lws2_32').
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 := #('-lkernel32' '-luser32' '-lodbc32' '-lglu32' '-lopengl32' '-lwsock32' '-lws2_32').
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.
]
].
!