From d9952d775abb77c056da36551547a42f7694ddef Mon Sep 17 00:00:00 2001 From: davygrvy Date: Mon, 4 Nov 2002 05:50:19 +0000 Subject: * win/tclAppInit.c: Calls Registry_Init() and Dde_Init() when STATIC_BUILD and TCL_USE_STATIC_PACKAGES macros are set. * win/makefile.vc: * win/rules.vc: linkexten option now sets the TCL_USE_STATIC_PACKAGES macro which also adds the registry and dde object files to the link of the shell. [Patch 479697] Also factored some additional macros that will be helpful for extension authors. Version grepping of tcl.h will need to be added to complete this. * win/buildall.vc.bat: Added more descriptive commentary. --- ChangeLog | 14 ++++++++ win/buildall.vc.bat | 35 +++++++++++++++---- win/makefile.vc | 26 +++++--------- win/rules.vc | 99 +++++++++++++++++++++++++++++++++++++++++++++++++---- win/tclAppInit.c | 19 +++++++++- 5 files changed, 161 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5a4db7..4b40993 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2002-11-03 David Gravereaux + + * win/tclAppInit.c: Calls Registry_Init() and Dde_Init() when + STATIC_BUILD and TCL_USE_STATIC_PACKAGES macros are set. + + * win/makefile.vc: + * win/rules.vc: linkexten option now sets the TCL_USE_STATIC_PACKAGES + macro which also adds the registry and dde object files to the link + of the shell. [Patch 479697] Also factored some additional macros + that will be helpful for extension authors. Version grepping of tcl.h + will need to be added to complete this. + + * win/buildall.vc.bat: Added more descriptive commentary. + 2002-11-01 David Gravereaux * win/tclWinReg.c: Changed the Tcl_PkgProvide() line to declare diff --git a/win/buildall.vc.bat b/win/buildall.vc.bat index 84b4576..6aa00d8 100755 --- a/win/buildall.vc.bat +++ b/win/buildall.vc.bat @@ -4,32 +4,55 @@ :: edit this (or make your own) for your needs and wants using :: the instructions for calling makefile.vc found in makefile.vc :: -:: RCS: @(#) $Id: buildall.vc.bat,v 1.5 2002/03/27 22:57:57 davygrvy Exp $ +:: RCS: @(#) $Id: buildall.vc.bat,v 1.6 2002/11/04 05:50:19 davygrvy Exp $ echo Sit back and have a cup of coffee while this grinds through ;) echo You asked for *everything*, remember? echo. -if "%MSVCDir%" == "" call C:\dev\devstudio60\vc98\bin\vcvars32.bat -set INSTALLDIR=C:\progra~1\tcl +title Building Tcl, please wait... +if "%MSVCDir%" == "" call c:\dev\devstudio60\vc98\bin\vcvars32.bat +::if "%MSVCDir%" == "" call "C:\Program Files\Microsoft Developer Studio\vc98\bin\vcvars32.bat" +set INSTALLDIR=C:\Program Files\Tcl + +:: Build the normal stuff along with the help file. +:: nmake -nologo -f makefile.vc release winhelp OPTS=none if errorlevel 1 goto error + +:: Build the static core, dlls and shell. +:: nmake -nologo -f makefile.vc release OPTS=static if errorlevel 1 goto error + +:: Build the special static libraries that use the dynamic runtime. +:: nmake -nologo -f makefile.vc core dlls OPTS=static,msvcrt if errorlevel 1 goto error + +:: Build the core and shell for thread support. +:: +nmake -nologo -f makefile.vc shell OPTS=threads +if errorlevel 1 goto error + +:: Build a static, thread support core library (no shell). +:: nmake -nologo -f makefile.vc core OPTS=static,threads if errorlevel 1 goto error + +:: Build the special static libraries the use the dynamic runtime, +:: but now with thread support. +:: nmake -nologo -f makefile.vc core dlls OPTS=static,msvcrt,threads if errorlevel 1 goto error -nmake -nologo -f makefile.vc shell OPTS=threads -if errorlevel 1 goto error + goto end :error echo *** BOOM! *** :end -echo done! +title Building Tcl, please wait...DONE! +echo DONE! pause diff --git a/win/makefile.vc b/win/makefile.vc index 11ad0fd..9a7bf77 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -12,7 +12,7 @@ # Copyright (c) 2001-2002 David Gravereaux. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.95 2002/10/26 07:59:58 davygrvy Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.96 2002/11/04 05:50:19 davygrvy Exp $ #------------------------------------------------------------------------------ !if "$(MSVCDIR)" == "" @@ -197,7 +197,7 @@ INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include TCLSHOBJS = \ $(TMP_DIR)\tclAppInit.obj \ -!if $(TCL_LINKWITHEXTENSIONS) +!if $(TCL_USE_STATIC_PACKAGES) $(TMP_DIR)\tclWinReg.obj \ $(TMP_DIR)\tclWinDde.obj \ !endif @@ -209,7 +209,7 @@ TCLTESTOBJS = \ $(TMP_DIR)\tclTestProcBodyObj.obj \ $(TMP_DIR)\tclThreadTest.obj \ $(TMP_DIR)\tclWinTest.obj \ -!if $(TCL_LINKWITHEXTENSIONS) +!if $(TCL_USE_STATIC_PACKAGES) $(TMP_DIR)\tclWinReg.obj \ $(TMP_DIR)\tclWinDde.obj \ !endif @@ -575,7 +575,7 @@ $(MAN2TCL): $(TOOLSDIR)\$$(@B).c $(cc32) -nologo -G4 -ML -O2 -Fo$(@D)\ $(TOOLSDIR)\$(@B).c -link -out:$@ $(HELPRTF): $(MAN2TCL) $(MAN2HELP) $(MAN2HELP2) $(INDEX) $(DOCDIR)\* - $(TCLSH) $(MAN2HELP:\=/) -bitmap $(BMP_NOPATH) $(PROJECT) $(VERSION) $(DOCDIR:\=/) + $(TCLSH) $(MAN2HELP) -bitmap $(BMP_NOPATH) $(PROJECT) $(VERSION) $(DOCDIR:\=/) install-docs: !if exist($(HELPFILE)) @@ -589,8 +589,8 @@ install-docs: #--------------------------------------------------------------------- $(TMP_DIR)\testMain.obj: $(WINDIR)\tclAppInit.c -!if $(TCL_LINKWITHEXTENSIONS) - $(cc32) $(TCL_CFLAGS) -DTCL_TEST -DTCL_LINKWITHEXTENSIONS -Fo$@ $? +!if $(TCL_USE_STATIC_PACKAGES) + $(cc32) $(TCL_CFLAGS) -DTCL_TEST -DTCL_USE_STATIC_PACKAGES -Fo$@ $? !else $(cc32) $(TCL_CFLAGS) -DTCL_TEST -Fo$@ $? !endif @@ -605,8 +605,8 @@ $(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c $(cc32) $(TCL_CFLAGS) -Fo$@ $? $(TMP_DIR)\tclAppInit.obj: $(WINDIR)\tclAppInit.c -!if $(TCL_LINKWITHEXTENSIONS) - $(cc32) $(TCL_CFLAGS) -DTCL_LINKWITHEXTENSIONS -Fo$@ $? +!if $(TCL_USE_STATIC_PACKAGES) + $(cc32) $(TCL_CFLAGS) -DTCL_USE_STATIC_PACKAGES -Fo$@ $? !else $(cc32) $(TCL_CFLAGS) -Fo$@ $? !endif @@ -710,16 +710,6 @@ $< # Installation. #--------------------------------------------------------------------- -!if "$(OS)" == "Windows_NT" -!if ![ver | find "4.0" > nul] -CPY = echo y | xcopy /i -!else -CPY = xcopy /i /y -!endif -!else -CPY = xcopy /i -!endif - install-binaries: @echo installing $(TCLLIBNAME) !if "$(TCLLIB)" != "$(TCLIMPLIB)" diff --git a/win/rules.vc b/win/rules.vc index bb9cc30..0bc3469 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -10,7 +10,7 @@ # Copyright (c) 2001-2002 David Gravereaux. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: rules.vc,v 1.8 2002/06/14 14:42:21 davygrvy Exp $ +# RCS: @(#) $Id: rules.vc,v 1.9 2002/11/04 05:50:19 davygrvy Exp $ #------------------------------------------------------------------------------ !ifndef _RULES_VC @@ -22,13 +22,34 @@ lib32 = lib rc32 = $(RC) # built-in default. !ifndef INSTALLDIR -INSTALLDIR = C:\Progra~1\Tcl +### Assume the normal default. +_INSTALLDIR = C:\Program Files\Tcl +!else +### Fix the path seperators. +_INSTALLDIR = $(INSTALLDIR:/=\) !endif !ifndef MACHINE MACHINE = IX86 !endif + +#---------------------------------------------------------- +# Set the proper copy method to avoid overwrite questions +# to the user when copying files. +#---------------------------------------------------------- + +!if "$(OS)" == "Windows_NT" +!if ![ver | find "4.0" > nul] +CPY = echo y | xcopy /i +!else +CPY = xcopy /i /y +!endif +!else +CPY = xcopy /i +!endif + + !message =============================================================================== #---------------------------------------------------------- @@ -46,7 +67,7 @@ MACHINE = IX86 #---------------------------------------------------------- ### test for optimizations -!if [nmakehlp -c -Otip ] +!if [nmakehlp -c -Otip] !message *** Compiler has 'Optimizations' OPTIMIZING = 1 !else @@ -100,7 +121,7 @@ DEBUG = 0 PROFILE = 0 MSVCRT = 0 LOIMPACT = 0 -TCL_LINKWITHEXTENSIONS = 0 +TCL_USE_STATIC_PACKAGES = 0 !else !if [nmakehlp -f $(OPTS) "static"] !message *** Doing static @@ -116,9 +137,9 @@ MSVCRT = 0 !endif !if [nmakehlp -f $(OPTS) "linkexten"] !message *** Doing linkexten -TCL_LINKWITHEXTENSIONS = 1 +TCL_USE_STATIC_PACKAGES = 1 !else -TCL_LINKWITHEXTENSIONS = 0 +TCL_USE_STATIC_PACKAGES = 0 !endif !if [nmakehlp -f $(OPTS) "threads"] !message *** Doing threads @@ -151,7 +172,7 @@ LOIMPACT = 0 # Make sure we don't build overly fat DLLs. MSVCRT = 1 # We shouldn't statically put the extensions inside the shell when dynamic. -TCL_LINKWITHEXTENSIONS = 0 +TCL_USE_STATIC_PACKAGES = 0 !endif @@ -251,6 +272,70 @@ OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD #---------------------------------------------------------- +# Get common info used when building extensions. +#---------------------------------------------------------- + +!if "$(PROJECT)" != "tcl" + +!if !defined(TCLDIR) +!if exist("$(_INSTALLDIR)\include\tcl.h") +TCLINSTALL = 1 +_TCLDIR = $(_INSTALLDIR) +!else +MSG=^ +Don't know where tcl.h is. Set the TCLDIR macro. +!error $(MSG) +!endif +!else +_TCLDIR = $(TCLDIR:/=\) +!if exist("$(_TCLDIR)\include\tcl.h") +TCLINSTALL = 1 +!elseif exist("$(_TCLDIR)\generic\tcl.h") +TCLINSTALL = 0 +!else +MSG =^ +Don't know where tcl.h is. The TCLDIR macro doesn't appear correct. +!error $(MSG) +!endif +!endif + +### TODO: add a command to nmakehlp.c to grep for Tcl's version from tcl.h. +### Because nmake can't return a string, we'll need to play games with return +### codes :) It might look something like this: +#!if [nmakehlp -g $(TCL.H)] == 81 +#TCL_DOTVERSION = 8.1 +#!elseif [nmakehlp -g $(TCL.H)] == 82 +#TCL_DOTVERSION = 8.2 +#... +#!endif + +TCL_DOTVERSION = 8.4 +TCL_VERSION = $(TCL_DOTVERSION:.=) + +!if $(TCLINSTALL) +TCLSH = "$(_INSTALLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" +TCLSTUBLIB = "$(_INSTALLDIR)\lib\tclstub$(TCL_VERSION).lib" +TCLIMPLIB = "$(_INSTALLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib" +TCL_LIBRARY = $(_INSTALLDIR)\lib +TCLREGLIB = "$(_INSTALLDIR)\lib\tclreg11$(SUFX:t=).lib" +TCLDDELIB = "$(_INSTALLDIR)\lib\tcldde12$(SUFX:t=).lib" +COFFBASE = \must\have\tcl\sources\to\build\this\target +TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target +!else +TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe" +TCLSTUBLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib" +TCLIMPLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib" +TCL_LIBRARY = $(_TCLDIR)\library +TCLREGLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg11$(SUFX:t=).lib" +TCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde12$(SUFX:t=).lib" +COFFBASE = "$(_TCLDIR)\win\coffbase.txt" +TCLTOOLSDIR = $(_TCLDIR)\tools +!endif + +!endif + + +#---------------------------------------------------------- # Display stats being used. #---------------------------------------------------------- diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 414e4d8..b589027 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclAppInit.c,v 1.9 2002/09/30 00:08:01 davygrvy Exp $ + * RCS: @(#) $Id: tclAppInit.c,v 1.10 2002/11/04 05:50:19 davygrvy Exp $ */ #include "tcl.h" @@ -167,6 +167,23 @@ Tcl_AppInit(interp) Procbodytest_SafeInit); #endif /* TCL_TEST */ +#if defined(STATIC_BUILD) && defined(TCL_USE_STATIC_PACKAGES) + { + extern Tcl_PackageInitProc Registry_Init; + extern Tcl_PackageInitProc Dde_Init; + + if (Registry_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "registry", Registry_Init, NULL); + + if (Dde_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "dde", Dde_Init, NULL); + } +#endif + /* * Call the init procedures for included packages. Each call should * look like this: -- cgit v0.12