source: trunk/tcl/install.tcl @ 171

Last change on this file since 171 was 171, checked in by mmc, 15 years ago
  • Moved Rappture::result and Rappture::exec to the tcl library and cleaned up the installation.
  • Fixed the filexfer applet so that it is more robust, and can disconnect and reconnect to the Rappture application.
  • Added bindings to the postern so that it is easier to find.
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 "1.0"
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 sdir [file join $targetdir scripts]
53if {![file exists $sdir]} {
54    puts "making directory $sdir..."
55    catch {file mkdir $sdir}
56    fixperms $sdir ugo+rx
57}
58
59foreach file {
60    ./scripts/library.tcl
61    ./scripts/exec.tcl
62    ./scripts/result.tcl
63    ../gui/scripts/units.tcl
64} {
65    set target [file join $targetdir scripts [file tail $file]]
66    puts "installing $target..."
67    file copy -force $file $target
68    fixperms $target ugo+r
69}
70
71catch {file mkdir [file join $targetdir lib]}
72foreach file [find ../lib] {
73    set target [file join $targetdir lib [file tail $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
85set fid [open [file join $targetdir pkgIndex.tcl] w]
86puts $fid "# Tcl package index file"
87puts $fid "package ifneeded $package $version \""
88puts $fid "  \[list lappend auto_path \[file join \$dir scripts\]\]"
89puts $fid "  namespace eval \[list Rappture \[list variable installdir \$dir\]\]"
90puts $fid "  package provide $package $version"
91puts $fid "\""
92close $fid
93
94mkindex [file join $targetdir scripts]
95
96if {[string match wish* [file tail [info nameofexecutable]]]} {
97    package require Tk
98    wm withdraw .
99    tk_messageBox -icon info -message "$package-$version INSTALLED"
100} else {
101    puts "== $package-$version INSTALLED"
102}
103exit 0
Note: See TracBrowser for help on using the repository browser.