source: trunk/tcl/install.tcl @ 21

Last change on this file since 21 was 13, checked in by mmc, 16 years ago

Many improvements, including a new energy level viewer
for Huckel-IV. Added support for a new <boolean> type.
Fixed the cloud/field stuff so that when a cloud is 1D,
it reverts to BLT vectors so it will plot correctly.
Fixed the install script to work better on Windows.

File size: 2.7 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  Purdue Research Foundation, West Lafayette, IN
9# ======================================================================
10
11# run this script from directory containing it
12cd [file dirname [info script]]
13
14set package "Rappture"
15set version "0.9"
16
17proc find {dir} {
18    set flist ""
19    foreach name [glob [file join $dir *]] {
20        lappend flist $name
21        if {[file isdirectory $name]} {
22            eval lappend flist [find $name]
23        }
24    }
25    return $flist
26}
27
28proc mkindex {dir} {
29    package require Itcl  ;# index Itcl files too!
30    auto_mkindex $dir *.tcl
31}
32
33proc fixperms {target perms} {
34    global tcl_platform
35    if {$tcl_platform(platform) == "unix"} {
36        file attributes $target -permissions $perms
37    }
38}
39
40
41set dir [file dirname [info library]]
42set targetdir [file join $dir $package$version]
43
44if {![file exists $targetdir]} {
45    puts "making directory $targetdir..."
46    file mkdir $targetdir
47}
48
49set origdir [pwd]
50foreach context {. ../gui} {
51    cd $context
52
53    foreach file [find .] {
54        set target [file join $targetdir $file]
55        if {[file isdirectory $file]} {
56            puts "making directory $target..."
57            catch {file mkdir $target}
58            fixperms $target ugo+rx
59        } else {
60            puts "installing $target..."
61            file copy -force $file $target
62            fixperms $target ugo+r
63        }
64    }
65}
66
67cd ..
68catch {file mkdir [file join $targetdir lib]}
69foreach file [find ./lib] {
70    set target [file join $targetdir $file]
71    if {[file isdirectory $file]} {
72        puts "making directory $target..."
73        catch {file mkdir $target}
74        fixperms $target ugo+rx
75    } else {
76        puts "installing $target..."
77        file copy -force $file $target
78        fixperms $target ugo+r
79    }
80}
81
82cd $origdir
83
84set fid [open [file join $targetdir pkgIndex.tcl] w]
85puts $fid "# Tcl package index file"
86puts $fid "package ifneeded $package $version \""
87puts $fid "  \[list lappend auto_path \[file join \$dir scripts\]\]"
88puts $fid "  namespace eval \[list Rappture \[list variable installdir \$dir\]\]"
89puts $fid "  package provide $package $version"
90puts $fid "\""
91close $fid
92
93mkindex [file join $targetdir scripts]
94
95if {[catch {package require Tk}] == 0} {
96    wm withdraw .
97    tk_messageBox -icon info -message "$package-$version INSTALLED"
98} else {
99    puts "== $package-$version INSTALLED"
100}
101exit 0
Note: See TracBrowser for help on using the repository browser.