added:5 methods
authorClaus Gittinger <cg@exept.de>
Sat, 10 Oct 2009 17:57:31 +0200
changeset 2600 bfde5434dcdd
parent 2599 e8624fcf3c1b
child 2601 be55f85e2ebf
added:5 methods changed: #build #generateSourceFilesByFilingOut
ProjectBuilder.st
--- a/ProjectBuilder.st	Sat Oct 10 16:26:51 2009 +0200
+++ b/ProjectBuilder.st	Sat Oct 10 17:57:31 2009 +0200
@@ -81,11 +81,11 @@
     mySTXTopDirectory := myTopDirectory / 'stx'.
 
     self setupBuildDirectory.
-self halt.
     self copySTCDirectoryForBuild.
     self generateSourceFiles.
-    self generateDLLsForLinkage.
-self halt.
+    self copyDLLsForLinkage.
+    self copySupportFilesForLinkage.
+    self copyStartupFilesFromSmalltalk.
 
     OperatingSystem
         executeCommand:(ParserFlags makeCommand,' exe')
@@ -100,6 +100,46 @@
     "Modified: / 22-09-2006 / 17:37:11 / cg"
 !
 
+copyDLLsForLinkage
+    |targetBuildDir|
+
+    targetBuildDir := buildDirectory / package module / package directory.
+
+    (projectDefinitionClass allPreRequisites)
+    do:[:eachPackageToFileout |
+        |packageId packageDef packageModule packageDirectory packageTargetDir
+         dllSource dllSourceDir libraryName dllRelativePath|
+
+        packageId := eachPackageToFileout asPackageId.
+        packageModule := packageId module.
+        packageDirectory := packageId directory.
+        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
+
+        packageDef := packageId projectDefinitionClass.
+        libraryName := packageDef libraryName.
+
+        "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
+        dllSourceDir := myTopDirectory / packageModule / packageDirectory.
+        OperatingSystem isMSWINDOWSlike ifTrue:[
+"/            dllRelativePath := 'objvc','/',(libraryName,'.dll').
+"/            (dllSourceDir / dllRelativePath) exists 
+            false ifFalse:[
+                dllRelativePath := 'objbc','/',(libraryName,'.dll').
+            ]
+        ] ifFalse:[
+            dllRelativePath := libraryName,'.so'.
+        ].
+        ((packageTargetDir / dllRelativePath) exists
+        and:[ (dllSourceDir / dllRelativePath) fileSize = (packageTargetDir / dllRelativePath) fileSize
+        and:[ (dllSourceDir / dllRelativePath) modificationTime < (packageTargetDir / dllRelativePath) modificationTime
+        "/ and:[ (dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath) ]
+        ]]) ifFalse:[
+            (packageTargetDir / dllRelativePath) directory recursiveMakeDirectory.
+            (dllSourceDir / dllRelativePath) copyTo:(packageTargetDir / dllRelativePath).    
+        ]
+    ].
+!
+
 copyDirectory:relativepath
     "/ need rules in stx
     ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
@@ -126,6 +166,22 @@
     self activityNotification:nil
 !
 
+copyResourcesForPackage:aPackage
+    |module directory|
+
+    module := aPackage asPackageId module.
+    directory := aPackage asPackageId directory.
+
+    (myTopDirectory / module / directory / 'resources' ) exists ifTrue:[
+        (myTopDirectory / module / directory / 'resources' )
+            recursiveCopyTo:(buildDirectory / module / directory)
+    ].
+    (myTopDirectory / module / directory / 'styles' ) exists ifTrue:[
+        (myTopDirectory / module / directory / 'styles' )
+            recursiveCopyTo:(buildDirectory / module / directory)
+    ].
+!
+
 copySTCDirectoryForBuild
     |targetDir stc files|
 
@@ -152,6 +208,53 @@
     self activityNotification:nil
 !
 
+copyStartupFilesFromSmalltalk
+    (buildDirectory / 'stx' / 'projects/smalltalk' ) exists ifFalse:[
+        (buildDirectory / 'stx' / 'projects/smalltalk' ) recursiveMakeDirectory.
+    ].
+
+    #( 'keyboard.rc' 'keyboardMacros.rc' 'display.rc' 'd_win32.rc'
+       'host.rc' 'h_win32.rc'  
+    ) do:[:fn |
+        (myTopDirectory / 'stx' / 'projects/smalltalk' / fn)
+            copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / fn)
+    ]
+!
+
+copySupportFilesForLinkage
+    |files|
+
+    OperatingSystem isMSWINDOWSlike ifTrue:[
+        files := #( 
+                    'support/win32/borland/cs3245.dll' 
+                    'support/win32/X11.dll'
+                    'support/win32/Xext.dll'
+                    'librun/librun.dll'
+                    'libbc/librun.lib'
+                    'libbc/cs32i.lib'
+                    'librun/genDate.exe'
+                    'librun/main.c'
+                 ).
+    ] ifFalse:[
+        files := #(
+                    'librun/genDate'
+                    'librun/main.c'
+                    'librun/librun.so'
+                )
+    ].
+
+    files do:[:dllRelativePath |
+        ((buildDirectory / 'stx' / dllRelativePath) exists
+        and:[ (mySTXTopDirectory / dllRelativePath) fileSize = (buildDirectory / 'stx' / dllRelativePath) fileSize
+        and:[ (mySTXTopDirectory / dllRelativePath) modificationTime < (buildDirectory / 'stx' / dllRelativePath) modificationTime
+        "/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ]
+        ]]) ifFalse:[
+            (buildDirectory / 'stx' / dllRelativePath) directory recursiveMakeDirectory.
+            (mySTXTopDirectory / dllRelativePath) copyTo:(buildDirectory / 'stx' / dllRelativePath).    
+        ]
+    ].
+!
+
 createHeaderFileFor:aClass in:packageTargetDir
     |instVarList classInstVarList classVarList bindings superclassFilename
      template file newContents oldContents|
@@ -214,47 +317,6 @@
     ].
 !
 
-generateDLLsForLinkage
-    |targetBuildDir|
-
-    targetBuildDir := buildDirectory / package module / package directory.
-
-    "/ generate header files...
-    (projectDefinitionClass allPreRequisites)
-    do:[:eachPackageToFileout |
-        |packageId packageDef packageModule packageDirectory packageTargetDir
-         dllSource dllSourceDir libraryName dllRelativePath|
-
-        packageId := eachPackageToFileout asPackageId.
-        packageModule := packageId module.
-        packageDirectory := packageId directory.
-        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
-
-        packageDef := packageId projectDefinitionClass.
-        libraryName := packageDef libraryName.
-
-        "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
-        dllSourceDir := myTopDirectory / packageModule / packageDirectory.
-        OperatingSystem isMSWINDOWSlike ifTrue:[
-"/            dllRelativePath := 'objvc','/',(libraryName,'.dll').
-"/            (dllSourceDir / dllRelativePath) exists 
-            false ifFalse:[
-                dllRelativePath := 'objbc','/',(libraryName,'.dll').
-            ]
-        ] ifFalse:[
-            dllRelativePath := libraryName,'.so'.
-        ].
-        ((dllSourceDir / dllRelativePath) exists
-        and:[ (dllSourceDir / dllRelativePath) fileSize = (packageTargetDir / dllRelativePath) fileSize
-        and:[ (dllSourceDir / dllRelativePath) modificationTime < (packageTargetDir / dllRelativePath) modificationTime
-        "/ and:[ (dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath) ]
-        ]]) ifFalse:[
-            (packageTargetDir / dllRelativePath) directory recursiveMakeDirectory.
-            (dllSourceDir / dllRelativePath) copyTo:(packageTargetDir / dllRelativePath).    
-        ]
-    ].
-!
-
 generateSourceFiles
     sourceCodeManager notNil ifTrue:[
         "/ check out / generate files there
@@ -351,7 +413,6 @@
                 (packageTargetDir / fileName) contents:fileContents.
             ].
         ].    
-self halt.
     ].
 
     "/ generate header files in prerequisite packages...
@@ -370,11 +431,12 @@
             |cls|
 
             cls := Smalltalk classNamed:eachClassName.
-            self assert:cls isLoaded.
+            "/ self assert:cls isLoaded.
             cls isLoaded ifTrue:[    
                 self createHeaderFileFor:cls in:packageTargetDir
             ].
         ].
+        self copyResourcesForPackage:eachPackageToFileout.
     ].
 
 "/    stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic')