namespace eval genWinImage {
variable toolsDir
variable tclBuildDir
variable tkBuildDir
variable script [info script]
}
proc genWinImage::init {} {
global tcl_platform argv argv0
variable tclBuildDir
variable tkBuildDir
variable toolsDir
variable script
puts "\n--- $script started: \
[clock format [clock seconds] -format "%Y%m%d-%H:%M"] --\n"
if {$tcl_platform(platform) != "windows"} {
puts stderr "ERROR: Cannot build TCL.EXE on Unix systems"
exit 1
}
if {[llength $argv] != 3} {
puts stderr "usage: $argv0 <tclBuildDir> <tkBuildDir> <toolsDir>"
exit 0
}
set tclBuildDir [lindex $argv 0]
set tkBuildDir [lindex $argv 1]
set toolsDir [lindex $argv 2]
generateInstallers
puts "\n--- $script finished: \
[clock format [clock seconds] -format "%Y%m%d-%H:%M"] --\n\n"
}
proc genWinImage::makeTextFile {infile outfile} {
set f [open $infile r]
set text [read $f]
close $f
set f [open $outfile w]
fconfigure $f -translation crlf
puts -nonewline $f $text
close $f
}
proc genWinImage::generateInstallers {} {
variable toolsDir
variable tclBuildDir
variable tkBuildDir
set __TCLBASEDIR__ [file native $tclBuildDir]
set __TKBASEDIR__ [file native $tkBuildDir]
set __WISE__ [file native [file join $toolsDir wise]]
set f [open [file join $__TCLBASEDIR__ generic/tcl.h] r]
set s [read $f]
close $f
regexp {TCL_PATCH_LEVEL\s*\"([^\"]*)\"} $s dummy __TCL_PATCH_LEVEL__
set f [open tcl.wse.in r]
set s [read $f]
close $f
set s [subst -nocommands -nobackslashes $s]
set f [open tcl.wse w]
puts $f $s
close $f
# Ensure the text files are CRLF terminated
makeTextFile [file join $tclBuildDir win/README.binary] \
[file join $tclBuildDir win/readme.txt]
makeTextFile [file join $tclBuildDir license.terms] \
[file join $tclBuildDir license.txt]
set wise32ProgFilePath [file native [file join $__WISE__ wise32.exe]]
# Run the Wise installer to create the Windows install images.
if {[catch {exec [file native $wise32ProgFilePath] /c tcl.wse} errMsg]} {
puts stderr "ERROR: $errMsg"
} else {
puts "\"TCL.EXE\" created."
}
return
}
genWinImage::init