79 ]. |
79 ]. |
80 myTopDirectory := myTopDirectory asFilename. |
80 myTopDirectory := myTopDirectory asFilename. |
81 mySTXTopDirectory := myTopDirectory / 'stx'. |
81 mySTXTopDirectory := myTopDirectory / 'stx'. |
82 |
82 |
83 self setupBuildDirectory. |
83 self setupBuildDirectory. |
|
84 self halt. |
|
85 self copySTCDirectoryForBuild. |
84 self generateSourceFiles. |
86 self generateSourceFiles. |
|
87 self generateDLLsForLinkage. |
85 self halt. |
88 self halt. |
86 |
89 |
87 OperatingSystem |
90 OperatingSystem |
88 executeCommand:(ParserFlags makeCommand) |
91 executeCommand:(ParserFlags makeCommand,' exe') |
89 inputFrom:nil |
92 inputFrom:nil |
90 outputTo:Transcript |
93 outputTo:Transcript |
91 errorTo:Transcript |
94 errorTo:Transcript |
92 inDirectory:((buildDirectory construct:module) construct:directory) |
95 inDirectory:(buildDirectory / module / directory) |
93 onError:[:status| self error:'make failed']. |
96 onError:[:status| self error:'make failed']. |
94 |
97 |
95 "Created: / 09-08-2006 / 18:37:19 / fm" |
98 "Created: / 09-08-2006 / 18:37:19 / fm" |
96 "Modified: / 09-08-2006 / 19:55:50 / fm" |
99 "Modified: / 09-08-2006 / 19:55:50 / fm" |
97 "Modified: / 22-09-2006 / 17:37:11 / cg" |
100 "Modified: / 22-09-2006 / 17:37:11 / cg" |
116 (targetFile exists not |
119 (targetFile exists not |
117 or:[ targetFile modificationTime < eachFile modificationTime ]) ifTrue:[ |
120 or:[ targetFile modificationTime < eachFile modificationTime ]) ifTrue:[ |
118 self activityNotification:'copying ',eachFile pathName,'...'. |
121 self activityNotification:'copying ',eachFile pathName,'...'. |
119 eachFile copyTo:(targetDir construct:eachFile baseName) |
122 eachFile copyTo:(targetDir construct:eachFile baseName) |
120 ] |
123 ] |
|
124 ]. |
|
125 ]. |
|
126 self activityNotification:nil |
|
127 ! |
|
128 |
|
129 copySTCDirectoryForBuild |
|
130 |targetDir stc files| |
|
131 |
|
132 targetDir := buildDirectory / 'stx' / 'stc'. |
|
133 targetDir exists ifFalse:[ targetDir makeDirectory ]. |
|
134 |
|
135 stc := OperatingSystem isMSWINDOWSlike |
|
136 ifTrue:[ 'stc.exe' ] |
|
137 ifFalse:[ 'stc' ]. |
|
138 |
|
139 files := #( ) copyWith:stc. |
|
140 |
|
141 files do:[:eachFile | |
|
142 |sourceFile targetFile| |
|
143 |
|
144 sourceFile := mySTXTopDirectory / 'stc' / eachFile. |
|
145 targetFile := targetDir / eachFile. |
|
146 (targetFile exists not |
|
147 or:[ targetFile modificationTime < sourceFile modificationTime ]) ifTrue:[ |
|
148 self activityNotification:'copying ',sourceFile pathName,'...'. |
|
149 sourceFile copyTo:targetFile |
121 ]. |
150 ]. |
122 ]. |
151 ]. |
123 self activityNotification:nil |
152 self activityNotification:nil |
124 ! |
153 ! |
125 |
154 |
183 or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[ |
212 or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[ |
184 file contents: newContents. |
213 file contents: newContents. |
185 ]. |
214 ]. |
186 ! |
215 ! |
187 |
216 |
|
217 generateDLLsForLinkage |
|
218 |targetBuildDir| |
|
219 |
|
220 targetBuildDir := buildDirectory / package module / package directory. |
|
221 |
|
222 "/ generate header files... |
|
223 (projectDefinitionClass allPreRequisites) |
|
224 do:[:eachPackageToFileout | |
|
225 |packageId packageDef packageModule packageDirectory packageTargetDir |
|
226 dllSource dllSourceDir libraryName dllRelativePath| |
|
227 |
|
228 packageId := eachPackageToFileout asPackageId. |
|
229 packageModule := packageId module. |
|
230 packageDirectory := packageId directory. |
|
231 packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory. |
|
232 |
|
233 packageDef := packageId projectDefinitionClass. |
|
234 libraryName := packageDef libraryName. |
|
235 |
|
236 "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ?? |
|
237 dllSourceDir := myTopDirectory / packageModule / packageDirectory. |
|
238 OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
239 "/ dllRelativePath := 'objvc','/',(libraryName,'.dll'). |
|
240 "/ (dllSourceDir / dllRelativePath) exists |
|
241 false ifFalse:[ |
|
242 dllRelativePath := 'objbc','/',(libraryName,'.dll'). |
|
243 ] |
|
244 ] ifFalse:[ |
|
245 dllRelativePath := libraryName,'.so'. |
|
246 ]. |
|
247 ((dllSourceDir / dllRelativePath) exists |
|
248 and:[ (dllSourceDir / dllRelativePath) fileSize = (packageTargetDir / dllRelativePath) fileSize |
|
249 and:[ (dllSourceDir / dllRelativePath) modificationTime < (packageTargetDir / dllRelativePath) modificationTime |
|
250 "/ and:[ (dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath) ] |
|
251 ]]) ifFalse:[ |
|
252 (packageTargetDir / dllRelativePath) directory recursiveMakeDirectory. |
|
253 (dllSourceDir / dllRelativePath) copyTo:(packageTargetDir / dllRelativePath). |
|
254 ] |
|
255 ]. |
|
256 ! |
|
257 |
188 generateSourceFiles |
258 generateSourceFiles |
189 sourceCodeManager notNil ifTrue:[ |
259 sourceCodeManager notNil ifTrue:[ |
190 "/ check out / generate files there |
260 "/ check out / generate files there |
191 self generateSourceFilesByCheckingOutUsing:sourceCodeManager |
261 self generateSourceFilesByCheckingOutUsing:sourceCodeManager |
192 ] ifFalse:[ |
262 ] ifFalse:[ |
236 onError:[:status| self error:'cvs update failed']. |
306 onError:[:status| self error:'cvs update failed']. |
237 self halt. |
307 self halt. |
238 ! |
308 ! |
239 |
309 |
240 generateSourceFilesByFilingOut |
310 generateSourceFilesByFilingOut |
241 |targetDir prerequisitePackages| |
|
242 |
|
243 "/ local build |
311 "/ local build |
244 "/ fileout the project |
312 "/ fileout the project |
245 |
313 |
246 (package module ~= 'stx') ifTrue:[ |
314 (package module ~= 'stx') ifTrue:[ |
247 (buildDirectory / package module) makeDirectory. |
315 (buildDirectory / package module) makeDirectory. |
248 ]. |
316 ]. |
249 |
317 |
250 "/ file out the package(s) |
318 "/ file out the package(s) which are to be built |
251 ((Array with:package)) |
319 ((Array with:package)) |
252 do:[:eachPackageToFileout | |
320 do:[:eachPackageToFileout | |
253 |packageId packageModule packageDirectory packageTargetDir packageDef| |
321 |packageId packageModule packageDirectory packageTargetDir packageDef| |
254 |
322 |
255 packageId := eachPackageToFileout asPackageId. |
323 packageId := eachPackageToFileout asPackageId. |
274 "/ cls autoload. |
342 "/ cls autoload. |
275 "/ ]. |
343 "/ ]. |
276 "/ cls fileOutIn:packageTargetDir |
344 "/ cls fileOutIn:packageTargetDir |
277 "/ ] |
345 "/ ] |
278 "/ ]. |
346 "/ ]. |
279 ]. |
347 |
280 "/ generate header files... |
348 projectDefinitionClass forEachFileNameAndGeneratedContentsDo:[:fileName :fileContents | |
|
349 ((packageTargetDir / fileName) exists |
|
350 and:[ (packageTargetDir / fileName) contents = fileContents ]) ifFalse:[ |
|
351 (packageTargetDir / fileName) contents:fileContents. |
|
352 ]. |
|
353 ]. |
|
354 self halt. |
|
355 ]. |
|
356 |
|
357 "/ generate header files in prerequisite packages... |
281 (projectDefinitionClass allPreRequisites) |
358 (projectDefinitionClass allPreRequisites) |
282 do:[:eachPackageToFileout | |
359 do:[:eachPackageToFileout | |
283 |packageId packageDef packageModule packageDirectory packageTargetDir| |
360 |packageId packageDef packageModule packageDirectory packageTargetDir| |
284 |
361 |
285 packageId := eachPackageToFileout asPackageId. |
362 packageId := eachPackageToFileout asPackageId. |
296 self assert:cls isLoaded. |
373 self assert:cls isLoaded. |
297 cls isLoaded ifTrue:[ |
374 cls isLoaded ifTrue:[ |
298 self createHeaderFileFor:cls in:packageTargetDir |
375 self createHeaderFileFor:cls in:packageTargetDir |
299 ]. |
376 ]. |
300 ]. |
377 ]. |
301 |
378 ]. |
302 "/ (Smalltalk allClassesInPackage:eachPackageToFileout) do:[:cls | |
|
303 "/ cls isPrivate ifFalse:[ |
|
304 "/ cls isLoaded ifTrue:[ |
|
305 "/ self createHeaderFileFor:cls in:packageTargetDir |
|
306 "/ ] |
|
307 "/ ] |
|
308 "/ ]. |
|
309 ]. |
|
310 |
|
311 "/ "/ copy h-files preRequisite packages |
|
312 "/ prerequisitePackages := projectDefinitionClass preRequisitesForBuilding. |
|
313 "/ prerequisitePackages do:[:eachPackage | |
|
314 "/ |relativeDir sourceDir| |
|
315 "/ |
|
316 "/ relativeDir := eachPackage asPackageId pathRelativeToTopDirectory. |
|
317 "/ sourceDir := Smalltalk packageDirectoryForPackageId:eachPackage. |
|
318 "/ targetDir := buildDirectory construct:relativeDir. |
|
319 "/ targetDir recursiveMakeDirectory. |
|
320 "/ sourceDir directoryContentsAsFilenamesDo:[:eachSourceFilename | |
|
321 "/ ((eachSourceFilename suffix asLowercase = 'h') |
|
322 "/ or:[ eachSourceFilename suffix asLowercase = 'sth' ]) ifTrue:[ |
|
323 "/ eachSourceFilename copyTo:targetDir. |
|
324 "/ ]. |
|
325 "/ ]. |
|
326 "/ ]. |
|
327 |
379 |
328 "/ stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic') |
380 "/ stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic') |
329 "/ "/ generate support files there |
|
330 "/ targetDir := ((buildDirectory construct:module) construct:directory) recursiveMakeDirectory. |
|
331 "/ #('bmake.bat' 'Make.spec' 'Make.proto' 'libInit.cc' 'abbrev.stc' |
|
332 "/ 'bc.mak' |
|
333 "/ ) do:[:f | |
|
334 "/ |contents| |
|
335 "/ |
|
336 "/ contents := projectDefinitionClass generateFile:f. |
|
337 "/ (targetDir construct:f) contents:contents. |
|
338 "/ ]. |
|
339 ! |
381 ! |
340 |
382 |
341 setupBuildDirectory |
383 setupBuildDirectory |
342 buildDirectory exists ifFalse:[ |
384 buildDirectory exists ifFalse:[ |
343 buildDirectory recursiveMakeDirectory. |
385 buildDirectory recursiveMakeDirectory. |