From 3ee316c8220c48c6a84dacdde0c7482ab66487e4 Mon Sep 17 00:00:00 2001 From: patthoyts Date: Sun, 22 Mar 2009 18:54:18 +0000 Subject: [PATCH] The 8.6 core zlib cannot be used for the vfs::zstreamed mode that is used with mk4vfs. This commit disabled zstreamed for 8.6 so we will never call this tclvfs function for 8.6 tclkits. The tclvfs pkgIndex code has been moved from files/ into setupvfs.tcl to make it easier to handle new versions of tclvfs. Makefile.vc gets some post-build sanity checking to ensure we do not produce useless tclkits. git-svn-id: svn://svn.equi4.com/kitgen/trunk@4468 9e558909-932a-0410-a563-af77432da1eb --- Makefile.vc | 21 +++++++++++++-------- files/boot.tcl | 5 ++++- files/vfs1.3-pkgIndex.tcl | 7 ------- files/vfs1.4-pkgIndex.tcl | 7 ------- setupvfs.tcl | 33 +++++++++++++++++++++++++++++---- 5 files changed, 46 insertions(+), 27 deletions(-) delete mode 100644 files/vfs1.3-pkgIndex.tcl delete mode 100644 files/vfs1.4-pkgIndex.tcl diff --git a/Makefile.vc b/Makefile.vc index e225150..70dda22 100644 --- a/Makefile.vc +++ b/Makefile.vc @@ -153,6 +153,7 @@ GUIOBJS = $(BUILD)\pwb.obj $(BUILD)\rechan.obj \ $(BUILD)\winMain.obj $(BUILD)\tclkit.res !if $V < 86 +CFLAGS=$(CFLAGS) -DKIT_INCLUDES_ZLIB=1 CLIOBJS = $(CLIOBJS) $(BUILD)\zlib.obj GUIOBJS = $(GUIOBJS) $(BUILD)\zlib.obj !endif @@ -173,11 +174,13 @@ tclkit-cli.exe: kit-cli.exe tidy kit-cli.exe -init- ../../setupvfs.tcl $(KITOPTS) $@ cli $@ << puts "version : Tcl [info patchlevel] $$tcl_platform(osVersion) $$tcl_platform(machine)" -foreach pkg {starkit rechan registry dde} {package require $$pkg} +set ext {starkit rechan registry dde} +foreach lib [info loaded] {if {[lindex $$lib 1] eq "zlib"} {lappend ext zlib}} +foreach pkg $$ext {package require $$pkg} +set f [open [info nameofexecutable]/boot.tcl r] +list [seek $$f 0 end] [tell $$f] [close $$f] interp create slave -slave eval { - foreach pkg {starkit rechan registry dde} {package require $$pkg} -} +slave eval [list foreach pkg $$ext {package require $$pkg}] << @@ -219,11 +222,13 @@ tclkitsh.exe: kitsh.exe tidy kitsh.exe -init- ../../setupvfs.tcl $(KITOPTS) $@ cli $@ << puts "version : Tcl [info patchlevel] $$tcl_platform(osVersion) $$tcl_platform(machine)" -foreach pkg {starkit rechan registry dde} {package require $$pkg} +set ext {starkit rechan registry dde Mk4tcl Itcl} +foreach lib [info loaded] {if {[lindex $$lib 1] eq "zlib"} {lappend ext zlib}} +foreach pkg $$ext {package require $$pkg} +set f [open [info nameofexecutable]/boot.tcl r] +list [seek $$f 0 end] [tell $$f] [close $$f] interp create slave -slave eval { - foreach pkg {starkit rechan registry dde} {package require $$pkg} -} +slave eval [list foreach pkg $$ext {package require $$pkg}] << tclkit.exe: kitsh.exe kit.exe tidy diff --git a/files/boot.tcl b/files/boot.tcl index 8d19fce..db47f30 100644 --- a/files/boot.tcl +++ b/files/boot.tcl @@ -38,7 +38,10 @@ proc tclInit {} { } # use on-the-fly decompression, if mk4vfs understands that - set mk4vfs::zstreamed 1 + # Note: 8.6 core zlib does not support this for mk4vfs + if {![package vsatisfies [package require Tcl] 8.6]} { + set mk4vfs::zstreamed 1 + } } else { set driver mkcl diff --git a/files/vfs1.3-pkgIndex.tcl b/files/vfs1.3-pkgIndex.tcl deleted file mode 100644 index 7d76217..0000000 --- a/files/vfs1.3-pkgIndex.tcl +++ /dev/null @@ -1,7 +0,0 @@ -package ifneeded vfs 1.3 [list load {} vfs] -package ifneeded starkit 1.3.2 [list source [file join $dir starkit.tcl]] -package ifneeded vfslib 1.3.1 [list source [file join $dir vfslib.tcl]] -package ifneeded vfs::mk4 1.10.1 [list source [file join $dir mk4vfs.tcl]] -package ifneeded vfs::zip 1.0.1 [list source [file join $dir zipvfs.tcl]] -#compat -package ifneeded mk4vfs 1.10.1 [list source [file join $dir mk4vfscompat.tcl]] diff --git a/files/vfs1.4-pkgIndex.tcl b/files/vfs1.4-pkgIndex.tcl deleted file mode 100644 index 699a860..0000000 --- a/files/vfs1.4-pkgIndex.tcl +++ /dev/null @@ -1,7 +0,0 @@ -package ifneeded vfs 1.4 [list load {} vfs] -package ifneeded starkit 1.3.3 [list source [file join $dir starkit.tcl]] -package ifneeded vfslib 1.4 [list source [file join $dir vfslib.tcl]] -package ifneeded vfs::mk4 1.10.1 [list source [file join $dir mk4vfs.tcl]] -package ifneeded vfs::zip 1.0.2 [list source [file join $dir zipvfs.tcl]] -package ifneeded vfs::tar 0.91 [list source [file join $dir tarvfs.tcl]] - diff --git a/setupvfs.tcl b/setupvfs.tcl index 5966eb4..ce10e37 100644 --- a/setupvfs.tcl +++ b/setupvfs.tcl @@ -149,8 +149,8 @@ set guifiles { lib/tk8@/unsupported.tcl lib/tk8@/xmfbox.tcl } -# handle files no longer present -foreach f { lib/tk8@/prolog.ps } { +# handle new or deleted files +foreach f { lib/tk8@/prolog.ps lib/tk8@/icons.tcl } { set fx [string map $versmap $f] if {[file exists build/$fx]} { lappend guifiles $f @@ -220,6 +220,9 @@ proc locatefile {f} { if {$::debugOpt} { puts " $n ==> \$vfs/$f" } + } elseif {[string match "lib/vfs*/pkgIndex.tcl" $f]} { + set n [mk_tclvfs_index build/$f] + if {$::debugOpt} {puts " $n ==> \$vfs/$f" } } else { set n build/files/$f if {[file exists $n]} { @@ -233,6 +236,26 @@ proc locatefile {f} { return $n } +# We use a modified tclvfs pkgIndex with a reduced set of vfs' and force +# the use of vfslib.tcl for utility functions. +proc mk_tclvfs_index {src} { + global versmap + set fin [open $src r] + set fout [open ${src}.tclkit w] + puts $fout [string map $versmap \ + "package ifneeded vfs [package provide vfs] \[list load {} vfs\]"] + while {[gets $fin line] != -1} { + foreach pkg {starkit vfslib vfs::mk4 vfs::zip vfs::tar mk4vfs} { + if {[string match "package ifneeded $pkg *" $line]} { + puts $fout $line + } + } + } + close $fin + close $fout + return ${src}.tclkit +} + # copy file to m2m-mounted vfs proc vfscopy {argv} { global vfs versmap @@ -268,6 +291,8 @@ proc vfscopy {argv} { } } +# Create a pkgIndex file for a statick package 'pkg'. If the version +# is not provided then it is detected when creating the vfs. proc staticpkg {pkg {ver {}} {init {}}} { global vfs if {$ver eq {}} { @@ -326,14 +351,14 @@ switch [info sharedlibext] { } # Create package index files for the static extensions. -# verq registry dde and vfs are handled above or using files/* +# vlerq registry dde and vfs are handled above or using files/* set exts {rechan} if {![package vsatisfies [package provide Tcl] 8.6]} { lappend exts zlib } if {[package vcompare [package provide Tcl] 8.4] == 0} { lappend exts pwb } foreach ext $exts { staticpkg $ext } - +if {!$lite} { staticpkg Mk4tcl } if {[lsearch [info loaded] {{} Itcl}] != -1} { catch {load {} Itcl} lappend versmap itcl3@ itcl[package provide Itcl] -- 2.23.0