diff options
author | hypnotoad <yoda@etoyoc.com> | 2017-11-08 09:41:00 (GMT) |
---|---|---|
committer | hypnotoad <yoda@etoyoc.com> | 2017-11-08 09:41:00 (GMT) |
commit | b2722c42b1a43b10ba1047b6be28d5b4663732b8 (patch) | |
tree | e23cb491d47c82dd36f752d4f7981534ab9b9aa1 /tools/mkVfs.tcl | |
parent | c2dfae075806fd3b5117755f85ba3e8a3a6c2170 (diff) | |
download | tcl-b2722c42b1a43b10ba1047b6be28d5b4663732b8.zip tcl-b2722c42b1a43b10ba1047b6be28d5b4663732b8.tar.gz tcl-b2722c42b1a43b10ba1047b6be28d5b4663732b8.tar.bz2 |
Pairing down the tip#430 branch to only include files and utilities
called out by the tip. Eliminated the header files tclZipfs.h and
zcrypt.h. The only public calls for tclZipfs.h are now in the stubs
table and the contents of zcrypt.h are already part of the minizip
implementation that Tcl keeps around in the compat/zlib/contrib/minizip
directory. tclBootVFS.h hasn't been used by the implementation in a while.
Alos eliminated the mkzip.tcl facility from tools/. The C based mkzip is
much faster and more reliable
Diffstat (limited to 'tools/mkVfs.tcl')
-rw-r--r-- | tools/mkVfs.tcl | 198 |
1 files changed, 99 insertions, 99 deletions
diff --git a/tools/mkVfs.tcl b/tools/mkVfs.tcl index e670775..cbfb81e 100644 --- a/tools/mkVfs.tcl +++ b/tools/mkVfs.tcl @@ -1,99 +1,99 @@ -proc cat fname {
- set fname [open $fname r]
- set data [read $fname]
- close $fname
- return $data
-}
-
-proc pkgIndexDir {root fout d1} {
-
- puts [format {%*sIndexing %s} [expr {4 * [info level]}] {} \
- [file tail $d1]]
- set idx [string length $root]
- foreach ftail [glob -directory $d1 -nocomplain -tails *] {
- set f [file join $d1 $ftail]
- if {[file isdirectory $f] && [string compare CVS $ftail]} {
- pkgIndexDir $root $fout $f
- } elseif {[file tail $f] eq "pkgIndex.tcl"} {
- puts $fout "set dir \${VFSROOT}[string range $d1 $idx end]"
- puts $fout [cat $f]
- }
- }
-}
-
-###
-# Script to build the VFS file system
-###
-proc copyDir {d1 d2} {
-
- puts [format {%*sCreating %s} [expr {4 * [info level]}] {} \
- [file tail $d2]]
-
- file delete -force -- $d2
- file mkdir $d2
-
- foreach ftail [glob -directory $d1 -nocomplain -tails *] {
- set f [file join $d1 $ftail]
- if {[file isdirectory $f] && [string compare CVS $ftail]} {
- copyDir $f [file join $d2 $ftail]
- } elseif {[file isfile $f]} {
- file copy -force $f [file join $d2 $ftail]
- if {$::tcl_platform(platform) eq {unix}} {
- file attributes [file join $d2 $ftail] -permissions 0644
- } else {
- file attributes [file join $d2 $ftail] -readonly 1
- }
- }
- }
-
- if {$::tcl_platform(platform) eq {unix}} {
- file attributes $d2 -permissions 0755
- } else {
- file attributes $d2 -readonly 1
- }
-}
-
-if {[llength $argv] < 3} {
- puts "Usage: VFS_ROOT TCLSRC_ROOT PLATFORM"
- exit 1
-}
-set TCL_SCRIPT_DIR [lindex $argv 0]
-set TCLSRC_ROOT [lindex $argv 1]
-set PLATFORM [lindex $argv 2]
-set TKDLL [lindex $argv 3]
-set TKVER [lindex $argv 4]
-
-puts "Building [file tail $TCL_SCRIPT_DIR] for $PLATFORM"
-copyDir ${TCLSRC_ROOT}/library ${TCL_SCRIPT_DIR}
-
-if {$PLATFORM == "windows"} {
- set ddedll [glob -nocomplain ${TCLSRC_ROOT}/win/tcldde*.dll]
- puts "DDE DLL $ddedll"
- if {$ddedll != {}} {
- file copy $ddedll ${TCL_SCRIPT_DIR}/dde
- }
- set regdll [glob -nocomplain ${TCLSRC_ROOT}/win/tclreg*.dll]
- puts "REG DLL $ddedll"
- if {$regdll != {}} {
- file copy $regdll ${TCL_SCRIPT_DIR}/reg
- }
-} else {
- # Remove the dde and reg package paths
- file delete -force ${TCL_SCRIPT_DIR}/dde
- file delete -force ${TCL_SCRIPT_DIR}/reg
-}
-
-# For the following packages, cat their pkgIndex files to tclIndex
-file attributes ${TCL_SCRIPT_DIR}/tclIndex -readonly 0
-set fout [open ${TCL_SCRIPT_DIR}/tclIndex a]
-puts $fout {#
-# MANIFEST OF INCLUDED PACKAGES
-#
-set VFSROOT $dir
-}
-if {$TKDLL ne {} && [file exists $TKDLL]} {
- file copy $TKDLL ${TCL_SCRIPT_DIR}
- puts $fout [list package ifneeded Tk $TKVER "load \$dir $TKDLL"]
-}
-pkgIndexDir ${TCL_SCRIPT_DIR} $fout ${TCL_SCRIPT_DIR}
-close $fout
+proc cat fname { + set fname [open $fname r] + set data [read $fname] + close $fname + return $data +} + +proc pkgIndexDir {root fout d1} { + + puts [format {%*sIndexing %s} [expr {4 * [info level]}] {} \ + [file tail $d1]] + set idx [string length $root] + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + pkgIndexDir $root $fout $f + } elseif {[file tail $f] eq "pkgIndex.tcl"} { + puts $fout "set dir \${VFSROOT}[string range $d1 $idx end]" + puts $fout [cat $f] + } + } +} + +### +# Script to build the VFS file system +### +proc copyDir {d1 d2} { + + puts [format {%*sCreating %s} [expr {4 * [info level]}] {} \ + [file tail $d2]] + + file delete -force -- $d2 + file mkdir $d2 + + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + copyDir $f [file join $d2 $ftail] + } elseif {[file isfile $f]} { + file copy -force $f [file join $d2 $ftail] + if {$::tcl_platform(platform) eq {unix}} { + file attributes [file join $d2 $ftail] -permissions 0644 + } else { + file attributes [file join $d2 $ftail] -readonly 1 + } + } + } + + if {$::tcl_platform(platform) eq {unix}} { + file attributes $d2 -permissions 0755 + } else { + file attributes $d2 -readonly 1 + } +} + +if {[llength $argv] < 3} { + puts "Usage: VFS_ROOT TCLSRC_ROOT PLATFORM" + exit 1 +} +set TCL_SCRIPT_DIR [lindex $argv 0] +set TCLSRC_ROOT [lindex $argv 1] +set PLATFORM [lindex $argv 2] +set TKDLL [lindex $argv 3] +set TKVER [lindex $argv 4] + +puts "Building [file tail $TCL_SCRIPT_DIR] for $PLATFORM" +copyDir ${TCLSRC_ROOT}/library ${TCL_SCRIPT_DIR} + +if {$PLATFORM == "windows"} { + set ddedll [glob -nocomplain ${TCLSRC_ROOT}/win/tcldde*.dll] + puts "DDE DLL $ddedll" + if {$ddedll != {}} { + file copy $ddedll ${TCL_SCRIPT_DIR}/dde + } + set regdll [glob -nocomplain ${TCLSRC_ROOT}/win/tclreg*.dll] + puts "REG DLL $ddedll" + if {$regdll != {}} { + file copy $regdll ${TCL_SCRIPT_DIR}/reg + } +} else { + # Remove the dde and reg package paths + file delete -force ${TCL_SCRIPT_DIR}/dde + file delete -force ${TCL_SCRIPT_DIR}/reg +} + +# For the following packages, cat their pkgIndex files to tclIndex +file attributes ${TCL_SCRIPT_DIR}/tclIndex -readonly 0 +set fout [open ${TCL_SCRIPT_DIR}/tclIndex a] +puts $fout {# +# MANIFEST OF INCLUDED PACKAGES +# +set VFSROOT $dir +} +if {$TKDLL ne {} && [file exists $TKDLL]} { + file copy $TKDLL ${TCL_SCRIPT_DIR} + puts $fout [list package ifneeded Tk $TKVER "load \$dir $TKDLL"] +} +pkgIndexDir ${TCL_SCRIPT_DIR} $fout ${TCL_SCRIPT_DIR} +close $fout |