From 4d20f665946c27cd45eb210ffd754af25bc4688f Mon Sep 17 00:00:00 2001 From: "nijtmans@users.sourceforge.net" Date: Tue, 5 Jun 2012 11:11:21 +0000 Subject: Generate same pkgIndex.tcl file for win32 and cygwin, one that is equally useable for both --- ChangeLog | 2 ++ generic/tkIntDecls.h | 2 +- generic/tkIntXlibDecls.h | 6 ++-- generic/tkStubInit.c | 2 +- unix/Makefile.in | 78 +++++++++++++++++++++++++----------------------- win/Makefile.in | 10 +++++-- 6 files changed, 54 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04b0140..0c45255 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * generic/tkInt.decls: Change XSetDashes signature and many others * generic/tkIntDecls.h: to match Xorg, needed for Cygwin. * generic/tkIntXlibDeclsDecls.h + * win/Makefile.in: Generate same pkgIndex.tcl file for win32 and + * unix/Makefile.in: cygwin, one that is equally useable for both. 2012-05-30 Jan Nijtmans diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index eb224c8..59e7e30 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -1854,7 +1854,7 @@ extern TkIntStubs *tkIntStubsPtr; #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT -#if !defined(__WIN32__) && !defined(MAC_OSX_TK) +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TK) /* * These macros are just wrappers for the equivalent X Region calls. diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index 0e59123..5f1b3ad 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -32,7 +32,7 @@ * Exported function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(__WIN32__) /* WIN */ #ifndef XSetDashes_TCL_DECLARED #define XSetDashes_TCL_DECLARED /* 0 */ @@ -1192,7 +1192,7 @@ typedef struct TkIntXlibStubs { int magic; struct TkIntXlibStubHooks *hooks; -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(__WIN32__) /* WIN */ int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */ XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */ XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */ @@ -1411,7 +1411,7 @@ extern TkIntXlibStubs *tkIntXlibStubsPtr; * Inline function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(__WIN32__) /* WIN */ #ifndef XSetDashes #define XSetDashes \ (tkIntXlibStubsPtr->xSetDashes) /* 0 */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 342994a..42bb3f1 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -573,7 +573,7 @@ TkIntPlatStubs tkIntPlatStubs = { TkIntXlibStubs tkIntXlibStubs = { TCL_STUB_MAGIC, NULL, -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(__WIN32__) /* WIN */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ diff --git a/unix/Makefile.in b/unix/Makefile.in index 4e83c09..406eeac 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -208,6 +208,8 @@ BUILD_TCLSH = @BUILD_TCLSH@@EXEEXT@ # required just to do a normal build although it can be required to run # make dist. This variable is set to "" if no tclsh is available. TCL_EXE = @TCLSH_PROG@ +WISH_EXE = wish@EXEEXT@ +TKTEST_EXE = tktest@EXEEXT@ # Tk used to let the configure script choose which program to use # for installing, but there are just too many different versions of @@ -563,7 +565,7 @@ SHELL_ENV = \ all: binaries libraries doc -binaries: ${LIB_FILE} ${STUB_LIB_FILE} wish@EXEEXT@ +binaries: ${LIB_FILE} ${STUB_LIB_FILE} ${WISH_EXE} libraries: @@ -604,9 +606,9 @@ tkLibObjs: objs: ${OBJS} -wish@EXEEXT@: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@ +${WISH_EXE}: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@ ${CC} ${CFLAGS} ${LDFLAGS} $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ \ - $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o wish@EXEEXT@ + $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o ${WISH_EXE} # Resetting the LIB_RUNTIME_DIR below is required so that # the generated tktest executable gets the build directory @@ -614,12 +616,12 @@ wish@EXEEXT@: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@ # picking up an already installed version of the Tcl or # Tk shared libraries. -tktest@EXEEXT@: $(TKTEST_OBJS) $(TK_LIB_FILE) +$(TKTEST_EXE): $(TKTEST_OBJS) $(TK_LIB_FILE) $(MAKE) tktest-real LIB_RUNTIME_DIR="`pwd`:$(TCL_BIN_DIR)" tktest-real: ${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) @TK_BUILD_LIB_SPEC@ \ - $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o tktest@EXEEXT@ + $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o $(TKTEST_EXE) # FIXME: This xttest rule seems to be broken in a number of ways. # It should use CC_SEARCH_FLAGS, it does not include the shared @@ -639,50 +641,50 @@ xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE) test: test-classic test-ttk -test-classic: tktest@EXEEXT@ - $(SHELL_ENV) ./tktest@EXEEXT@ $(TEST_DIR)/all.tcl -geometry +0+0 $(TESTFLAGS) +test-classic: $(TKTEST_EXE) + $(SHELL_ENV) ./$(TKTEST_EXE) $(TEST_DIR)/all.tcl -geometry +0+0 $(TESTFLAGS) -test-ttk: tktest@EXEEXT@ - $(SHELL_ENV) ./tktest@EXEEXT@ $(TEST_DIR)/ttk/all.tcl -geometry +0+0 \ +test-ttk: $(TKTEST_EXE) + $(SHELL_ENV) ./$(TKTEST_EXE) $(TEST_DIR)/ttk/all.tcl -geometry +0+0 \ $(TESTFLAGS) # Tests with different languages -testlang: tktest@EXEEXT@ +testlang: $(TKTEST_EXE) $(SHELL_ENV) \ for lang in $(LOCALES) ; \ do \ LANG=$(lang); export LANG; \ - ./tktest@EXEEXT@ $(TEST_DIR)/all.tcl -geometry +0+0 \ + ./$(TKTEST_EXE) $(TEST_DIR)/all.tcl -geometry +0+0 \ $(TESTFLAGS); \ done # Useful target to launch a built tktest with the proper path,... -runtest: tktest@EXEEXT@ - $(SHELL_ENV) ./tktest@EXEEXT@ +runtest: $(TKTEST_EXE) + $(SHELL_ENV) ./$(TKTEST_EXE) # This target can be used to run wish from the build directory # via `make shell` or `make shell SCRIPT=/tmp/foo.tcl` -shell: wish@EXEEXT@ - $(SHELL_ENV) ./wish@EXEEXT@ $(SCRIPT) +shell: ${WISH_EXE} + $(SHELL_ENV) ./${WISH_EXE} $(SCRIPT) demo: - $(SHELL_ENV) ./wish@EXEEXT@ $(TOP_DIR)/library/demos/widget + $(SHELL_ENV) ./${WISH_EXE} $(TOP_DIR)/library/demos/widget # This target can be used to run wish inside either gdb or insight -gdb: wish@EXEEXT@ +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 TK_LIBRARY=@TK_SRC_DIR@/library" >> gdb.run - gdb ./wish@EXEEXT@ --command=gdb.run + gdb ./${WISH_EXE} --command=gdb.run rm gdb.run VALGRINDARGS=--tool=memcheck --num-callers=8 --leak-resolution=high --leak-check=yes --show-reachable=yes -v -valgrind: tktest@EXEEXT@ - $(SHELL_ENV) valgrind $(VALGRINDARGS) ./tktest@EXEEXT@ $(TEST_DIR)/all.tcl -geometry +0+0 -singleproc 1 $(TESTFLAGS) +valgrind: $(TKTEST_EXE) + $(SHELL_ENV) valgrind $(VALGRINDARGS) ./$(TKTEST_EXE) $(TEST_DIR)/all.tcl -geometry +0+0 -singleproc 1 $(TESTFLAGS) -valgrindshell: tktest@EXEEXT@ - $(SHELL_ENV) valgrind $(VALGRINDARGS) ./tktest@EXEEXT@ $(SCRIPT) +valgrindshell: $(TKTEST_EXE) + $(SHELL_ENV) valgrind $(VALGRINDARGS) ./$(TKTEST_EXE) $(SCRIPT) INSTALL_TARGETS = install-binaries install-libraries install-demos install-doc @EXTRA_INSTALL@ @@ -697,7 +699,7 @@ install-strip: # some ranlibs write to current directory, and this might not always be # possible (e.g. if installing as root). -install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) wish@EXEEXT@ +install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) ${WISH_EXE} @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" \ "$(PKG_INSTALL_DIR)" "$(CONFIG_INSTALL_DIR)" ; \ do \ @@ -731,10 +733,10 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) wish@EXEEXT@ @echo "Installing $(LIB_FILE) to $(DLL_INSTALL_DIR)/" @@INSTALL_LIB@ @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" - @echo "Installing wish@EXEEXT@ as $(BIN_INSTALL_DIR)/wish$(VERSION)@EXEEXT@" - @$(INSTALL_PROGRAM) wish@EXEEXT@ "$(BIN_INSTALL_DIR)"/wish$(VERSION)@EXEEXT@ + @echo "Installing ${WISH_EXE} as $(BIN_INSTALL_DIR)/wish$(VERSION)@EXEEXT@" + @$(INSTALL_PROGRAM) ${WISH_EXE} "$(BIN_INSTALL_DIR)/wish$(VERSION)@EXEEXT@" @echo "Installing tkConfig.sh to $(CONFIG_INSTALL_DIR)/" - @$(INSTALL_DATA) tkConfig.sh "$(CONFIG_INSTALL_DIR)"/tkConfig.sh + @$(INSTALL_DATA) tkConfig.sh "$(CONFIG_INSTALL_DIR)/tkConfig.sh" @if test "$(STUB_LIB_FILE)" != "" ; then \ echo "Installing $(STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \ @INSTALL_STUB_LIB@ ; \ @@ -743,10 +745,10 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) wish@EXEEXT@ install-libraries: libraries @if test "$(@TK_WINDOWINGSYSTEM@_XLIB_HDRS)" != ""; then \ - XLIB_INCLUDE_INSTALL_DIR="$(INCLUDE_INSTALL_DIR)"/X11; fi; \ + XLIB_INCLUDE_INSTALL_DIR="$(INCLUDE_INSTALL_DIR)/X11"; fi; \ for i in "$(INCLUDE_INSTALL_DIR)" "$${XLIB_INCLUDE_INSTALL_DIR}" \ - "$(SCRIPT_INSTALL_DIR)" "$(SCRIPT_INSTALL_DIR)"/images \ - "$(SCRIPT_INSTALL_DIR)"/msgs "$(SCRIPT_INSTALL_DIR)"/ttk; \ + "$(SCRIPT_INSTALL_DIR)" "$(SCRIPT_INSTALL_DIR)/images" \ + "$(SCRIPT_INSTALL_DIR)/msgs" "$(SCRIPT_INSTALL_DIR)/ttk"; \ do \ if [ -n "$$i" -a ! -d "$$i" ] ; then \ echo "Making directory $$i"; \ @@ -765,7 +767,7 @@ install-libraries: libraries done; @list='$(@TK_WINDOWINGSYSTEM@_XLIB_HDRS)'; for i in $$list ; \ do \ - $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)"/X11; \ + $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)/X11"; \ done; @echo "Installing library files to $(SCRIPT_INSTALL_DIR)"; @for i in $(TOP_DIR)/library/*.tcl \ @@ -784,19 +786,19 @@ install-libraries: libraries @for i in $(TOP_DIR)/library/images/*; \ do \ if [ -f $$i ] ; then \ - $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/images; \ + $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)/images"; \ fi; \ done; @echo "Installing translation directory"; @for i in $(TOP_DIR)/library/msgs/*.msg; \ do \ if [ -f $$i ] ; then \ - $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/msgs; \ + $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)/msgs"; \ fi; \ done; install-demos: - @for i in "$(DEMO_INSTALL_DIR)" "$(DEMO_INSTALL_DIR)"/images ; \ + @for i in "$(DEMO_INSTALL_DIR)" "$(DEMO_INSTALL_DIR)/images" ; \ do \ if [ ! -d "$$i" ] ; then \ echo "Making directory $$i"; \ @@ -816,16 +818,16 @@ install-demos: @for i in $(DEMOPROGS); \ do \ if test $$i = "square"; then \ - rm -f "$(DEMO_INSTALL_DIR)"/$$i; \ + rm -f "$(DEMO_INSTALL_DIR)/$$i"; \ else \ - chmod 755 "$(DEMO_INSTALL_DIR)"/$$i; \ + chmod 755 "$(DEMO_INSTALL_DIR)/$$i"; \ fi; \ done; @echo "Installing demo images"; @for i in $(TOP_DIR)/library/demos/images/*; \ do \ if [ -f $$i ] ; then \ - $(INSTALL_DATA) $$i "$(DEMO_INSTALL_DIR)"/images; \ + $(INSTALL_DATA) $$i "$(DEMO_INSTALL_DIR)/images"; \ fi; \ done; @@ -884,7 +886,7 @@ Makefile: $(UNIX_DIR)/Makefile.in clean: rm -f *.a *.o libtk* core errs *~ \#* TAGS *.E a.out \ - errors wish@EXEEXT@ tktest@EXEEXT@ lib.exp Tk *.rsrc + errors ${WISH_EXE} $(TKTEST_EXE) lib.exp Tk *.rsrc distclean: clean rm -rf Makefile config.status config.cache config.log tkConfig.sh \ @@ -901,7 +903,7 @@ depend: # execute concurrently with the renaming and recompiling of that same object # file in the target below. -tkTestInit.o: $(UNIX_DIR)/tkAppInit.c wish@EXEEXT@ +tkTestInit.o: $(UNIX_DIR)/tkAppInit.c ${WISH_EXE} @if test -f tkAppInit.o ; then \ rm -f tkAppInit.sav; \ mv tkAppInit.o tkAppInit.sav; \ diff --git a/win/Makefile.in b/win/Makefile.in index 89b61cd..6bfa4ad 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -478,8 +478,12 @@ install-binaries: binaries @$(RM) $(PKG_INDEX); @(\ echo "if {[catch {package present Tcl 8.5.0}]} { return }";\ - echo "package ifneeded Tk $(VERSION)$(PATCH_LEVEL)\ - [list load [file join \$$dir .. .. bin $(TK_DLL_FILE)] Tk]";\ + echo "if {(\$$::tcl_platform(platform) eq \"unix\")";\ + echo " && ([info exists ::env(DISPLAY)] || [lsearch -exact \$$::argv -display] > -1)} {";\ + echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file join \$$dir .. .. bin libtk$(VERSION).dll] Tk]";\ + echo "} else {";\ + echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file join \$$dir .. .. bin $(TK_DLL_FILE)] Tk]";\ + echo "}";\ ) > $(PKG_INDEX); @for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \ do \ @@ -669,7 +673,7 @@ tkWindow.$(OBJEXT): configure Makefile .SUFFIXES: .$(RES) .SUFFIXES: .rc -# Implicit rule for all object files that will end up in the Tcl library +# Implicit rule for all object files that will end up in the Tk library %.$(OBJEXT): %.c $(CC) -c $(STUB_CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME) -- cgit v0.12