From 8b4d71c2cf4be3c46face99a2620b144570a370a Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 22 Dec 2008 01:22:21 +0000 Subject: [PATCH] Support tcl 8.6 core zlib command and vfs1.4 git-svn-id: svn://svn.equi4.com/kitgen/trunk@4455 9e558909-932a-0410-a563-af77432da1eb --- Makefile.vc | 69 +++++++++++++++++++++++++++++---------- files/vfs1.4-pkgIndex.tcl | 2 +- kitInit.c | 27 +++++++++++++-- setupvfs.tcl | 3 +- 4 files changed, 79 insertions(+), 22 deletions(-) diff --git a/Makefile.vc b/Makefile.vc index ec8dd31..e225150 100644 --- a/Makefile.vc +++ b/Makefile.vc @@ -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: diff --git a/files/vfs1.4-pkgIndex.tcl b/files/vfs1.4-pkgIndex.tcl index c3c7b85..699a860 100644 --- a/files/vfs1.4-pkgIndex.tcl +++ b/files/vfs1.4-pkgIndex.tcl @@ -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]] diff --git a/kitInit.c b/kitInit.c index 5542945..b35ffa6 100644 --- a/kitInit.c +++ b/kitInit.c @@ -23,6 +23,15 @@ #include #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 #ifdef _WIN32 @@ -32,11 +41,15 @@ #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]"); } diff --git a/setupvfs.tcl b/setupvfs.tcl index dc7a6df..5966eb4 100644 --- a/setupvfs.tcl +++ b/setupvfs.tcl @@ -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 -- 2.23.0