source: trunk/tcl/install.tcl @ 115

Last change on this file since 115 was 115, checked in by mmc, 19 years ago

Updated all copyright notices.

File size: 2.8 KB
Line 
1# ----------------------------------------------------------------------
2#  USAGE: tclsh install.tcl
3#
4#  Use this script to install the Rappture toolkit into an existing
5#  Tcl installation.
6# ======================================================================
7#  AUTHOR:  Michael McLennan, Purdue University
8#  Copyright (c) 2004-2005  Purdue Research Foundation
9#
10#  See the file "license.terms" for information on usage and
11#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12# ======================================================================
13
14# run this script from directory containing it
15cd [file dirname [info script]]
16
17set package "Rappture"
18set version "0.9"
19
20proc find {dir} {
21    set flist ""
22    foreach name [glob [file join $dir *]] {
23        lappend flist $name
24        if {[file isdirectory $name]} {
25            eval lappend flist [find $name]
26        }
27    }
28    return $flist
29}
30
31proc mkindex {dir} {
32    package require Itcl  ;# index Itcl files too!
33    auto_mkindex $dir *.tcl
34}
35
36proc fixperms {target perms} {
37    global tcl_platform
38    if {$tcl_platform(platform) == "unix"} {
39        file attributes $target -permissions $perms
40    }
41}
42
43
44set dir [file dirname [info library]]
45set targetdir [file join $dir $package$version]
46
47if {![file exists $targetdir]} {
48    puts "making directory $targetdir..."
49    file mkdir $targetdir
50}
51
52set origdir [pwd]
53foreach context {. ../gui} {
54    cd $context
55
56    foreach file [find .] {
57        set target [file join $targetdir $file]
58        if {[file isdirectory $file]} {
59            puts "making directory $target..."
60            catch {file mkdir $target}
61            fixperms $target ugo+rx
62        } else {
63            puts "installing $target..."
64            file copy -force $file $target
65            fixperms $target ugo+r
66        }
67    }
68}
69
70cd ..
71catch {file mkdir [file join $targetdir lib]}
72foreach file [find ./lib] {
73    set target [file join $targetdir $file]
74    if {[file isdirectory $file]} {
75        puts "making directory $target..."
76        catch {file mkdir $target}
77        fixperms $target ugo+rx
78    } else {
79        puts "installing $target..."
80        file copy -force $file $target
81        fixperms $target ugo+r
82    }
83}
84
85cd $origdir
86
87set fid [open [file join $targetdir pkgIndex.tcl] w]
88puts $fid "# Tcl package index file"
89puts $fid "package ifneeded $package $version \""
90puts $fid "  \[list lappend auto_path \[file join \$dir scripts\]\]"
91puts $fid "  namespace eval \[list Rappture \[list variable installdir \$dir\]\]"
92puts $fid "  package provide $package $version"
93puts $fid "\""
94close $fid
95
96mkindex [file join $targetdir scripts]
97
98if {[string match wish* [file tail [info nameofexecutable]]]} {
99    package require Tk
100    wm withdraw .
101    tk_messageBox -icon info -message "$package-$version INSTALLED"
102} else {
103    puts "== $package-$version INSTALLED"
104}
105exit 0
Note: See TracBrowser for help on using the repository browser.