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