98 "Created: / 09-08-2006 / 18:37:19 / fm" |
98 "Created: / 09-08-2006 / 18:37:19 / fm" |
99 "Modified: / 09-08-2006 / 19:55:50 / fm" |
99 "Modified: / 09-08-2006 / 19:55:50 / fm" |
100 "Modified: / 22-09-2006 / 17:37:11 / cg" |
100 "Modified: / 22-09-2006 / 17:37:11 / cg" |
101 ! |
101 ! |
102 |
102 |
103 copyDirectory:relativepath |
103 copyDLLsForLinkage |
104 "/ need rules in stx |
|
105 ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath) |
|
106 recursiveCopyTo:(buildDirectory construct:'stx'). |
|
107 ! |
|
108 |
|
109 copyDirectoryForBuild:subdir |
|
110 |targetDir targetFile| |
|
111 |
|
112 targetDir := buildDirectory / 'stx' / subdir. |
|
113 targetDir exists ifFalse:[ |
|
114 targetDir makeDirectory. |
|
115 ]. |
|
116 (mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile | |
|
117 eachFile isDirectory ifFalse:[ |
|
118 targetFile := targetDir / eachFile baseName. |
|
119 (targetFile exists not |
|
120 or:[ targetFile modificationTime < eachFile modificationTime ]) ifTrue:[ |
|
121 self activityNotification:'copying ',eachFile pathName,'...'. |
|
122 eachFile copyTo:(targetDir construct:eachFile baseName) |
|
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 |
|
150 ]. |
|
151 ]. |
|
152 self activityNotification:nil |
|
153 ! |
|
154 |
|
155 createHeaderFileFor:aClass in:packageTargetDir |
|
156 |instVarList classInstVarList classVarList bindings superclassFilename |
|
157 template file newContents oldContents| |
|
158 |
|
159 instVarList := StringCollection new. |
|
160 aClass instVarNames do:[:v | |
|
161 instVarList add:('OBJ %1;' bindWith:v) |
|
162 ]. |
|
163 classInstVarList := StringCollection new. |
|
164 aClass class instVarNames do:[:v | |
|
165 (v includes:$_) ifTrue:[self halt]. |
|
166 classInstVarList add:('OBJ %1;' bindWith:v) |
|
167 ]. |
|
168 classVarList := StringCollection new. |
|
169 aClass classVarNames do:[:v | |
|
170 classVarList add:('extern OBJ %1_%2;' bindWith:aClass name with:v) |
|
171 ]. |
|
172 |
|
173 bindings := Dictionary new. |
|
174 bindings at:'ClassName' put:aClass name. |
|
175 aClass superclass isNil ifTrue:[ |
|
176 bindings at:'SuperclassName' put:'-'. |
|
177 bindings at:'SuperclassFileInclude' put:nil. |
|
178 ] ifFalse:[ |
|
179 bindings at:'SuperclassName' put:aClass superclass name. |
|
180 bindings at:'SuperclassFileName' put:(superclassFilename := Smalltalk fileNameForClass:aClass superclass). |
|
181 bindings at:'SuperclassFileInclude' put:('#include "%1.STH"' bindWith:superclassFilename). |
|
182 ]. |
|
183 bindings at:'InstVarList' put:instVarList asString. |
|
184 bindings at:'ClassVarList' put:classVarList asString. |
|
185 bindings at:'ClassInstVarList' put:classInstVarList asString. |
|
186 |
|
187 template := |
|
188 '/* This file was generated by ProjectBuilder. */ |
|
189 /* !!!!!!!! Do not change by hand !!!!!!!! */ |
|
190 |
|
191 /* Class: %(ClassName) */ |
|
192 /* Superclass: %(SuperclassName) */ |
|
193 |
|
194 %(SuperclassFileInclude) |
|
195 |
|
196 /* INDIRECTGLOBALS */ |
|
197 #ifdef _HEADER_INST_ |
|
198 %(InstVarList) |
|
199 #endif /* _HEADER_INST_ */ |
|
200 |
|
201 #ifdef _HEADER_CLASS_ |
|
202 %(ClassVarList) |
|
203 #endif /* _HEADER_CLASS_ */ |
|
204 |
|
205 #ifdef _HEADER_CLASSINST_ |
|
206 %(ClassInstVarList) |
|
207 #endif /* _HEADER_CLASSINST_ */ |
|
208 '. |
|
209 newContents := template bindWithArguments:bindings. |
|
210 file := packageTargetDir asFilename / ((Smalltalk fileNameForClass:aClass),'.STH'). |
|
211 (file exists not |
|
212 or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[ |
|
213 file contents: newContents. |
|
214 ]. |
|
215 ! |
|
216 |
|
217 generateDLLsForLinkage |
|
218 |targetBuildDir| |
104 |targetBuildDir| |
219 |
105 |
220 targetBuildDir := buildDirectory / package module / package directory. |
106 targetBuildDir := buildDirectory / package module / package directory. |
221 |
107 |
222 "/ generate header files... |
|
223 (projectDefinitionClass allPreRequisites) |
108 (projectDefinitionClass allPreRequisites) |
224 do:[:eachPackageToFileout | |
109 do:[:eachPackageToFileout | |
225 |packageId packageDef packageModule packageDirectory packageTargetDir |
110 |packageId packageDef packageModule packageDirectory packageTargetDir |
226 dllSource dllSourceDir libraryName dllRelativePath| |
111 dllSource dllSourceDir libraryName dllRelativePath| |
227 |
112 |
242 dllRelativePath := 'objbc','/',(libraryName,'.dll'). |
127 dllRelativePath := 'objbc','/',(libraryName,'.dll'). |
243 ] |
128 ] |
244 ] ifFalse:[ |
129 ] ifFalse:[ |
245 dllRelativePath := libraryName,'.so'. |
130 dllRelativePath := libraryName,'.so'. |
246 ]. |
131 ]. |
247 ((dllSourceDir / dllRelativePath) exists |
132 ((packageTargetDir / dllRelativePath) exists |
248 and:[ (dllSourceDir / dllRelativePath) fileSize = (packageTargetDir / dllRelativePath) fileSize |
133 and:[ (dllSourceDir / dllRelativePath) fileSize = (packageTargetDir / dllRelativePath) fileSize |
249 and:[ (dllSourceDir / dllRelativePath) modificationTime < (packageTargetDir / dllRelativePath) modificationTime |
134 and:[ (dllSourceDir / dllRelativePath) modificationTime < (packageTargetDir / dllRelativePath) modificationTime |
250 "/ and:[ (dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath) ] |
135 "/ and:[ (dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath) ] |
251 ]]) ifFalse:[ |
136 ]]) ifFalse:[ |
252 (packageTargetDir / dllRelativePath) directory recursiveMakeDirectory. |
137 (packageTargetDir / dllRelativePath) directory recursiveMakeDirectory. |
253 (dllSourceDir / dllRelativePath) copyTo:(packageTargetDir / dllRelativePath). |
138 (dllSourceDir / dllRelativePath) copyTo:(packageTargetDir / dllRelativePath). |
254 ] |
139 ] |
|
140 ]. |
|
141 ! |
|
142 |
|
143 copyDirectory:relativepath |
|
144 "/ need rules in stx |
|
145 ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath) |
|
146 recursiveCopyTo:(buildDirectory construct:'stx'). |
|
147 ! |
|
148 |
|
149 copyDirectoryForBuild:subdir |
|
150 |targetDir targetFile| |
|
151 |
|
152 targetDir := buildDirectory / 'stx' / subdir. |
|
153 targetDir exists ifFalse:[ |
|
154 targetDir makeDirectory. |
|
155 ]. |
|
156 (mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile | |
|
157 eachFile isDirectory ifFalse:[ |
|
158 targetFile := targetDir / eachFile baseName. |
|
159 (targetFile exists not |
|
160 or:[ targetFile modificationTime < eachFile modificationTime ]) ifTrue:[ |
|
161 self activityNotification:'copying ',eachFile pathName,'...'. |
|
162 eachFile copyTo:(targetDir construct:eachFile baseName) |
|
163 ] |
|
164 ]. |
|
165 ]. |
|
166 self activityNotification:nil |
|
167 ! |
|
168 |
|
169 copyResourcesForPackage:aPackage |
|
170 |module directory| |
|
171 |
|
172 module := aPackage asPackageId module. |
|
173 directory := aPackage asPackageId directory. |
|
174 |
|
175 (myTopDirectory / module / directory / 'resources' ) exists ifTrue:[ |
|
176 (myTopDirectory / module / directory / 'resources' ) |
|
177 recursiveCopyTo:(buildDirectory / module / directory) |
|
178 ]. |
|
179 (myTopDirectory / module / directory / 'styles' ) exists ifTrue:[ |
|
180 (myTopDirectory / module / directory / 'styles' ) |
|
181 recursiveCopyTo:(buildDirectory / module / directory) |
|
182 ]. |
|
183 ! |
|
184 |
|
185 copySTCDirectoryForBuild |
|
186 |targetDir stc files| |
|
187 |
|
188 targetDir := buildDirectory / 'stx' / 'stc'. |
|
189 targetDir exists ifFalse:[ targetDir makeDirectory ]. |
|
190 |
|
191 stc := OperatingSystem isMSWINDOWSlike |
|
192 ifTrue:[ 'stc.exe' ] |
|
193 ifFalse:[ 'stc' ]. |
|
194 |
|
195 files := #( ) copyWith:stc. |
|
196 |
|
197 files do:[:eachFile | |
|
198 |sourceFile targetFile| |
|
199 |
|
200 sourceFile := mySTXTopDirectory / 'stc' / eachFile. |
|
201 targetFile := targetDir / eachFile. |
|
202 (targetFile exists not |
|
203 or:[ targetFile modificationTime < sourceFile modificationTime ]) ifTrue:[ |
|
204 self activityNotification:'copying ',sourceFile pathName,'...'. |
|
205 sourceFile copyTo:targetFile |
|
206 ]. |
|
207 ]. |
|
208 self activityNotification:nil |
|
209 ! |
|
210 |
|
211 copyStartupFilesFromSmalltalk |
|
212 (buildDirectory / 'stx' / 'projects/smalltalk' ) exists ifFalse:[ |
|
213 (buildDirectory / 'stx' / 'projects/smalltalk' ) recursiveMakeDirectory. |
|
214 ]. |
|
215 |
|
216 #( 'keyboard.rc' 'keyboardMacros.rc' 'display.rc' 'd_win32.rc' |
|
217 'host.rc' 'h_win32.rc' |
|
218 ) do:[:fn | |
|
219 (myTopDirectory / 'stx' / 'projects/smalltalk' / fn) |
|
220 copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / fn) |
|
221 ] |
|
222 ! |
|
223 |
|
224 copySupportFilesForLinkage |
|
225 |files| |
|
226 |
|
227 OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
228 files := #( |
|
229 'support/win32/borland/cs3245.dll' |
|
230 'support/win32/X11.dll' |
|
231 'support/win32/Xext.dll' |
|
232 'librun/librun.dll' |
|
233 'libbc/librun.lib' |
|
234 'libbc/cs32i.lib' |
|
235 'librun/genDate.exe' |
|
236 'librun/main.c' |
|
237 ). |
|
238 ] ifFalse:[ |
|
239 files := #( |
|
240 'librun/genDate' |
|
241 'librun/main.c' |
|
242 'librun/librun.so' |
|
243 ) |
|
244 ]. |
|
245 |
|
246 files do:[:dllRelativePath | |
|
247 ((buildDirectory / 'stx' / dllRelativePath) exists |
|
248 and:[ (mySTXTopDirectory / dllRelativePath) fileSize = (buildDirectory / 'stx' / dllRelativePath) fileSize |
|
249 and:[ (mySTXTopDirectory / dllRelativePath) modificationTime < (buildDirectory / 'stx' / dllRelativePath) modificationTime |
|
250 "/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ] |
|
251 ]]) ifFalse:[ |
|
252 (buildDirectory / 'stx' / dllRelativePath) directory recursiveMakeDirectory. |
|
253 (mySTXTopDirectory / dllRelativePath) copyTo:(buildDirectory / 'stx' / dllRelativePath). |
|
254 ] |
|
255 ]. |
|
256 ! |
|
257 |
|
258 createHeaderFileFor:aClass in:packageTargetDir |
|
259 |instVarList classInstVarList classVarList bindings superclassFilename |
|
260 template file newContents oldContents| |
|
261 |
|
262 instVarList := StringCollection new. |
|
263 aClass instVarNames do:[:v | |
|
264 instVarList add:('OBJ %1;' bindWith:v) |
|
265 ]. |
|
266 classInstVarList := StringCollection new. |
|
267 aClass class instVarNames do:[:v | |
|
268 (v includes:$_) ifTrue:[self halt]. |
|
269 classInstVarList add:('OBJ %1;' bindWith:v) |
|
270 ]. |
|
271 classVarList := StringCollection new. |
|
272 aClass classVarNames do:[:v | |
|
273 classVarList add:('extern OBJ %1_%2;' bindWith:aClass name with:v) |
|
274 ]. |
|
275 |
|
276 bindings := Dictionary new. |
|
277 bindings at:'ClassName' put:aClass name. |
|
278 aClass superclass isNil ifTrue:[ |
|
279 bindings at:'SuperclassName' put:'-'. |
|
280 bindings at:'SuperclassFileInclude' put:nil. |
|
281 ] ifFalse:[ |
|
282 bindings at:'SuperclassName' put:aClass superclass name. |
|
283 bindings at:'SuperclassFileName' put:(superclassFilename := Smalltalk fileNameForClass:aClass superclass). |
|
284 bindings at:'SuperclassFileInclude' put:('#include "%1.STH"' bindWith:superclassFilename). |
|
285 ]. |
|
286 bindings at:'InstVarList' put:instVarList asString. |
|
287 bindings at:'ClassVarList' put:classVarList asString. |
|
288 bindings at:'ClassInstVarList' put:classInstVarList asString. |
|
289 |
|
290 template := |
|
291 '/* This file was generated by ProjectBuilder. */ |
|
292 /* !!!!!!!! Do not change by hand !!!!!!!! */ |
|
293 |
|
294 /* Class: %(ClassName) */ |
|
295 /* Superclass: %(SuperclassName) */ |
|
296 |
|
297 %(SuperclassFileInclude) |
|
298 |
|
299 /* INDIRECTGLOBALS */ |
|
300 #ifdef _HEADER_INST_ |
|
301 %(InstVarList) |
|
302 #endif /* _HEADER_INST_ */ |
|
303 |
|
304 #ifdef _HEADER_CLASS_ |
|
305 %(ClassVarList) |
|
306 #endif /* _HEADER_CLASS_ */ |
|
307 |
|
308 #ifdef _HEADER_CLASSINST_ |
|
309 %(ClassInstVarList) |
|
310 #endif /* _HEADER_CLASSINST_ */ |
|
311 '. |
|
312 newContents := template bindWithArguments:bindings. |
|
313 file := packageTargetDir asFilename / ((Smalltalk fileNameForClass:aClass),'.STH'). |
|
314 (file exists not |
|
315 or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[ |
|
316 file contents: newContents. |
255 ]. |
317 ]. |
256 ! |
318 ! |
257 |
319 |
258 generateSourceFiles |
320 generateSourceFiles |
259 sourceCodeManager notNil ifTrue:[ |
321 sourceCodeManager notNil ifTrue:[ |