From 2389c143d1bc1b5400aefcaef26e2e15945a82ad Mon Sep 17 00:00:00 2001 From: das Date: Thu, 26 May 2005 11:18:50 +0000 Subject: * macosx/tkMacOSXInit.c (TkpInit): fixed resource file extraction from __tk_rsrc section to work with non-prebound .dylib and .bundle. * macosx/Makefile: corrected EMBEDDED_BUILD check, use separate tcl and tk version vars to properly support tk/x11 framework version overriding, rewrite tkConfig.sh when overriding tk version, corrected Wish.app symlink in tk build dir. * unix/configure.in: corrected framework finalization to softlink stub library to Versions/8.x subdir instead of Versions/Current. * unix/configure: autoconf-2.59 --- ChangeLog | 16 +++++++- macosx/Makefile | 23 +++++++---- macosx/tkMacOSXInit.c | 18 ++++----- unix/configure | 104 +------------------------------------------------- unix/configure.in | 5 +-- 5 files changed, 41 insertions(+), 125 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c9bd03..6220db0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-05-26 Daniel Steffen + + * macosx/tkMacOSXInit.c (TkpInit): fixed resource file extraction + from __tk_rsrc section to work with non-prebound .dylib and .bundle. + + * macosx/Makefile: corrected EMBEDDED_BUILD check, use separate tcl + and tk version vars to properly support tk/x11 framework version + overriding, rewrite tkConfig.sh when overriding tk version, corrected + Wish.app symlink in tk build dir. + + * unix/configure.in: corrected framework finalization to softlink + stub library to Versions/8.x subdir instead of Versions/Current. + * unix/configure: autoconf-2.59 + 2005-05-25 Jeff Hobbs * unix/Makefile.in (install-libraries): protect possible empty @@ -36,7 +50,7 @@ compatibility symlinks for the old name. * macosx/tkMacOSXInit.c (TkpInit): added support for Tk resource file in non-framework and static builds: the resource file is copied into a - __tk_rsrc MachO segment of the library or executable at link time and + __tk_rsrc MachO section of the library or executable at link time and extracted into a temporary location at initialization. * unix/configure: autoconf-2.59 * unix/tkConfig.h.in (new file): autoheader-2.59 diff --git a/macosx/Makefile b/macosx/Makefile index 9908165..a1cd172 100644 --- a/macosx/Makefile +++ b/macosx/Makefile @@ -4,7 +4,7 @@ # uses the standard unix build system in tk/unix (which can be used directly instead of this # if you are not using the tk/macosx projects). # -# RCS: @(#) $Id: Makefile,v 1.16 2005/05/23 20:24:59 das Exp $ +# RCS: @(#) $Id: Makefile,v 1.17 2005/05/26 11:19:01 das Exp $ # ######################################################################################################## @@ -96,6 +96,7 @@ PRODUCT_NAME := Tk UNIX_DIR := ${CURDIR}/../unix VERSION := $(shell awk -F= '/^TK_VERSION/ {print $$2; nextfile}' ${UNIX_DIR}/configure.in) +TCL_VERSION := ${VERSION} WISH = wish${VERSION} BUILD_TARGET := wish @@ -106,7 +107,7 @@ TCL_DIR := ${TCL_BUILD_DIR} TCL_FRAMEWORK_DIR := ${TCL_BUILD_DIR}/.. else TCL_DIR := ${TCL_FRAMEWORK_DIR}/Tcl.framework -TCL_EXE := ${TCLSH_DIR}/tclsh${VERSION} +TCL_EXE := ${TCLSH_DIR}/tclsh${TCL_VERSION} MAKE_VARS = TCL_EXE export DYLD_FRAMEWORK_PATH := ${TCL_FRAMEWORK_DIR} endif @@ -154,7 +155,7 @@ APP_DIR := . FMWK_DIR := . endif -TCL_FMWK_DIR := ${FMWK_DIR}/Tcl.framework/Versions/${VERSION} +TCL_FMWK_DIR := ${FMWK_DIR}/Tcl.framework/Versions/${TCL_VERSION} TK_FMWK_DIR := ${FMWK_DIR}/${PRODUCT_NAME}.framework/Versions/${VERSION} #------------------------------------------------------------------------------------------------------- @@ -168,6 +169,10 @@ ${OBJ_DIR}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure --mandir=${MANDIR} --enable-threads --enable-framework \ --with-tcl=${TCL_DIR} \ ${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS} +ifneq (${TK_X11},) + @cd ${OBJ_DIR} && sed -e 's#/Versions/${TCL_VERSION}#/Versions/${VERSION}#' \ + tkConfig.sh > tkConfig.sh.1 && mv -f tkConfig.sh.1 tkConfig.sh +endif build-${PROJECT}: ${OBJ_DIR}/Makefile ${DO_MAKE} @@ -187,7 +192,8 @@ endif install-${PROJECT}: build-${PROJECT} ifeq (${EMBEDDED_BUILD}_${INSTALL_ROOT},1_) @echo "Cannot install-embedded with empty INSTALL_ROOT !" && false -else +endif +ifeq (${EMBEDDED_BUILD},1) @rm -rf "${INSTALL_ROOT}/${LIBDIR}/Tk.framework" endif ${DO_MAKE} @@ -225,9 +231,9 @@ endif ifeq (${TK_X11},) ifeq (${EMBEDDED_BUILD},) # install Wish.app link in APPLICATION_INSTALL_PATH and setup 'Wish Shell' compatibility links - @cd ${TOP_DIR} && mkdir -p "./${APP_DIR}" && \ - ln -fsh "$$(echo ./${APP_DIR} | sed -e 's#/[^/][^/]*#/..#g')/${TK_FMWK_DIR}/Resources/Wish.app" "./${APP_DIR}" && \ - ln -fsh Wish.app "./${APP_DIR}/Wish Shell.app" && \ + @cd ${TOP_DIR} && if [ -n "${APP_DIR}" ]; then mkdir -p "./${APP_DIR}" && \ + ln -fsh "./$$(echo ${APP_DIR} | sed -e 's#/[^/][^/]*#/..#g')/${FMWK_DIR}/${PRODUCT_NAME}.framework/Resources/Wish.app" "./${APP_DIR}" && \ + ln -fsh Wish.app "./${APP_DIR}/Wish Shell.app"; fi && \ ln -fsh Wish.app "./${TK_FMWK_DIR}/Resources/Wish Shell.app" && \ ln -fsh Wish "./${TK_FMWK_DIR}/Resources/Wish.app/Contents/MacOS/Wish Shell" else @@ -240,7 +246,8 @@ else mkdir -p "./${APP_DIR}/Wish.app/Contents/Frameworks" && \ mv -f "./${FMWK_DIR}"/T{cl,k}.framework "./${APP_DIR}/Wish.app/Contents/Frameworks" && \ rmdir -p "./${FMWK_DIR}" 2>&- || true && cd "./${APP_DIR}/Wish.app/Contents" && \ - rm -rf Frameworks/T{cl,k}.framework/{,/Versions/$(VERSION)}/{Headers,PrivateHeaders,*_debug,lib*.a,*Config.sh} && \ + rm -rf Frameworks/Tcl.framework/{,/Versions/$(TCL_VERSION)}/{Headers,PrivateHeaders,*_debug,lib*.a,*Config.sh} && \ + rm -rf Frameworks/Tk.framework/{,/Versions/$(VERSION)}/{Headers,PrivateHeaders,*_debug,lib*.a,*Config.sh} && \ fix_install_id ( ) { \ chmod -RH a+w "$$1"; \ install_name_tool -id $$(otool -L "$$1" | awk "/$$2\.framework.*[^:]\$$/ {sub(\"^.*/Frameworks\",\"@executable_path/../Frameworks\",\$$1); print \$$1}") "$$1"; \ diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 780bcc3..b604317 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXInit.c,v 1.11 2005/05/24 02:32:15 das Exp $ + * RCS: @(#) $Id: tkMacOSXInit.c,v 1.12 2005/05/26 11:19:01 das Exp $ */ #include "tkInt.h" @@ -175,23 +175,20 @@ TkpInit(interp) unsigned long size; int fd = -1; char fileName[L_tmpnam + 15]; + int i, n; /* Get resource data from __tk_rsrc section of tk library file */ -#ifdef HAVE__DYLD_GET_IMAGE_HEADER_CONTAINING_ADDRESS - image = _dyld_get_image_header_containing_address((unsigned long)&TkpInit); - if (image) { - data = getsectdatafromheader(image, SEG_TEXT, "__tk_rsrc", &size); - } -#else - int i, n = _dyld_image_count(); + n = _dyld_image_count(); for (i = 0; i < n; i++) { image = _dyld_get_image_header(i); if (image) { data = getsectdatafromheader(image, SEG_TEXT, "__tk_rsrc", &size); + if (data) { + data += _dyld_get_image_vmaddr_slide(i); + break; + } } - if (data) break; } -#endif while (data) { OSStatus err; FSRef ref; @@ -210,6 +207,7 @@ TkpInit(interp) err = FSPathMakeRef(fileName, &ref, NULL); if (err != noErr) break; err = FSOpenResourceFile(&ref, 0, NULL, fsRdPerm, &refNum); + if (err != noErr) fprintf(stderr,"FSOpenResourceFile error %d\n",err); break; } if (fd != -1) { diff --git a/unix/configure b/unix/configure index a50b418..ec22896 100755 --- a/unix/configure +++ b/unix/configure @@ -8635,108 +8635,6 @@ _ACEOF LIBS="$LIBS -framework Carbon" CFLAGS="$CFLAGS -fpascal-strings" - -for ac_func in _dyld_get_image_header_containing_address -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - TK_WINDOWINGSYSTEM=AQUA else #-------------------------------------------------------------------- @@ -9793,7 +9691,7 @@ _ACEOF EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"' fi - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" "$(STUB_LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."' TK_YEAR="`date +%Y`" # Don't use AC_DEFINE for the following as the framework version define # needs to go into the Makefile even when using autoheader, so that we diff --git a/unix/configure.in b/unix/configure.in index 7d350c1..7dbf335 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.103 2005/05/24 01:34:26 das Exp $ +# RCS: @(#) $Id: configure.in,v 1.104 2005/05/26 11:19:04 das Exp $ AC_INIT([tk],[8.5]) AC_PREREQ(2.57) @@ -229,7 +229,6 @@ if test $tk_aqua = yes; then AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?]) LIBS="$LIBS -framework Carbon" CFLAGS="$CFLAGS -fpascal-strings" - AC_CHECK_FUNCS(_dyld_get_image_header_containing_address) TK_WINDOWINGSYSTEM=AQUA else #-------------------------------------------------------------------- @@ -454,7 +453,7 @@ if test "$FRAMEWORK_BUILD" = "1" ; then EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"' fi - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" "$(STUB_LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."' TK_YEAR="`date +%Y`" # Don't use AC_DEFINE for the following as the framework version define # needs to go into the Makefile even when using autoheader, so that we -- cgit v0.12