author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
sl@0 | 1 |
# genWinImage.tcl -- |
sl@0 | 2 |
# |
sl@0 | 3 |
# This script generates the Windows installer. |
sl@0 | 4 |
# |
sl@0 | 5 |
# Copyright (c) 1999 by Scriptics Corporation. |
sl@0 | 6 |
# All rights reserved. |
sl@0 | 7 |
# |
sl@0 | 8 |
# RCS: @(#) $Id: genWinImage.tcl,v 1.5 2000/04/25 22:29:21 hobbs Exp $ |
sl@0 | 9 |
|
sl@0 | 10 |
|
sl@0 | 11 |
# This file is insensitive to the directory from which it is invoked. |
sl@0 | 12 |
|
sl@0 | 13 |
namespace eval genWinImage { |
sl@0 | 14 |
# toolsDir -- |
sl@0 | 15 |
# |
sl@0 | 16 |
# This variable points to the platform specific tools directory. |
sl@0 | 17 |
|
sl@0 | 18 |
variable toolsDir |
sl@0 | 19 |
|
sl@0 | 20 |
# tclBuildDir -- |
sl@0 | 21 |
# |
sl@0 | 22 |
# This variable points to the directory containing the Tcl built tree. |
sl@0 | 23 |
|
sl@0 | 24 |
variable tclBuildDir |
sl@0 | 25 |
|
sl@0 | 26 |
# tkBuildDir -- |
sl@0 | 27 |
# |
sl@0 | 28 |
# This variable points to the directory containing the Tk built tree. |
sl@0 | 29 |
|
sl@0 | 30 |
variable tkBuildDir |
sl@0 | 31 |
|
sl@0 | 32 |
# our script name at runtime |
sl@0 | 33 |
variable script [info script] |
sl@0 | 34 |
} |
sl@0 | 35 |
|
sl@0 | 36 |
# genWinImage::init -- |
sl@0 | 37 |
# |
sl@0 | 38 |
# This is the main entry point. |
sl@0 | 39 |
# |
sl@0 | 40 |
# Arguments: |
sl@0 | 41 |
# None. |
sl@0 | 42 |
# |
sl@0 | 43 |
# Results: |
sl@0 | 44 |
# None. |
sl@0 | 45 |
|
sl@0 | 46 |
proc genWinImage::init {} { |
sl@0 | 47 |
global tcl_platform argv argv0 |
sl@0 | 48 |
variable tclBuildDir |
sl@0 | 49 |
variable tkBuildDir |
sl@0 | 50 |
variable toolsDir |
sl@0 | 51 |
variable script |
sl@0 | 52 |
|
sl@0 | 53 |
puts "\n--- $script started: \ |
sl@0 | 54 |
[clock format [clock seconds] -format "%Y%m%d-%H:%M"] --\n" |
sl@0 | 55 |
|
sl@0 | 56 |
if {$tcl_platform(platform) != "windows"} { |
sl@0 | 57 |
puts stderr "ERROR: Cannot build TCL.EXE on Unix systems" |
sl@0 | 58 |
exit 1 |
sl@0 | 59 |
} |
sl@0 | 60 |
|
sl@0 | 61 |
if {[llength $argv] != 3} { |
sl@0 | 62 |
puts stderr "usage: $argv0 <tclBuildDir> <tkBuildDir> <toolsDir>" |
sl@0 | 63 |
exit 0 |
sl@0 | 64 |
} |
sl@0 | 65 |
|
sl@0 | 66 |
set tclBuildDir [lindex $argv 0] |
sl@0 | 67 |
set tkBuildDir [lindex $argv 1] |
sl@0 | 68 |
set toolsDir [lindex $argv 2] |
sl@0 | 69 |
|
sl@0 | 70 |
generateInstallers |
sl@0 | 71 |
|
sl@0 | 72 |
puts "\n--- $script finished: \ |
sl@0 | 73 |
[clock format [clock seconds] -format "%Y%m%d-%H:%M"] --\n\n" |
sl@0 | 74 |
} |
sl@0 | 75 |
|
sl@0 | 76 |
# genWinImage::makeTextFile -- |
sl@0 | 77 |
# |
sl@0 | 78 |
# Convert the input file into a CRLF terminated text file. |
sl@0 | 79 |
# |
sl@0 | 80 |
# Arguments: |
sl@0 | 81 |
# infile The input file to convert. |
sl@0 | 82 |
# outfile The location where the text file should be stored. |
sl@0 | 83 |
# |
sl@0 | 84 |
# Results: |
sl@0 | 85 |
# None. |
sl@0 | 86 |
|
sl@0 | 87 |
proc genWinImage::makeTextFile {infile outfile} { |
sl@0 | 88 |
set f [open $infile r] |
sl@0 | 89 |
set text [read $f] |
sl@0 | 90 |
close $f |
sl@0 | 91 |
set f [open $outfile w] |
sl@0 | 92 |
fconfigure $f -translation crlf |
sl@0 | 93 |
puts -nonewline $f $text |
sl@0 | 94 |
close $f |
sl@0 | 95 |
} |
sl@0 | 96 |
|
sl@0 | 97 |
# genWinImage::generateInstallers -- |
sl@0 | 98 |
# |
sl@0 | 99 |
# Perform substitutions on the pro.wse.in file and then |
sl@0 | 100 |
# invoke the WSE script twice; once for CD and once for web. |
sl@0 | 101 |
# |
sl@0 | 102 |
# Arguments: |
sl@0 | 103 |
# None. |
sl@0 | 104 |
# |
sl@0 | 105 |
# Results: |
sl@0 | 106 |
# Leaves proweb.exe and procd.exe sitting in the curent directory. |
sl@0 | 107 |
|
sl@0 | 108 |
proc genWinImage::generateInstallers {} { |
sl@0 | 109 |
variable toolsDir |
sl@0 | 110 |
variable tclBuildDir |
sl@0 | 111 |
variable tkBuildDir |
sl@0 | 112 |
|
sl@0 | 113 |
# Now read the "pro/srcs/install/pro.wse.in" file, have Tcl make |
sl@0 | 114 |
# appropriate substitutions, write out the resulting file in a |
sl@0 | 115 |
# current-working-directory. Use this new file to perform installation |
sl@0 | 116 |
# image creation. Note that we have to use this technique to set |
sl@0 | 117 |
# the value of _WISE_ because wise32 won't use a /d switch for this |
sl@0 | 118 |
# variable. |
sl@0 | 119 |
|
sl@0 | 120 |
set __TCLBASEDIR__ [file native $tclBuildDir] |
sl@0 | 121 |
set __TKBASEDIR__ [file native $tkBuildDir] |
sl@0 | 122 |
set __WISE__ [file native [file join $toolsDir wise]] |
sl@0 | 123 |
|
sl@0 | 124 |
set f [open [file join $__TCLBASEDIR__ generic/tcl.h] r] |
sl@0 | 125 |
set s [read $f] |
sl@0 | 126 |
close $f |
sl@0 | 127 |
regexp {TCL_PATCH_LEVEL\s*\"([^\"]*)\"} $s dummy __TCL_PATCH_LEVEL__ |
sl@0 | 128 |
|
sl@0 | 129 |
set f [open tcl.wse.in r] |
sl@0 | 130 |
set s [read $f] |
sl@0 | 131 |
close $f |
sl@0 | 132 |
set s [subst -nocommands -nobackslashes $s] |
sl@0 | 133 |
set f [open tcl.wse w] |
sl@0 | 134 |
puts $f $s |
sl@0 | 135 |
close $f |
sl@0 | 136 |
|
sl@0 | 137 |
# Ensure the text files are CRLF terminated |
sl@0 | 138 |
|
sl@0 | 139 |
makeTextFile [file join $tclBuildDir win/README.binary] \ |
sl@0 | 140 |
[file join $tclBuildDir win/readme.txt] |
sl@0 | 141 |
makeTextFile [file join $tclBuildDir license.terms] \ |
sl@0 | 142 |
[file join $tclBuildDir license.txt] |
sl@0 | 143 |
|
sl@0 | 144 |
set wise32ProgFilePath [file native [file join $__WISE__ wise32.exe]] |
sl@0 | 145 |
|
sl@0 | 146 |
# Run the Wise installer to create the Windows install images. |
sl@0 | 147 |
|
sl@0 | 148 |
if {[catch {exec [file native $wise32ProgFilePath] /c tcl.wse} errMsg]} { |
sl@0 | 149 |
puts stderr "ERROR: $errMsg" |
sl@0 | 150 |
} else { |
sl@0 | 151 |
puts "\"TCL.EXE\" created." |
sl@0 | 152 |
} |
sl@0 | 153 |
|
sl@0 | 154 |
return |
sl@0 | 155 |
} |
sl@0 | 156 |
|
sl@0 | 157 |
genWinImage::init |