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