diff -r a7ddf89e20e3 -r bea9c6bb6a90 ProjectBuilder.st --- a/ProjectBuilder.st Wed Sep 05 20:30:07 2012 +0200 +++ b/ProjectBuilder.st Thu Sep 06 20:59:03 2012 +0200 @@ -16,7 +16,7 @@ Object subclass:#ProjectBuilder instanceVariableNames:'package projectDefinitionClass sourceCodeManager buildDirectory myWorkingDirectory mySTXTopDirectory myTopDirectory outputStream - makeExeOnly usedCompiler' + makeExeOnly usedCompiler stdOut stdErr' classVariableNames:'PreviousBuildDirectory' poolDictionaries:'' category:'System-Support-Projects' @@ -82,10 +82,9 @@ ^ compiler ]. - OperatingSystem isMSWINDOWSlike ifTrue:[ - ^ 'bcc' - ]. - ^ 'gcc' + ^ OperatingSystem isMSWINDOWSlike + ifTrue:[ 'bcc' ] + ifFalse:[ 'gcc' ] "Created: / 21-01-2012 / 14:06:51 / cg" ! @@ -93,13 +92,45 @@ listOfPossibleCompilers OperatingSystem isMSWINDOWSlike ifTrue:[ OperatingSystem getLoginName = 'cg' ifTrue:[ - ^ #('bcc' 'vc' 'lcc' 'tcc' 'mingw' ) + ^ #( + 'bcc' "/ OK + 'vc' "/ almost OK + 'lcc' "/ experimental, but only free for non-commercial work + 'tcc' "/ experimental; limited but free + 'mingw' "/ experimental; free + ) ]. - ^ #('bcc' 'vc' 'lcc' ) + ^ #('bcc' 'vc' "'lcc' 'mingw'" ) ]. ^ #('gcc') "Created: / 21-01-2012 / 14:04:15 / cg" +! + +suiteNameOfCompiler:usedCompiler + usedCompiler = 'bcc' ifTrue:[ + ^ 'Borland C-Compiler'. + ]. + usedCompiler = 'vc' ifTrue:[ + ^ 'Microsoft Visual C C-Compiler'. + ]. + usedCompiler = 'lcc' ifTrue:[ + ^ 'LCC C-Compiler'. + ]. + usedCompiler = 'tcc' ifTrue:[ + ^ 'Tiny C-Compiler'. + ]. + usedCompiler = 'gcc' ifTrue:[ + ^ 'GNU C-Compiler'. + ]. + usedCompiler = 'mingw' ifTrue:[ + ^ 'MINGW GNU C-Compiler'. + ]. + self halt:'unknown compiler'. + + ^ 'C-Compiler'. + + "Created: / 06-09-2012 / 15:58:33 / cg" ! ! !ProjectBuilder methodsFor:'accessing'! @@ -158,24 +189,24 @@ "/ intermediate - this will move into a commonly used utility class "/ (where all the project code support will be collected). - |stdOut stdErr lock| + |lock| lock := Semaphore forMutualExclusion. stdErr := ActorStream new nextPutBlock:[:char | lock critical:[ - makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}. - makeOutput nextPut:char. - makeOutput emphasis:nil. + makeOutput + withEmphasis:{#backgroundColor->Color red. #color->Color white.} + do:[makeOutput nextPut:char]. ] ]; nextPutAllBlock:[:string | lock critical:[ "/ (string includesString:'das Ziel' )ifTrue:[self halt]. - makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}. - makeOutput nextPutAll:string. - makeOutput emphasis:nil. + makeOutput + withEmphasis:{#backgroundColor->Color red. #color->Color white.} + do:[makeOutput nextPutAll:string]. ] ]. stdOut := ActorStream new @@ -193,7 +224,7 @@ self buildWithOutputTo:stdOut errorTo:stdErr. - "Modified: / 21-01-2012 / 13:49:13 / cg" + "Modified: / 06-09-2012 / 16:15:50 / cg" ! buildWithOutputTo:stdOut errorTo:stdErr @@ -309,8 +340,22 @@ (dllSourceDir / objDirSource / (libraryName, '.dll')) exists ifFalse:[ alternativeObjDirSource := self objDirForUsedCompiler:'vc'. (dllSourceDir / alternativeObjDirSource / (libraryName, '.dll')) exists ifTrue:[ - objDirSource := alternativeObjDirSource - ] + objDirSource := alternativeObjDirSource. + stdErr nextPutLine:(('Warning: using alternative %1 from %2 (%3 version)...' + bindWith:libraryName + with:alternativeObjDirSource + with:(self class suiteNameOfCompiler:'vc')) + emphasizeAllWith:(#color -> Color red darkened)). + ] ifFalse:[ + alternativeObjDirSource := self objDirForUsedCompiler:'bcc'. + (dllSourceDir / alternativeObjDirSource / (libraryName, '.dll')) exists ifTrue:[ + objDirSource := alternativeObjDirSource. + stdErr nextPutLine:('Warning: using alternative %1 from %2 (%3 version)...' + bindWith:libraryName + with:alternativeObjDirSource + with:(self class suiteNameOfCompiler:'bcc')). + ] + ]. ]. "/ dllRelativePath := objDir,'/',(libraryName,'.dll'). @@ -340,7 +385,7 @@ ]. ]. - "Modified: / 05-09-2012 / 08:27:07 / cg" + "Modified: / 06-09-2012 / 16:19:29 / cg" ! copyDirectory:relativepath @@ -788,10 +833,10 @@ ^ 'tccmake'. "/ compilerFlag := '-DUSELCC' ]. usedCompiler = 'gcc' ifTrue:[ - ^ 'make'. + ^ 'make'. "/ compilerFlag := '-DUSEGCC' ]. usedCompiler = 'mingw' ifTrue:[ - ^ 'mingwmake'. + ^ 'mingwmake'. "/ compilerFlag := '-DUSEMINGW' ]. self error:'unknown compiler specified'. @@ -813,44 +858,49 @@ "/ makeCommand := makeCommand, ' TOP=', mySTXTopDirectory pathName. OperatingSystem isUNIXlike ifTrue:[ + "/ generate the makefile first OperatingSystem executeCommand:('sh %1/rules/stmkmf' bindWith:mySTXTopDirectory pathName) inputFrom:nil outputTo:stdOut errorTo:stdErr inDirectory:(buildDirectory / module / directory) - onError:[:status| self error:'make failed']. + onError:[:status | self error:'make failed']. ]. projectDefinitionClass isLibraryDefinition ifTrue:[ + "/ generate the library OperatingSystem executeCommand:(makeCommand,' classLibRule') inputFrom:nil outputTo:stdOut errorTo:stdErr inDirectory:(buildDirectory / module / directory) - onError:[:status| self error:'make failed']. + onError:[:status | self error:'make failed']. ] ifFalse:[ OperatingSystem + "/ generate the executable executeCommand:(makeCommand,' exe') inputFrom:nil outputTo:stdOut errorTo:stdErr inDirectory:(buildDirectory / module / directory) - onError:[:status| self error:'make failed']. + onError:[:status | self error:'make failed']. (makeExeOnly ? false) ifFalse:[ + "/ generate the self-installable package OperatingSystem executeCommand:(makeCommand,' setup') inputFrom:nil outputTo:stdOut errorTo:stdErr inDirectory:(buildDirectory / module / directory) - onError:[:status| self error:'make failed']. + onError:[:status | self error:'make failed']. ] ] "Modified: / 03-09-2012 / 19:47:15 / cg" + "Modified (comment): / 06-09-2012 / 16:22:38 / cg" ! objDirForUsedCompiler