LibraryBuilder.st
changeset 1558 c4ed1badfc13
parent 1552 924c8331a628
child 1560 308be6511a7c
--- a/LibraryBuilder.st	Sat Apr 18 15:58:57 1998 +0200
+++ b/LibraryBuilder.st	Sat Apr 18 16:17:45 1998 +0200
@@ -11,12 +11,12 @@
 "
     The Library Builder of ST/X allows you to build ST/X-libraries by following steps:
 
-        0. Clobber the target directory of the library
+        0. Clobber the target directory of the application
         1. File out the source code of all library classes
-        2. Generate the file Make.Proto
-        3. Generate the file Makefile
-        4. Make the library
-
+        2. Link the source code of all library classes into the source directory
+        3. Generate the file Make.Proto
+        4. Generate the file Makefile
+        5. Make the library
 
     [start with:]
         LibraryBuilder open
@@ -29,6 +29,18 @@
 "
 ! !
 
+!LibraryBuilder class methodsFor:'accessing'!
+
+label
+
+   ^'Library Builder (experimental)'
+
+
+
+
+
+! !
+
 !LibraryBuilder class methodsFor:'help specs'!
 
 helpSpec
@@ -47,7 +59,10 @@
     ^super helpSpec addPairsFrom:#(
 
 #addRemoveClasses
-'Removes or adds classes to the library classes.'
+'Removes or adds the selected classes to the list of the library classes.'
+
+#fileOutClasses
+'Files out the source code of the selected library classes.'
 
 #findClass
 'Find the class with the first known letters.'
@@ -61,6 +76,9 @@
 #libraryName
 'Name of the library.'
 
+#linkSources
+'Creates links in the source directory to the source file of the library classes.'
+
 #optinline
 'Generate optimized inline code.'
 
@@ -101,12 +119,12 @@
        #(#FullSpec
           #window: 
            #(#WindowSpec
-              #name: 'Library Builder'
-              #layout: #(#LayoutFrame 428 0 301 0 927 0 760 0)
-              #label: 'Library Builder'
+              #name: 'Library Builder (experimental)'
+              #layout: #(#LayoutFrame -48 0 102 0 451 0 561 0)
+              #label: 'Library Builder (experimental)'
               #min: #(#Point 420 220)
               #max: #(#Point 1152 900)
-              #bounds: #(#Rectangle 428 301 928 761)
+              #bounds: #(#Rectangle -48 102 452 562)
               #menu: #menu
               #usePreferredExtent: false
           )
@@ -116,14 +134,14 @@
                #(
                  #(#ViewSpec
                     #name: 'Box1'
-                    #layout: #(#LayoutFrame 0 0.0 3 0 0 1.0 292 0)
+                    #layout: #(#LayoutFrame 0 0.0 3 0 0 1.0 316 0)
                     #component: 
                      #(#SpecCollection
                         #collection: 
                          #(
                            #(#ViewSpec
                               #name: 'Box2'
-                              #layout: #(#LayoutFrame 0 0.0 0 0.0 -148 1.0 2 1.0)
+                              #layout: #(#LayoutFrame 0 0.0 0 0.0 -148 1.0 0 1.0)
                               #component: 
                                #(#SpecCollection
                                   #collection: 
@@ -150,45 +168,22 @@
                                         #label: 'Library Classes:'
                                         #adjust: #right
                                     )
-                                     #(#SelectionInTreeViewSpec
-                                        #name: 'listOfClassesView'
-                                        #layout: #(#LayoutFrame 2 0.0 52 0 148 0 172 0)
-                                        #activeHelpKey: #stxClasses
-                                        #model: #selectionOfClasses
-                                        #hasHorizontalScrollBar: true
-                                        #hasVerticalScrollBar: true
-                                        #miniScrollerVertical: true
-                                        #showDirectoryIndicatorForRoot: false
-                                        #showDirectoryIndicator: true
-                                        #isMultiSelect: true
-                                        #valueChangeSelector: #classSelected:
-                                        #hierarchicalList: #listOfClasses
-                                        #contentsSelector: #treeViewContents
-                                        #labelSelector: #treeViewLabel
-                                        #childrenSelector: #treeViewChildren
-                                        #iconSelector: #treeViewIcon
-                                    )
                                      #(#SequenceViewSpec
-                                        #name: 'List1'
-                                        #layout: #(#LayoutFrame 150 0 34 0 0 1.0 -98 1.0)
+                                        #name: 'libraryClassesList'
+                                        #layout: #(#LayoutFrame 0 0.6 56 0 0 1.0 195 0)
                                         #activeHelpKey: #libraryClasses
                                         #model: #selectionOfLibraryClasses
                                         #hasHorizontalScrollBar: true
                                         #hasVerticalScrollBar: true
                                         #miniScrollerVertical: true
+                                        #backgroundColor: #(#Color 100.0 74.9996 49.9992)
                                         #isMultiSelect: true
                                         #useIndex: false
                                         #sequenceList: #libraryClasses
                                     )
-                                     #(#InputFieldSpec
-                                        #name: 'classNameInputField'
-                                        #layout: #(#LayoutFrame 2 0.0 -120 1 100 0 -98 1)
-                                        #activeHelpKey: #findClass
-                                        #model: #valueOfClassName
-                                    )
                                      #(#UpDownButtonSpec
-                                        #name: 'UpDownButton1'
-                                        #layout: #(#LayoutFrame 102 0 172 0 146 0 194 0)
+                                        #name: 'addRemoveButton'
+                                        #layout: #(#LayoutOrigin -23 0.6 33 0)
                                         #activeHelpKey: #addRemoveClasses
                                         #orientation: #horizontal
                                         #upAction: #removeLibraryClasses
@@ -202,6 +197,7 @@
                                      #(#ActionButtonSpec
                                         #name: 'targetDirectoryButton'
                                         #layout: #(#LayoutFrame 4 0 204 0 147 0 228 0)
+                                        #activeHelpKey: #selectPath
                                         #label: 'Target Directory:'
                                         #model: #doSelectDirectory:
                                         #actionValue: 'Target'
@@ -215,6 +211,7 @@
                                      #(#ActionButtonSpec
                                         #name: 'topDirectoryButton'
                                         #layout: #(#LayoutFrame 4 0 228 0 147 0 252 0)
+                                        #activeHelpKey: #selectPath
                                         #label: 'Top Directory:'
                                         #model: #doSelectDirectory:
                                         #actionValue: 'Top'
@@ -227,24 +224,64 @@
                                     )
                                      #(#DividerSpec
                                         #name: 'Separator4'
-                                        #layout: #(#LayoutFrame 0 0.0 256 0 0 1.0 259 0)
+                                        #layout: #(#LayoutFrame 0 0.0 278 0 0 1.0 281 0)
                                     )
                                      #(#ActionButtonSpec
                                         #name: 'systemLibrariesButton'
-                                        #layout: #(#LayoutFrame 4 0 263 0 147 0 287 0)
+                                        #layout: #(#LayoutFrame 4 0 285 0 147 0 309 0)
+                                        #activeHelpKey: #selectPath
                                         #label: 'System Libraries:'
                                         #model: #doSelectLibrary:
                                         #actionValue: 'SystemLibrary'
                                     )
                                      #(#ComboBoxSpec
                                         #name: 'systemLibrariesComboBox'
-                                        #layout: #(#LayoutFrame 150 0 264 0 0 1 286 0)
+                                        #layout: #(#LayoutFrame 150 0 286 0 0 1 308 0)
                                         #activeHelpKey: #systemLibaries
                                         #model: #systemLibrary
                                         #immediateAccept: false
                                         #acceptOnTab: false
                                         #comboList: #systemLibraries
                                     )
+                                     #(#SequenceViewSpec
+                                        #name: 'listOfCategoriesList'
+                                        #layout: #(#LayoutFrame 0 0.0 56 0 0 0.3 195 0)
+                                        #activeHelpKey: #libraryClasses
+                                        #model: #selectionOfCategory
+                                        #hasHorizontalScrollBar: true
+                                        #hasVerticalScrollBar: true
+                                        #miniScrollerVertical: true
+                                        #backgroundColor: #(#Color 86.9993 86.9993 86.9993)
+                                        #useIndex: false
+                                        #sequenceList: #listOfCategories
+                                    )
+                                     #(#SequenceViewSpec
+                                        #name: 'listOfClassesList'
+                                        #layout: #(#LayoutFrame 0 0.3 56 0 0 0.6 195 0)
+                                        #activeHelpKey: #libraryClasses
+                                        #model: #selectionOfClasses
+                                        #hasHorizontalScrollBar: true
+                                        #hasVerticalScrollBar: true
+                                        #miniScrollerVertical: true
+                                        #backgroundColor: #(#Color 86.9993 86.9993 86.9993)
+                                        #isMultiSelect: true
+                                        #useIndex: false
+                                        #sequenceList: #listOfClasses
+                                    )
+                                     #(#ActionButtonSpec
+                                        #name: 'sourceDirectoryButton1'
+                                        #layout: #(#LayoutFrame 4 0 252 0 147 0 276 0)
+                                        #activeHelpKey: #selectPath
+                                        #label: 'Source Directory:'
+                                        #model: #doSelectDirectory:
+                                        #actionValue: 'Source'
+                                    )
+                                     #(#InputFieldSpec
+                                        #name: 'sourceDirectoryField'
+                                        #layout: #(#LayoutFrame 150 0 253 0 0 1.0 275 0)
+                                        #activeHelpKey: #sourceDirectory
+                                        #model: #sourceDirectory
+                                    )
                                   )
                               )
                           )
@@ -262,49 +299,56 @@
                                    #(
                                      #(#FramedBoxSpec
                                         #name: 'FramedBox'
-                                        #layout: #(#LayoutFrame -4 0.0 4 0.0 0 1.0 -126 1.0)
+                                        #layout: #(#LayoutFrame -4 0.0 4 0.0 0 1.0 -128 1.0)
                                         #component: 
                                          #(#SpecCollection
                                             #collection: 
                                              #(
                                                #(#CheckBoxSpec
                                                   #name: 'spaceCheckBox'
-                                                  #layout: #(#LayoutFrame 12 0 24 0 12 1 46 0)
+                                                  #layout: #(#LayoutFrame 12 0 24 0 21 1 46 0)
                                                   #activeHelpKey: #optspace
                                                   #model: #optspace
                                                   #label: 'Space'
                                               )
                                                #(#CheckBoxSpec
                                                   #name: 'space2CheckBox'
-                                                  #layout: #(#LayoutFrame 12 0 48 0 12 1 70 0)
+                                                  #layout: #(#LayoutFrame 12 0 48 0 21 1 70 0)
                                                   #activeHelpKey: #optspace2
                                                   #model: #optspace2
                                                   #label: 'Space2'
                                               )
                                                #(#CheckBoxSpec
                                                   #name: 'space3CheckBox'
-                                                  #layout: #(#LayoutFrame 12 0 72 0 12 1 94 0)
+                                                  #layout: #(#LayoutFrame 12 0 72 0 21 1 94 0)
                                                   #activeHelpKey: #optspace3
                                                   #model: #optspace3
                                                   #label: 'Space3'
                                               )
                                                #(#CheckBoxSpec
                                                   #name: 'inlineCheckBox'
-                                                  #layout: #(#LayoutFrame 12 0 96 0 12 1 118 0)
+                                                  #layout: #(#LayoutFrame 12 0 96 0 21 1 118 0)
                                                   #activeHelpKey: #optinline
                                                   #model: #optinline
                                                   #label: 'Inline'
                                               )
                                                #(#CheckBoxSpec
                                                   #name: 'inlineNewCheckBox'
-                                                  #layout: #(#LayoutFrame 12 0 120 0 12 1 142 0)
+                                                  #layout: #(#LayoutFrame 12 0 120 0 21 1 142 0)
                                                   #activeHelpKey: #inlineNew
                                                   #model: #inlineNew
                                                   #label: 'Inline New'
                                               )
+                                               #(#CheckBoxSpec
+                                                  #name: 'linkSourcesCheckBox'
+                                                  #layout: #(#LayoutFrame 12 0 144 0 21 1 166 0)
+                                                  #activeHelpKey: #linkSources
+                                                  #model: #linkSources
+                                                  #label: 'Link Sources'
+                                              )
                                             )
                                         )
-                                        #label: 'Optimizations'
+                                        #label: 'Options'
                                         #labelPosition: #topLeft
                                     )
                                      #(#VerticalPanelViewSpec
@@ -344,7 +388,7 @@
                 )
                  #(#SubCanvasSpec
                     #name: 'shellViewSubCanvas'
-                    #layout: #(#LayoutFrame 0 0.0 294 0 0 1.0 -26 1)
+                    #layout: #(#LayoutFrame 0 0.0 318 0 0 1.0 -26 1)
                     #hasHorizontalScrollBar: false
                     #hasVerticalScrollBar: false
                     #clientHolder: #shellView
@@ -382,12 +426,46 @@
           
            #(
              #(#MenuItem
+                #label: 'About'
+                #labelImage: #(#ResourceRetriever nil #menuIcon)
+                #submenuChannel: #menuAbout
+            )
+             #(#MenuItem
                 #label: 'File'
                 #submenu: 
                  #(#Menu
                     
                      #(
                        #(#MenuItem
+                          #label: 'Load...'
+                          #value: #doLoad
+                      )
+                       #(#MenuItem
+                          #label: '-'
+                      )
+                       #(#MenuItem
+                          #label: 'Save As...'
+                          #value: #doSaveAs
+                      )
+                       #(#MenuItem
+                          #label: '-'
+                      )
+                       #(#MenuItem
+                          #label: 'Exit'
+                          #value: #closeRequest
+                          #activeHelpKey: #fileExit
+                      )
+                    ) nil
+                    nil
+                )
+            )
+             #(#MenuItem
+                #label: 'Library'
+                #submenu: 
+                 #(#Menu
+                    
+                     #(
+                       #(#MenuItem
                           #label: 'Build'
                           #value: #doBuild
                           #activeHelpKey: #build
@@ -401,9 +479,9 @@
                           #label: '-'
                       )
                        #(#MenuItem
-                          #label: 'Exit'
-                          #value: #closeRequest
-                          #activeHelpKey: #fileExit
+                          #label: 'File Out Class'
+                          #value: #doFileOutClass
+                          #activeHelpKey: #fileOutClasses
                       )
                     ) nil
                     nil
@@ -457,34 +535,25 @@
       )
 ! !
 
-!LibraryBuilder methodsFor:'accessing - views'!
-
-classNameInputField
-
-    ^builder componentAt: #classNameInputField
-
-!
-
-listOfClassesView
-
-    ^builder componentAt: #listOfClassesView
-! !
-
 !LibraryBuilder methodsFor:'actions'!
 
 addLibraryClasses
-    "adds classes to the list of the library classes"
+    "adds selecetd classes to the list of the library classes"
 
     |libraryClasses selectionOfLibraryClasses|
 
+    self selectionOfClasses value size == 0 ifTrue: [^self warn: 'No class selected!!'].
+
     libraryClasses := (aspects at: #libraryClasses) value.
 
     (aspects at: #libraryClasses) value: 
         ((libraryClasses,
-        (selectionOfLibraryClasses := self selectionOfClasses value collect: [:treeItem| treeItem name])) asSet asSortedCollection asArray
+        (selectionOfLibraryClasses := self selectionOfClasses value)) asSet asSortedCollection asArray
             topologicalSort:[:n1 :n2 | ((Smalltalk at: n2) isSubclassOf: (Smalltalk at: n1))]) asOrderedCollection.
 
-    self selectionOfLibraryClasses value: selectionOfLibraryClasses
+    self selectionOfLibraryClasses value: selectionOfLibraryClasses.
+
+    self selectionOfCategory changed
 !
 
 classSelected: anIndexCollection
@@ -499,11 +568,12 @@
     "builds the library by doing following tasks:
         0. Clobber the target directory of the application
         1. File out the source code of all library classes
-        2. Generate the file Make.Proto
-        3. Generate the file Makefile
-        4. Make the library
+        2. Link the source code of all library classes into the source directory
+        3. Generate the file Make.Proto
+        4. Generate the file Makefile
+        5. Make the library
     "
-    |dir compilerPath compilerFlags block0 block1 block2 block3 block4 priority|
+    |dir compilerPath compilerFlags block0 block1 block2 block3 block4 block5 priority|
 
     task notNil ifTrue: [self warn: 'There is already a build running!!'].
 
@@ -520,9 +590,10 @@
 
     block0 := self getBlockForClobberingTargetDirectory: dir.
     block1 := self getBlockForFilingOutAllClassesIn: dir.
-    block2 := self getBlockForGeneratingMakeProtoFileIn: dir.
-    block3 := self getBlockForGeneratingMakefileFileIn: dir.
-    block4 := self getBlockForMakingTheLibraryIn: dir.
+    block2 := self getBlockForLinkingSourceOfAllClassesIn: dir.
+    block3 := self getBlockForGeneratingMakeProtoFileIn: dir.
+    block4 := self getBlockForGeneratingMakefileFileIn: dir.
+    block5 := self getBlockForMakingTheLibraryIn: dir.
 
     priority := Processor userBackgroundPriority.
     task := block0 forkAt: priority.
@@ -548,12 +619,19 @@
                                     task := block4 forkAt: priority.
                                     task addExitAction: 
                                     [
-                                        task isNil 
-                                            ifTrue: [self inform: 'Library build.' asBoldText]
-                                            ifFalse: [self informTargetBuildingFailured].
-                                        task := nil.
-                                        Display beep.
-                                    ]   
+                                        task isNil ifTrue: 
+                                        [
+                                            task := block5 forkAt: priority.
+                                            task addExitAction: 
+                                            [
+                                                task isNil 
+                                                    ifTrue: [self inform: 'Library build.' asBoldText]
+                                                    ifFalse: [self informTargetBuildingFailured].
+                                                task := nil.
+                                                Display beep.
+                                            ]   
+                                        ] ifFalse: [self informTargetBuildingFailured]
+                                    ]
                                 ] ifFalse: [self informTargetBuildingFailured]
                             ]
                         ] ifFalse: [self informTargetBuildingFailured]
@@ -571,6 +649,81 @@
 
 !
 
+doFileOutClass
+    "files out the source code of the selected classes"
+
+    |dir|
+    (dir := self getTargetDirectory) isNil 
+        ifTrue: [^self warn: 'Could not create library directory!!'].
+
+    self selectionOfLibraryClasses value do:
+    [:clsName |
+        (Smalltalk at: clsName) fileOutIn: dir
+    ]
+
+!
+
+doLoad
+    "opens a dialog for loading a library specification"
+
+    |selectedFile fileStream fileAspects|
+
+    (selectedFile := FileSelectionBrowser
+        request: 'Load Library Specification' 
+        fileName: ((aspects at: #targetDirectory) value asFilename construct: (aspects at: #libraryName) value,'.def') name
+        withFileFilters: #('*.def')) notNil 
+    ifTrue:
+    [
+        (fileStream := selectedFile asFilename readStream) notNil
+        ifTrue:
+        [   
+            fileAspects := Compiler evaluate: fileStream contents asString.
+            fileAspects associationsDo: 
+            [:aspect|
+                (aspects at: aspect key) value: aspect value
+            ].
+            shellView directory: (aspects at: #targetDirectory) value.
+            fileStream close    
+        ]
+    ]
+
+
+!
+
+doSaveAs
+    "opens a dialog for saving the the library specification"
+
+    |selectedFile fileStream longestStringSize|
+
+    (selectedFile := FileSelectionBrowser
+        request: 'Save Library Specification' 
+        fileName: ((aspects at: #targetDirectory) value asFilename construct: (aspects at: #libraryName) value,'.def') name
+        withFileFilters: #('*.def')) notNil 
+    ifTrue:
+    [
+        (fileStream := selectedFile asFilename writeStream) notNil
+        ifTrue:
+        [   
+            longestStringSize := aspects keys first size.
+            aspects keys do: [:key| key size > longestStringSize ifTrue: [longestStringSize := key size]].
+            fileStream nextPutAll: 'IdentityDictionary new'; cr.
+            aspects associationsDo: 
+            [:aspect| 
+                fileStream nextPutAll: 'at: #', aspect key.
+                (longestStringSize - aspect key size) timesRepeat: [fileStream space].
+                fileStream nextPutAll: ' put: '. 
+                aspect value value storeOn: fileStream.
+                fileStream nextPutAll: ';'. 
+                fileStream cr
+            ].
+            fileStream nextPutAll: 'yourself'.
+            fileStream close    
+        ]
+    ]
+
+
+!
+
 informTargetBuildingFailured
     "informs that something went wrong"
 
@@ -579,28 +732,32 @@
 !
 
 removeLibraryClasses
-    "removes classes from the list of the library classes"
+    "removes selected library classes from the list of the library classes"
 
     |libraryClasses|
 
+    self selectionOfLibraryClasses value size == 0 ifTrue: [^self warn: 'No library class selected!!'].
+
     libraryClasses := aspects at: #libraryClasses.
 
     self selectionOfLibraryClasses value do:
     [:clsName|
         libraryClasses value remove: clsName ifAbsent: nil
     ].
-    libraryClasses changed.
-
+    self selectionOfCategory changed.
+    libraryClasses changed
 
 ! !
 
 !LibraryBuilder methodsFor:'aspects'!
 
-listOfClasses
+listOfCategories
+    "returns the list of categories as value holder"
 
     |holder|
-    (holder := builder bindingAt:#listOfClasses) isNil ifTrue:[
-        builder aspectAt:#listOfClasses put: (holder := TreeItem new)
+    (holder := builder bindingAt:#listOfCategories) isNil ifTrue:[
+        builder aspectAt:#listOfCategories put: (holder :=  List withAll:
+        ((Object withAllSubclasses reject: [:cls|cls isPrivate]) collect: [:cls| cls category]) asSet asSortedCollection)
     ].
     ^ holder
 
@@ -608,7 +765,37 @@
 
 !
 
+listOfClasses
+    "returns the list of classes belonging to the selected category as value holder"
+
+    |holder|
+    (holder := builder bindingAt:#listOfClasses) isNil ifTrue:[
+        builder aspectAt:#listOfClasses put: (holder := List new)
+    ].
+    ^ holder
+
+
+
+!
+
+selectionOfCategory
+    "returns the selected category as value holder"
+
+    |holder|
+    (holder := builder bindingAt:#selectionOfCategory) isNil ifTrue:[
+        builder aspectAt:#selectionOfCategory put:(holder :=  ValueHolder new).
+        holder onChangeSend: #value to: 
+        [self listOfClasses contents: 
+                ((Object withAllSubclasses select: [:cls| cls category = holder value and: [cls isPrivate not]]) collect: [:cls| cls name]).
+        self selectionOfLibraryClasses value: ((aspects at: #libraryClasses) value  select: [:clsName| self listOfClasses includes: clsName ]).
+        self selectionOfClasses        value: (self listOfClasses select: [:clsName| self selectionOfLibraryClasses value includes: clsName ])].
+    ].
+    ^ holder
+
+!
+
 selectionOfClasses
+    "returns the selected classes as value holder"
 
     |holder|
     (holder := builder bindingAt:#selectionOfClasses) isNil ifTrue:[
@@ -619,49 +806,14 @@
 !
 
 selectionOfLibraryClasses
+    "returns the selected library classes as value holder"
 
     |holder|
     (holder := builder bindingAt:#selectionOfLibraryClasses) isNil ifTrue:[
-        builder aspectAt:#selectionOfLibraryClasses put:(holder := ValueHolder new).
+        builder aspectAt:#selectionOfLibraryClasses put:(holder := Array new asValue).
     ].
     ^ holder
 
-!
-
-treeViewChildren
-
-    ^[:aTreeItem|
-        |classes|
-        classes := OrderedCollection new.    
-        classes addAll: ((aTreeItem contents subclasses reject: [:cls| cls isPrivate]) asSortedCollection: [:i1 :i2| i1 name < i2 name]).
-        classes
-     ]
-!
-
-treeViewContents
-
-    ^ResourceSelectionBrowser treeViewContents
-!
-
-treeViewIcon
-
-    ^ResourceSelectionBrowser treeViewIcon
-!
-
-treeViewLabel
-
-    ^ResourceSelectionBrowser treeViewLabel
-!
-
-valueOfClassName
-
-    |holder|
-    (holder := builder bindingAt:#valueOfClassName) isNil ifTrue:[
-        builder aspectAt:#valueOfClassName put:(holder :=  '' asValue).
-    ].
-    ^ holder
-
-
 ! !
 
 !LibraryBuilder methodsFor:'building blocks'!
@@ -682,7 +834,7 @@
             libraryClasses do:
             [:cls |
                 cls isLoaded ifFalse: [cls autoload].     
-                cls fileOutIn: dir
+                cls fileOutIn: dir.
             ].
             task := nil
         ]
@@ -697,15 +849,10 @@
     [
         |makeProtoFile makeProtoFileStream conf libraryClasses|
 
-        (makeProtoFile := dir asFilename construct:'Make.proto') exists
-        ifTrue:
-        [
-            makeProtoFile renameTo:(dir asFilename construct:'Make.proto.bak')
-        ].
         (makeProtoFileStream := makeProtoFile writeStream) isNil
         ifTrue:
         [
-            self warn:'Cannot create Make.proto'.
+            self warn: 'Cannot create Make.proto'
         ]
         ifFalse:
         [
@@ -715,7 +862,7 @@
                 nextPutAll:'#Make.proto automatically generated by the Library Builder of ST/X.'; cr; cr;
                 nextPutAll:'TOP=', (aspects at: #topDirectory) value; cr;
                 nextPutAll:'LIBNAME=', (aspects at: #libraryName) value ; cr;
-                nextPutAll:'PACKAGE=private-classes-(private:$LIBNAME)' ; cr;
+                nextPutAll:'PACKAGE=tz:$(LIBNAME)' ; cr;
                 nextPutAll:'STCLOCALOPTIMIZATIONS=', 
                     ((aspects at: #optspace ) value ifTrue: [' +optspace' ] ifFalse: ['']),
                     ((aspects at: #optspace2) value ifTrue: [' +optspace2'] ifFalse: ['']),
@@ -723,10 +870,10 @@
                     ((aspects at: #optinline) value ifTrue: [' +optinline'] ifFalse: ['']),
                     ((aspects at: #inlineNew) value ifTrue: [' +inlineNew'] ifFalse: ['']); cr;
 
-                nextPutAll:'STCLOCALOPT=$(STCLOCALOPTIMIZATIONS) -H. ''-P$(PACKAGE)'' -Z$(LIBNAME) $(COMMONSYMFLAG) $(INITCODESEPFLAG)'; cr;
+                nextPutAll:'STCLOCALOPT=$(STCLOCALOPTIMIZATIONS) -H. -package=$(PACKAGE) -Z$(LIBNAME) $(COMMONSYMFLAG) $(INITCODESEPFLAG)'; cr;
                 nextPutAll:'RCSSOURCES=*.st Make.proto' ; cr;
                 nextPutAll:'all::           classLibRule' ; cr;
-                nextPutAll:'LOCAL_EXTRA_TARGTES=', ((aspects at: #systemLibraries) value asStringCollection asStringWith: $ ); cr.
+                nextPutAll:'LINK_ADDITIONAL_OBJS=', ((aspects at: #systemLibraries) value asStringCollection asStringWith: $ ); cr.
 
             makeProtoFileStream nextPutAll:'OBJS= \'; cr.
 
@@ -803,6 +950,27 @@
 
 !
 
+getBlockForLinkingSourceOfAllClassesIn: dir
+    "returns the block for linking source of all Smalltalk-source files into the target directory"
+
+    ^
+    [
+        self getLibraryClasses do:
+        [:cls |
+            (aspects at: #linkSources) value 
+            ifTrue: 
+            [                       
+                self executeCommand: 
+                'ln -s ', 
+                ((aspects at: #targetDirectory) value asFilename construct: cls name, '.st') name, ' ', 
+                 (aspects at: #sourceDirectory) value inDirectory: dir.
+            ]
+        ].
+        task := nil
+    ]
+
+!
+
 getBlockForMakingTheLibraryIn: dir
     "returns the block for making the library"
 
@@ -819,7 +987,7 @@
 !LibraryBuilder methodsFor:'initialization'!
 
 initialize
-    "initialize all aspects"
+    "initializes all aspects"
 
     |homeDir|
 
@@ -832,6 +1000,7 @@
     self getLibraryClasses. "do check classes"
     self aspectsAt: #libraryDefines  putFirst: '-L/usr/X11/lib -Llib -Lbinary -L. -L/usr/local/lib -L/usr/lib -L/lib -lm -ldl -lXext -lX11'.
     self aspectsAt: #targetDirectory putFirst: (homeDir construct: 'stx/libnew') name.
+    self aspectsAt: #sourceDirectory putFirst: (homeDir construct: 'stx') name.
 
     self aspectsAt: #standardHeaderPath                   putFirst: '/rules/stdHeader'.
     self aspectsAt: #commonDefinesPath                    putFirst: '/configurations/COMMON/defines'.
@@ -841,11 +1010,13 @@
     self aspectsAt: #standardHeader2Path                  putFirst: '/rules/stdHeader2'.
     self aspectsAt: #standardRulesPath                    putFirst: '/rules/stdRules'.
 
-    self aspectsAt: #optspace  putFirst: false.
-    self aspectsAt: #optspace2 putFirst: false.
-    self aspectsAt: #optspace3 putFirst: false.
-    self aspectsAt: #optinline putFirst: false.
-    self aspectsAt: #inlineNew putFirst: false.
+    self aspectsAt: #optspace    putFirst: false.
+    self aspectsAt: #optspace2   putFirst: false.
+    self aspectsAt: #optspace3   putFirst: false.
+    self aspectsAt: #optinline   putFirst: false.
+    self aspectsAt: #inlineNew   putFirst: false.
+
+    self aspectsAt: #linkSources putFirst: true.
 
 ! !
 
@@ -863,61 +1034,11 @@
             ifFalse:[(aspects at: #libraryClasses) value remove: clsName]
     ].
     (aspects at: #libraryClasses) changed.
-    ^libraryClasses
-! !
-
-!LibraryBuilder methodsFor:'startup / release'!
-
-postBuildWith:aBuilder
-    "defines an class name completion block for searching classes"
-
-    |classSelection|
-    allClasses := Object withAllSubclasses.
-    classSelection :=  #Object.
-    classSelectionBlock := 
-    [:clsPattern|                                  
-        |foundClass classes|         
-        ((foundClass := Smalltalk at: clsPattern printString asSymbol) isClass not or:
-        [foundClass name ~= clsPattern])
-        ifTrue:
-        [
-            classes := allClasses select: [:cls| cls name size >= clsPattern size].
-            1 to: clsPattern size do: 
-            [:i|    
-                 classes := classes select: [:cls| (cls name at: i) == (clsPattern at: i)].
-            ].    
-            foundClass := classes at: 1 ifAbsent: [nil] 
-        ].
-        foundClass notNil
-        ifTrue:
-        [
-            self listOfClassesView 
-                selectFromListOfNames: (foundClass 
-                    withAllSuperclasses reverse collect: [:cls| cls name asString]);
-                selectedNodeExpand: true
-        ].
-        self valueOfClassName value: clsPattern
-    ].
-    self valueOfClassName value: classSelection.  
-    self classNameInputField entryCompletionBlock:
-    [:value|
-        |what|
-        what := Smalltalk classnameCompletion: value withoutSpaces.
-        self classNameInputField contents:what first.
-        (what at:2) size ~~ 1 ifTrue:[Display beep].
-        classSelectionBlock value: self classNameInputField contents
-    ].
-    self listOfClassesView validateDoubleClickBlock: [:aTreeItem | aTreeItem contents ~~ self treeViewContents].
-    self listOfClassesView selectedNodeExpand: true.
-
-    ^super postBuildWith:aBuilder
-
-
-
+    ^libraryClasses reverse
 ! !
 
 !LibraryBuilder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/LibraryBuilder.st,v 1.2 1998-04-16 22:07:16 tz Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/LibraryBuilder.st,v 1.3 1998-04-18 14:17:45 tz Exp $'
 ! !