From 36415dc8c7cf46b9091ebe18c50fa21d99b1aa70 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 14 Feb 2020 11:19:25 +0000 Subject: Fix travis build. Revise usage of TCLDIR. Make Tk 8.5 compile/run with Tcl 8.6. Useful for Travis build. --- .travis.yml | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ generic/tk.h | 12 +++++++++- generic/tkMain.c | 25 ++++++++++++++------ unix/Makefile.in | 24 ++++++++++---------- unix/configure | 19 ++++++++++------ unix/configure.in | 11 +++++---- 6 files changed, 128 insertions(+), 31 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5f01fb0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,68 @@ +sudo: required +language: c +addons: + apt: + packages: + - tcl-dev + - libx11-dev + +matrix: + include: +# Testing on Linux with various compilers + - name: "Linux/GCC/Shared" + os: linux + dist: bionic + compiler: gcc + env: + - BUILD_DIR=unix + - name: "Linux/GCC/Static" + os: linux + dist: bionic + compiler: gcc + env: + - CFGOPT="--disable-shared" + - BUILD_DIR=unix + - name: "Linux/GCC 7/Shared" + os: linux + dist: bionic + compiler: gcc-7 + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-7 + env: + - BUILD_DIR=unix + - name: "Linux/GCC 6/Shared" + os: linux + dist: bionic + compiler: gcc-6 + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-6 + env: + - BUILD_DIR=unix + - name: "Linux/GCC 5/Shared" + os: linux + dist: bionic + compiler: gcc-5 + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-5 + env: + - BUILD_DIR=unix +before_install: + - cd ${BUILD_DIR} +install: + - ./configure ${CFGOPT} --prefix=$HOME || (cat config.log && exit 1) +before_script: + - export ERROR_ON_FAILURES=1 +script: + - make binaries libraries tktest diff --git a/generic/tk.h b/generic/tk.h index 3d5f3b7..baa0aad 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -1488,8 +1488,18 @@ typedef struct Tk_ElementSpec { #define Tk_Release Tcl_Release /* Removed Tk_Main, use macro instead */ +#if TCL_MINOR_VERSION > 5 +#if defined(_WIN32) || defined(__CYGWIN__) +#define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ + (Tcl_FindExecutable(0), (Tcl_CreateInterp)())) +#else +#define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ + (Tcl_FindExecutable(argv[0]), (Tcl_CreateInterp)())) +#endif +#else #define Tk_Main(argc, argv, proc) \ - Tk_MainEx(argc, argv, proc, Tcl_CreateInterp()) + Tk_MainEx(argc, argv, proc, (Tcl_CreateInterp)()) +#endif const char * Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, const char *version, int exact)); diff --git a/generic/tkMain.c b/generic/tkMain.c index 00ac165..e8aa08b 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -14,11 +14,19 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#include "tclInt.h" #include "tkInt.h" -#ifdef __WIN32__ -#include "tkWinInt.h" -#include "../win/tclWinPort.h" +#ifdef _WIN32 +/* Little hack to eliminate the need for "tclInt.h" here: + Just copy a small portion of TclIntPlatStubs, just + enough to make it work. See [600b72bfbc] */ +typedef struct { + int magic; + void *hooks; + void (*dummy[16]) (void); /* dummy entries 0-15, not used */ + int (*tclpIsAtty) (int fd); /* 16 */ +} TclIntPlatStubs; +extern const TclIntPlatStubs *tclIntPlatStubsPtr; +# include "tkWinInt.h" #endif #ifdef MAC_OSX_TK #include "tkMacOSXInt.h" @@ -59,9 +67,9 @@ static int WinIsTty(int fd) { */ #if !defined(STATIC_BUILD) - if (tclStubsPtr->reserved9 && TclpIsAtty) { + if (tclStubsPtr->reserved9 && tclIntPlatStubsPtr->tclpIsAtty) { /* We are running on Cygwin */ - return TclpIsAtty(fd); + return tclIntPlatStubsPtr->tclpIsAtty(fd); } #endif handle = GetStdHandle(STD_INPUT_HANDLE + fd); @@ -105,7 +113,7 @@ static void StdinProc(ClientData clientData, int mask); * * Results: * None. This function never returns (it exits the process when it's - * done. + * done). * * Side effects: * This function initializes the Tk world and then starts interpreting @@ -114,6 +122,7 @@ static void StdinProc(ClientData clientData, int mask); * *---------------------------------------------------------------------- */ + void Tk_MainEx( int argc, /* Number of arguments. */ @@ -171,7 +180,9 @@ Tk_MainEx( tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); +#if TCL_MINOR_VERSION < 6 Tcl_FindExecutable(argv[0]); +#endif tsdPtr->interp = interp; Tcl_Preserve((ClientData) interp); diff --git a/unix/Makefile.in b/unix/Makefile.in index c26e893..1baa41b 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -100,11 +100,12 @@ DEMO_INSTALL_DIR = $(INSTALL_ROOT)$(TK_LIBRARY)/demos # The directory containing the Tcl sources and headers appropriate # for this version of Tk ("srcdir" will be replaced or has already # been replaced by the configure script): -TCL_GENERIC_DIR = @TCL_SRC_DIR@/generic +TCLDIR = @TCL_SRC_DIR@ +TCL_GENERIC_DIR = $(TCLDIR)/generic # The directory containing the platform specific Tcl sources and headers # appropriate for this version of Tk: -TCL_PLATFORM_DIR = @TCL_SRC_DIR@/unix +TCL_PLATFORM_DIR = $(TCLDIR)/unix # The directory containing the Tcl library archive file appropriate # for this version of Tk: @@ -304,7 +305,7 @@ GENERIC_DIR = $(TOP_DIR)/generic TTK_DIR = $(GENERIC_DIR)/ttk UNIX_DIR = $(TOP_DIR)/unix BMAP_DIR = $(TOP_DIR)/bitmaps -TOOL_DIR = @TCL_SRC_DIR@/tools +TOOL_DIR = $(TCLDIR)/tools TEST_DIR = $(TOP_DIR)/tests MAC_OSX_DIR = $(TOP_DIR)/macosx XLIB_DIR = $(TOP_DIR)/xlib @@ -549,7 +550,7 @@ DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget SHELL_ENV = \ @LD_LIBRARY_PATH_VAR@="`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}"; \ export @LD_LIBRARY_PATH_VAR@; \ - TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \ + TCL_LIBRARY=$(TCLDIR)/library; export TCL_LIBRARY; \ TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; all: binaries libraries doc @@ -559,7 +560,7 @@ binaries: ${LIB_FILE} ${WISH_EXE} libraries: $(TOP_DIR)/doc/man.macros: - $(INSTALL_DATA) @TCL_SRC_DIR@/doc/man.macros $(TOP_DIR)/doc/man.macros + $(INSTALL_DATA) $(TCLDIR)/doc/man.macros $(TOP_DIR)/doc/man.macros doc: $(TOP_DIR)/doc/man.macros @@ -654,7 +655,7 @@ demo: # This target can be used to run wish inside either gdb or insight gdb: ${WISH_EXE} @echo "set env @LD_LIBRARY_PATH_VAR@=\"`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}\"" > gdb.run - @echo "set env TCL_LIBRARY=@TCL_SRC_DIR@/library" >> gdb.run + @echo "set env TCL_LIBRARY=$(TCLDIR)/library" >> gdb.run @echo "set env TK_LIBRARY=@TK_SRC_DIR@/library" >> gdb.run gdb ./${WISH_EXE} --command=gdb.run rm gdb.run @@ -1495,7 +1496,6 @@ DISTROOT = /tmp/dist DISTNAME = tk${VERSION}${PATCH_LEVEL} ZIPNAME = tk${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip DISTDIR = $(DISTROOT)/$(DISTNAME) -TCLDIR = @TCL_SRC_DIR@ $(UNIX_DIR)/configure: $(UNIX_DIR)/configure.in $(UNIX_DIR)/tcl.m4 \ $(UNIX_DIR)/aclocal.m4 cd $(UNIX_DIR); autoconf @@ -1504,7 +1504,7 @@ $(MAC_OSX_DIR)/configure: $(MAC_OSX_DIR)/configure.ac $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in: $(MAC_OSX_DIR)/configure cd $(MAC_OSX_DIR); autoheader; touch $@ -dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure genstubs +dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure $(TOP_DIR)/doc/man.macros genstubs rm -rf $(DISTDIR) mkdir -p $(DISTDIR)/unix cp -p $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix @@ -1512,7 +1512,7 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(M chmod 664 $(DISTDIR)/unix/Makefile.in cp $(UNIX_DIR)/configure $(UNIX_DIR)/configure.in $(UNIX_DIR)/tk.spec \ $(UNIX_DIR)/aclocal.m4 $(UNIX_DIR)/tcl.m4 \ - $(UNIX_DIR)/tkConfig.sh.in $(TCLDIR)/unix/install-sh \ + $(UNIX_DIR)/tkConfig.sh.in $(UNIX_DIR)/install-sh \ $(UNIX_DIR)/README $(UNIX_DIR)/installManPage \ $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(DISTDIR)/unix chmod 775 $(DISTDIR)/unix/configure $(DISTDIR)/unix/configure.in @@ -1566,8 +1566,8 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(M $(MAC_OSX_DIR)/Wish.xcodeproj/default.pbxuser \ $(DISTDIR)/macosx/Wish.xcodeproj mkdir $(DISTDIR)/compat - cp -p $(TOP_DIR)/license.terms $(TCLDIR)/compat/unistd.h \ - $(TCLDIR)/compat/stdlib.h $(TCLDIR)/compat/limits.h \ + cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/compat/unistd.h \ + $(TOP_DIR)/compat/stdlib.h $(TOP_DIR)/compat/limits.h \ $(DISTDIR)/compat mkdir $(DISTDIR)/xlib cp -p $(XLIB_DIR)/*.[ch] $(DISTDIR)/xlib @@ -1614,7 +1614,7 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(M done;) mkdir $(DISTDIR)/doc cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \ - $(TCLDIR)/doc/man.macros $(DISTDIR)/doc + $(TOP_DIR)/doc/man.macros $(DISTDIR)/doc mkdir $(DISTDIR)/tests cp -p $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \ $(TEST_DIR)/README $(TEST_DIR)/*.{gif,ppm,xbm} \ diff --git a/unix/configure b/unix/configure index 029b866..1d8bc0d 100755 --- a/unix/configure +++ b/unix/configure @@ -1545,13 +1545,18 @@ echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6 -if test "${TCL_VERSION}" != "${TK_VERSION}"; then - { { echo "$as_me:$LINENO: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. -Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}. -Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&5 -echo "$as_me: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. -Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}. -Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&2;} +if test "${TCL_MAJOR_VERSION}" -ne 8 ; then + { { echo "$as_me:$LINENO: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.5+ +Found config for Tcl ${TCL_VERSION}" >&5 +echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.5+ +Found config for Tcl ${TCL_VERSION}" >&2;} + { (exit 1); exit 1; }; } +fi +if test "${TCL_MINOR_VERSION}" -lt 5 ; then + { { echo "$as_me:$LINENO: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.5+ +Found config for Tcl ${TCL_VERSION}" >&5 +echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.5+ +Found config for Tcl ${TCL_VERSION}" >&2;} { (exit 1); exit 1; }; } fi diff --git a/unix/configure.in b/unix/configure.in index 4b1f992..32cfb02 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -36,10 +36,13 @@ LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" SC_PATH_TCLCONFIG SC_LOAD_TCLCONFIG -if test "${TCL_VERSION}" != "${TK_VERSION}"; then - AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. -Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}. -Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}.]) +if test "${TCL_MAJOR_VERSION}" -ne 8 ; then + AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.5+ +Found config for Tcl ${TCL_VERSION}]) +fi +if test "${TCL_MINOR_VERSION}" -lt 5 ; then + AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.5+ +Found config for Tcl ${TCL_VERSION}]) fi SC_PROG_TCLSH -- cgit v0.12