author | Claus Gittinger <cg@exept.de> |
Wed, 05 Sep 2012 20:24:52 +0200 | |
changeset 2919 | f6656592583b |
parent 2918 | 47d5c20da62d |
child 2921 | bea9c6bb6a90 |
permissions | -rw-r--r-- |
2741 | 1 |
" |
2 |
COPYRIGHT (c) 2009 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2596 | 12 |
"{ Package: 'stx:libtool2' }" |
13 |
||
2635 | 14 |
"{ NameSpace: Tools }" |
15 |
||
2596 | 16 |
Object subclass:#ProjectBuilder |
17 |
instanceVariableNames:'package projectDefinitionClass sourceCodeManager buildDirectory |
|
2673 | 18 |
myWorkingDirectory mySTXTopDirectory myTopDirectory outputStream |
2680 | 19 |
makeExeOnly usedCompiler' |
2596 | 20 |
classVariableNames:'PreviousBuildDirectory' |
21 |
poolDictionaries:'' |
|
22 |
category:'System-Support-Projects' |
|
23 |
! |
|
24 |
||
2741 | 25 |
!ProjectBuilder class methodsFor:'documentation'! |
26 |
||
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 2009 by eXept Software AG |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! ! |
|
2596 | 40 |
|
2633 | 41 |
!ProjectBuilder class methodsFor:'accessing'! |
42 |
||
43 |
previousBuildDirectory |
|
44 |
^ PreviousBuildDirectory |
|
45 |
! |
|
46 |
||
47 |
previousBuildDirectory:something |
|
48 |
PreviousBuildDirectory := something. |
|
49 |
! ! |
|
50 |
||
2596 | 51 |
!ProjectBuilder class methodsFor:'examples'! |
52 |
||
2644 | 53 |
example1 |
54 |
Smalltalk loadPackage:'stx:projects/helloWorldApp' asAutoloaded:true. |
|
55 |
||
56 |
self new |
|
57 |
package:'stx:projects/helloWorldApp'; |
|
58 |
build |
|
2622 | 59 |
! |
60 |
||
2644 | 61 |
example2 |
62 |
|builder| |
|
63 |
||
64 |
Smalltalk loadPackage:'stx:clients/Demos/foxCalcApplication' asAutoloaded:true. |
|
65 |
||
66 |
builder := self new. |
|
2909 | 67 |
builder |
68 |
package:'stx:clients/Demos/foxCalcApplication'; |
|
69 |
build. |
|
2644 | 70 |
|
71 |
UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory. |
|
2909 | 72 |
|
73 |
"Modified: / 03-09-2012 / 19:23:53 / cg" |
|
2596 | 74 |
! ! |
75 |
||
2873 | 76 |
!ProjectBuilder class methodsFor:'queries'! |
77 |
||
78 |
defaultUsedCompiler |
|
79 |
|compiler| |
|
80 |
||
81 |
(compiler := UserPreferences current usedCompilerForBuild) notNil ifTrue:[ |
|
82 |
^ compiler |
|
83 |
]. |
|
84 |
||
85 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
86 |
^ 'bcc' |
|
87 |
]. |
|
88 |
^ 'gcc' |
|
89 |
||
90 |
"Created: / 21-01-2012 / 14:06:51 / cg" |
|
91 |
! |
|
92 |
||
93 |
listOfPossibleCompilers |
|
94 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
2918 | 95 |
OperatingSystem getLoginName = 'cg' ifTrue:[ |
96 |
^ #('bcc' 'vc' 'lcc' 'tcc' 'mingw' ) |
|
97 |
]. |
|
98 |
^ #('bcc' 'vc' 'lcc' ) |
|
2873 | 99 |
]. |
100 |
^ #('gcc') |
|
101 |
||
102 |
"Created: / 21-01-2012 / 14:04:15 / cg" |
|
103 |
! ! |
|
104 |
||
2596 | 105 |
!ProjectBuilder methodsFor:'accessing'! |
106 |
||
2644 | 107 |
buildDirectory |
108 |
^ buildDirectory |
|
2622 | 109 |
! |
110 |
||
2634 | 111 |
buildDirectory:something |
112 |
buildDirectory := something. |
|
113 |
! |
|
114 |
||
2673 | 115 |
makeExeOnly:aBoolean |
116 |
makeExeOnly := aBoolean. |
|
117 |
! |
|
118 |
||
2644 | 119 |
package:aPackageIDOrSymbol |
120 |
package := aPackageIDOrSymbol asPackageId. |
|
2596 | 121 |
! |
122 |
||
2644 | 123 |
packageBuildDirectory |
124 |
"the directoray, where the deployable binary is created (xxxSetup.exe)" |
|
2622 | 125 |
|
126 |
^ buildDirectory / (package asPackageId module) / (package asPackageId directory) |
|
2635 | 127 |
! |
128 |
||
2644 | 129 |
projectDefinitionClass:something |
130 |
projectDefinitionClass := something. |
|
2680 | 131 |
! |
132 |
||
2683 | 133 |
suffixForHeaderFiles |
134 |
^ OperatingSystem isUNIXlike ifTrue:['.H'] ifFalse:['.STH'] |
|
135 |
! |
|
136 |
||
2873 | 137 |
usedCompilerForBuild:something |
2680 | 138 |
usedCompiler := something. |
2873 | 139 |
|
140 |
"Created: / 22-01-2012 / 10:50:48 / cg" |
|
2596 | 141 |
! ! |
142 |
||
143 |
!ProjectBuilder methodsFor:'building'! |
|
144 |
||
2644 | 145 |
build |
146 |
"/ intermediate - this will move into a commonly used utility class |
|
2635 | 147 |
"/ (where all the project code support will be collected). |
148 |
||
2647 | 149 |
|makeOutput| |
150 |
||
151 |
makeOutput := TextStream on:(Text new:10000). |
|
152 |
self buildWithColorizedOutputTo:makeOutput. |
|
153 |
||
154 |
TextView openWith:makeOutput contents. |
|
155 |
! |
|
156 |
||
157 |
buildWithColorizedOutputTo:makeOutput |
|
158 |
"/ intermediate - this will move into a commonly used utility class |
|
159 |
"/ (where all the project code support will be collected). |
|
160 |
||
161 |
|stdOut stdErr lock| |
|
2635 | 162 |
|
2644 | 163 |
lock := Semaphore forMutualExclusion. |
2647 | 164 |
|
2644 | 165 |
stdErr := ActorStream new |
166 |
nextPutBlock:[:char | |
|
167 |
lock critical:[ |
|
168 |
makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}. |
|
169 |
makeOutput nextPut:char. |
|
170 |
makeOutput emphasis:nil. |
|
171 |
] |
|
172 |
]; |
|
2683 | 173 |
nextPutAllBlock:[:string | |
2873 | 174 |
lock critical:[ |
175 |
"/ (string includesString:'das Ziel' )ifTrue:[self halt]. |
|
2644 | 176 |
makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}. |
2683 | 177 |
makeOutput nextPutAll:string. |
2644 | 178 |
makeOutput emphasis:nil. |
179 |
] |
|
180 |
]. |
|
181 |
stdOut := ActorStream new |
|
182 |
nextPutBlock:[:char | |
|
183 |
lock critical:[ |
|
184 |
makeOutput nextPut:char. |
|
185 |
] |
|
186 |
]; |
|
2683 | 187 |
nextPutAllBlock:[:string | |
2873 | 188 |
lock critical:[ |
189 |
"/ (string includesString:'das Ziel' )ifTrue:[self halt]. |
|
2683 | 190 |
makeOutput nextPutAll:string. |
2644 | 191 |
] |
192 |
]. |
|
2635 | 193 |
|
2644 | 194 |
self buildWithOutputTo:stdOut errorTo:stdErr. |
2873 | 195 |
|
196 |
"Modified: / 21-01-2012 / 13:49:13 / cg" |
|
2611 | 197 |
! |
198 |
||
199 |
buildWithOutputTo:stdOut errorTo:stdErr |
|
200 |
"/ intermediate - this will move into a commonly used utility class |
|
201 |
"/ (where all the project code support will be collected). |
|
202 |
||
2596 | 203 |
|module directory| |
204 |
||
205 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:package. |
|
206 |
projectDefinitionClass isNil ifTrue:[ |
|
207 |
self error:('Missing ProjectDefinition class for "',package asString,'"') |
|
208 |
]. |
|
209 |
||
210 |
"/ ensure that everything is loaded... |
|
211 |
projectDefinitionClass loadAsAutoloaded:false. |
|
212 |
projectDefinitionClass loadExtensions. |
|
213 |
projectDefinitionClass loadAllClassesAsAutoloaded:false. |
|
214 |
||
215 |
module := package module. |
|
216 |
directory := package directory. |
|
217 |
||
218 |
buildDirectory isNil ifTrue:[ |
|
2634 | 219 |
buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ]. |
220 |
buildDirectory isNil ifTrue:[ |
|
221 |
buildDirectory := Filename tempDirectory construct:'stx_build'. |
|
222 |
]. |
|
2596 | 223 |
]. |
224 |
buildDirectory := buildDirectory asFilename. |
|
225 |
||
226 |
"/ self validateBuildDirectoryIsPresent. |
|
227 |
||
228 |
PreviousBuildDirectory := buildDirectory. |
|
229 |
||
230 |
"/ UserPreferences current localBuild:true |
|
231 |
UserPreferences current localBuild ifFalse:[ |
|
232 |
SourceCodeManager notNil ifTrue:[ |
|
2861
b8c6e02e60a1
Do not call obsolete methods in SourceCodeManager class
Stefan Vogel <sv@exept.de>
parents:
2852
diff
changeset
|
233 |
sourceCodeManager := SourceCodeManagerUtilities default sourceCodeManagerFor:projectDefinitionClass. |
2596 | 234 |
] |
235 |
]. |
|
236 |
sourceCodeManager := nil. |
|
237 |
||
2598 | 238 |
myTopDirectory := |
2596 | 239 |
Smalltalk packagePath |
240 |
detect:[:aPath | |
|
241 |
(aPath asFilename / 'stx' / 'include') exists |
|
242 |
and: [ (aPath asFilename / 'stx' / 'rules') exists ]] |
|
243 |
ifNone:nil. |
|
2598 | 244 |
myTopDirectory isNil ifTrue:[ |
245 |
self error:('Cannot figure out my top directory (where stx/include and stx/rules are)') |
|
2596 | 246 |
]. |
2598 | 247 |
myTopDirectory := myTopDirectory asFilename. |
248 |
mySTXTopDirectory := myTopDirectory / 'stx'. |
|
2613
b8d38caaa884
changed: #buildWithOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2612
diff
changeset
|
249 |
|
2596 | 250 |
self setupBuildDirectory. |
2628 | 251 |
self activityNotification:'Generating stc directory...'. |
2599 | 252 |
self copySTCDirectoryForBuild. |
2628 | 253 |
self activityNotification:'Generating source files...'. |
2596 | 254 |
self generateSourceFiles. |
2672
a1cda5d8943d
changed: #buildWithOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
255 |
self activityNotification:'Copying dlls for linkage...'. |
2600 | 256 |
self copyDLLsForLinkage. |
2912
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
257 |
self activityNotification:'Copying support files for compilation and linkage...'. |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
258 |
self copySupportFilesForCompilation. |
2600 | 259 |
self copySupportFilesForLinkage. |
260 |
self copyStartupFilesFromSmalltalk. |
|
2596 | 261 |
|
2628 | 262 |
self activityNotification:'Executing make...'. |
2611 | 263 |
self makeWithOutputTo:stdOut errorTo:stdErr. |
2912
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
264 |
|
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
265 |
"Modified: / 04-09-2012 / 00:49:52 / cg" |
2898 | 266 |
! ! |
267 |
||
268 |
!ProjectBuilder methodsFor:'building/private'! |
|
2596 | 269 |
|
2644 | 270 |
copyDLLsForLinkage |
2911 | 271 |
|targetBuildDir preRequisites dllRelativeSourcePathes dllRelativeDestPathes| |
2723 | 272 |
|
2644 | 273 |
targetBuildDir := buildDirectory / package module / package directory. |
274 |
||
2723 | 275 |
preRequisites := projectDefinitionClass allPreRequisites. |
276 |
OperatingSystem isUNIXlike ifTrue:[ |
|
277 |
"For now: unix Makefiles require some libs implicitely..." |
|
278 |
preRequisites := preRequisites union:#( |
|
279 |
'stx:goodies/refactoryBrowser/parser' |
|
280 |
'stx:libtool' |
|
281 |
). |
|
282 |
]. |
|
283 |
||
284 |
preRequisites do:[:eachPackageToFileout | |
|
2644 | 285 |
|packageId packageDef packageModule packageDirectory packageTargetDir |
2911 | 286 |
dllSource dllSourceDir libraryName dllRelativePathSource |
2916 | 287 |
dllRelativePathDest objDirSource objDirDest alternativeObjDirSource| |
2644 | 288 |
|
289 |
packageId := eachPackageToFileout asPackageId. |
|
290 |
packageModule := packageId module. |
|
291 |
packageDirectory := packageId directory. |
|
292 |
packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory. |
|
293 |
||
294 |
packageDef := packageId projectDefinitionClass. |
|
295 |
libraryName := packageDef libraryName. |
|
296 |
||
297 |
"/ mhmh - take them from my tree or from the projects/smalltalk execution directory ?? |
|
298 |
dllSourceDir := myTopDirectory / packageModule / packageDirectory. |
|
2909 | 299 |
|
2644 | 300 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
2911 | 301 |
objDirDest := self objDirForUsedCompiler:usedCompiler. |
2916 | 302 |
objDirSource := objDirDest. |
303 |
"/ "/ use visual-c files for tcc linkage |
|
304 |
"/ usedCompiler = 'tcc' ifTrue:[ |
|
305 |
"/ objDirSource := self objDirForUsedCompiler:'vc'. |
|
306 |
"/ ] ifFalse:[ |
|
307 |
"/ objDirSource := objDirDest |
|
308 |
"/ ]. |
|
309 |
(dllSourceDir / objDirSource / (libraryName, '.dll')) exists ifFalse:[ |
|
310 |
alternativeObjDirSource := self objDirForUsedCompiler:'vc'. |
|
311 |
(dllSourceDir / alternativeObjDirSource / (libraryName, '.dll')) exists ifTrue:[ |
|
312 |
objDirSource := alternativeObjDirSource |
|
313 |
] |
|
2911 | 314 |
]. |
2916 | 315 |
|
2905 | 316 |
"/ dllRelativePath := objDir,'/',(libraryName,'.dll'). |
2644 | 317 |
"/ (dllSourceDir / dllRelativePath) exists |
2911 | 318 |
dllRelativeSourcePathes := Array with:(objDirSource,'\', libraryName, '.dll'). |
319 |
dllRelativeDestPathes := Array with:(objDirDest,'\', libraryName, '.dll'). |
|
2644 | 320 |
] ifFalse:[ |
2911 | 321 |
dllRelativeSourcePathes := Array with:(libraryName,'.so'). |
2723 | 322 |
(packageModule = 'stx' and:[packageDirectory = 'libview']) ifTrue:[ |
2911 | 323 |
dllRelativeSourcePathes := dllRelativeSourcePathes, #('XWorkstation.so' 'GLXWorkstation.so'). |
2723 | 324 |
]. |
2644 | 325 |
]. |
2911 | 326 |
dllRelativeSourcePathes with:dllRelativeDestPathes do:[:dllRelativeSourcePath :dllRelativeDestPath| |
2896
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
327 |
|source dest| |
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
328 |
|
2911 | 329 |
source := dllSourceDir / dllRelativeSourcePath. |
330 |
dest := packageTargetDir / dllRelativeDestPath. |
|
2896
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
331 |
(dest exists not |
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
332 |
or:[source fileSize ~= dest fileSize |
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
333 |
or:[source modificationTime >= dest modificationTime |
2723 | 334 |
"/ or:[ ((dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath)) not ] |
335 |
]]) ifTrue:[ |
|
2911 | 336 |
Transcript showCR:'updating ',dllRelativeDestPath. |
2896
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
337 |
dest directory recursiveMakeDirectory. |
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
338 |
source copyTo:dest. |
2723 | 339 |
]. |
340 |
]. |
|
2644 | 341 |
]. |
2896
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
342 |
|
2916 | 343 |
"Modified: / 05-09-2012 / 08:27:07 / cg" |
2644 | 344 |
! |
345 |
||
346 |
copyDirectory:relativepath |
|
347 |
"/ need rules in stx |
|
348 |
((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath) |
|
349 |
recursiveCopyTo:(buildDirectory construct:'stx'). |
|
350 |
! |
|
351 |
||
352 |
copyDirectoryForBuild:subdir |
|
353 |
|targetDir targetFile| |
|
354 |
||
355 |
targetDir := buildDirectory / 'stx' / subdir. |
|
356 |
targetDir exists ifFalse:[ |
|
357 |
targetDir makeDirectory. |
|
358 |
]. |
|
359 |
(mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile | |
|
360 |
eachFile isDirectory ifFalse:[ |
|
361 |
targetFile := targetDir / eachFile baseName. |
|
362 |
(targetFile exists not |
|
363 |
or:[ targetFile modificationTime < eachFile modificationTime ]) ifTrue:[ |
|
364 |
self activityNotification:'copying ',eachFile pathName,'...'. |
|
365 |
eachFile copyTo:(targetDir construct:eachFile baseName) |
|
366 |
] |
|
367 |
]. |
|
368 |
]. |
|
369 |
self activityNotification:nil |
|
370 |
! |
|
371 |
||
372 |
copyResourcesForPackage:aPackage |
|
373 |
|module directory| |
|
374 |
||
375 |
module := aPackage asPackageId module. |
|
376 |
directory := aPackage asPackageId directory. |
|
377 |
||
378 |
(myTopDirectory / module / directory / 'resources' ) exists ifTrue:[ |
|
379 |
(myTopDirectory / module / directory / 'resources' ) |
|
380 |
recursiveCopyTo:(buildDirectory / module / directory) |
|
381 |
]. |
|
382 |
(myTopDirectory / module / directory / 'styles' ) exists ifTrue:[ |
|
383 |
(myTopDirectory / module / directory / 'styles' ) |
|
384 |
recursiveCopyTo:(buildDirectory / module / directory) |
|
385 |
]. |
|
386 |
! |
|
387 |
||
388 |
copySTCDirectoryForBuild |
|
2912
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
389 |
"copy stc files to the build directory" |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
390 |
|
2644 | 391 |
|targetDir stc files| |
392 |
||
393 |
targetDir := buildDirectory / 'stx' / 'stc'. |
|
394 |
targetDir exists ifFalse:[ targetDir makeDirectory ]. |
|
395 |
||
396 |
stc := OperatingSystem isMSWINDOWSlike |
|
397 |
ifTrue:[ 'stc.exe' ] |
|
398 |
ifFalse:[ 'stc' ]. |
|
399 |
||
400 |
files := #( ) copyWith:stc. |
|
401 |
||
402 |
files do:[:eachFile | |
|
403 |
|sourceFile targetFile| |
|
404 |
||
405 |
sourceFile := mySTXTopDirectory / 'stc' / eachFile. |
|
406 |
targetFile := targetDir / eachFile. |
|
407 |
(targetFile exists not |
|
408 |
or:[ targetFile modificationTime < sourceFile modificationTime ]) ifTrue:[ |
|
409 |
self activityNotification:'copying ',sourceFile pathName,'...'. |
|
410 |
sourceFile copyTo:targetFile |
|
411 |
]. |
|
412 |
]. |
|
2683 | 413 |
|
414 |
OperatingSystem isUNIXlike ifTrue:[ |
|
415 |
(targetDir / 'stc') makeExecutableForAll |
|
416 |
]. |
|
417 |
||
2644 | 418 |
self activityNotification:nil |
2912
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
419 |
|
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
420 |
"Modified (comment): / 04-09-2012 / 00:49:19 / cg" |
2644 | 421 |
! |
422 |
||
423 |
copyStartupFilesFromSmalltalk |
|
2912
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
424 |
"copy additional smalltalk startup files to the build directory" |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
425 |
|
2644 | 426 |
(buildDirectory / 'stx' / 'projects/smalltalk' ) exists ifFalse:[ |
427 |
(buildDirectory / 'stx' / 'projects/smalltalk' ) recursiveMakeDirectory. |
|
428 |
]. |
|
429 |
||
2678
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
430 |
#( |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
431 |
'keyboard.rc' |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
432 |
'keyboardMacros.rc' |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
433 |
'display.rc' |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
434 |
'd_win32.rc' |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
435 |
'host.rc' |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
436 |
'h_win32.rc' |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
437 |
'smalltalk.rc' |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
438 |
'private.rc' |
2644 | 439 |
) do:[:fn | |
440 |
(myTopDirectory / 'stx' / 'projects/smalltalk' / fn) |
|
441 |
copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / fn) |
|
2678
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
442 |
]. |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
443 |
|
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
444 |
(myTopDirectory / 'stx' / 'doc/online/english/LICENCE_STX.html') |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
445 |
copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / 'LICENCE_STX.html'). |
2912
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
446 |
|
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
447 |
"Modified (comment): / 04-09-2012 / 00:48:47 / cg" |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
448 |
! |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
449 |
|
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
450 |
copySupportFilesForCompilation |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
451 |
"copy the tcc compiler to the build directory" |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
452 |
|
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
453 |
|files| |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
454 |
|
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
455 |
files := #(). |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
456 |
|
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
457 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
458 |
usedCompiler = 'tcc' ifTrue:[ |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
459 |
files := files , #( |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
460 |
'support/tcc' |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
461 |
). |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
462 |
]. |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
463 |
] ifFalse:[ |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
464 |
files := files , #( |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
465 |
) |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
466 |
]. |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
467 |
files := files asOrderedCollection. |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
468 |
|
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
469 |
files do:[:relativePath | |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
470 |
(mySTXTopDirectory / relativePath) exists ifTrue:[ |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
471 |
((buildDirectory / 'stx' / relativePath) exists |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
472 |
and:[ (mySTXTopDirectory / relativePath) fileSize = (buildDirectory / 'stx' / relativePath) fileSize |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
473 |
and:[ (mySTXTopDirectory / relativePath) modificationTime < (buildDirectory / 'stx' / relativePath) modificationTime |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
474 |
"/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ] |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
475 |
]]) ifFalse:[ |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
476 |
(mySTXTopDirectory / relativePath) recursiveCopyTo:(buildDirectory / 'stx' / relativePath). |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
477 |
] |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
478 |
] ifFalse:[ |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
479 |
self error:'Missing directory: ',relativePath printString mayProceed:true. |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
480 |
]. |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
481 |
]. |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
482 |
|
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
483 |
"Created: / 04-09-2012 / 00:47:49 / cg" |
2644 | 484 |
! |
485 |
||
486 |
copySupportFilesForLinkage |
|
2912
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
487 |
"copy additional files which are req'd for linkage to the build directory" |
6e62954c5f35
added: #copySupportFilesForCompilation
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
488 |
|
2644 | 489 |
|files| |
490 |
||
491 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
492 |
files := #( |
|
493 |
'librun/genDate.exe' |
|
494 |
'librun/main.c' |
|
2673 | 495 |
'projects/smalltalk/stx_16x16.ico' |
496 |
'projects/smalltalk/stx_32x32.ico' |
|
497 |
'projects/smalltalk/stx_splash.bmp' |
|
2644 | 498 |
). |
2905 | 499 |
|
500 |
usedCompiler = 'bcc' ifTrue:[ |
|
501 |
files := files , #( |
|
502 |
'librun/objbc/librun.dll' |
|
503 |
'support/win32/borland/cs3245.dll' |
|
504 |
'support/win32/X11.dll' |
|
505 |
'support/win32/Xext.dll' |
|
2916 | 506 |
'lib/bc/librun.lib' |
507 |
'lib/bc/cs32i.lib' |
|
2905 | 508 |
). |
509 |
]. |
|
510 |
usedCompiler = 'vc' ifTrue:[ |
|
511 |
files := files , #( |
|
512 |
'librun/objvc/librun.dll' |
|
2916 | 513 |
'lib/vc/librun.lib' |
2905 | 514 |
). |
515 |
]. |
|
2911 | 516 |
usedCompiler = 'tcc' ifTrue:[ |
517 |
files := files , #( |
|
2916 | 518 |
'librun/objvc/librun.dll' "/ linkage is against vc version!! |
519 |
'lib/vc/librun.lib' |
|
520 |
). |
|
521 |
]. |
|
522 |
usedCompiler = 'lcc' ifTrue:[ |
|
523 |
files := files , #( |
|
524 |
'librun/objvc/librun.dll' "/ linkage is against vc version!! |
|
525 |
'lib/vc/librun.lib' |
|
2911 | 526 |
). |
527 |
]. |
|
2918 | 528 |
usedCompiler = 'mingw' ifTrue:[ |
529 |
files := files , #( |
|
530 |
'librun/objvc/librun.dll' "/ linkage is against vc version!! |
|
531 |
'lib/vc/librun.lib' |
|
532 |
). |
|
533 |
]. |
|
2644 | 534 |
] ifFalse:[ |
535 |
files := #( |
|
536 |
'librun/main.c' |
|
537 |
'librun/librun.so' |
|
538 |
) |
|
539 |
]. |
|
2677
e2c24a1be97f
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2673
diff
changeset
|
540 |
files := files asOrderedCollection. |
e2c24a1be97f
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2673
diff
changeset
|
541 |
|
e2c24a1be97f
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2673
diff
changeset
|
542 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
e2c24a1be97f
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2673
diff
changeset
|
543 |
projectDefinitionClass applicationIconFileName notNil ifTrue:[ |
2678
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
544 |
files add:('projects/smalltalk/',projectDefinitionClass applicationIconFileName,'.ico') |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
545 |
]. |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
546 |
projectDefinitionClass splashFileName notNil ifTrue:[ |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
547 |
files add:('projects/smalltalk/',projectDefinitionClass splashFileName,'.bmp') |
cca2788228ad
added: #copySupportFilesForExecution
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
548 |
]. |
2677
e2c24a1be97f
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2673
diff
changeset
|
549 |
]. |
2644 | 550 |
|
2914
745b9c77b599
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2912
diff
changeset
|
551 |
files do:[:relativePath | |
745b9c77b599
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2912
diff
changeset
|
552 |
(mySTXTopDirectory / relativePath) exists ifTrue:[ |
745b9c77b599
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2912
diff
changeset
|
553 |
((buildDirectory / 'stx' / relativePath) exists |
745b9c77b599
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2912
diff
changeset
|
554 |
and:[ (mySTXTopDirectory / relativePath) fileSize = (buildDirectory / 'stx' / relativePath) fileSize |
745b9c77b599
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2912
diff
changeset
|
555 |
and:[ (mySTXTopDirectory / relativePath) modificationTime < (buildDirectory / 'stx' / relativePath) modificationTime |
2684 | 556 |
"/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ] |
557 |
]]) ifFalse:[ |
|
2914
745b9c77b599
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2912
diff
changeset
|
558 |
(buildDirectory / 'stx' / relativePath) directory recursiveMakeDirectory. |
745b9c77b599
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2912
diff
changeset
|
559 |
(mySTXTopDirectory / relativePath) copyTo:(buildDirectory / 'stx' / relativePath). |
2684 | 560 |
] |
561 |
] ifFalse:[ |
|
2914
745b9c77b599
changed: #copySupportFilesForLinkage
Claus Gittinger <cg@exept.de>
parents:
2912
diff
changeset
|
562 |
self error:'Missing file: ',relativePath printString mayProceed:true. |
2684 | 563 |
]. |
2614 | 564 |
]. |
2873 | 565 |
|
2918 | 566 |
"Modified: / 05-09-2012 / 16:26:25 / cg" |
2600 | 567 |
! |
568 |
||
2644 | 569 |
createHeaderFileFor:aClass in:packageTargetDir |
570 |
|instVarList classInstVarList classVarList bindings superclassFilename |
|
571 |
template file newContents oldContents| |
|
572 |
||
573 |
instVarList := StringCollection new. |
|
574 |
aClass instVarNames do:[:v | |
|
575 |
instVarList add:('OBJ %1;' bindWith:v) |
|
576 |
]. |
|
577 |
classInstVarList := StringCollection new. |
|
578 |
aClass class instVarNames do:[:v | |
|
579 |
(v includes:$_) ifTrue:[self halt]. |
|
580 |
classInstVarList add:('OBJ %1;' bindWith:v) |
|
581 |
]. |
|
582 |
classVarList := StringCollection new. |
|
583 |
aClass classVarNames do:[:v | |
|
584 |
classVarList add:('extern OBJ %1_%2;' bindWith:aClass name with:v) |
|
585 |
]. |
|
2614 | 586 |
|
2644 | 587 |
bindings := Dictionary new. |
588 |
bindings at:'ClassName' put:aClass name. |
|
589 |
aClass superclass isNil ifTrue:[ |
|
590 |
bindings at:'SuperclassName' put:'-'. |
|
2852 | 591 |
bindings at:'SuperclassFileInclude' put:''. |
2644 | 592 |
] ifFalse:[ |
593 |
bindings at:'SuperclassName' put:aClass superclass name. |
|
594 |
bindings at:'SuperclassFileName' put:(superclassFilename := Smalltalk fileNameForClass:aClass superclass). |
|
595 |
bindings at:'SuperclassFileInclude' put:('#include "%1.STH"' bindWith:superclassFilename). |
|
596 |
]. |
|
597 |
bindings at:'InstVarList' put:instVarList asString. |
|
598 |
bindings at:'ClassVarList' put:classVarList asString. |
|
599 |
bindings at:'ClassInstVarList' put:classInstVarList asString. |
|
600 |
||
601 |
template := |
|
602 |
'/* This file was generated by ProjectBuilder. */ |
|
603 |
/* !!!!!!!! Do not change by hand !!!!!!!! */ |
|
604 |
||
605 |
/* Class: %(ClassName) */ |
|
606 |
/* Superclass: %(SuperclassName) */ |
|
607 |
||
608 |
%(SuperclassFileInclude) |
|
609 |
||
610 |
/* INDIRECTGLOBALS */ |
|
611 |
#ifdef _HEADER_INST_ |
|
612 |
%(InstVarList) |
|
613 |
#endif /* _HEADER_INST_ */ |
|
614 |
||
615 |
#ifdef _HEADER_CLASS_ |
|
616 |
%(ClassVarList) |
|
617 |
#endif /* _HEADER_CLASS_ */ |
|
618 |
||
619 |
#ifdef _HEADER_CLASSINST_ |
|
620 |
%(ClassInstVarList) |
|
621 |
#endif /* _HEADER_CLASSINST_ */ |
|
622 |
'. |
|
623 |
newContents := template bindWithArguments:bindings. |
|
2683 | 624 |
file := packageTargetDir asFilename / ((Smalltalk fileNameForClass:aClass),(self suffixForHeaderFiles)). |
2644 | 625 |
(file exists not |
626 |
or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[ |
|
627 |
file contents: newContents. |
|
628 |
]. |
|
2852 | 629 |
|
630 |
"Modified: / 15-08-2011 / 14:58:46 / cg" |
|
2614 | 631 |
! |
632 |
||
2644 | 633 |
generateSourceFiles |
634 |
sourceCodeManager notNil ifTrue:[ |
|
635 |
"/ check out / generate files there |
|
636 |
self generateSourceFilesByCheckingOutUsing:sourceCodeManager |
|
637 |
] ifFalse:[ |
|
638 |
"/ local build |
|
639 |
"/ fileout the project |
|
640 |
self generateSourceFilesByFilingOut |
|
641 |
] |
|
2599 | 642 |
! |
643 |
||
2644 | 644 |
generateSourceFilesByCheckingOutUsing:aSourceCodeManager |
645 |
"/ will no longer be needed/supported |
|
646 |
||
647 |
|repository stxRepository module directory| |
|
648 |
||
2868
8a4d46fd157c
changed: #generateSourceFilesByCheckingOutUsing:
Claus Gittinger <cg@exept.de>
parents:
2861
diff
changeset
|
649 |
self breakPoint:#cg. |
8a4d46fd157c
changed: #generateSourceFilesByCheckingOutUsing:
Claus Gittinger <cg@exept.de>
parents:
2861
diff
changeset
|
650 |
|
2644 | 651 |
"/ check out / generate files there |
652 |
repository := (aSourceCodeManager repositoryNameForModule:module) ifNil:[aSourceCodeManager repositoryName]. |
|
653 |
stxRepository := aSourceCodeManager repositoryName. |
|
2600 | 654 |
|
2644 | 655 |
(buildDirectory construct:'stx') exists ifFalse:[ |
656 |
(module ~= 'stx') ifTrue:[ |
|
657 |
OperatingSystem |
|
658 |
executeCommand:('cvs -d ',stxRepository,' co stx') |
|
659 |
inputFrom:nil |
|
660 |
outputTo:Transcript |
|
661 |
errorTo:Transcript |
|
662 |
inDirectory:buildDirectory |
|
663 |
onError:[:status| self error:'cvs update stx failed']. |
|
664 |
]. |
|
665 |
]. |
|
2635 | 666 |
|
2644 | 667 |
((buildDirectory construct:module) construct:'CVS') exists ifFalse:[ |
668 |
OperatingSystem |
|
669 |
executeCommand:('cvs -d ',repository,' co -l ',directory) |
|
670 |
inputFrom:nil |
|
671 |
outputTo:Transcript |
|
672 |
errorTo:Transcript |
|
673 |
inDirectory:buildDirectory |
|
674 |
onError:[:status| self error:'cvs update failed']. |
|
675 |
]. |
|
676 |
OperatingSystem |
|
677 |
executeCommand:'cvs upd -d' |
|
678 |
inputFrom:nil |
|
679 |
outputTo:Transcript |
|
680 |
errorTo:Transcript |
|
681 |
inDirectory:(buildDirectory construct:module) |
|
682 |
onError:[:status| self error:'cvs update failed']. |
|
683 |
self halt. |
|
2868
8a4d46fd157c
changed: #generateSourceFilesByCheckingOutUsing:
Claus Gittinger <cg@exept.de>
parents:
2861
diff
changeset
|
684 |
|
8a4d46fd157c
changed: #generateSourceFilesByCheckingOutUsing:
Claus Gittinger <cg@exept.de>
parents:
2861
diff
changeset
|
685 |
"Modified: / 29-12-2011 / 14:02:56 / cg" |
2600 | 686 |
! |
687 |
||
2644 | 688 |
generateSourceFilesByFilingOut |
689 |
"/ local build |
|
690 |
"/ fileout the project |
|
691 |
||
2844
5e4e46856d8d
changed: #generateSourceFilesByFilingOut
Stefan Vogel <sv@exept.de>
parents:
2793
diff
changeset
|
692 |
|fullPathName| |
5e4e46856d8d
changed: #generateSourceFilesByFilingOut
Stefan Vogel <sv@exept.de>
parents:
2793
diff
changeset
|
693 |
|
2644 | 694 |
(package module ~= 'stx') ifTrue:[ |
695 |
(buildDirectory / package module) makeDirectory. |
|
696 |
]. |
|
697 |
||
698 |
"/ file out the package(s) which are to be built |
|
699 |
((Array with:package)) |
|
700 |
do:[:eachPackageToFileout | |
|
701 |
|packageId packageModule packageDirectory packageTargetDir packageDef| |
|
702 |
||
703 |
packageId := eachPackageToFileout asPackageId. |
|
704 |
packageModule := packageId module. |
|
705 |
packageDirectory := packageId directory. |
|
706 |
packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory. |
|
707 |
||
708 |
packageDef := packageId projectDefinitionClass. |
|
709 |
(packageDef compiled_classNames_common , |
|
710 |
packageDef compiled_classNamesForPlatform) do:[:eachClassName | |
|
711 |
|cls fileName newSource| |
|
712 |
||
713 |
cls := Smalltalk classNamed:eachClassName. |
|
714 |
self assert:cls isLoaded. |
|
715 |
fileName := (Smalltalk fileNameForClass:cls),'.st'. |
|
716 |
fileName := packageTargetDir asFilename construct:fileName. |
|
717 |
fileName exists ifTrue:[ |
|
718 |
newSource := String streamContents:[:s | cls fileOutOn:s withTimeStamp:false]. |
|
719 |
newSource = fileName contentsAsString ifFalse:[ |
|
720 |
fileName contents:newSource |
|
721 |
]. |
|
722 |
] ifFalse:[ |
|
723 |
cls fileOutIn:packageTargetDir withTimeStamp:false |
|
724 |
]. |
|
725 |
]. |
|
2596 | 726 |
|
2644 | 727 |
"/ (Smalltalk allClassesInPackage:eachPackageToFileout) do:[:cls | |
728 |
"/ cls isPrivate ifFalse:[ |
|
729 |
"/ cls isLoaded ifFalse:[ |
|
730 |
"/ self halt. |
|
731 |
"/ cls autoload. |
|
732 |
"/ ]. |
|
733 |
"/ cls fileOutIn:packageTargetDir |
|
734 |
"/ ] |
|
735 |
"/ ]. |
|
736 |
||
737 |
projectDefinitionClass forEachFileNameAndGeneratedContentsDo:[:fileName :fileContents | |
|
2844
5e4e46856d8d
changed: #generateSourceFilesByFilingOut
Stefan Vogel <sv@exept.de>
parents:
2793
diff
changeset
|
738 |
fullPathName := packageTargetDir construct:fileName. |
5e4e46856d8d
changed: #generateSourceFilesByFilingOut
Stefan Vogel <sv@exept.de>
parents:
2793
diff
changeset
|
739 |
fullPathName directory exists ifFalse:[ |
5e4e46856d8d
changed: #generateSourceFilesByFilingOut
Stefan Vogel <sv@exept.de>
parents:
2793
diff
changeset
|
740 |
"take care for files like 'autopackage/default.apspec'" |
5e4e46856d8d
changed: #generateSourceFilesByFilingOut
Stefan Vogel <sv@exept.de>
parents:
2793
diff
changeset
|
741 |
fullPathName directory makeDirectory. |
5e4e46856d8d
changed: #generateSourceFilesByFilingOut
Stefan Vogel <sv@exept.de>
parents:
2793
diff
changeset
|
742 |
]. |
5e4e46856d8d
changed: #generateSourceFilesByFilingOut
Stefan Vogel <sv@exept.de>
parents:
2793
diff
changeset
|
743 |
(fullPathName exists |
5e4e46856d8d
changed: #generateSourceFilesByFilingOut
Stefan Vogel <sv@exept.de>
parents:
2793
diff
changeset
|
744 |
and:[ fullPathName contents = fileContents ]) ifFalse:[ |
5e4e46856d8d
changed: #generateSourceFilesByFilingOut
Stefan Vogel <sv@exept.de>
parents:
2793
diff
changeset
|
745 |
fullPathName contents:fileContents. |
2644 | 746 |
]. |
747 |
]. |
|
748 |
]. |
|
2596 | 749 |
|
2644 | 750 |
"/ generate header files in prerequisite packages... |
751 |
(projectDefinitionClass allPreRequisites) |
|
752 |
do:[:eachPackageToFileout | |
|
753 |
|packageId packageDef packageModule packageDirectory packageTargetDir| |
|
754 |
||
755 |
packageId := eachPackageToFileout asPackageId. |
|
756 |
packageModule := packageId module. |
|
757 |
packageDirectory := packageId directory. |
|
758 |
packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory. |
|
759 |
||
760 |
packageDef := packageId projectDefinitionClass. |
|
761 |
(packageDef compiled_classNames_common , |
|
762 |
packageDef compiled_classNamesForPlatform) do:[:eachClassName | |
|
763 |
|cls| |
|
764 |
||
765 |
cls := Smalltalk classNamed:eachClassName. |
|
766 |
"/ self assert:cls isLoaded. |
|
767 |
cls isLoaded ifTrue:[ |
|
768 |
self createHeaderFileFor:cls in:packageTargetDir |
|
769 |
]. |
|
770 |
]. |
|
771 |
self copyResourcesForPackage:eachPackageToFileout. |
|
772 |
]. |
|
773 |
||
774 |
"/ stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic') |
|
2596 | 775 |
! |
776 |
||
2909 | 777 |
makeCommandOfCompiler:usedCompiler |
778 |
usedCompiler = 'bcc' ifTrue:[ |
|
779 |
^ 'bmake'. |
|
780 |
]. |
|
781 |
usedCompiler = 'vc' ifTrue:[ |
|
782 |
^ 'vcmake'. "/ compilerFlag := '-DUSEVC' |
|
783 |
]. |
|
784 |
usedCompiler = 'lcc' ifTrue:[ |
|
785 |
^ 'lccmake'. "/ compilerFlag := '-DUSELCC' |
|
786 |
]. |
|
787 |
usedCompiler = 'tcc' ifTrue:[ |
|
788 |
^ 'tccmake'. "/ compilerFlag := '-DUSELCC' |
|
789 |
]. |
|
790 |
usedCompiler = 'gcc' ifTrue:[ |
|
791 |
^ 'make'. |
|
792 |
]. |
|
2918 | 793 |
usedCompiler = 'mingw' ifTrue:[ |
794 |
^ 'mingwmake'. |
|
2909 | 795 |
]. |
796 |
self error:'unknown compiler specified'. |
|
797 |
||
798 |
"Created: / 03-09-2012 / 19:46:07 / cg" |
|
799 |
! |
|
800 |
||
2644 | 801 |
makeWithOutputTo:stdOut errorTo:stdErr |
2909 | 802 |
|module directory makeCommand| |
2644 | 803 |
|
804 |
module := package module. |
|
805 |
directory := package directory. |
|
806 |
||
2680 | 807 |
makeCommand := ParserFlags makeCommand. |
2895
2b939399b83b
changed: #makeWithOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
808 |
usedCompiler isNil ifTrue:[ |
2b939399b83b
changed: #makeWithOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
809 |
usedCompiler := ParserFlags usedCompiler. |
2b939399b83b
changed: #makeWithOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
810 |
]. |
2909 | 811 |
makeCommand := self makeCommandOfCompiler:usedCompiler. |
2873 | 812 |
|
2852 | 813 |
"/ makeCommand := makeCommand, ' TOP=', mySTXTopDirectory pathName. |
2680 | 814 |
|
2683 | 815 |
OperatingSystem isUNIXlike ifTrue:[ |
816 |
OperatingSystem |
|
2845
0d52c66fbc8e
changed: #makeWithOutputTo:errorTo:
Stefan Vogel <sv@exept.de>
parents:
2844
diff
changeset
|
817 |
executeCommand:('sh %1/rules/stmkmf' bindWith:mySTXTopDirectory pathName) |
2683 | 818 |
inputFrom:nil |
819 |
outputTo:stdOut |
|
820 |
errorTo:stdErr |
|
821 |
inDirectory:(buildDirectory / module / directory) |
|
822 |
onError:[:status| self error:'make failed']. |
|
823 |
]. |
|
824 |
||
2644 | 825 |
projectDefinitionClass isLibraryDefinition ifTrue:[ |
826 |
OperatingSystem |
|
2680 | 827 |
executeCommand:(makeCommand,' classLibRule') |
2644 | 828 |
inputFrom:nil |
829 |
outputTo:stdOut |
|
830 |
errorTo:stdErr |
|
831 |
inDirectory:(buildDirectory / module / directory) |
|
832 |
onError:[:status| self error:'make failed']. |
|
833 |
] ifFalse:[ |
|
834 |
OperatingSystem |
|
2680 | 835 |
executeCommand:(makeCommand,' exe') |
2644 | 836 |
inputFrom:nil |
837 |
outputTo:stdOut |
|
838 |
errorTo:stdErr |
|
839 |
inDirectory:(buildDirectory / module / directory) |
|
840 |
onError:[:status| self error:'make failed']. |
|
841 |
||
2673 | 842 |
(makeExeOnly ? false) ifFalse:[ |
843 |
OperatingSystem |
|
2680 | 844 |
executeCommand:(makeCommand,' setup') |
2673 | 845 |
inputFrom:nil |
846 |
outputTo:stdOut |
|
847 |
errorTo:stdErr |
|
848 |
inDirectory:(buildDirectory / module / directory) |
|
849 |
onError:[:status| self error:'make failed']. |
|
850 |
] |
|
2644 | 851 |
] |
2793 | 852 |
|
2909 | 853 |
"Modified: / 03-09-2012 / 19:47:15 / cg" |
2596 | 854 |
! |
855 |
||
2905 | 856 |
objDirForUsedCompiler |
2909 | 857 |
^ self objDirForUsedCompiler:usedCompiler |
858 |
||
859 |
"Created: / 20-08-2012 / 17:01:13 / cg" |
|
860 |
! |
|
861 |
||
862 |
objDirForUsedCompiler:usedCompiler |
|
2918 | 863 |
usedCompiler = 'gcc' ifTrue:[^ 'obj']. "/ unix case |
864 |
||
2905 | 865 |
usedCompiler = 'bcc' ifTrue:[^ 'objbc']. |
866 |
usedCompiler = 'vc' ifTrue:[^ 'objvc']. |
|
2909 | 867 |
usedCompiler = 'tcc' ifTrue:[^ 'objtcc']. |
868 |
usedCompiler = 'lcc' ifTrue:[^ 'objlcc']. |
|
2918 | 869 |
usedCompiler = 'mingw' ifTrue:[^ 'objmingw']. |
2905 | 870 |
self halt:'please fill in here'. |
871 |
^ 'objbc' |
|
872 |
||
2909 | 873 |
"Created: / 03-09-2012 / 19:55:34 / cg" |
2905 | 874 |
! |
875 |
||
2683 | 876 |
recursiveCopyDirectoryForBuild:subdir |
877 |
|targetDir| |
|
878 |
||
879 |
targetDir := buildDirectory / 'stx' / subdir. |
|
880 |
targetDir exists ifFalse:[ |
|
881 |
targetDir makeDirectory. |
|
882 |
]. |
|
883 |
(mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile | |
|
884 |
eachFile recursiveCopyTo:(targetDir construct:eachFile baseName) |
|
885 |
]. |
|
886 |
self activityNotification:nil |
|
887 |
! |
|
888 |
||
2644 | 889 |
setupBuildDirectory |
890 |
buildDirectory exists ifFalse:[ |
|
891 |
buildDirectory recursiveMakeDirectory. |
|
892 |
]. |
|
893 |
(buildDirectory / 'stx') exists ifFalse:[ |
|
894 |
(buildDirectory / 'stx') makeDirectory. |
|
895 |
]. |
|
896 |
||
897 |
self copyDirectoryForBuild:'include'. |
|
898 |
self copyDirectoryForBuild:'rules'. |
|
2683 | 899 |
OperatingSystem isUNIXlike ifTrue:[ |
900 |
self recursiveCopyDirectoryForBuild:'configurations'. |
|
901 |
] |
|
2611 | 902 |
! |
903 |
||
2644 | 904 |
validateBuildDirectoryIsPresent |
905 |
||
906 |
^ self. |
|
2596 | 907 |
|
2644 | 908 |
"/ [ |
909 |
"/ |default directoryIsOKForMe stc | |
|
910 |
"/ |
|
911 |
"/ default := (buildDirectory ? |
|
912 |
"/ PreviousBuildDirectory) |
|
913 |
"/ ifNil:[ UserPreferences current buildDirectory]. |
|
914 |
"/ |
|
915 |
"/ buildDirectory := Dialog requestDirectoryName:'Temporary Work-ROOT for build:' |
|
916 |
"/ default:default. |
|
917 |
"/ |
|
918 |
"/ buildDirectory isEmptyOrNil ifTrue:[^ self]. |
|
919 |
"/ buildDirectory := buildDirectory asFilename. |
|
920 |
"/ directoryIsOKForMe := true. |
|
921 |
"/ |
|
922 |
"/ buildDirectory exists ifFalse:[ |
|
923 |
"/ Dialog warn:(self classResources string:'Work directory %1 does not exist.' with:buildDirectory). |
|
924 |
"/ directoryIsOKForMe := false. |
|
925 |
"/ ] ifTrue:[ |
|
926 |
"/ (buildDirectory construct:'stx') exists ifFalse:[ |
|
927 |
"/ Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stx subDirectory,\which contains (at least) the stc and include subdirectories.'). |
|
928 |
"/ directoryIsOKForMe := false. |
|
929 |
"/ ] ifTrue:[ |
|
930 |
"/ stc := (OperatingSystem isMSDOSlike) ifTrue:['stc.exe'] ifFalse:['stc']. |
|
931 |
"/ (((buildDirectory construct:'stx')construct:'stc')construct:stc) exists ifFalse:[ |
|
932 |
"/ Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stc compiler in the stx/stc subDirectory.'). |
|
933 |
"/ directoryIsOKForMe := false. |
|
934 |
"/ ]. |
|
935 |
"/ ((buildDirectory construct:'stx')construct:'include') exists ifFalse:[ |
|
936 |
"/ Dialog warn:(self classResources stringWithCRs:'Work directory must have had a make run before (for include files to exists).'). |
|
937 |
"/ directoryIsOKForMe := false. |
|
938 |
"/ ]. |
|
939 |
"/ ] |
|
940 |
"/ ]. |
|
941 |
"/ directoryIsOKForMe |
|
942 |
"/ ] whileFalse |
|
2596 | 943 |
! ! |
944 |
||
945 |
!ProjectBuilder class methodsFor:'documentation'! |
|
946 |
||
2896
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
947 |
version |
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
948 |
^ '$Header$' |
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
949 |
! |
6ed90332dbda
changed: #copyDLLsForLinkage
Claus Gittinger <cg@exept.de>
parents:
2895
diff
changeset
|
950 |
|
2596 | 951 |
version_CVS |
952 |
^ '$Header$' |
|
953 |
! ! |