Support tcl 8.6 core zlib command and vfs1.4
authorPat Thoyts <patthoyts@users.sourceforge.net>
Mon, 22 Dec 2008 01:22:21 +0000 (01:22 +0000)
committerPat Thoyts <patthoyts@users.sourceforge.net>
Mon, 22 Dec 2008 01:22:21 +0000 (01:22 +0000)
git-svn-id: svn://svn.equi4.com/kitgen/trunk@4455 9e558909-932a-0410-a563-af77432da1eb

Makefile.vc
files/vfs1.4-pkgIndex.tcl
kitInit.c
setupvfs.tcl

index ec8dd3147ad718d2f6667893d783242b56495148..e2251504b4433c96d43a3053f09b8589102ea4c5 100644 (file)
@@ -63,7 +63,7 @@ CFLAGS  = -W3 -D_WINDOWS -DWIN32 -DSTATIC_BUILD
 BUILD   = $(MAKEDIR)\build
 
 !if $V == 84
-PARTS   = vqtcl zlib vfs
+PARTS   = vqtcl vfs
 OPTS    = static,msvcrt
 X       = sx
 !ifndef KITOPTS
@@ -72,7 +72,7 @@ KITOPTS =
 LIBS    = user32.lib gdi32.lib comdlg32.lib comctl32.lib \
          shell32.lib imm32.lib advapi32.lib
 !else
-PARTS   = vqtcl zlib vfs threaddyn
+PARTS   = vqtcl vfs threaddyn
 OPTS    = static,msvcrt,threads
 X       = tsx
 !ifndef KITOPTS
@@ -81,6 +81,11 @@ KITOPTS = -t
 LIBS    = user32.lib gdi32.lib ws2_32.lib
 !endif
 
+!if $V < 86
+PARTS = $(PARTS) zlib
+LIBS  = $(BUILD)\lib\zlib.lib $(LIBS) 
+!endif
+
 !if $(SYMBOLS)
 X       = $(X:x=gx)
 OPTS    = $(OPTS),symbols
@@ -142,10 +147,17 @@ LIBS    = $(LIBS) bufferoverflowU.lib
 #-------------------------------------------------------------------------
 
 CLIOBJS = $(BUILD)\pwb.obj $(BUILD)\rechan.obj \
-        $(BUILD)\zlib.obj $(BUILD)\tclAppInit.obj $(BUILD)\tclkitsh.res
+        $(BUILD)\tclAppInit.obj $(BUILD)\tclkitsh.res
 
 GUIOBJS = $(BUILD)\pwb.obj $(BUILD)\rechan.obj \
-        $(BUILD)\zlib.obj $(BUILD)\winMain.obj $(BUILD)\tclkit.res
+         $(BUILD)\winMain.obj $(BUILD)\tclkit.res
+
+!if $V < 86
+CLIOBJS = $(CLIOBJS) $(BUILD)\zlib.obj
+GUIOBJS = $(GUIOBJS) $(BUILD)\zlib.obj
+!endif
+
+#-------------------------------------------------------------------------
 
 #all: lite heavy
 lite: tclkit-cli tclkit-gui
@@ -159,6 +171,15 @@ tclkit-cli.exe: kit-cli.exe tidy
        @$(COPY) kit-cli.exe $@
        -@$(UPXCOMP)
        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}
+interp create slave
+slave eval {
+  foreach pkg {starkit rechan registry dde} {package require $$pkg}
+}
+<<
+
 
 tclkit-gui.exe: kit-gui.exe tidy
        @$(COPY) kit-gui.exe $@
@@ -169,9 +190,9 @@ kit-cli.exe: setup tcl $(PARTS) files $(CLIOBJS)
        @$(CC) $(CFLAGS) -I$(BUILD)/include -DKIT_LITE -DSTATIC_BUILD \
          -c ../../kitInit.c -Fo$(BUILD)/kitInit.obj
        @$(LINK) $(LDFLAGS) -subsystem:console -out:$@ $(CLIOBJS) \
-         $(BUILD)\kitInit.obj $(BUILD)\vfs.obj \
+         $(BUILD)\kitInit.obj \
+         $(BUILD)\lib\vfs1.4\vfs1*.lib \
          $(BUILD)\lib\vqtcl4.1\vqtcl4*.lib \
-         $(BUILD)\lib\zlib.lib \
          $(BUILD)\lib\tcl$V*.lib \
          $(BUILD)\lib\tcldde1*.lib \
          $(BUILD)\lib\tclreg1*.lib $(LIBS)
@@ -181,9 +202,9 @@ kit-gui.exe: setup tcl tk $(PARTS) files $(GUIOBJS)
        @$(CC) $(CFLAGS) -I$(BUILD)/include -DKIT_LITE -DKIT_INCLUDES_TK \
          -c ../../kitInit.c -Fo$(BUILD)/kitInit.obj
        @$(LINK) $(LDFLAGS) -subsystem:windows -out:$@ $(GUIOBJS) \
-         $(BUILD)\kitInit.obj $(BUILD)\vfs.obj \
+         $(BUILD)\kitInit.obj \
+         $(BUILD)\lib\vfs1.4\vfs1*.lib \
          $(BUILD)\lib\vqtcl4.1\vqtcl4*.lib \
-         $(BUILD)\lib\zlib.lib \
          $(BUILD)\lib\tcl$V*.lib \
          $(BUILD)\lib\tk$V*.lib \
          $(BUILD)\lib\tcldde1*.lib \
@@ -196,6 +217,14 @@ tclkitsh.exe: kitsh.exe tidy
        @$(COPY) kitsh.exe $@
        -@$(UPXCOMP)
        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}
+interp create slave
+slave eval {
+  foreach pkg {starkit rechan registry dde} {package require $$pkg}
+}
+<<
 
 tclkit.exe: kitsh.exe kit.exe tidy
        @$(COPY) kit.exe $@
@@ -203,29 +232,29 @@ tclkit.exe: kitsh.exe kit.exe tidy
        kitsh.exe -init- ../../setupvfs.tcl $(KITOPTS) $@ gui
 
 kitsh.exe: setup tcl mk itcl $(PARTS:vqtcl=) files $(CLIOBJS)
-       $(CC) $(CFLAGS) -I$(BUILD)/include -DSTATIC_BUILD \
+       @$(CC) $(CFLAGS) -I$(BUILD)/include -DSTATIC_BUILD \
          -DKIT_INCLUDES_ITCL -c ../../kitInit.c -Fo$(BUILD)/kitInit.obj
        $(LINK) $(LDFLAGS) -subsystem:console -out:$@ $(CLIOBJS) \
-         $(BUILD)\kitInit.obj $(BUILD)\vfs.obj \
+         $(BUILD)\kitInit.obj \
          $(BUILD)\mk4tcl.obj $(BUILD)\mk4too.obj \
+         $(BUILD)\lib\vfs1.4\vfs1*.lib \
          $(BUILD)\lib\mk4vc*.lib \
          $(BUILD)\lib\itcl3.4\itcl3*.lib \
-         $(BUILD)\lib\zlib.lib \
          $(BUILD)\lib\tcl$V*.lib \
          $(BUILD)\lib\tcldde1*.lib \
          $(BUILD)\lib\tclreg1*.lib $(LIBS)
        $(_VC_MANIFEST_EMBED_EXE)
 
 kit.exe: setup tcl tk mk itcl $(PARTS:vqtcl=) files $(GUIOBJS)
-       $(CC) $(CFLAGS) -I$(BUILD)/include -DSTATIC_BUILD \
+       @$(CC) $(CFLAGS) -I$(BUILD)/include -DSTATIC_BUILD \
          -DKIT_INCLUDES_ITCL -DKIT_INCLUDES_TK \
          -c ../../kitInit.c -Fo$(BUILD)/kitInit.obj
-       $(LINK) $(LDFLAGS) -subsystem:windows -out:$@ $(GUIOBJS) \
-         $(BUILD)\kitInit.obj $(BUILD)\vfs.obj \
+       @$(LINK) $(LDFLAGS) -subsystem:windows -out:$@ $(GUIOBJS) \
+         $(BUILD)\kitInit.obj \
          $(BUILD)\mk4tcl.obj $(BUILD)\mk4too.obj \
+         $(BUILD)\lib\vfs1.4\vfs1*.lib \
          $(BUILD)\lib\mk4vc*.lib \
          $(BUILD)\lib\itcl3.4\itcl3*.lib \
-         $(BUILD)\lib\zlib.lib \
          $(BUILD)\lib\tcl$V*.lib \
          $(BUILD)\lib\tk$V*.lib \
          $(BUILD)\lib\tcldde1*.lib \
@@ -267,12 +296,18 @@ $(BUILD)\lib\thread\thread26$(X:t=).lib:
          INSTALLDIR=$(BUILD) OPTS=$(OPTS) TMP_DIR=$(BUILD)\thread \
          OUT_DIR=$(BUILD)\thread all install
 
-vfs: $(BUILD)\vfs.obj
+vfs: $(BUILD)\lib\vfs1.4\vfs14$(X:t=).lib
 $(BUILD)\vfs.obj:
        $(CC) $(CFLAGS) -DSTATIC_BUILD -I..\tcl\generic -I..\tcl\win \
          -I..\..\8.x\tclvfs\generic -c ..\..\8.x\tclvfs\generic\vfs.c \
          -Fo$(BUILD)\vfs.obj
-       $(CPY) ..\..\8.x\tclvfs\library $(BUILD)\lib\vfs1.3^\
+       $(CPY) ..\..\8.x\tclvfs\library $(BUILD)\lib\vfs1.4^\
+
+$(BUILD)\lib\vfs1.4\vfs14$(X:t=).lib:
+       pushd ..\..\8.x\tclvfs\win & $(MAKE) -f Makefile.vc \
+         INSTALLDIR=$(BUILD) TCLDIR=$(BUILD)\..\..\tcl \
+         OPTS=$(OPTS) TMP_DIR=$(BUILD)\vfs \
+         OUT_DIR=$(BUILD)\vfs all install-binaries install-libraries
 
 zlib: $(BUILD)\lib\zlib.lib
 $(BUILD)\lib\zlib.lib:
index c3c7b8594d4ddf8e93f6a52abf9ee8be64de9dfe..699a860c0d727e7c365004c16d22a9e15111ebfb 100644 (file)
@@ -2,6 +2,6 @@ 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.1 [list source [file join $dir zipvfs.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]]
 
index 55429452deccd333dcc8a0407585f779f5f68c42..b35ffa6fa26af0cfdc869e099fc2f63910ab66c3 100644 (file)
--- a/kitInit.c
+++ b/kitInit.c
 #include <tcl.h>
 #endif
 
+/* define this to use the zlib package */
+#ifndef KIT_INCLUDES_ZLIB
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
+#define KIT_INCLUDES_ZLIB 1
+#else
+#define KIT_INCLUDES_ZLIB 0
+#endif
+#endif
+
 #include <string.h>
 
 #ifdef _WIN32
 #endif
 
 /* defined in tclInt.h */
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
 extern Tcl_Obj* TclGetStartupScriptPath();
 extern void TclSetStartupScriptPath(Tcl_Obj*);
+#define Tcl_GetStartupScript(encPtr) TclGetStartupScriptPath()
+#define Tcl_SetStartupScript(path,enc) TclSetStartupScriptPath(path)
+#endif
 extern char* TclSetPreInitScript (char*);
 
-Tcl_AppInitProc        Pwb_Init, Rechan_Init, Vfs_Init, Zlib_Init;
+Tcl_AppInitProc        Pwb_Init, Rechan_Init, Vfs_Init;
 #ifdef KIT_LITE
 Tcl_AppInitProc        Vlerq_Init, Vlerq_SafeInit;
 #else
@@ -45,6 +58,9 @@ Tcl_AppInitProc       Mk4tcl_Init;
 #ifdef TCL_THREADS
 Tcl_AppInitProc        Thread_Init;
 #endif
+#if KIT_INCLUDES_ZLIB
+Tcl_AppInitProc        Zlib_Init;
+#endif
 #ifdef KIT_INCLUDES_ITCL
 Tcl_AppInitProc        Itcl_Init;
 #endif
@@ -79,7 +95,9 @@ static char appInitCmd[] =
     "rename tclKitInit {}\n"
     "load {} tclkitpath\n"
     /*"puts \"appInit: [encoding system] $::tcl::kitpath\"\n"*/
+#if KIT_INCLUDES_ZLIB
     "catch {load {} zlib}\n"
+#endif
 #ifdef KIT_LITE
     "load {} vlerq\n"
     "namespace eval ::vlerq {}\n"
@@ -169,7 +187,9 @@ TclKit_AppInit(Tcl_Interp *interp)
     Tcl_StaticPackage(0, "tclkitpath", TclKitPath_Init, NULL);
     Tcl_StaticPackage(0, "rechan", Rechan_Init, NULL);
     Tcl_StaticPackage(0, "vfs", Vfs_Init, NULL);
+#if KIT_INCLUDES_ZLIB
     Tcl_StaticPackage(0, "zlib", Zlib_Init, NULL);
+#endif
 #ifdef TCL_THREADS
     Tcl_StaticPackage(0, "Thread", Thread_Init, Thread_SafeInit);
 #endif
@@ -221,8 +241,9 @@ TclKit_AppInit(Tcl_Interp *interp)
 
     /* messy because TclSetStartupScriptPath is called slightly too late */
     if (Tcl_EvalEx(interp, initScript, -1, TCL_EVAL_GLOBAL) == TCL_OK) {
-        Tcl_Obj* path = TclGetStartupScriptPath();
-       TclSetStartupScriptPath(Tcl_GetObjResult(interp));
+       const char *encoding = NULL;
+        Tcl_Obj* path = Tcl_GetStartupScript(&encoding);
+       Tcl_SetStartupScript(Tcl_GetObjResult(interp), encoding);
        if (path == NULL) {
            Tcl_Eval(interp, "incr argc -1; set argv [lrange $argv 1 end]");
        }
index dc7a6df75fa9e49a43dc04791c958e1418f9f0da..5966eb42237ed84eb88f274a9439b4dc58d721b6 100644 (file)
@@ -327,7 +327,8 @@ switch [info sharedlibext] {
 
 # Create package index files for the static extensions.
 # verq registry dde and vfs are handled above or using files/*
-set exts {zlib rechan}
+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