ProjectBuilder.st
changeset 2921 bea9c6bb6a90
parent 2918 47d5c20da62d
child 2958 d842f4a91d44
     1.1 --- a/ProjectBuilder.st	Wed Sep 05 20:30:07 2012 +0200
     1.2 +++ b/ProjectBuilder.st	Thu Sep 06 20:59:03 2012 +0200
     1.3 @@ -16,7 +16,7 @@
     1.4  Object subclass:#ProjectBuilder
     1.5  	instanceVariableNames:'package projectDefinitionClass sourceCodeManager buildDirectory
     1.6  		myWorkingDirectory mySTXTopDirectory myTopDirectory outputStream
     1.7 -		makeExeOnly usedCompiler'
     1.8 +		makeExeOnly usedCompiler stdOut stdErr'
     1.9  	classVariableNames:'PreviousBuildDirectory'
    1.10  	poolDictionaries:''
    1.11  	category:'System-Support-Projects'
    1.12 @@ -82,10 +82,9 @@
    1.13          ^ compiler
    1.14      ].
    1.15  
    1.16 -    OperatingSystem isMSWINDOWSlike ifTrue:[
    1.17 -        ^ 'bcc'
    1.18 -    ].
    1.19 -    ^ 'gcc'
    1.20 +    ^ OperatingSystem isMSWINDOWSlike 
    1.21 +        ifTrue:[ 'bcc' ]
    1.22 +        ifFalse:[ 'gcc' ]
    1.23  
    1.24      "Created: / 21-01-2012 / 14:06:51 / cg"
    1.25  !
    1.26 @@ -93,13 +92,45 @@
    1.27  listOfPossibleCompilers
    1.28      OperatingSystem isMSWINDOWSlike ifTrue:[
    1.29          OperatingSystem getLoginName = 'cg' ifTrue:[
    1.30 -            ^ #('bcc' 'vc' 'lcc' 'tcc' 'mingw'  )
    1.31 +            ^ #(
    1.32 +                'bcc'   "/ OK
    1.33 +                'vc'    "/ almost OK
    1.34 +                'lcc'   "/ experimental, but only free for non-commercial work
    1.35 +                'tcc'   "/ experimental; limited but free
    1.36 +                'mingw' "/ experimental; free
    1.37 +             )
    1.38          ].
    1.39 -        ^ #('bcc' 'vc' 'lcc'  )
    1.40 +        ^ #('bcc' 'vc' "'lcc' 'mingw'" )
    1.41      ].
    1.42      ^ #('gcc')
    1.43  
    1.44      "Created: / 21-01-2012 / 14:04:15 / cg"
    1.45 +!
    1.46 +
    1.47 +suiteNameOfCompiler:usedCompiler
    1.48 +    usedCompiler = 'bcc' ifTrue:[
    1.49 +        ^ 'Borland C-Compiler'.
    1.50 +    ].
    1.51 +    usedCompiler = 'vc' ifTrue:[
    1.52 +        ^ 'Microsoft Visual C C-Compiler'.
    1.53 +    ].
    1.54 +    usedCompiler = 'lcc' ifTrue:[
    1.55 +        ^ 'LCC C-Compiler'.
    1.56 +    ].
    1.57 +    usedCompiler = 'tcc' ifTrue:[
    1.58 +        ^ 'Tiny C-Compiler'.
    1.59 +    ].
    1.60 +    usedCompiler = 'gcc' ifTrue:[
    1.61 +        ^ 'GNU C-Compiler'.
    1.62 +    ].
    1.63 +    usedCompiler = 'mingw' ifTrue:[
    1.64 +        ^ 'MINGW GNU C-Compiler'.
    1.65 +    ].
    1.66 +    self halt:'unknown compiler'.
    1.67 +
    1.68 +    ^ 'C-Compiler'.
    1.69 +
    1.70 +    "Created: / 06-09-2012 / 15:58:33 / cg"
    1.71  ! !
    1.72  
    1.73  !ProjectBuilder methodsFor:'accessing'!
    1.74 @@ -158,24 +189,24 @@
    1.75      "/ intermediate - this will move into a commonly used utility class
    1.76      "/ (where all the project code support will be collected).
    1.77  
    1.78 -    |stdOut stdErr lock|
    1.79 +    |lock|
    1.80  
    1.81      lock := Semaphore forMutualExclusion.
    1.82  
    1.83      stdErr := ActorStream new
    1.84                      nextPutBlock:[:char |
    1.85                          lock critical:[
    1.86 -                            makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
    1.87 -                            makeOutput nextPut:char.
    1.88 -                            makeOutput emphasis:nil.
    1.89 +                            makeOutput 
    1.90 +                                withEmphasis:{#backgroundColor->Color red. #color->Color white.}
    1.91 +                                do:[makeOutput nextPut:char].
    1.92                          ]
    1.93                      ];
    1.94                      nextPutAllBlock:[:string |
    1.95                          lock critical:[          
    1.96                              "/ (string includesString:'das Ziel' )ifTrue:[self halt].
    1.97 -                            makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
    1.98 -                            makeOutput nextPutAll:string.
    1.99 -                            makeOutput emphasis:nil.
   1.100 +                            makeOutput
   1.101 +                                withEmphasis:{#backgroundColor->Color red. #color->Color white.}
   1.102 +                                do:[makeOutput nextPutAll:string].
   1.103                          ]
   1.104                      ].
   1.105      stdOut := ActorStream new
   1.106 @@ -193,7 +224,7 @@
   1.107  
   1.108      self buildWithOutputTo:stdOut errorTo:stdErr.
   1.109  
   1.110 -    "Modified: / 21-01-2012 / 13:49:13 / cg"
   1.111 +    "Modified: / 06-09-2012 / 16:15:50 / cg"
   1.112  !
   1.113  
   1.114  buildWithOutputTo:stdOut errorTo:stdErr
   1.115 @@ -309,8 +340,22 @@
   1.116              (dllSourceDir / objDirSource / (libraryName, '.dll')) exists ifFalse:[
   1.117                  alternativeObjDirSource := self objDirForUsedCompiler:'vc'.
   1.118                  (dllSourceDir / alternativeObjDirSource / (libraryName, '.dll')) exists ifTrue:[
   1.119 -                    objDirSource := alternativeObjDirSource
   1.120 -                ]
   1.121 +                    objDirSource := alternativeObjDirSource.
   1.122 +                    stdErr nextPutLine:(('Warning: using alternative %1 from %2 (%3 version)...' 
   1.123 +                                                bindWith:libraryName 
   1.124 +                                                with:alternativeObjDirSource 
   1.125 +                                                with:(self class suiteNameOfCompiler:'vc'))
   1.126 +                                            emphasizeAllWith:(#color -> Color red darkened)).
   1.127 +                ] ifFalse:[
   1.128 +                    alternativeObjDirSource := self objDirForUsedCompiler:'bcc'.
   1.129 +                    (dllSourceDir / alternativeObjDirSource / (libraryName, '.dll')) exists ifTrue:[
   1.130 +                        objDirSource := alternativeObjDirSource.
   1.131 +                        stdErr nextPutLine:('Warning: using alternative %1 from %2 (%3 version)...' 
   1.132 +                                    bindWith:libraryName 
   1.133 +                                    with:alternativeObjDirSource 
   1.134 +                                    with:(self class suiteNameOfCompiler:'bcc')).
   1.135 +                    ]
   1.136 +                ].
   1.137              ].
   1.138  
   1.139  "/            dllRelativePath := objDir,'/',(libraryName,'.dll').
   1.140 @@ -340,7 +385,7 @@
   1.141          ].
   1.142      ].
   1.143  
   1.144 -    "Modified: / 05-09-2012 / 08:27:07 / cg"
   1.145 +    "Modified: / 06-09-2012 / 16:19:29 / cg"
   1.146  !
   1.147  
   1.148  copyDirectory:relativepath
   1.149 @@ -788,10 +833,10 @@
   1.150          ^ 'tccmake'. "/ compilerFlag := '-DUSELCC' 
   1.151      ].
   1.152      usedCompiler = 'gcc' ifTrue:[ 
   1.153 -        ^ 'make'. 
   1.154 +        ^ 'make'.       "/ compilerFlag := '-DUSEGCC' 
   1.155      ].
   1.156      usedCompiler = 'mingw' ifTrue:[ 
   1.157 -        ^ 'mingwmake'. 
   1.158 +        ^ 'mingwmake'.  "/ compilerFlag := '-DUSEMINGW' 
   1.159      ].
   1.160      self error:'unknown compiler specified'.
   1.161  
   1.162 @@ -813,44 +858,49 @@
   1.163      "/ makeCommand := makeCommand, ' TOP=', mySTXTopDirectory pathName.
   1.164  
   1.165      OperatingSystem isUNIXlike ifTrue:[
   1.166 +        "/ generate the makefile first
   1.167          OperatingSystem
   1.168              executeCommand:('sh %1/rules/stmkmf' bindWith:mySTXTopDirectory pathName)
   1.169              inputFrom:nil
   1.170              outputTo:stdOut
   1.171              errorTo:stdErr
   1.172              inDirectory:(buildDirectory / module / directory)
   1.173 -            onError:[:status| self error:'make failed'].
   1.174 +            onError:[:status | self error:'make failed'].
   1.175      ].
   1.176  
   1.177      projectDefinitionClass isLibraryDefinition ifTrue:[
   1.178 +        "/ generate the library
   1.179          OperatingSystem
   1.180              executeCommand:(makeCommand,' classLibRule')
   1.181              inputFrom:nil
   1.182              outputTo:stdOut
   1.183              errorTo:stdErr
   1.184              inDirectory:(buildDirectory / module / directory)
   1.185 -            onError:[:status| self error:'make failed'].
   1.186 +            onError:[:status | self error:'make failed'].
   1.187      ] ifFalse:[
   1.188          OperatingSystem
   1.189 +            "/ generate the executable
   1.190              executeCommand:(makeCommand,' exe')
   1.191              inputFrom:nil
   1.192              outputTo:stdOut
   1.193              errorTo:stdErr
   1.194              inDirectory:(buildDirectory / module / directory)
   1.195 -            onError:[:status| self error:'make failed'].
   1.196 +            onError:[:status | self error:'make failed'].
   1.197  
   1.198          (makeExeOnly ? false) ifFalse:[
   1.199 +            "/ generate the self-installable package
   1.200              OperatingSystem
   1.201                  executeCommand:(makeCommand,' setup')
   1.202                  inputFrom:nil
   1.203                  outputTo:stdOut
   1.204                  errorTo:stdErr
   1.205                  inDirectory:(buildDirectory / module / directory)
   1.206 -                onError:[:status| self error:'make failed'].
   1.207 +                onError:[:status | self error:'make failed'].
   1.208          ]
   1.209      ]
   1.210  
   1.211      "Modified: / 03-09-2012 / 19:47:15 / cg"
   1.212 +    "Modified (comment): / 06-09-2012 / 16:22:38 / cg"
   1.213  !
   1.214  
   1.215  objDirForUsedCompiler