From fc592a5531622654821ba2649b1fe00408b8872a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 29 Nov 2021 14:38:35 +0000 Subject: Implement TIP #599 for Tk 8.6 (only effective when loaded into Tcl 8.7+): Extended build information --- generic/tkWindow.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++- unix/Makefile.in | 4 +-- win/Makefile.in | 4 ++- win/makefile.vc | 10 +++++++ 4 files changed, 91 insertions(+), 4 deletions(-) diff --git a/generic/tkWindow.c b/generic/tkWindow.c index f48e469..6fa5e50 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -19,6 +19,7 @@ #elif !defined(MAC_OSX_TK) #include "tkUnixInt.h" #endif +#include "tkUuid.h" /* * Type used to keep track of Window objects that were only partially @@ -821,6 +822,11 @@ NameWindow( *---------------------------------------------------------------------- */ +#ifndef STRINGIFY +# define STRINGIFY(x) STRINGIFY1(x) +# define STRINGIFY1(x) #x +#endif + Tk_Window TkCreateMainWindow( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ @@ -837,6 +843,7 @@ TkCreateMainWindow( TkWindow *winPtr; const TkCmd *cmdPtr; ClientData clientData; + Tcl_CmdInfo info; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -957,9 +964,77 @@ TkCreateMainWindow( Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name); } } + if (Tcl_GetCommandInfo(interp, "::tcl::build-info", &info)) { + Tcl_CreateObjCommand(interp, "::tk::build-info", + info.objProc, + TK_PATCH_LEVEL "+" STRINGIFY(TK_VERSION_UUID) +#if defined(MAC_OSX_TK) + ".aqua" +#endif +#if defined(__clang__) && defined(__clang_major__) + ".clang-" STRINGIFY(__clang_major__) +#if __clang_minor__ < 10 + "0" +#endif + STRINGIFY(__clang_minor__) +#endif +#if defined(__cplusplus) && !defined(__OBJC__) + ".cplusplus" +#endif +#ifndef NDEBUG + ".debug" +#endif +#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) + ".gcc-" STRINGIFY(__GNUC__) +#if __GNUC_MINOR__ < 10 + "0" +#endif + STRINGIFY(__GNUC_MINOR__) +#endif +#ifdef __INTEL_COMPILER + ".icc-" STRINGIFY(__INTEL_COMPILER) +#endif +#ifdef TCL_MEM_DEBUG + ".memdebug" +#endif +#if defined(_MSC_VER) + ".msvc-" STRINGIFY(_MSC_VER) +#endif +#ifdef USE_NMAKE + ".nmake" +#endif +#ifndef TCL_CFG_OPTIMIZED + ".no-optimize" +#endif +#ifdef __OBJC__ + ".objective-c" +#if defined(__cplusplus) + "plusplus" +#endif +#endif +#ifdef TCL_CFG_PROFILED + ".profile" +#endif +#ifdef PURIFY + ".purify" +#endif +#ifdef STATIC_BUILD + ".static" +#endif +#if TCL_UTF_MAX <= (3 + (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 6)) + ".utf-16" +#endif +#if defined(_WIN32) + ".win32" +#endif +#if !defined(_WIN32) && !defined(MAC_OSX_TK) + ".x11" +#endif + , NULL); + } /* - * Set variables for the intepreter. + * Set variables for the interpreter. */ Tcl_SetVar2(interp, "tk_patchLevel", NULL, TK_PATCH_LEVEL, TCL_GLOBAL_ONLY); diff --git a/unix/Makefile.in b/unix/Makefile.in index 9414ee7..85fff36 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1032,8 +1032,8 @@ tkUtil.o: $(GENERIC_DIR)/tkUtil.c tkVisual.o: $(GENERIC_DIR)/tkVisual.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkVisual.c -tkWindow.o: $(GENERIC_DIR)/tkWindow.c - $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkWindow.c +tkWindow.o: $(GENERIC_DIR)/tkWindow.c tkUuid.h + $(CC) -c $(CC_SWITCHES) -I. $(GENERIC_DIR)/tkWindow.c tkButton.o: $(GENERIC_DIR)/tkButton.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkButton.c diff --git a/win/Makefile.in b/win/Makefile.in index 68e66d9..7903efc 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -696,11 +696,13 @@ tkUnixMenubu.$(OBJEXT): ${UNIX_DIR}/tkUnixMenubu.c tkUnixScale.$(OBJEXT): ${UNIX_DIR}/tkUnixScale.c $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME) +tkWindow.$(OBJEXT): ${GENERIC_DIR}/tkWindow.c configure Makefile tkUuid.h + $(CC) -c $(CC_SWITCHES) -I. -DBUILD_tk @DEPARG@ $(CC_OBJNAME) + # Extra dependency info tkConsole.$(OBJEXT): configure Makefile tkMain.$(OBJEXT): configure Makefile tkMain2.$(OBJEXT): configure Makefile -tkWindow.$(OBJEXT): configure Makefile # Add the object extension to the implicit rules. By default .obj is not # automatically added. diff --git a/win/makefile.vc b/win/makefile.vc index ee14935..250303e 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -535,6 +535,13 @@ $(TMP_DIR)\testMain.obj: $(WIN_DIR)\winMain.c /DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \ -Fo$@ $? +$(ROOT)\manifest.uuid: + copy $(WIN_DIR)\gitmanifest.in $(ROOT)\manifest.uuid + git rev-parse HEAD >>$(ROOT)\manifest.uuid + +$(TMP_DIR)\tkUuid.h: $(ROOT)\manifest.uuid + copy $(WIN_DIR)\tkUuid.h.in+$(ROOT)\manifest.uuid $(TMP_DIR)\tkUuid.h + $(TMP_DIR)\tkTest.obj: $(GENERICDIR)\tkTest.c $(cc32) $(appcflags_nostubs) -Fo$@ $? @@ -555,6 +562,9 @@ $(TMP_DIR)\winMain.obj: $(WIN_DIR)\winMain.c $(TMP_DIR)\tkMain2.obj: $(GENERICDIR)\tkMain.c $(cc32) $(pkgcflags) /DUNICODE /D_UNICODE -Fo$@ $? +$(TMP_DIR)\tkWindow.obj: $(GENERICDIR)\tkWindow.c $(TMP_DIR)\tkUuid.h + $(cc32) $(pkgcflags) -I$(TMP_DIR) -Fo$@ $? + # The following objects are part of the stub library and should not # be built as DLL objects but none of the symbols should be exported # and no reference made to a C runtime. -- cgit v0.12