STXInstaller.st
changeset 1281 e83c14253471
parent 1279 b531a4cf201a
child 1282 7fa3b3c668f3
--- a/STXInstaller.st	Thu Dec 23 15:56:58 1999 +0100
+++ b/STXInstaller.st	Thu Dec 23 17:29:22 1999 +0100
@@ -37,9 +37,7 @@
         dirs add:'/usr/bin'.
 
         dirs add:(Filename homeDirectory constructString:'bin').
-        dirs add:((Filename homeDirectory 
-                                construct:'stx')
-                                constructString:'bin').
+        dirs add:((Filename homeDirectory construct:'stx') constructString:'bin').
         dirs add:'/tmp/stxbin'.
         ('/home' asFilename exists and:['/home' asFilename isDirectory]) ifTrue:[
             dirs add:'/home/stx/bin'.
@@ -65,9 +63,7 @@
 
     dirs := OrderedCollection new.
     dirs add:(Filename homeDirectory constructString:'stxDevelop').
-    dirs add:((Filename homeDirectory 
-                            construct:'stx')
-                            constructString:'develop').
+    dirs add:((Filename homeDirectory construct:'stx') constructString:'develop').
     ('/home' asFilename exists and:['/home' asFilename isDirectory]) ifTrue:[
         dirs add:'/home/stx/develop'.
     ].
@@ -133,12 +129,9 @@
         dirs add:'/usr/local/lib'.
         dirs add:'/usr/lib'.
         dirs add:'/lib'.
-        dirs add:(Filename homeDirectory 
-                                constructString:'lib').
+        dirs add:(Filename homeDirectory constructString:'lib').
 
-        dirs add:((Filename homeDirectory 
-                                construct:'stx')
-                                constructString:'lib').
+        dirs add:((Filename homeDirectory construct:'stx') constructString:'lib').
         dirs add:'/tmp/stxlib'.
         dirs add:'/home/stx/lib'.
         dirs add:'/home2/stx/lib'.
@@ -162,12 +155,8 @@
         dirs add:'/opt/smalltalk/' , stxRel , '/lib'.
         dirs add:'/usr/local/lib/smalltalk'.
         dirs add:'/usr/lib/smalltalk'.
-        dirs add:((Filename homeDirectory 
-                                construct:'lib')
-                                constructString:'smalltalk').
-        dirs add:((Filename homeDirectory 
-                                construct:'stx')
-                                constructString:'lib').
+        dirs add:((Filename homeDirectory construct:'lib') constructString:'smalltalk').
+        dirs add:((Filename homeDirectory construct:'stx') constructString:'lib').
         dirs add:'/tmp/stxlib'.
         dirs add:'/home/stx/lib'.
         dirs add:'/home2/stx/lib'.
@@ -193,17 +182,18 @@
     ] ifFalse:[
         dirsToMake add:stxBinDir.
         dirsToMake add:stxLibDir.
-        dirsToMake add:stxLibBinDir.
+        stxLibDir ~= stxLibBinDir ifTrue:[
+            dirsToMake add:stxLibBinDir.
+        ].
         dirsToMake add:stxDocDir.
         docOnlineDir := stxDocDir asFilename construct:'online'.
         dirsToMake add:docOnlineDir name.
         dirsToMake add:(docOnlineDir constructString:'english').
         dirsToMake add:(docOnlineDir constructString:'german').
-        dirsToMake add:(docOnlineDir constructString:'french').
-        dirsToMake add:(docOnlineDir constructString:'italian').
-        installGoodyFiles ifTrue:[
-            dirsToMake add:(stxLibDir asFilename constructString:'goodies').
-        ].
+        installDocFiles ifTrue:[
+            dirsToMake add:(docOnlineDir constructString:'french').
+            dirsToMake add:(docOnlineDir constructString:'italian').
+        ]
     ].
     ^ dirsToMake
 
@@ -245,101 +235,11 @@
                 ( 'COPYRIGHT'                           #lib     nil                  true  '644' )
                 ( 'doc/online/german/LICENCE.STX.html'  nil      'doc/online/german'      true  '644' )
                 ( 'doc/online/english/LICENCE.STX.html' nil      'doc/online/english'     true  '644' )
-
-                ( 'libbasic/abbrev.stc'                 #pkg     'stx/libbasic'      true  )
-                ( 'libbasic/bitmaps'                    #pkg     'stx/libbasic'      true  )
-                ( 'libbasic/resources'                  #pkg     'stx/libbasic'      true  )
-
-                ( 'libbasic2/abbrev.stc'                #pkg     'stx/libbasic2'     true  )
-                ( 'libbasic2/bitmaps'                   #pkg     'stx/libbasic2'     true  )
-                ( 'libbasic2/resources'                 #pkg     'stx/libbasic2'     true  )
-
-                ( 'libbasic3/abbrev.stc'                #pkg     'stx/libbasic3'     true  )
-                ( 'libbasic3/bitmaps'                   #pkg     'stx/libbasic3'     true  )
-                ( 'libbasic3/resources'                 #pkg     'stx/libbasic3'     true  )
-
-                ( 'libboss/abbrev.stc'                  #pkg     'stx/libboss'       true  )
-                ( 'libboss/bitmaps'                     #pkg     'stx/libboss'       true  )
-                ( 'libboss/resources'                   #pkg     'stx/libboss'       true  )
-
-                ( 'libcomp/abbrev.stc'                  #pkg     'stx/libcomp'       true  )
-                ( 'libcomp/bitmaps'                     #pkg     'stx/libcomp'       true  )
-                ( 'libcomp/resources'                   #pkg     'stx/libcomp'       true  )
-
-                ( 'libview/abbrev.stc'                  #pkg     'stx/libview'       true  )
-                ( 'libview/bitmaps'                     #pkg     'stx/libview'       true  )
-                ( 'libview/resources'                   #pkg     'stx/libview'       true  )
-
-                ( 'libview2/abbrev.stc'                 #pkg     'stx/libview2'      true  )
-                ( 'libview2/bitmaps'                    #pkg     'stx/libview2'      true  )
-                ( 'libview2/resources'                  #pkg     'stx/libview2'      true  )
-
-                ( 'libwidg/abbrev.stc'                  #pkg     'stx/libwidg'       true  )
-                ( 'libwidg/bitmaps'                     #pkg     'stx/libwidg'       true  )
-                ( 'libwidg/resources'                   #pkg     'stx/libwidg'       true  )
-
-                ( 'libwidg2/abbrev.stc'                 #pkg     'stx/libwidg2'      true  )
-                ( 'libwidg2/bitmaps'                    #pkg     'stx/libwidg2'      true  )
-                ( 'libwidg2/resources'                  #pkg     'stx/libwidg2'      true  )
-
-                ( 'libwidg3/abbrev.stc'                 #pkg     'stx/libwidg3'      true  )
-                ( 'libwidg3/bitmaps'                    #pkg     'stx/libwidg2'      true  )
-                ( 'libwidg3/resources'                  #pkg     'stx/libwidg2'      true  )
-
-                ( 'libtool/abbrev.stc'                  #pkg     'stx/libtool'       true  )
-                ( 'libtool/bitmaps'                     #pkg     'stx/libtool'       true  )
-                ( 'libtool/resources'                   #pkg     'stx/libtool'       true  )
-
-                ( 'libtool2/abbrev.stc'                 #pkg     'stx/libtool2'      true  )
-                ( 'libtool2/bitmaps'                    #pkg     'stx/libtool2'      true  )
-                ( 'libtool2/resources'                  #pkg     'stx/libtool2'      true  )
-
-                ( 'libui/abbrev.stc'                    #pkg     'stx/libui'         true  )
-                ( 'libui/bitmaps'                       #pkg     'stx/libui'         true  )
-                ( 'libui/resources'                     #pkg     'stx/libui'         true  )
-
-                ( 'libhtml/abbrev.stc'                  #pkg     'stx/libhtml'       true  )
-                ( 'libhtml/bitmaps'                     #pkg     'stx/libhtml'       true  )
-                ( 'libhtml/resources'                   #pkg     'stx/libhtml'       true  )
-
-                ( 'libodbc/abbrev.stc'                  #pkg     'stx/libodbc'       true  )
-                ( 'libodbc/bitmaps'                     #pkg     'stx/libodbc'       true  )
-                ( 'libodbc/resources'                   #pkg     'stx/libodbc'       true  )
-
-                ( 'libopengl/abbrev.stc'                #pkg     'stx/libopengl'     true  )
-                ( 'libopengl/bitmaps'                   #pkg     'stx/libopengl'     true  )
-                ( 'libopengl/resources'                 #pkg     'stx/libopengl'     true  )
-
-                ( 'libjava/abbrev.stc'                  #pkg     'stx/libjava'     true  )
-                ( 'libjava/bitmaps'                     #pkg     'stx/libjava'     true  )
-                ( 'libjava/resources'                   #pkg     'stx/libjava'     true  )
     ).
 
     installDocFiles ifTrue:[
         fileSpec := fileSpec , #(
-                ( 'doc'                                  #lib     nil        false '644' )
-        ).
-    ].
-
-    installSourceFiles ifTrue:[
-        fileSpec := fileSpec , #(
-                ( 'libbasic/*.st'               #pkg     'stx/libbasic/source'      false  )
-                ( 'libbasic2/*.st'              #pkg     'stx/libbasic2/source'     false  )
-                ( 'libbasic3/*.st'              #pkg     'stx/libbasic3/source'     false  )
-                ( 'libboss/*.st'                #pkg     'stx/libboss/source'       false  )
-                ( 'libcomp/*.st'                #pkg     'stx/libcomp/source'       false  )
-                ( 'libview/*.st'                #pkg     'stx/libview/source'       false  )
-                ( 'libview2/*.st'               #pkg     'stx/libview2/source'      false  )
-                ( 'libwidg/*.st'                #pkg     'stx/libwidg/source'       false  )
-                ( 'libwidg2/*.st'               #pkg     'stx/libwidg2/source'      false  )
-                ( 'libwidg3/*.st'               #pkg     'stx/libwidg3/source'      false  )
-                ( 'libtool/*.st'                #pkg     'stx/libtool/source'       false  )
-                ( 'libtool2/*.st'               #pkg     'stx/libtool2/source'      false  )
-                ( 'libui/*.st'                  #pkg     'stx/libui/source'         false  )
-                ( 'libhtml/*.st'                #pkg     'stx/libhtml/source'       false  )
-                ( 'libodbc/*.st'                #pkg     'stx/libodbc/source'       false  )
-                ( 'libopengl/*.st'              #pkg     'stx/libopengl/source'     false  )
-                ( 'libjava/*.st'                #pkg     'stx/libjava/source'     false  )
+                ( 'doc'                                  nil     nil        false '644' )
         ).
     ].
 
@@ -356,9 +256,8 @@
 
     installGoodyFiles ifTrue:[
         fileSpec := fileSpec , #(
-                ( 'goodies/*.st'                 #pkg     'stx/goodies/source'  false '644' )
-                ( 'goodies/*.chg'                #pkg     'stx/goodies/source'  false '644' )
-                ( 'goodies/rdoit/rdoit'          #bin     nil               false '755' )
+                ( 'goodies/*.st'                  #pkg     'stx/goodies/source'       false '644' )
+                ( 'goodies/*.chg'                 #pkg     'stx/goodies/source'       false '644' )
         ).
     ].
 
@@ -387,6 +286,7 @@
                 "/ name                             destination  subDir             required mode      
                 ( 'projects/smalltalk/smalltalk'        #bin     nil                  true  '755' )
                 ( 'projects/smalltalk/stx'              #bin     nil                  true  '755' )
+                ( 'librun/librun.so'                    #lib     'lib'                true  '644' )
     ).
 
     installSTCFiles ifTrue:[
@@ -394,7 +294,7 @@
                 ( 'stc/stc'                                  #bin        nil              false '755' )
                 ( 'rules/stmkmp'                             #bin        nil              false '755' )
                 ( 'rules/stmkmf'                             #bin        nil              false '755' )
-                ( 'configurations'                           #lib        nil              false '644' )
+                ( 'configurations/COMMON'                    #lib        'configurations' false '644' )
                 ( 'configurations/PACKS'                     #lib        'configurations' false '644' )
                 ( 'configurations/my*'                       #lib        'configurations' false '644' )
                 ( 'configurations/vendor*'                   #lib        'configurations' false '644' )
@@ -403,46 +303,21 @@
                 ( 'support/VGL/vogl/src/*.h'                 #lib        'include'        false '644' )
                 ( 'support/DLD/dld-3.2.5/libdld.*'           #lib        'lib'            false '644' )
 
-                ( 'goodies/persistency/db-1.6/PORT/libdb.*'  #lib        'lib'            false '644' )
+                ( 'goodies/persistency/db-1.6/PORT/libdb.*'  #libBin     'lib'            false '644' )
 
-                ( 'librun/librun.o'                          #libBin     nil              false '644' )
-                ( 'librun/librun.a'                          #libBin     nil              false '644' )
-                ( 'libbasic/libbasic.o'                      #libBin     nil              false '644' )
-                ( 'libbasic2/libbasic2.o'                    #libBin     nil              false '644' )
-                ( 'libbasic3/libbasic3.o'                    #libBin     nil              false '644' )
-                ( 'libhtml/libhtml.o'                        #libBin     nil              false '644' )
-                ( 'libcomp/libcomp.o'                        #libBin     nil              false '644' )
-                ( 'libcomp/ObjFL*.o'                         #libBin     nil              false '644' )
-                ( 'libcomp/ObjFL*.obj'                       #libBin     nil              false '644' )
-                ( 'libcomp/ObjFL*.so'                        #libBin     nil              false '644' )
-                ( 'libview/libview.o'                        #libBin     nil              false '644' )
-                ( 'libview/GLX*.o'                           #libBin     nil              false '644' )
-                ( 'libview/GLX*.obj'                         #libBin     nil              false '644' )
-                ( 'libview/GLX*.so'                          #libBin     nil              false '644' )
-                ( 'libview/XW*.o'                            #libBin     nil              false '644' )
-                ( 'libview/XW*.obj'                          #libBin     nil              false '644' )
-                ( 'libview/XW*.so'                           #libBin     nil              false '644' )
-                ( 'libview2/libview2.o'                      #libBin     nil              false '644' )
-                ( 'libwidg/libwidg.o'                        #libBin     nil              false '644' )
-                ( 'libwidg2/libwidg2.o'                      #libBin     nil              false '644' )
-                ( 'libwidg3/libwidg3.o'                      #libBin     nil              false '644' )
-                ( 'libui/libui.o'                            #libBin     nil              false '644' )
-                ( 'libjava/libjava.o'                        #libBin     nil              false '644' )
-
-"/                ( 'libsnmp/libsnmp.*'                        #libBin     nil      false '644' )
-"/                ( 'contrib/libPVM/libPVM.*'                  #libBin     nil      false '644' )
-                ( 'goodies/persistency/libdbase.o'           #libBin     nil      false '644' )
-"/                ( 'libtable/libtable.*'                      #libBin     nil      false '644' )
-                ( 'libtool/libtool.o'                        #libBin     nil      false '644' )
-                ( 'libtool2/libtool2.o'                      #libBin     nil      false '644' )
-"/                ( 'libxt/libxt.*'                            #libBin     nil      false '644' )
-"/                ( 'librt/librt.*'                            #libBin     nil      false '644' )
+"/                ( 'librun/librun.o'                          #libBin     nil              false '644' )
+"/                ( 'librun/librun.a'                          #libBin     nil              false '644' )
         ).
     ].
 
     installGoodyFiles ifTrue:[
         fileSpec := fileSpec , #(
-                ( 'goodies/rdoit/rdoit'                      #bin     nil        false '755' )
+                ( 'goodies/rdoit/rdoit'           #bin     nil        false '755' )
+                ( 'goodies/xml-indelv/abbrev.stc' #pkg     'stx/goodies/xml-indelv'   true  )
+        ).
+    ] ifFalse:[
+        fileSpec := fileSpec , #(
+                ( 'goodies/persistency/libdbase.so'  #pkg     'stx/goodies/persistency' true '644' )
         ).
     ].
 
@@ -487,6 +362,45 @@
 
 !STXInstaller methodsFor:'installing'!
 
+addFilesToSpec:fileSpec relativeTo:rel fromINSTALLSpec:f
+    |s entry t cond dst|
+
+    s := f asFilename readStream.
+    s isNil ifTrue:[^  self].
+    [s atEnd] whileFalse:[
+        entry := s nextLine.
+        (entry startsWith:$#) ifFalse:[
+            t := entry asCollectionOfWords.
+            t size >= 2 ifTrue:[
+                cond := t at:3 ifAbsent:nil.
+                (cond ~= 'optionalSource' 
+                 or:[installSourceFiles]) ifTrue:[
+                    ((rel startsWith:'goodies/') not
+                    or:[installGoodyFiles]) ifTrue:[
+                        dst := t at:2.
+                        (dst startsWith:'packages/stx/') ifTrue:[
+                            fileSpec add:(Array 
+                                            with:(rel asFilename constructString:(t at:1))
+                                            with:#pkg
+                                            with:('stx' asFilename constructString:(dst copyFrom:'packages/stx/' size+1))
+                                            with:true).
+                        ] ifFalse:[
+                            (dst = 'bin') ifTrue:[
+                                fileSpec add:(Array 
+                                                with:(rel asFilename constructString:(t at:1))
+                                                with:#bin
+                                                with:nil
+                                                with:true).
+                            ]
+                        ]
+                    ]
+                ].
+            ].
+        ].
+    ].
+    s close.
+!
+
 changeWritability
     |msg|
 
@@ -538,7 +452,18 @@
         ^ true
     ].
 
-    fileSpec := self specOfFilesToCopy.
+    fileSpec := self specOfFilesToCopy asOrderedCollection.
+
+    actionPercentageHolder value:0.
+    "/ search for INSTALL.files specs, and add to list ...
+    actionTextHolder value:nil.
+    actionTextHolder value:(resources array:#('ST/X Installation' '' 'searching for packages to install...' '' '' '')) asStringCollection.
+
+    topDir asFilename recursiveDirectoryContentsDo:[:f |
+        f asFilename baseName = 'INSTALL.files' ifTrue:[
+            self addFilesToSpec:fileSpec relativeTo:f asFilename directoryName fromINSTALLSpec:(topDir asFilename construct:f).
+        ]
+    ].
 
     filesToCopy := OrderedCollection new.
 
@@ -720,12 +645,36 @@
     actionTextHolder value:nil.
     actionTextHolder value:msg.
 
-    commandTraceView showCR:(resources string:'setting up symbolic links in doc/online ...').
-    commandTraceView endEntry.
+    commandTraceView showCR:(resources string:'setting up symbolic links in doc/online ...'); endEntry.
+
     installWhat == #full ifTrue:[
         OperatingSystem executeCommand:('(cd ' , fullDir , '/doc/online ; make links)').
     ] ifFalse:[
         OperatingSystem executeCommand:('(cd ' , stxLibDir , '/doc/online ; make links)').
+
+        commandTraceView showCR:(resources string:'setting up symbolic links in lib ...'); endEntry.
+
+        #(
+            'libbasic/libbasic.so'
+            'libbasic2/libbasic2.so'
+            'libbasic3/libbasic3.so'
+            'libcomp/libcomp.so'
+            'libboss/libboss.so'
+            'libview/*.so'
+            'libview2/libview2.so'
+            'libwidg/libwidg.so'
+            'libwidg2/libwidg2.so'
+            'libwidg3/libwidg3.so'
+            'libhtml/libhtml.so'
+            'libui/libui.so'
+            'libtool/libtool.so'
+            'libtool2/libtool2.so'
+            'goodies/persistency/libdbase.so'
+        ) do:[:src |  |cmd|
+            cmd := '(cd ' , stxLibDir , '/lib ; ln -s ../../packages/stx/' , src , ' . )'.
+            commandTraceView showCR:cmd; endEntry.
+            OperatingSystem executeCommand:cmd.
+        ].
     ].
 
     "Created: / 17.7.1996 / 15:24:19 / cg"
@@ -820,6 +769,10 @@
 !
 
 recursiveCopy:src to:dst
+    self recursiveCopy:src to:dst print:true
+!
+
+recursiveCopy:src to:dst print:doPrint
     |cmd srcF dstF d|
 
     srcF := src asFilename.
@@ -837,29 +790,46 @@
             'not_delivered'
         ) includes:srcF baseName) ifFalse:[
             srcF baseName includesMatchCharacters ifTrue:[
+                doPrint ifTrue:[
+                    OperatingSystem isUNIXlike ifTrue:[
+                        commandTraceView showCR:('cp ' , srcF pathName , ' ' , dstF pathName).
+                    ] ifFalse:[
+                        commandTraceView showCR:('copy ' , srcF pathName , ' ' , dstF pathName).
+                    ].
+                    commandTraceView endEntry.
+                ].
                 srcF directory directoryContents do:[:fileName |
                     ((srcF baseName) match:fileName) ifTrue:[
                         (#(
                             'CVS'
                             'not_delivered'
                         ) includes:fileName) ifFalse:[
-                            self recursiveCopy:(srcF directory construct:fileName) to:dstF
+                            self 
+                                recursiveCopy:(srcF directory construct:fileName) 
+                                to:dstF
+                                print:false
                         ]
                     ]
                 ]
             ] ifFalse:[
-                OperatingSystem isUNIXlike ifTrue:[
-                    commandTraceView showCR:('cp ' , srcF pathName , ' ' , dstF pathName).
-                ] ifFalse:[
-                    commandTraceView showCR:('copy ' , srcF pathName , ' ' , dstF pathName).
+                doPrint ifTrue:[
+                    OperatingSystem isUNIXlike ifTrue:[
+                        commandTraceView showCR:('cp ' , srcF pathName , ' ' , dstF pathName).
+                    ] ifFalse:[
+                        commandTraceView showCR:('copy ' , srcF pathName , ' ' , dstF pathName).
+                    ].
+                    commandTraceView endEntry.
                 ].
-                commandTraceView endEntry.
-
                 srcF isDirectory ifFalse:[
                     (dstF exists and:[dstF isDirectory]) ifTrue:[
                         dstF := dstF construct:srcF baseName.
                     ].
-                    srcF copyTo:dstF
+                    srcF copyTo:dstF.
+                    OperatingSystem isUNIXlike ifTrue:[
+                        srcF isExecutable ifTrue:[
+                            dstF makeExecutableForAll
+                        ]
+                    ]
                 ] ifTrue:[
                     d := dstF asFilename construct:srcF baseName.
                     (d exists) ifFalse:[
@@ -868,6 +838,7 @@
                     srcF directoryContents do:[:fileName |
                         self recursiveCopy:(srcF construct:fileName) 
                              to:d
+                             print:false
                     ]
                 ]
             ]