From 9650646e7b30b598e584949594624fd6364983cf Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Sat, 11 Aug 2007 16:15:25 +0000 Subject: [PATCH] Fix building with msvc8 and for symbols builds. Add tclkit resources to the cli executable git-svn-id: svn://svn.equi4.com/kitgen/trunk@1735 9e558909-932a-0410-a563-af77432da1eb --- Makefile.vc | 60 ++++++++++++++++++++++++++++++++++++++------ tclkit.rc | 72 +++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 106 insertions(+), 26 deletions(-) diff --git a/Makefile.vc b/Makefile.vc index 5bdc10b..20d3109 100644 --- a/Makefile.vc +++ b/Makefile.vc @@ -16,7 +16,7 @@ !ifndef VERSION !message *** You must specify the Tcl version. Set VERSION=84 or 85 -!message *** You may also specify SYMBOLS=0|1 +!message *** You may also specify SYMBOLS=0|1 UPX=0|1 !error !else V=$(VERSION) @@ -26,6 +26,16 @@ V=$(VERSION) SYMBOLS=0 !endif +!ifndef UPX +!if ![upx -V > NUL] +!message *** Enabling upx compression of executables +UPX=1 +!else +!message *** Disabling upx compression of executables +UPX=0 +!endif +!endif + MAKE = $(MAKE) -nologo CPY = xcopy /i /y >NUL COPY = copy /y >NUL @@ -55,13 +65,41 @@ X = $(X:x=gx) OPTS = $(OPTS),symbols CFLAGS = -MDd -Od -Zi -D_DEBUG $(CFLAGS) LDFLAGS = -debug +UPXCOMP = !else CFLAGS = -MD -O2 -DNDEBUG $(CFLAGS) LDFLAGS = -release +!if $(UPX) +UPXCOMP = upx -q9 $@ >NUL +!endif +!endif + +#------------------------------------------------------------------------- +# MSVC8 (ships with Visual Studio 2005) generates a manifest +# file that we should link into the binaries. This is how. +#------------------------------------------------------------------------- + +_VC_MANIFEST_EMBED_EXE= +_VC_MANIFEST_EMBED_DLL= +VCVER=0 +!if ![echo VCVERSION=_MSC_VER > vercl.x] \ + && ![cl -nologo -TC -P vercl.x $(ERRNULL)] +!include vercl.i +!if $(VCVERSION) >= 1400 +VCVER=8 +_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 +_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 +!elseif $(VCVERSION) >= 1300 +VCVER=7 +!elseif $(VCVERSION) >= 1200 +VCVER=6 +!endif !endif +#------------------------------------------------------------------------- + CLIOBJS = $(BUILD)\pwb.obj $(BUILD)\rechan.obj \ - $(BUILD)\zlib.obj $(BUILD)\tclAppInit.obj + $(BUILD)\zlib.obj $(BUILD)\tclAppInit.obj $(BUILD)\tclkitsh.res GUIOBJS = $(BUILD)\pwb.obj $(BUILD)\rechan.obj \ $(BUILD)\zlib.obj $(BUILD)\winMain.obj $(BUILD)\tclkit.res @@ -72,12 +110,12 @@ tclkit-gui: tclkit-gui.exe tclkit-cli.exe: kit-cli.exe tidy @$(COPY) kit-cli.exe $@ - -@upx -q9 $@ >NUL + -@$(UPXCOMP) kit-cli.exe -init- ../../setupvfs.tcl $(KITOPTS) $@ cli tclkit-gui.exe: kit-gui.exe tidy @$(COPY) kit-gui.exe $@ - -@upx -q9 $@ >NUL + -@$(UPXCOMP) kit-cli.exe -init- ../../setupvfs.tcl $(KITOPTS) $@ gui kit-cli.exe: setup tcl $(PARTS) files $(CLIOBJS) @@ -90,6 +128,7 @@ kit-cli.exe: setup tcl $(PARTS) files $(CLIOBJS) $(BUILD)\lib\tcl$V*.lib \ $(BUILD)\lib\tcldde1*.lib \ $(BUILD)\lib\tclreg1*.lib $(LIBS) + $(_VC_MANIFEST_EMBED_EXE) kit-gui.exe: setup tcl tk $(PARTS) files $(GUIOBJS) @$(CC) $(CFLAGS) -I$(BUILD)/include -DKIT_LITE -DKIT_INCLUDES_TK \ @@ -102,6 +141,7 @@ kit-gui.exe: setup tcl tk $(PARTS) files $(GUIOBJS) $(BUILD)\lib\tk$V*.lib \ $(BUILD)\lib\tcldde1*.lib \ $(BUILD)\lib\tclreg1*.lib $(LIBS) + $(_VC_MANIFEST_EMBED_EXE) tcl: $(BUILD)\lib\tcl$V$X.lib $(BUILD)\lib\tcl$V$X.lib: @@ -168,11 +208,15 @@ $(BUILD)\winMain.obj: ..\tk\win\winMain.c -I..\tcl\generic -I..\tcl\win -I..\tk\generic -I..\tk\win \ -DTK_LOCAL_APPINIT=TclKit_AppInit -Fo$@ -c $** +$(BUILD)\tclkitsh.res: ..\..\tclkit.rc + $(RC) -fo $@ -r -d STATIC_BUILD=1 -i $(BUILD)\include \ + -i $(BUILD)\files -i ..\tcl\win\rc $** + $(BUILD)\tclkit.res: ..\..\tclkit.rc $(COPY) $** $(BUILD)\tk\tclkit.rc - $(RC) -fo $@ -r -d STATIC_BUILD=1 -i $(BUILD)\include \ - -i $(BUILD)\tk -i $(BUILD)\files -i ..\tk\win\rc \ - $(BUILD)\tk\tclkit.rc + $(RC) -fo $@ -r -d STATIC_BUILD=1 -d BASE_NO_TK_ICON=1 \ + -d TCLKIT_WITH_TK -i $(BUILD)\include -i $(BUILD)\tk \ + -i $(BUILD)\files -i ..\tk\win\rc $(BUILD)\tk\tclkit.rc .PHONY: setup files tidy clean @@ -187,6 +231,8 @@ tidy: @if exist kit-cli.lib del kit-cli.lib @if exist kit-gui.exp del kit-gui.exp @if exist kit-gui.lib del kit-gui.lib + @if exist vercl.i del vercl.i + @if exist vercl.x del vercl.x clean: tidy @if exist build\nul $(RMDIR) build diff --git a/tclkit.rc b/tclkit.rc index 7c1980d..e073bc8 100644 --- a/tclkit.rc +++ b/tclkit.rc @@ -1,38 +1,57 @@ -// RCS: @(#) $Id: tclkit.rc,v 1.2 2006/01/12 09:00:23 jcw Exp $ -// -// Version Resource Script -// - -#include +/* RCS: @(#) $Id: tclkit.rc,v 1.2 2006/01/12 09:00:23 jcw Exp $ + * + * Version Resource Script + * + */ #define RESOURCE_INCLUDED + +#include +#include + +#ifdef TCLKIT_WITH_TK #include +#endif #define STRINGIFY1(x) #x #define STRINGIFY(x) STRINGIFY1(x) -// -// build-up the name suffix that defines the type of build this is. -// +/* + * build-up the name suffix that defines the type of build this is. + */ + #ifdef TCL_THREADS #define SUFFIX_THREADS "t" #else #define SUFFIX_THREADS "" #endif +#if STATIC_BUILD +#define SUFFIX_STATIC "s" +#else +#define SUFFIX_STATIC "" +#endif + #ifdef DEBUG -#define SUFFIX_DEBUG "d" +#define SUFFIX_DEBUG "g" #else #define SUFFIX_DEBUG "" #endif -#define SUFFIX SUFFIX_THREADS SUFFIX_DEBUG +#define SUFFIX SUFFIX_THREADS SUFFIX_STATIC SUFFIX_DEBUG +LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ + VS_VERSION_INFO VERSIONINFO +#ifdef TCLKIT_WITH_TK FILEVERSION TK_MAJOR_VERSION,TK_MINOR_VERSION,TK_RELEASE_LEVEL,TK_RELEASE_SERIAL PRODUCTVERSION TK_MAJOR_VERSION,TK_MINOR_VERSION,TK_RELEASE_LEVEL,TK_RELEASE_SERIAL +#else + FILEVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL + PRODUCTVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL +#endif FILEFLAGSMASK 0x3fL #ifdef DEBUG FILEFLAGS VS_FF_DEBUG @@ -48,12 +67,18 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Tclkit, a standalone runtime for Tcl/Tk\0" - VALUE "OriginalFilename", "tclkit.exe\0" + VALUE "OriginalFilename", "tclkit-gui.exe\0" VALUE "CompanyName", "Equi4 Software\0" - VALUE "FileVersion", TK_PATCH_LEVEL VALUE "LegalCopyright", "Copyright \251 1989-2003 by J.Ousterhout et al.\0" +#ifdef TCLKIT_WITH_TK + VALUE "FileVersion", TK_PATCH_LEVEL VALUE "ProductName", "Tclkit " TK_VERSION " for Windows\0" VALUE "ProductVersion", TK_PATCH_LEVEL +#else + VALUE "FileVersion", TCL_PATCH_LEVEL + VALUE "ProductName", "Tclkit " TCL_VERSION " for Windows\0" + VALUE "ProductVersion", TCL_PATCH_LEVEL +#endif END END BLOCK "VarFileInfo" @@ -62,15 +87,22 @@ BEGIN END END -// -// Include the base resources. -// +/* + * Icon + */ + +tk ICON DISCARDABLE "tclkit.ico" + +#ifdef TCLKIT_WITH_TK +/* + * Include the base resources. + */ #include "tk_base.rc" -// -// This enables themed scrollbars in XP by trying to use comctl32 v6. -// +/* + * This enables themed scrollbars in XP by trying to use comctl32 v6. + */ #ifndef RT_MANIFEST #define RT_MANIFEST 24 @@ -79,3 +111,5 @@ END #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 #endif CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "wish.exe.manifest" + +#endif -- 2.23.0