sl@0: # genWinImage.tcl -- sl@0: # sl@0: # This script generates the Windows installer. sl@0: # sl@0: # Copyright (c) 1999 by Scriptics Corporation. sl@0: # All rights reserved. sl@0: # sl@0: # RCS: @(#) $Id: genWinImage.tcl,v 1.5 2000/04/25 22:29:21 hobbs Exp $ sl@0: sl@0: sl@0: # This file is insensitive to the directory from which it is invoked. sl@0: sl@0: namespace eval genWinImage { sl@0: # toolsDir -- sl@0: # sl@0: # This variable points to the platform specific tools directory. sl@0: sl@0: variable toolsDir sl@0: sl@0: # tclBuildDir -- sl@0: # sl@0: # This variable points to the directory containing the Tcl built tree. sl@0: sl@0: variable tclBuildDir sl@0: sl@0: # tkBuildDir -- sl@0: # sl@0: # This variable points to the directory containing the Tk built tree. sl@0: sl@0: variable tkBuildDir sl@0: sl@0: # our script name at runtime sl@0: variable script [info script] sl@0: } sl@0: sl@0: # genWinImage::init -- sl@0: # sl@0: # This is the main entry point. sl@0: # sl@0: # Arguments: sl@0: # None. sl@0: # sl@0: # Results: sl@0: # None. sl@0: sl@0: proc genWinImage::init {} { sl@0: global tcl_platform argv argv0 sl@0: variable tclBuildDir sl@0: variable tkBuildDir sl@0: variable toolsDir sl@0: variable script sl@0: sl@0: puts "\n--- $script started: \ sl@0: [clock format [clock seconds] -format "%Y%m%d-%H:%M"] --\n" sl@0: sl@0: if {$tcl_platform(platform) != "windows"} { sl@0: puts stderr "ERROR: Cannot build TCL.EXE on Unix systems" sl@0: exit 1 sl@0: } sl@0: sl@0: if {[llength $argv] != 3} { sl@0: puts stderr "usage: $argv0 " sl@0: exit 0 sl@0: } sl@0: sl@0: set tclBuildDir [lindex $argv 0] sl@0: set tkBuildDir [lindex $argv 1] sl@0: set toolsDir [lindex $argv 2] sl@0: sl@0: generateInstallers sl@0: sl@0: puts "\n--- $script finished: \ sl@0: [clock format [clock seconds] -format "%Y%m%d-%H:%M"] --\n\n" sl@0: } sl@0: sl@0: # genWinImage::makeTextFile -- sl@0: # sl@0: # Convert the input file into a CRLF terminated text file. sl@0: # sl@0: # Arguments: sl@0: # infile The input file to convert. sl@0: # outfile The location where the text file should be stored. sl@0: # sl@0: # Results: sl@0: # None. sl@0: sl@0: proc genWinImage::makeTextFile {infile outfile} { sl@0: set f [open $infile r] sl@0: set text [read $f] sl@0: close $f sl@0: set f [open $outfile w] sl@0: fconfigure $f -translation crlf sl@0: puts -nonewline $f $text sl@0: close $f sl@0: } sl@0: sl@0: # genWinImage::generateInstallers -- sl@0: # sl@0: # Perform substitutions on the pro.wse.in file and then sl@0: # invoke the WSE script twice; once for CD and once for web. sl@0: # sl@0: # Arguments: sl@0: # None. sl@0: # sl@0: # Results: sl@0: # Leaves proweb.exe and procd.exe sitting in the curent directory. sl@0: sl@0: proc genWinImage::generateInstallers {} { sl@0: variable toolsDir sl@0: variable tclBuildDir sl@0: variable tkBuildDir sl@0: sl@0: # Now read the "pro/srcs/install/pro.wse.in" file, have Tcl make sl@0: # appropriate substitutions, write out the resulting file in a sl@0: # current-working-directory. Use this new file to perform installation sl@0: # image creation. Note that we have to use this technique to set sl@0: # the value of _WISE_ because wise32 won't use a /d switch for this sl@0: # variable. sl@0: sl@0: set __TCLBASEDIR__ [file native $tclBuildDir] sl@0: set __TKBASEDIR__ [file native $tkBuildDir] sl@0: set __WISE__ [file native [file join $toolsDir wise]] sl@0: sl@0: set f [open [file join $__TCLBASEDIR__ generic/tcl.h] r] sl@0: set s [read $f] sl@0: close $f sl@0: regexp {TCL_PATCH_LEVEL\s*\"([^\"]*)\"} $s dummy __TCL_PATCH_LEVEL__ sl@0: sl@0: set f [open tcl.wse.in r] sl@0: set s [read $f] sl@0: close $f sl@0: set s [subst -nocommands -nobackslashes $s] sl@0: set f [open tcl.wse w] sl@0: puts $f $s sl@0: close $f sl@0: sl@0: # Ensure the text files are CRLF terminated sl@0: sl@0: makeTextFile [file join $tclBuildDir win/README.binary] \ sl@0: [file join $tclBuildDir win/readme.txt] sl@0: makeTextFile [file join $tclBuildDir license.terms] \ sl@0: [file join $tclBuildDir license.txt] sl@0: sl@0: set wise32ProgFilePath [file native [file join $__WISE__ wise32.exe]] sl@0: sl@0: # Run the Wise installer to create the Windows install images. sl@0: sl@0: if {[catch {exec [file native $wise32ProgFilePath] /c tcl.wse} errMsg]} { sl@0: puts stderr "ERROR: $errMsg" sl@0: } else { sl@0: puts "\"TCL.EXE\" created." sl@0: } sl@0: sl@0: return sl@0: } sl@0: sl@0: genWinImage::init