Parent: [4bfb2f] (diff)

Download this file

findpkgdir.tcl    48 lines (39 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Try to find a nice place where to install.
# It seems (end 2008) that distributions tend to remove /usr/lib from
# auto_path, leaving only things like /usr/lib/tcl /usr/lib/tcl8.x
# /usr/share/tcl
# We look at the auto_path, and try to find the best place, ideally
# the equivalent of $prefix/lib[64]/tcl because like this we don't
# need a reinstall at each tcl version change, else $prefix/lib else
# .../tcl8.x, else whatever is at the beginning of the auto_path
set usrlibtcl {}
set usrlib {}
set usrlibtclxy {}
#test set auto_path {/usr/lib/tcl8.4 /usr/lib/tcl /usr/share/tcl}
foreach d $auto_path {
if {[regexp {lib.*/tcl$} $d]} {
set usrlibtcl $d
}
if {[regexp {lib.*/tcl8\.[0-9]+$} $d]} {
set usrlibtclxy $d
}
if {[regexp {lib$} $d]} {
set usrlib $d
}
if {[regexp {lib64$} $d]} {
set usrlib $d
}
}
if {[string compare $usrlibtcl {}]} {
puts stdout $usrlibtcl
exit 0
}
if {[string compare $usrlib {}]} {
puts stdout $usrlib
exit 0
}
if {[string compare $usrlibtclxy {}]} {
puts stdout $usrlibtclxy
exit 0
}
puts [lindex $auto_path 0]