source: trunk/tcl/install @ 1

Last change on this file since 1 was 1, checked in by mmc, 18 years ago

initial import

File size: 2.0 KB
Line 
1#!/bin/sh
2# ----------------------------------------------------------------------
3#  USAGE: tclsh install
4#
5#  Use this script to install the Rappture toolkit into an existing
6#  Tcl installation.
7# ======================================================================
8#  AUTHOR:  Michael McLennan, Purdue University
9#  Copyright (c) 2004  Purdue Research Foundation, West Lafayette, IN
10# ======================================================================
11#\
12exec tclsh "$0" "$*"
13# ----------------------------------------------------------------------
14# tclsh executes everything from here on...
15
16# run this script from directory containing it
17cd [file dirname [info script]]
18
19set package "Rappture"
20set version "0.9"
21
22proc find {dir} {
23    set flist ""
24    foreach name [glob [file join $dir *]] {
25        lappend flist $name
26        if {[file isdirectory $name]} {
27            eval lappend flist [find $name]
28        }
29    }
30    return $flist
31}
32
33proc mkindex {dir} {
34    package require Itcl  ;# index Itcl files too!
35    auto_mkindex $dir *.tcl
36}
37
38
39set dir [file dirname [info library]]
40set targetdir [file join $dir $package$version]
41
42mkindex scripts
43
44if {![file exists $targetdir]} {
45    puts "making directory $targetdir..."
46    file mkdir $targetdir
47}
48
49foreach file [find .] {
50    set target [file join $targetdir $file]
51    if {[file isdirectory $file]} {
52        puts "making directory $target..."
53        catch {file mkdir $target}
54        file attributes $target -permissions ugo+rx
55    } else {
56        puts "installing $target..."
57        file copy -force $file $target
58        file attributes $target -permissions ugo+r
59    }
60}
61
62set fid [open [file join $targetdir pkgIndex.tcl] w]
63puts $fid "# Tcl package index file"
64puts $fid "package ifneeded $package $version \""
65puts $fid "  \[list lappend auto_path \[file join \$dir scripts\]\]"
66puts $fid "  namespace eval Rappture \[list variable installdir \$dir\]"
67puts $fid "  package provide $package $version"
68puts $fid "\""
69close $fid
70
71puts "== $package-$version INSTALLED"
Note: See TracBrowser for help on using the repository browser.