home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tclX6.5c / tclsrc / installTcl.tcl < prev    next >
Encoding:
Text File  |  1992-12-19  |  20.4 KB  |  643 lines

  1. #
  2. # installTcl.tcl -- 
  3. #
  4. # Tcl program to install Tcl onto the system.
  5. #
  6. #------------------------------------------------------------------------------
  7. # Copyright 1992 Karl Lehenbauer and Mark Diekhans.
  8. #
  9. # Permission to use, copy, modify, and distribute this software and its
  10. # documentation for any purpose and without fee is hereby granted, provided
  11. # that the above copyright notice appear in all copies.  Karl Lehenbauer and
  12. # Mark Diekhans make no representations about the suitability of this
  13. # software for any purpose.  It is provided "as is" without express or
  14. # implied warranty.
  15. #------------------------------------------------------------------------------
  16. # $Id: installTcl.tcl,v 2.3 1992/12/19 07:59:37 markd Exp $
  17. #------------------------------------------------------------------------------
  18. #
  19. # It is run in the following manner:
  20. #
  21. #     tcl installTcl.tcl
  22. #
  23. # This script reads the Extended Tcl Makefile confiugation file (Config.mk)
  24. # and converts the Makefile macros in Tcl variables that control the
  25. # installation.  The following variables are currently used:
  26. #
  27. #   TCL_UCB_DIR             TCL_DEFAULT             TCL_OWNER
  28. #   TCL_GROUP               TCL_BINDIR              TCL_LIBDIR
  29. #   TCL_INCLUDEDIR          TCL_TCLDIR              TCL_MAN_INSTALL
  30. #   TCL_MAN_BASEDIR         TCL_MAN_CMD_SECTION     TCL_MAN_FUNC_SECTION
  31. #   TK_MAN_CMD_SECTION      TK_MAN_FUNC_SECTION     TCL_MAN_STYLE*
  32. #   TCL_MAN_INDEX*          TCL_TK_SHELL*           TK_INSTALL_DEMO
  33. #
  34. # (ones marked with * are optional)
  35. #
  36. # Notes:
  37. #   o Must be run in the Extended Tcl top level directory.
  38. #   o The routine InstallManPages has code to determine if a manual page
  39. #     belongs to a command or function.  For Tcl the commands are assumed
  40. #     to be in "Tcl.man",  for TclX functions are in TclX.man.  All others
  41. #     are assumed to be functions.  For Tk, all manuals starting with Tk_
  42. #     are assumed to be functions, all others are assumed to be commands.
  43. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  44.  
  45. #------------------------------------------------------------------------------
  46. # ParseConfigFile --
  47. #
  48. #  Parse a configure file in the current directory and convert all make
  49. #  macros to global Tcl variables.
  50.  
  51. proc ParseConfigFile {configFile} {
  52.    set cfgFH [open $configFile]
  53.  
  54.    while {[gets $cfgFH line] >= 0} {
  55.       if {[string match {[A-Za-z]*} $line]} {
  56.           set idx [string first "=" $line]
  57.           if {$idx < 0} {
  58.               error "no `=' in: $line"}
  59.           set name  [string trim [csubstr $line 0 $idx]]
  60.           set value [string trim [crange  $line [expr $idx+1] end]]
  61.           global $name
  62.           set $name $value
  63.       }
  64.    }
  65.    close $cfgFH
  66.  
  67. }
  68.  
  69. #------------------------------------------------------------------------------
  70. # GiveAwayFile --
  71. #   Give away a file to the Tcl owner and group and set its permissions.
  72. #
  73. # Globals:
  74. #    TCL_OWNER - Owner name for Tcl files.
  75. #    TCL_GROUP - Group nmae for Tcl file.
  76. #------------------------------------------------------------------------------
  77.  
  78. proc GiveAwayFile {file} {
  79.     global TCL_OWNER TCL_GROUP
  80.  
  81.     if {[file isdirectory $file]} {
  82.         chmod a+rx,go-w $file
  83.     } else {
  84.         chmod a+r,go-w $file
  85.     }    
  86.     chown [list $TCL_OWNER $TCL_GROUP] $file
  87.  
  88. } ;# GiveAwayFile
  89.  
  90. #------------------------------------------------------------------------------
  91. # MakePath --
  92. #
  93. # Make sure all directories in a directory path exists, if not, create them.
  94. #------------------------------------------------------------------------------
  95. proc MakePath {pathlist} {
  96.     foreach path $pathlist {
  97.         set exploded_path [split $path /]
  98.         set thisdir {}
  99.         foreach element $exploded_path {
  100.             append thisdir $element
  101.             if {![file isdirectory $thisdir]} {
  102.                 mkdir $thisdir
  103.                 GiveAwayFile $thisdir
  104.             }
  105.             append thisdir /
  106.         }
  107.     }
  108. }
  109.  
  110. #------------------------------------------------------------------------------
  111. # CopyFile -- 
  112. #
  113. # Copy the specified file and change the ownership.  If target is a directory,
  114. # then the file is copied to it, otherwise target is a new file name.
  115. #------------------------------------------------------------------------------
  116.  
  117. proc CopyFile {sourceFile target} {
  118.  
  119.     if {[file isdirectory $target]} {
  120.         set targetFile "$target/[file tail $sourceFile]"
  121.     } else {
  122.         set targetFile $target
  123.     }
  124.  
  125.     unlink -nocomplain $targetFile
  126.     set sourceFH [open $sourceFile r]
  127.     set targetFH [open $targetFile w]
  128.     copyfile $sourceFH $targetFH
  129.     close $sourceFH
  130.     close $targetFH
  131.     GiveAwayFile $targetFile
  132.  
  133. } ;# CopyFile
  134.  
  135. #------------------------------------------------------------------------------
  136. # CopyManPage -- 
  137. #
  138. # Copy the specified manual page and change the ownership.  The manual page
  139. # is edited to remove change bars (.VS and .VE macros). If target is a
  140. # directory, then the file is copied to it, otherwise target is a new file
  141. # name.
  142. #------------------------------------------------------------------------------
  143.  
  144. proc CopyManPage {sourceFile target} {
  145.  
  146.     if {[file isdirectory $target]} {
  147.         set targetFile "$target/[file tail $sourceFile]"
  148.     } else {
  149.         set targetFile $target
  150.     }
  151.  
  152.     unlink -nocomplain $targetFile
  153.     set sourceFH [open $sourceFile r]
  154.     set targetFH [open $targetFile w]
  155.     while {[gets $sourceFH line] >= 0} {
  156.         if [string match {.V[SE]*} $line] continue
  157.         puts $targetFH $line
  158.     }
  159.     close $sourceFH
  160.     close $targetFH
  161.     GiveAwayFile $targetFile
  162.  
  163. } ;# CopyManPage
  164.  
  165. #------------------------------------------------------------------------------
  166. # CopySubDir --
  167. #
  168. # Recursively copy part of a directory tree, changing ownership and 
  169. # permissions.  This is a utility routine that actually does the copying.
  170. #------------------------------------------------------------------------------
  171.  
  172. proc CopySubDir {sourceDir destDir} {
  173.     foreach sourceFile [glob -nocomplain $sourceDir/*] {
  174.  
  175.         if [file isdirectory $sourceFile] {
  176.             set destFile $destDir/[file tail $sourceFile]
  177.             if {![file exists $destFile]} {
  178.                 mkdir $destFile}
  179.             GiveAwayFile $destFile
  180.             CopySubDir $sourceFile $destFile
  181.         } else {
  182.             CopyFile $sourceFile $destDir
  183.         }
  184.     }
  185. } ;# CopySubDir
  186.  
  187. #------------------------------------------------------------------------------
  188. # CopyDir --
  189. #
  190. # Recurisvely copy a directory tree.
  191. #------------------------------------------------------------------------------
  192.  
  193. proc CopyDir {sourceDir destDir} {
  194.  
  195.     set cwd [pwd]
  196.     if ![file exists $sourceDir] {
  197.         error "\"$sourceDir\" does not exist"
  198.     }
  199.     if ![file isdirectory $sourceDir] {
  200.         error "\"$sourceDir\" isn't a directory"
  201.     }
  202.     
  203.     # Dirs must be absolutes paths, as we are going to change directories.
  204.  
  205.     if {[cindex $sourceDir 0] != "/"} {
  206.         set sourceDir "$cwd/$sourceDir"
  207.     }
  208.     if {[cindex $destDir 0] != "/"} {
  209.         set destDir "$cwd/$destDir"
  210.     }
  211.  
  212.     if {![file exists $destDir]} {
  213.         mkdir $destDir
  214.         GiveAwayFile $destDir
  215.     }
  216.     if ![file isdirectory $destDir] {
  217.         error "\"$destDir\" isn't a directory"
  218.     }
  219.     cd $sourceDir
  220.     set status [catch {CopySubDir . $destDir} msg]
  221.     cd $cwd
  222.     if {$status != 0} {
  223.         global errorInfo errorCode
  224.         error $msg $errorInfo $errorCode
  225.     }
  226. }
  227.  
  228. #------------------------------------------------------------------------------
  229. # GenDefaultFile -- 
  230. #
  231. # Generate the tcl defaults file.
  232. #------------------------------------------------------------------------------
  233.  
  234. proc GenDefaultFile {defaultFileBase sourceDir} {
  235.  
  236.     set defaultFile "$defaultFileBase[infox version]"
  237.  
  238.     if ![file writable [file dirname $defaultFile]] {
  239.         puts stderr "Can't create $defaultFile -- directory is not writable"
  240.         puts stderr "Please reinstall with correct permissions or rebuild"
  241.         puts stderr "Tcl to select a default file where the directory path"
  242.         puts stderr "you specify is writable by you."
  243.         puts stderr ""
  244.         exit 1
  245.     }
  246.  
  247.     set fp [open $defaultFile w]
  248.  
  249.     puts $fp "# Extended Tcl [infox version] default file"
  250.     puts $fp ""
  251.     puts $fp "set TCLINIT $sourceDir/TclInit.tcl"
  252.     puts $fp ""
  253.     puts $fp "set TCLPATH $sourceDir"
  254.  
  255.     close $fp
  256.     GiveAwayFile $defaultFile
  257.  
  258. } ;# GenDefaultFile
  259.  
  260. #------------------------------------------------------------------------------
  261. # GetManNames --
  262. #
  263. #   Search a manual page (nroff source) for the name line.  Parse the name
  264. # line into all of the functions or commands that it references.  This isn't
  265. # comprehensive, but it works for all of the Tcl, TclX and Tk man pages.
  266. #
  267. # Parameters:
  268. #   o manFile (I) - The path to the  manual page file.
  269. # Returns:
  270. #   A list contain the functions or commands or {} if the name line can't be
  271. # found or parsed.
  272. #------------------------------------------------------------------------------
  273.  
  274. proc GetManNames {manFile} {
  275.  
  276.    set manFH [open $manFile]
  277.  
  278.    #
  279.    # Search for name line.  Once found, grab the next line that is not a
  280.    # nroff macro.  If we end up with a blank line, we didn't find it.
  281.    #
  282.    while {[gets $manFH line] >= 0} {
  283.        if [regexp {^.SH NAME.*$} $line] {
  284.            break
  285.        }
  286.    }
  287.    while {[gets $manFH line] >= 0} {
  288.        if {![string match ".*" $line]} break
  289.    }
  290.    close $manFH
  291.  
  292.    set line [string trim $line]
  293.    if {$line == ""} return
  294.  
  295.    #
  296.    # Lets try and parse the name list out of the line
  297.    #
  298.    if {![regexp {^(.*)(\\-)} $line {} namePart]} {
  299.        if {![regexp {^(.*)(-)} $line {} namePart]} return
  300.    }
  301.  
  302.    #
  303.    # This magic converts the name line into a list
  304.    #
  305.  
  306.    if {[catch {join [split $namePart ,] " "} namePart] != 0} return
  307.  
  308.    return $namePart
  309.  
  310. }
  311.  
  312. #------------------------------------------------------------------------------
  313. # SetUpManIndex --
  314. #   Setup generation of manual page index for short manual pages, if required.
  315. # Globals:
  316. #   o TCL_MAN_INDEX - Boolean indicating if a manual page is to be created.
  317. #     If it does not exists, false is assumed.
  318. #   o TCL_MAN_BASEDIR - Base manual directory where all of the man.* and cat.* 
  319. #     directories live.
  320. # Returns:
  321. #   The manual index file handle, or {} if the manual index is not to be
  322. #  generated.
  323. #------------------------------------------------------------------------------
  324.  
  325. proc SetUpManIndex {} {
  326.     global TCL_MAN_BASEDIR TCL_MAN_INDEX
  327.  
  328.     if {!([info exists TCL_MAN_INDEX] && [set TCL_MAN_INDEX])} {
  329.         return {}
  330.     }
  331.     set tclIndexFile $TCL_MAN_BASEDIR/index.TCL
  332.     return [open $tclIndexFile w]
  333. }
  334.  
  335. #------------------------------------------------------------------------------
  336. # FinishUpManIndex --
  337. #   Finish generation of manual page index for short manual pages, if required.
  338. # Parameters:
  339. #   o indexFileHdl - The file handle returned by SetUpManIndex, maybe {}.
  340. # Globals:
  341. #   o TCL_MAN_BASEDIR - Base manual directory where all of the man.* and cat.* 
  342. #     directories live.
  343. #------------------------------------------------------------------------------
  344.  
  345. proc FinishUpManIndex {indexFileHdl} {
  346.     global TCL_MAN_BASEDIR TCL_MAN_INDEX_MERGE
  347.  
  348.     if [lempty $indexFileHdl] return
  349.  
  350.     set tclIndexFile $TCL_MAN_BASEDIR/index.TCL
  351.     close $indexFileHdl
  352.     GiveAwayFile $tclIndexFile
  353.  
  354. }
  355.  
  356. #------------------------------------------------------------------------------
  357. # InstallShortMan --
  358. #   Install a manual page on a system that does not have long file names,
  359. #   optionally adding an entry to the man index.
  360. #
  361. # Parameters:
  362. #   o sourceFile - Manual page source file path.
  363. #   o section - Section to install the manual page in.
  364. #   o indexFileHdl - File handle of the current index file being created, or
  365. #     empty if no index is to be created.
  366. # Globals:
  367. #   o TCL_MAN_BASEDIR - Base manual directory where all of the man.* and cat.* 
  368. #     directories live.
  369. #   o TCL_MAN_SEPARATOR - The name separator between the directory and the
  370. #     section.
  371. #------------------------------------------------------------------------------
  372.  
  373. proc InstallShortMan {sourceFile section indexFileHdl} {
  374.     global TCL_MAN_BASEDIR TCL_MAN_SEPARATOR
  375.  
  376.     set manNames [GetManNames $sourceFile]
  377.     if [lempty $manNames] {
  378.         set baseName [file tail [file root $sourceFile]]
  379.         puts stderr "Warning: can't parse NAME line for man page: $sourceFile."
  380.         puts stderr "         Manual page only available as: $baseName"
  381.     }
  382.  
  383.     set manFileBase [file tail [file root $sourceFile]]
  384.     set manFileName "$manFileBase.$section"
  385.  
  386.     set destManDir "$TCL_MAN_BASEDIR/man$TCL_MAN_SEPARATOR$section"
  387.     set destCatDir "$TCL_MAN_BASEDIR/cat$TCL_MAN_SEPARATOR$section"
  388.  
  389.     CopyManPage $sourceFile "$destManDir/$manFileName"
  390.     unlink -nocomplain  "$destCatDir/$manFileName"
  391.  
  392.     if {![lempty $indexFileHdl]} {
  393.         foreach name $manNames {
  394.             puts $indexFileHdl "$name\t$manFileBase\t$section"
  395.         }
  396.     }    
  397. }
  398.  
  399. #------------------------------------------------------------------------------
  400. # InstallLongMan --
  401. #   Install a manual page on a system that does have long file names.
  402. #
  403. # Parameters:
  404. #   o sourceFile - Manual page source file path.
  405. #   o section - Section to install the manual page in.
  406. # Globals:
  407. #   o TCL_MAN_BASEDIR - Base manual directory where all of the man.* and cat.* 
  408. #     directories live.
  409. #   o TCL_MAN_SEPARATOR - The name separator between the directory and the
  410. #     section.
  411. #------------------------------------------------------------------------------
  412.  
  413. proc InstallLongMan {sourceFile section} {
  414.     global TCL_MAN_BASEDIR TCL_MAN_SEPARATOR
  415.  
  416.     set manNames [GetManNames $sourceFile]
  417.     if [lempty $manNames] {
  418.         set baseName [file tail [file root $sourceFile]]
  419.         puts stderr "Warning: can't parse NAME line for man page: $sourceFile."
  420.         puts stderr "         Manual page only available as: $baseName"
  421.         set manNames $baseName
  422.     }
  423.  
  424.     set destManDir "$TCL_MAN_BASEDIR/man$TCL_MAN_SEPARATOR$section"
  425.     set destCatDir "$TCL_MAN_BASEDIR/cat$TCL_MAN_SEPARATOR$section"
  426.  
  427.     # Copy file to the first name in the list.
  428.  
  429.     set firstFile [lvarpop manNames]
  430.     set firstFilePath "$destManDir/$firstFile.$section"
  431.  
  432.     CopyManPage $sourceFile $firstFilePath
  433.     unlink -nocomplain   "$destCatDir/$firstFile.$section"
  434.  
  435.     # Link it to the rest of the names in the list.
  436.  
  437.     foreach manEntry $manNames {
  438.         set destFilePath "$destManDir/$manEntry.$section"
  439.         unlink -nocomplain  $destFilePath
  440.         if {[catch {
  441.                 link $firstFilePath $destFilePath
  442.             } msg] != 0} {
  443.             puts stderr "error from: link $firstFilePath $destFilePath"
  444.             puts stderr "    $msg"
  445.         }
  446.         unlink -nocomplain "$destCatDir/$manEntry.$section"
  447.     }
  448.  
  449. }
  450.  
  451. #------------------------------------------------------------------------------
  452. # InstallManPage --
  453. #   Install a manual page on a system.
  454. #
  455. # Parameters:
  456. #   o sourceFile - Manual page source file path.
  457. #   o section - Section to install the manual page in.
  458. #   o indexFileHdl - File handle of the current index file being created, or
  459. #     empty if no index is to be created.
  460. # Globals
  461. #   o TCL_MAN_STYLE - SHORT if short manual page names are being used,
  462. #     LONG if long manual pages are being used.
  463. #------------------------------------------------------------------------------
  464.  
  465. proc InstallManPage {sourceFile section indexFileHdl} {
  466.     global TCL_MAN_STYLE
  467.  
  468.     if {"$TCL_MAN_STYLE" == "SHORT"} {
  469.         InstallShortMan $sourceFile $section $indexFileHdl
  470.     } else {
  471.         InstallLongMan $sourceFile $section
  472.     }
  473. }
  474.  
  475. #------------------------------------------------------------------------------
  476. # InstallManPages --
  477. #   Install the manual pages.
  478. #------------------------------------------------------------------------------
  479.  
  480. proc InstallManPages {} {
  481.     global TCL_UCB_DIR          TCL_TK_SHELL         TCL_TK_DIR
  482.     global TCL_MAN_BASEDIR      TCL_MAN_SEPARATOR    TCL_MAN_STYLE
  483.     global TCL_MAN_CMD_SECTION  TCL_MAN_FUNC_SECTION
  484.     global TK_MAN_CMD_SECTION   TK_MAN_FUNC_SECTION
  485.  
  486.     if {![info exists TCL_MAN_STYLE]} {
  487.         set TCL_MAN_STYLE LONG
  488.     }
  489.     set TCL_MAN_STYLE [string toupper $TCL_MAN_STYLE]
  490.     case $TCL_MAN_STYLE in {
  491.         {SHORT} {}
  492.         {LONG}  {}
  493.         default {error "invalid value for TCL_MAN_STYLE: `$TCL_MAN_STYLE'"}
  494.     }
  495.  
  496.     MakePath $TCL_MAN_BASEDIR 
  497.     MakePath "$TCL_MAN_BASEDIR/man$TCL_MAN_SEPARATOR$TCL_MAN_CMD_SECTION"
  498.     MakePath "$TCL_MAN_BASEDIR/cat$TCL_MAN_SEPARATOR$TCL_MAN_CMD_SECTION"
  499.     MakePath "$TCL_MAN_BASEDIR/man$TCL_MAN_SEPARATOR$TCL_MAN_FUNC_SECTION"
  500.     MakePath "$TCL_MAN_BASEDIR/cat$TCL_MAN_SEPARATOR$TCL_MAN_FUNC_SECTION"
  501.  
  502.     set indexFileHdl [SetUpManIndex]
  503.  
  504.     # Install all of the actual files.
  505.  
  506.     echo "    Installing Tcl [info tclversion] man pages"
  507.     foreach fileName [glob $TCL_UCB_DIR/doc/*] {
  508.         if {$fileName == "library.n"} continue
  509.  
  510.         case [file extension $fileName] {
  511.             {.n .1}  {set section $TCL_MAN_CMD_SECTION}
  512.             {.3}     {set section $TCL_MAN_FUNC_SECTION}
  513.         }
  514.         InstallManPage $fileName $section $indexFileHdl
  515.     }
  516.  
  517.     echo "    Installing Extended Tcl [infox version] man pages"
  518.  
  519.     foreach fileName [glob man/*.man] {
  520.         if {[file root $fileName] == "TclX.man"} {
  521.             set section $TCL_MAN_CMD_SECTION
  522.         } else {
  523.             set section $TCL_MAN_FUNC_SECTION
  524.         }
  525.         InstallManPage $fileName $section $indexFileHdl
  526.     }
  527.  
  528.     if {![info exists TCL_TK_SHELL]} {
  529.         FinishUpManIndex $indexFileHdl
  530.         return
  531.     }
  532.  
  533.     MakePath "$TCL_MAN_BASEDIR/man$TCL_MAN_SEPARATOR$TK_MAN_CMD_SECTION"
  534.     MakePath "$TCL_MAN_BASEDIR/cat$TCL_MAN_SEPARATOR$TK_MAN_CMD_SECTION"
  535.     MakePath "$TCL_MAN_BASEDIR/man$TCL_MAN_SEPARATOR$TK_MAN_FUNC_SECTION"
  536.     MakePath "$TCL_MAN_BASEDIR/cat$TCL_MAN_SEPARATOR$TK_MAN_FUNC_SECTION"
  537.  
  538.     echo "    Installing Tk man pages"
  539.  
  540.     foreach fileName [glob $TCL_TK_DIR/doc/*] {
  541.         case [file extension $fileName] {
  542.             {.n .1}  {set section $TK_MAN_CMD_SECTION}
  543.             {.3}     {set section $TK_MAN_FUNC_SECTION}
  544.         }
  545.         InstallManPage $fileName $section $indexFileHdl
  546.     }
  547.  
  548.     FinishUpManIndex $indexFileHdl
  549.  
  550. } ;# InstallLongManPages
  551.  
  552. #------------------------------------------------------------------------------
  553. # Main program code.
  554. #------------------------------------------------------------------------------
  555.  
  556. echo ""
  557. echo ">>> Installing Extended Tcl [infox version] <<<"
  558.  
  559. set argc [llength $argv]
  560. if {$argc != 0} {
  561.     puts stderr "usage: tcl installTcl.tcl"
  562.     exit 1
  563. }
  564.  
  565. #
  566. # Bring in all of the macros defined bu the configuration file.
  567. #
  568. ParseConfigFile Config.mk
  569. ParseConfigFile config/$TCL_CONFIG_FILE
  570.  
  571. #
  572. # Make sure all directories exists that we will be installing in.
  573. #
  574.  
  575. MakePath [list $TCL_TCLDIR [file dirname $TCL_DEFAULT] $TCL_BINDIR]
  576. MakePath [list $TCL_LIBDIR $TCL_INCLUDEDIR $TCL_TCLDIR]
  577.  
  578. echo "    Creating default file: $TCL_DEFAULT[infox version]"
  579. GenDefaultFile $TCL_DEFAULT $TCL_TCLDIR
  580.  
  581. echo "    Installing `tcl' program in: $TCL_BINDIR"
  582. CopyFile tcl $TCL_BINDIR
  583. chmod +rx $TCL_BINDIR/tcl
  584.  
  585. echo "    Installing `libtcl.a' library in: $TCL_LIBDIR"
  586. CopyFile libtcl.a $TCL_LIBDIR
  587.  
  588. echo "    Installing Tcl .h files in: $TCL_INCLUDEDIR"
  589. CopyFile $TCL_UCB_DIR/tcl.h $TCL_INCLUDEDIR
  590. CopyFile $TCL_UCB_DIR/tclHash.h $TCL_INCLUDEDIR
  591. CopyFile src/tclExtend.h $TCL_INCLUDEDIR
  592. CopyFile src/tcl++.h $TCL_INCLUDEDIR
  593.  
  594. echo "    Installing Tcl run-time files in: $TCL_TCLDIR"
  595. foreach srcFile [glob tcllib/*] {
  596.     if {![file isdirectory $srcFile]} {
  597.         CopyFile $srcFile $TCL_TCLDIR
  598.     }
  599. }
  600.  
  601. echo "    Installing Tcl help files in: $TCL_TCLDIR/help"
  602. if [file exists $TCL_TCLDIR/help] {
  603.      echo "       Purging old help tree"
  604.      exec rm -rf $TCL_TCLDIR/help
  605. }
  606. CopyDir tcllib/help $TCL_TCLDIR/help
  607.  
  608. if [info exists TCL_TK_SHELL] {
  609.     echo "    Installing `wishx' program in: $TCL_BINDIR"
  610.     CopyFile wishx $TCL_BINDIR
  611.     chmod +rx $TCL_BINDIR/wishx
  612.  
  613.     echo "    Installing `libtk.a' library in: $TCL_LIBDIR"
  614.     CopyFile libtk.a $TCL_LIBDIR
  615.  
  616.     echo "    Installing `prolog.ps' library in: $TCL_TCLDIR"
  617.     CopyFile $TCL_TK_DIR/library/prolog.ps $TCL_TCLDIR
  618.  
  619.     echo "    Installing `tk.h' & `tkConfig.h' in: $TCL_INCLUDEDIR"
  620.     CopyFile $TCL_TK_DIR/tk.h $TCL_INCLUDEDIR
  621.     CopyFile $TCL_TK_DIR/tkConfig.h $TCL_INCLUDEDIR
  622.  
  623.     if $TK_INSTALL_DEMO {
  624.         if [file exists $TCL_TCLDIR/demos] {
  625.              echo "       Purging old Tk demos"
  626.              exec rm -rf $TCL_TCLDIR/demos
  627.         }
  628.         echo "    Installing Tk demos in: $TCL_TCLDIR/demos"
  629.         CopyDir $TCL_TK_DIR/library/demos $TCL_TCLDIR/demos
  630.     }
  631. }
  632.  
  633. foreach file [glob $TCL_TCLDIR/*.tlib] {
  634.     buildpackageindex $file
  635. }
  636.  
  637. if {$TCL_MAN_INSTALL} {
  638.     InstallManPages
  639. }
  640.  
  641. echo "     *** TCL IS NOW INSTALLED ***"
  642.  
  643.