--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LibraryBuilder.st Thu Apr 02 21:03:08 1998 +0200
@@ -0,0 +1,925 @@
+ApplicationBuilder subclass:#LibraryBuilder
+ instanceVariableNames:'allClasses classSelectionBlock'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Interface-Smalltalk'
+!
+
+!LibraryBuilder class methodsFor:'documentation'!
+
+documentation
+"
+ The Library Builder of ST/X allows you to build ST/X-libraries by following steps:
+
+ 0. Clobber the target directory of the library
+ 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
+
+
+ [start with:]
+ LibraryBuilder open
+
+ [see also:]
+ ApplicationBuilder
+
+ [author:]
+ Thomas Zwick, eXept Software AG
+"
+! !
+
+!LibraryBuilder class methodsFor:'help specs'!
+
+helpSpec
+ "This resource specification was automatically generated
+ by the UIHelpTool of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIHelpTool may not be able to read the specification."
+
+ "
+ UIHelpTool openOnClass:LibraryBuilder
+ "
+
+ <resource: #help>
+
+ ^super helpSpec addPairsFrom:#(
+
+#addRemoveClasses
+'Removes or adds classes to the library classes.'
+
+#findClass
+'Find the class with the first known letters.'
+
+#inlineNew
+'Additionally inline new.'
+
+#libraryClasses
+'Classes of the library.'
+
+#libraryName
+'Name of the library.'
+
+#optinline
+'Generate optimized inline code.'
+
+#optspace
+'Optimize for space.'
+
+#optspace2
+'Optimize more for space.'
+
+#optspace3
+'Optimize even more for space.'
+
+#stxClasses
+'Classes of the ST/X.'
+
+)
+! !
+
+!LibraryBuilder class methodsFor:'interface specs'!
+
+windowSpec
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
+
+ "
+ UIPainter new openOnClass:LibraryBuilder andSelector:#windowSpec
+ LibraryBuilder new openInterface:#windowSpec
+ LibraryBuilder open
+ "
+
+ <resource: #canvas>
+
+ ^
+
+ #(#FullSpec
+ #window:
+ #(#WindowSpec
+ #name: 'Library Builder'
+ #layout: #(#LayoutFrame 428 0 301 0 927 0 760 0)
+ #label: 'Library Builder'
+ #min: #(#Point 420 220)
+ #max: #(#Point 1152 900)
+ #bounds: #(#Rectangle 428 301 928 761)
+ #menu: #menu
+ #usePreferredExtent: false
+ )
+ #component:
+ #(#SpecCollection
+ #collection:
+ #(
+ #(#ViewSpec
+ #name: 'Box1'
+ #layout: #(#LayoutFrame 0 0.0 3 0 0 1.0 292 0)
+ #component:
+ #(#SpecCollection
+ #collection:
+ #(
+ #(#ViewSpec
+ #name: 'Box2'
+ #layout: #(#LayoutFrame 0 0.0 0 0.0 -148 1.0 2 1.0)
+ #component:
+ #(#SpecCollection
+ #collection:
+ #(
+ #(#LabelSpec
+ #name: 'libraryNameLabel'
+ #layout: #(#AlignmentOrigin 147 0 15 0 1 0.5)
+ #label: 'Library Name:'
+ #adjust: #right
+ )
+ #(#InputFieldSpec
+ #name: 'libraryNameField'
+ #layout: #(#LayoutFrame 150 0 4 0 0 1 26 0)
+ #activeHelpKey: #libraryName
+ #model: #libraryName
+ )
+ #(#DividerSpec
+ #name: 'Separator2'
+ #layout: #(#LayoutFrame 0 0 28 0 0 1 31 0)
+ )
+ #(#LabelSpec
+ #name: 'libraryClassesLabel'
+ #layout: #(#AlignmentOrigin 147 0 42 0 1 0.5)
+ #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)
+ #activeHelpKey: #libraryClasses
+ #model: #selectionOfLibraryClasses
+ #hasHorizontalScrollBar: true
+ #hasVerticalScrollBar: true
+ #miniScrollerVertical: true
+ #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)
+ #activeHelpKey: #addRemoveClasses
+ #orientation: #horizontal
+ #upAction: #removeLibraryClasses
+ #downAction: #addLibraryClasses
+ #upArgument: ''
+ )
+ #(#DividerSpec
+ #name: 'Separator3'
+ #layout: #(#LayoutFrame 0 0 196 0 0 1 199 0)
+ )
+ #(#ActionButtonSpec
+ #name: 'targetDirectoryButton'
+ #layout: #(#LayoutFrame 4 0 204 0 147 0 228 0)
+ #label: 'Target Directory:'
+ #model: #doSelectDirectory:
+ #actionValue: 'Target'
+ )
+ #(#InputFieldSpec
+ #name: 'targetDirectoryField'
+ #layout: #(#LayoutFrame 150 0 205 0 0 1.0 227 0)
+ #activeHelpKey: #targetDirectory
+ #model: #targetDirectory
+ )
+ #(#ActionButtonSpec
+ #name: 'topDirectoryButton'
+ #layout: #(#LayoutFrame 4 0 228 0 147 0 252 0)
+ #label: 'Top Directory:'
+ #model: #doSelectDirectory:
+ #actionValue: 'Top'
+ )
+ #(#InputFieldSpec
+ #name: 'topDirectoryField'
+ #layout: #(#LayoutFrame 150 0 229 0 0 1.0 251 0)
+ #activeHelpKey: #topDirectory
+ #model: #topDirectory
+ )
+ #(#DividerSpec
+ #name: 'Separator4'
+ #layout: #(#LayoutFrame 0 0.0 256 0 0 1.0 259 0)
+ )
+ #(#ActionButtonSpec
+ #name: 'systemLibrariesButton'
+ #layout: #(#LayoutFrame 4 0 263 0 147 0 287 0)
+ #label: 'System Libraries:'
+ #model: #doSelectLibrary:
+ #actionValue: 'SystemLibrary'
+ )
+ #(#ComboBoxSpec
+ #name: 'systemLibrariesComboBox'
+ #layout: #(#LayoutFrame 150 0 264 0 0 1 286 0)
+ #activeHelpKey: #systemLibaries
+ #model: #systemLibrary
+ #immediateAccept: false
+ #acceptOnTab: false
+ #comboList: #systemLibraries
+ )
+ )
+ )
+ )
+ #(#DividerSpec
+ #name: 'Separator5'
+ #layout: #(#LayoutFrame -144 1 0 0.0 -138 1 0 1.0)
+ #orientation: #vertical
+ )
+ #(#ViewSpec
+ #name: 'Box3'
+ #layout: #(#LayoutFrame -134 1 0 0.0 0 1.0 0 1.0)
+ #component:
+ #(#SpecCollection
+ #collection:
+ #(
+ #(#FramedBoxSpec
+ #name: 'FramedBox'
+ #layout: #(#LayoutFrame -4 0.0 4 0.0 0 1.0 -126 1.0)
+ #component:
+ #(#SpecCollection
+ #collection:
+ #(
+ #(#CheckBoxSpec
+ #name: 'spaceCheckBox'
+ #layout: #(#LayoutFrame 12 0 24 0 12 1 46 0)
+ #activeHelpKey: #optspace
+ #model: #optspace
+ #label: 'Space'
+ )
+ #(#CheckBoxSpec
+ #name: 'space2CheckBox'
+ #layout: #(#LayoutFrame 12 0 48 0 12 1 70 0)
+ #activeHelpKey: #optspace2
+ #model: #optspace2
+ #label: 'Space2'
+ )
+ #(#CheckBoxSpec
+ #name: 'space3CheckBox'
+ #layout: #(#LayoutFrame 12 0 72 0 12 1 94 0)
+ #activeHelpKey: #optspace3
+ #model: #optspace3
+ #label: 'Space3'
+ )
+ #(#CheckBoxSpec
+ #name: 'inlineCheckBox'
+ #layout: #(#LayoutFrame 12 0 96 0 12 1 118 0)
+ #activeHelpKey: #optinline
+ #model: #optinline
+ #label: 'Inline'
+ )
+ #(#CheckBoxSpec
+ #name: 'inlineNewCheckBox'
+ #layout: #(#LayoutFrame 12 0 120 0 12 1 142 0)
+ #activeHelpKey: #inlineNew
+ #model: #inlineNew
+ #label: 'Inline New'
+ )
+ )
+ )
+ #label: 'Optimizations'
+ #labelPosition: #topLeft
+ )
+ #(#VerticalPanelViewSpec
+ #name: 'VerticalPanel'
+ #layout: #(#LayoutFrame 0 0.0 -68 1 -6 1.0 -2 1.0)
+ #component:
+ #(#SpecCollection
+ #collection:
+ #(
+ #(#ActionButtonSpec
+ #name: 'buildButton'
+ #activeHelpKey: #build
+ #label: 'Build'
+ #model: #doBuild
+ #extent: #(#Point 128 32)
+ )
+ #(#ActionButtonSpec
+ #name: 'stopButton'
+ #activeHelpKey: #stop
+ #label: 'Stop'
+ #model: #doStop
+ #extent: #(#Point 128 31)
+ )
+ )
+ )
+ #horizontalLayout: #fit
+ #verticalLayout: #fit
+ #horizontalSpace: 3
+ #verticalSpace: 3
+ )
+ )
+ )
+ )
+ )
+ )
+ #borderWidth: 1
+ )
+ #(#SubCanvasSpec
+ #name: 'shellViewSubCanvas'
+ #layout: #(#LayoutFrame 0 0.0 294 0 0 1.0 -26 1)
+ #hasHorizontalScrollBar: false
+ #hasVerticalScrollBar: false
+ #clientHolder: #shellView
+ )
+ #(#UISubSpecification
+ #name: 'windowSpecForInfoBar'
+ #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
+ #majorKey: #ToolApplicationModel
+ #minorKey: #windowSpecForInfoBar
+ )
+ )
+ )
+ )
+! !
+
+!LibraryBuilder class methodsFor:'menu specs'!
+
+menu
+ "This resource specification was automatically generated
+ by the MenuEditor of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the MenuEditor may not be able to read the specification."
+
+ "
+ MenuEditor new openOnClass:LibraryBuilder andSelector:#menu
+ (Menu new fromLiteralArrayEncoding:(LibraryBuilder menu)) startUp
+ "
+
+ <resource: #menu>
+
+ ^
+
+ #(#Menu
+
+ #(
+ #(#MenuItem
+ #label: 'File'
+ #submenu:
+ #(#Menu
+
+ #(
+ #(#MenuItem
+ #label: 'Build'
+ #value: #doBuild
+ #activeHelpKey: #build
+ )
+ #(#MenuItem
+ #label: 'Stop'
+ #value: #doStop
+ #activeHelpKey: #stop
+ )
+ #(#MenuItem
+ #label: '-'
+ )
+ #(#MenuItem
+ #label: 'Exit'
+ #value: #closeRequest
+ #activeHelpKey: #fileExit
+ )
+ ) nil
+ nil
+ )
+ )
+ #(#MenuItem
+ #label: 'Settings'
+ #submenu:
+ #(#Menu
+
+ #(
+ #(#MenuItem
+ #label: 'Target Directory...'
+ #value: #doSelectDirectory:
+ #activeHelpKey: #targetDirectory
+ #argument: 'Target'
+ )
+ #(#MenuItem
+ #label: 'Top Directory...'
+ #value: #doSelectDirectory:
+ #activeHelpKey: #topDirectory
+ #argument: 'Top'
+ )
+ #(#MenuItem
+ #label: '-'
+ )
+ #(#MenuItem
+ #label: 'System Libraries...'
+ #value: #doSelectLibrary:
+ #activeHelpKey: #systemLibaries
+ #argument: 'SystemLibrary'
+ )
+ #(#MenuItem
+ #label: '-'
+ )
+ #(#MenuItem
+ #label: 'Fonts'
+ #submenuChannel: #menuFont
+ )
+ ) nil
+ nil
+ )
+ )
+ #(#MenuItem
+ #label: 'Help'
+ #startGroup: #right
+ #submenuChannel: #menuHelp
+ )
+ ) nil
+ nil
+ )
+! !
+
+!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"
+
+ |libraryClasses selectionOfLibraryClasses|
+
+ libraryClasses := (aspects at: #libraryClasses) value.
+
+ (aspects at: #libraryClasses) value:
+ ((libraryClasses,
+ (selectionOfLibraryClasses := self selectionOfClasses value collect: [:treeItem| treeItem name])) asSet asSortedCollection asArray
+ topologicalSort:[:n1 :n2 | ((Smalltalk at: n2) isSubclassOf: (Smalltalk at: n1))]) asOrderedCollection.
+
+ self selectionOfLibraryClasses value: selectionOfLibraryClasses
+!
+
+classSelected: anIndexCollection
+ "updates the field of the class name after a selection in the class tree view"
+
+ |clsName|
+ clsName := ((self listOfClassesView scrolledView list at: anIndexCollection first) upTo: $ ) asSymbol.
+ self valueOfClassName value: clsName.
+
+
+!
+
+doBuild
+ "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
+ "
+ |dir compilerPath compilerFlags block0 block1 block2 block3 block4 priority|
+
+ task notNil ifTrue: [self warn: 'There is already a build running!!'].
+
+ self inform: 'Starting building of library...' asBoldText.
+
+ (dir := self getTargetDirectory) isNil
+ ifTrue: [^self warn: 'Could not create library directory!!'].
+
+ shellView directory: dir.
+
+ (compilerPath := ByteCodeCompiler ccPath, ' ') isNil
+ ifTrue: [^self warn:'Define first a system compiler!!'].
+ compilerFlags := self getCompilerFlags.
+
+ block0 := self getBlockForClobberingTargetDirectory: dir.
+ block1 := self getBlockForFilingOutAllClassesIn: dir.
+ block2 := self getBlockForGeneratingMakeProtoFileIn: dir.
+ block3 := self getBlockForGeneratingMakefileFileIn: dir.
+ block4 := self getBlockForMakingTheLibraryIn: dir.
+
+ priority := Processor userBackgroundPriority.
+ task := block0 forkAt: priority.
+ task addExitAction:
+ [
+ task isNil ifTrue:
+ [
+ task := block1 forkAt: priority.
+ task addExitAction:
+ [
+ task isNil ifTrue:
+ [
+ task := block2 forkAt: priority.
+ task addExitAction:
+ [
+ task isNil ifTrue:
+ [
+ task := block3 forkAt: priority.
+ task addExitAction:
+ [
+ task isNil ifTrue:
+ [
+ task := block4 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]
+ ]
+ ] ifFalse: [self informTargetBuildingFailured]
+ ].
+
+
+
+
+
+
+
+!
+
+informTargetBuildingFailured
+ "informs that something went wrong"
+
+ self inform: 'Library building failured.' asBoldText.
+ task := nil
+!
+
+removeLibraryClasses
+ "removes classes from the list of the library classes"
+
+ |libraryClasses|
+
+ libraryClasses := aspects at: #libraryClasses.
+
+ self selectionOfLibraryClasses value do:
+ [:clsName|
+ libraryClasses value remove: clsName ifAbsent: nil
+ ].
+ libraryClasses changed.
+
+
+! !
+
+!LibraryBuilder methodsFor:'aspects'!
+
+listOfClasses
+
+ |holder|
+ (holder := builder bindingAt:#listOfClasses) isNil ifTrue:[
+ builder aspectAt:#listOfClasses put: (holder := TreeItem new)
+ ].
+ ^ holder
+
+
+
+!
+
+selectionOfClasses
+
+ |holder|
+ (holder := builder bindingAt:#selectionOfClasses) isNil ifTrue:[
+ builder aspectAt:#selectionOfClasses put:(holder := ValueHolder new).
+ ].
+ ^ holder
+
+!
+
+selectionOfLibraryClasses
+
+ |holder|
+ (holder := builder bindingAt:#selectionOfLibraryClasses) isNil ifTrue:[
+ builder aspectAt:#selectionOfLibraryClasses put:(holder := ValueHolder new).
+ ].
+ ^ 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'!
+
+getBlockForFilingOutAllClassesIn: dir
+ "returns the block for filing out all Smalltalk-source files into the target directory"
+
+ ^
+ [
+ |libraryClasses|
+ (libraryClasses := self getLibraryClasses) isEmpty
+ ifTrue:
+ [
+ self warn:'No class libraries defined!!'
+ ]
+ ifFalse:
+ [
+ libraryClasses do:
+ [:cls |
+ cls isLoaded ifFalse: [cls autoload].
+ cls fileOutIn: dir
+ ].
+ task := nil
+ ]
+ ]
+
+!
+
+getBlockForGeneratingMakeProtoFileIn: dir
+ "returns the block for generating the file Make.proto"
+
+ ^
+ [
+ |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'.
+ ]
+ ifFalse:
+ [
+ libraryClasses := self getLibraryClasses collect: [:cls|Smalltalk fileNameForClass:cls name].
+
+ makeProtoFileStream
+ 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:'STCLOCALOPTIMIZATIONS=',
+ ((aspects at: #optspace ) value ifTrue: [' +optspace' ] ifFalse: ['']),
+ ((aspects at: #optspace2) value ifTrue: [' +optspace2'] ifFalse: ['']),
+ ((aspects at: #optspace3) value ifTrue: [' +optspace3'] ifFalse: ['']),
+ ((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:'RCSSOURCES=*.st Make.proto' ; cr;
+ nextPutAll:'all:: classLibRule' ; cr;
+ nextPutAll:'LOCAL_EXTRA_TARGTES=', ((aspects at: #systemLibraries) value asStringCollection asStringWith: $ ); cr.
+
+ makeProtoFileStream nextPutAll:'OBJS= \'; cr.
+
+ libraryClasses do:
+ [:clsFileName|
+ makeProtoFileStream tab; nextPutAll: clsFileName; nextPutAll:'.$(O)'; tab.
+ libraryClasses last ~~ clsFileName ifTrue: [makeProtoFileStream nextPutAll: '\'; cr]
+ ].
+
+ makeProtoFileStream cr; cr; nextPutAll:'# BEGINMAKEDEPEND --- do not remove this line; make depend needs it'.
+ libraryClasses do:
+ [:clsFileName|
+ makeProtoFileStream cr; nextPutAll: clsFileName; nextPutAll:'.$(O): '; nextPutAll: clsFileName; nextPutAll:'.st $(STCHDR)'.
+ ].
+ makeProtoFileStream cr; nextPutAll:'# ENDMAKEDEPEND --- do not remove this line'.
+
+ makeProtoFileStream close.
+
+ task := nil
+ ]
+ ]
+
+!
+
+getBlockForGeneratingMakefileFileIn: dir
+ "returns the block for generating the file Makefile"
+
+ ^
+ [
+ |makeFile makeFileStream makeProtoFile catOn|
+
+ (makeFile := dir asFilename construct:'Makefile') exists
+ ifTrue:
+ [
+ makeFile renameTo: (dir asFilename construct:'Makefile.bak')
+ ].
+ (makeFileStream := makeFile writeStream) isNil
+ ifTrue:
+ [
+ self warn:'Cannot create Makefile'.
+ ]
+ ifFalse:
+ [
+ catOn :=
+ [:aFileName|
+ |systemFileStream|
+ systemFileStream := Smalltalk systemFileStreamFor: ((aspects at: #topDirectory) value asFilename construct: aFileName) name.
+ makeFileStream nextPutAll: systemFileStream contents asString.
+ systemFileStream close
+ ].
+
+ catOn value: (aspects at: #standardHeaderPath) value.
+ catOn value: (aspects at: #commonDefinesPath) value.
+ catOn value: (aspects at: #vendorCommonDefinesPath) value.
+ catOn value: (aspects at: #vendorCommonConfigurationDefinesPath) value.
+ catOn value: (aspects at: #packagePath) value.
+ catOn value: (aspects at: #standardHeader2Path) value.
+
+ (makeProtoFile := self getTargetDirectory asFilename construct:'Make.proto') exists
+ ifTrue:
+ [
+ makeFileStream nextPutAll:makeProtoFile readStream contents asString.
+ ].
+
+ makeFileStream cr; cr; nextPutAll: 'CONF=', (aspects at: #configuration) value.
+ catOn value: (aspects at: #standardRulesPath) value.
+
+ makeFileStream close.
+
+ task := nil
+ ]
+ ]
+
+
+!
+
+getBlockForMakingTheLibraryIn: dir
+ "returns the block for making the library"
+
+ ^
+ [
+ self inform: 'Making the library...'.
+ self executeCommand: 'make' inDirectory: dir.
+ task := nil
+ ]
+
+
+! !
+
+!LibraryBuilder methodsFor:'initialization'!
+
+initialize
+ "initialize all aspects"
+
+ |homeDir|
+
+ super initialize.
+
+ homeDir := Filename homeDirectory asFilename.
+
+ self aspectsAt: #libraryName putFirst: 'libnew'.
+ self aspectsAt: #libraryClasses putFirst: OrderedCollection new.
+ 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: #standardHeaderPath putFirst: '/rules/stdHeader'.
+ self aspectsAt: #commonDefinesPath putFirst: '/configurations/COMMON/defines'.
+ self aspectsAt: #vendorCommonDefinesPath putFirst: '/configurations/vendorConf'.
+ self aspectsAt: #vendorCommonConfigurationDefinesPath putFirst: '/configurations/myConf'.
+ self aspectsAt: #packagePath putFirst: '/configurations/myPack'.
+ 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.
+
+! !
+
+!LibraryBuilder methodsFor:'queries'!
+
+getLibraryClasses
+ "returns the 'real' library classes"
+
+ |libraryClasses cls|
+ libraryClasses := OrderedCollection new.
+ (aspects at: #libraryClasses) value reverseDo:
+ [:clsName|
+ (cls := Smalltalk at: clsName) notNil
+ ifTrue: [libraryClasses add: cls]
+ 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
+
+
+
+! !
+
+!LibraryBuilder class methodsFor:'documentation'!
+
+version
+ ^ '$Header: /cvs/stx/stx/libtool/LibraryBuilder.st,v 1.1 1998-04-02 19:03:08 tz Exp $'
+! !