1#!/bin/sh 2# The next line restarts using wish \ 3exec wish $0 ${1+"$@"} 4# 5# Initialization of some global variables 6 7eval destroy [winfo children .] 8 9switch -glob [info sharedlibextension] { 10 .so* { 11 set libs [list libpng.so.2.1.0 libjpeg.so.62.0.0 libtiff.so.3.4.37 \ 12 libz.so.1.1.3 libttf.so.1.2.0 libungif.so.3.1.0] 13 } 14 ..a { 15 set libs [list libpng.a libjpeg.a libtiff.a libz.a libttf.a libungif.a] 16 } 17 .dll { 18 set libs [list png.lib jpeg62.lib tiff.lib zlib.lib ttf.lib ungif.lib] 19 set dll [list png.dll jpeg62.dll tiff.dll zlib.dll ttf.dll ungif.dll] 20 } 21 * { 22 set libs [list libpng[info sharedlibextension] libjpeg[info sharedlibextension] \ 23 libtiff[info sharedlibextension] libz[info sharedlibextension] \ 24 libttf[info sharedlibextension] libungif[info sharedlibextension]] 25 } 26} 27 28if [info exists env(PATH)] { 29 if [string compare $tcl_platform(platform) windows] { 30 set dirs [split $env(PATH) :] 31 } else { 32 set dirs [split $env(PATH) \;] 33 } 34} else { 35 set dirs "/usr/local/lib /usr/lib /lib" 36} 37 38foreach dir "$dirs C:/WINDOWS/* C:/WINNT/*" { 39 foreach d [list $dir [file join [file dirname $dir] lib]] { 40 set x [glob -nocomplain [file join $d \{lib,\}tcl\[78\]*[info sharedlibextension]*]] 41 if [string compare $x {}] break 42 } 43 if [string compare $x {}] break 44} 45 46 47label .f1 -text "Where should the following files be installed?" 48pack .f1 49proc line {f label default} { 50 frame $f 51 label $f.l -text $label 52 entry $f.e -width 50 53 $f.e insert end $default 54 pack $f.l -side left 55 pack $f.e -side right 56 pack $f -expand y -fill both 57} 58set prefix [file dirname [file dirname $tk_library]] 59 60if [string compare $tcl_platform(platform) windows] { 61 set imglibs [lindex [file split $x] end] 62 if [string match libtcl?.?[info sharedlibextension]* $imglibs] { 63 set imglibs libimg1.2[info sharedlibextension] 64 } else { 65 set imglibs libimg12[info sharedlibextension] 66 } 67} else { 68 set x [lindex $x 0] 69 set systemdll [file dirname $x] 70 set imglibs [list img1280.dll img1281.dll] 71 line .f2 "system dll's" $systemdll 72} 73line .f3 "system libraries" [file join $prefix lib] 74line .f4 "system headers" [file join $prefix include] 75line .f5 "Img 1.2 files" [file join $prefix lib Img1.2] 76frame .f6 77button .f6.install -text Install -command Install 78button .f6.exit -text Exit -command "destroy ." 79pack .f6.install .f6.exit -side left -fill both -expand y 80pack .f6 -fill both -expand y 81 82proc Copy {src dst} { 83 if [file exists $src] { 84 file delete -force [file join $dst $src] 85 puts_stdout "copying $src to $dst" 86 file copy $src $dst 87 return 1 88 } 89 return 0 90} 91 92proc Install {} { 93 global libs dll tcl_platform imglibs 94 if [winfo exists .t] { 95 raise .t 96 } else { 97 toplevel .t 98 frame .t.f 99 button .t.f.d -text dismiss -command [list destroy .t] 100 pack .t.f.d -side left 101 pack .t.f -side top -fill x 102 text .t.t -yscrollcommand [list .t.s set] 103 scrollbar .t.s -command [list .t.t yview] 104 pack .t.t .t.s -side left -expand y -fill both 105 } 106 .t.t delete 1.0 end 107 proc puts_stdout args { 108 .t.t insert end "[lindex $args 0]\n" 109 .t.t see end 110 update 111 } 112 .t.t see end 113 if ![string compare $tcl_platform(platform) windows] { 114 set dir [.f2.e get] 115 foreach lib $dll { 116 Copy $lib $dir 117 } 118 } 119 set dir [.f3.e get] 120 foreach lib $libs { 121 if {[Copy $lib $dir] && ![string compare [info sharedlibextension] .so]} { 122 while {[string compare .so [set ext [file extension $lib]]]} { 123 file delete [set file [file join $dir [file rootname $lib]]] 124 puts_stdout "ln -s $lib $file" 125 exec ln -s $lib $file 126 set lib [file rootname $lib] 127 } 128 } 129 } 130 set dir [.f4.e get] 131 foreach lib [list zlib.h zconf.h png.h pngconf.h jpeglib.h jconfig.h \ 132 jmorecfg.h jerror.h tiff.h tiffio.h tiffconf.h freetype.h gif_lib.h] { 133 Copy $lib $dir 134 } 135 set dir [.f5.e get] 136 catch {file mkdir $dir} 137 foreach lib "$imglibs pkgIndex.tcl" { 138 Copy $lib $dir 139 } 140 puts_stdout "---------- installation complete ----------" 141} 142