os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tools/genWinImage.tcl
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tools/genWinImage.tcl Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,157 @@
1.4 +# genWinImage.tcl --
1.5 +#
1.6 +# This script generates the Windows installer.
1.7 +#
1.8 +# Copyright (c) 1999 by Scriptics Corporation.
1.9 +# All rights reserved.
1.10 +#
1.11 +# RCS: @(#) $Id: genWinImage.tcl,v 1.5 2000/04/25 22:29:21 hobbs Exp $
1.12 +
1.13 +
1.14 +# This file is insensitive to the directory from which it is invoked.
1.15 +
1.16 +namespace eval genWinImage {
1.17 + # toolsDir --
1.18 + #
1.19 + # This variable points to the platform specific tools directory.
1.20 +
1.21 + variable toolsDir
1.22 +
1.23 + # tclBuildDir --
1.24 + #
1.25 + # This variable points to the directory containing the Tcl built tree.
1.26 +
1.27 + variable tclBuildDir
1.28 +
1.29 + # tkBuildDir --
1.30 + #
1.31 + # This variable points to the directory containing the Tk built tree.
1.32 +
1.33 + variable tkBuildDir
1.34 +
1.35 + # our script name at runtime
1.36 + variable script [info script]
1.37 +}
1.38 +
1.39 +# genWinImage::init --
1.40 +#
1.41 +# This is the main entry point.
1.42 +#
1.43 +# Arguments:
1.44 +# None.
1.45 +#
1.46 +# Results:
1.47 +# None.
1.48 +
1.49 +proc genWinImage::init {} {
1.50 + global tcl_platform argv argv0
1.51 + variable tclBuildDir
1.52 + variable tkBuildDir
1.53 + variable toolsDir
1.54 + variable script
1.55 +
1.56 + puts "\n--- $script started: \
1.57 + [clock format [clock seconds] -format "%Y%m%d-%H:%M"] --\n"
1.58 +
1.59 + if {$tcl_platform(platform) != "windows"} {
1.60 + puts stderr "ERROR: Cannot build TCL.EXE on Unix systems"
1.61 + exit 1
1.62 + }
1.63 +
1.64 + if {[llength $argv] != 3} {
1.65 + puts stderr "usage: $argv0 <tclBuildDir> <tkBuildDir> <toolsDir>"
1.66 + exit 0
1.67 + }
1.68 +
1.69 + set tclBuildDir [lindex $argv 0]
1.70 + set tkBuildDir [lindex $argv 1]
1.71 + set toolsDir [lindex $argv 2]
1.72 +
1.73 + generateInstallers
1.74 +
1.75 + puts "\n--- $script finished: \
1.76 + [clock format [clock seconds] -format "%Y%m%d-%H:%M"] --\n\n"
1.77 +}
1.78 +
1.79 +# genWinImage::makeTextFile --
1.80 +#
1.81 +# Convert the input file into a CRLF terminated text file.
1.82 +#
1.83 +# Arguments:
1.84 +# infile The input file to convert.
1.85 +# outfile The location where the text file should be stored.
1.86 +#
1.87 +# Results:
1.88 +# None.
1.89 +
1.90 +proc genWinImage::makeTextFile {infile outfile} {
1.91 + set f [open $infile r]
1.92 + set text [read $f]
1.93 + close $f
1.94 + set f [open $outfile w]
1.95 + fconfigure $f -translation crlf
1.96 + puts -nonewline $f $text
1.97 + close $f
1.98 +}
1.99 +
1.100 +# genWinImage::generateInstallers --
1.101 +#
1.102 +# Perform substitutions on the pro.wse.in file and then
1.103 +# invoke the WSE script twice; once for CD and once for web.
1.104 +#
1.105 +# Arguments:
1.106 +# None.
1.107 +#
1.108 +# Results:
1.109 +# Leaves proweb.exe and procd.exe sitting in the curent directory.
1.110 +
1.111 +proc genWinImage::generateInstallers {} {
1.112 + variable toolsDir
1.113 + variable tclBuildDir
1.114 + variable tkBuildDir
1.115 +
1.116 + # Now read the "pro/srcs/install/pro.wse.in" file, have Tcl make
1.117 + # appropriate substitutions, write out the resulting file in a
1.118 + # current-working-directory. Use this new file to perform installation
1.119 + # image creation. Note that we have to use this technique to set
1.120 + # the value of _WISE_ because wise32 won't use a /d switch for this
1.121 + # variable.
1.122 +
1.123 + set __TCLBASEDIR__ [file native $tclBuildDir]
1.124 + set __TKBASEDIR__ [file native $tkBuildDir]
1.125 + set __WISE__ [file native [file join $toolsDir wise]]
1.126 +
1.127 + set f [open [file join $__TCLBASEDIR__ generic/tcl.h] r]
1.128 + set s [read $f]
1.129 + close $f
1.130 + regexp {TCL_PATCH_LEVEL\s*\"([^\"]*)\"} $s dummy __TCL_PATCH_LEVEL__
1.131 +
1.132 + set f [open tcl.wse.in r]
1.133 + set s [read $f]
1.134 + close $f
1.135 + set s [subst -nocommands -nobackslashes $s]
1.136 + set f [open tcl.wse w]
1.137 + puts $f $s
1.138 + close $f
1.139 +
1.140 + # Ensure the text files are CRLF terminated
1.141 +
1.142 + makeTextFile [file join $tclBuildDir win/README.binary] \
1.143 + [file join $tclBuildDir win/readme.txt]
1.144 + makeTextFile [file join $tclBuildDir license.terms] \
1.145 + [file join $tclBuildDir license.txt]
1.146 +
1.147 + set wise32ProgFilePath [file native [file join $__WISE__ wise32.exe]]
1.148 +
1.149 + # Run the Wise installer to create the Windows install images.
1.150 +
1.151 + if {[catch {exec [file native $wise32ProgFilePath] /c tcl.wse} errMsg]} {
1.152 + puts stderr "ERROR: $errMsg"
1.153 + } else {
1.154 + puts "\"TCL.EXE\" created."
1.155 + }
1.156 +
1.157 + return
1.158 +}
1.159 +
1.160 +genWinImage::init