Attachment "tcl-darwin-8-3-4.patch" to
ticket [435258ffff]
added by
das
2001-10-16 11:12:01.
Index: tcl/unix/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/Makefile.in,v
retrieving revision 1.63.2.6
diff -u -3 -r1.63.2.6 Makefile.in
--- tcl/unix/Makefile.in 2001/10/03 20:26:09 1.63.2.6
+++ tcl/unix/Makefile.in 2001/10/16 01:47:31
@@ -166,8 +166,12 @@
# "install" around; better to use the install-sh script that comes
# with the distribution, which is slower but guaranteed to work.
+INSTALL_STRIP_PROGRAM = -s
+INSTALL_STRIP_LIBRARY = -S -S
+
INSTALL = @srcdir@/install-sh -c
INSTALL_PROGRAM = ${INSTALL}
+INSTALL_LIBRARY = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
# The following specifies which Tcl executable to use for make targets
@@ -252,7 +256,7 @@
${AC_FLAGS} ${MATH_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \
${COMPILE_DEBUG_FLAGS} ${ENV_FLAGS} -DTCL_SHLIB_EXT=\"${SHLIB_SUFFIX}\"
-LIBS = @DL_LIBS@ @LIBS@ $(MATH_LIBS) -lc
+LIBS = @DL_LIBS@ @LIBS@ $(MATH_LIBS)
DEPEND_SWITCHES = ${CFLAGS} -I${GENERIC_DIR} -I${SRC_DIR} \
${AC_FLAGS} ${MATH_FLAGS} \
@@ -414,7 +418,9 @@
${TCL_LIB_FILE}: ${OBJS} ${STUB_LIB_FILE}
rm -f ${TCL_LIB_FILE}
@MAKE_LIB@
- $(RANLIB) ${TCL_LIB_FILE}
+ if test "x@DL_OBJS@" = "xtclLoadAout.o"; then \
+ $(RANLIB) ${TCL_LIB_FILE}; \
+ fi
${STUB_LIB_FILE}: ${STUB_LIB_OBJS}
rm -f ${STUB_LIB_FILE}
@@ -510,14 +516,16 @@
install: install-binaries install-libraries install-doc
install-strip:
- $(MAKE) install INSTALL_PROGRAM="$(INSTALL_PROGRAM) -s"
+ $(MAKE) install \
+ INSTALL_PROGRAM="$(INSTALL_PROGRAM) ${INSTALL_STRIP_PROGRAM}" \
+ INSTALL_LIBRARY="$(INSTALL_LIBRARY) ${INSTALL_STRIP_LIBRARY}"
# Note: before running ranlib below, must cd to target directory because
# some ranlibs write to current directory, and this might not always be
# possible (e.g. if installing as root).
install-binaries: binaries
- @for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
+ @for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) $(SCRIPT_INSTALL_DIR); \
do \
if [ ! -d $$i ] ; then \
echo "Making directory $$i"; \
@@ -530,8 +538,10 @@
chmod +x $(SRC_DIR)/install-sh; \
fi
@echo "Installing $(TCL_LIB_FILE) to $(LIB_INSTALL_DIR)/"
- @$(INSTALL_DATA) $(TCL_LIB_FILE) $(LIB_INSTALL_DIR)/$(TCL_LIB_FILE)
- @(cd $(LIB_INSTALL_DIR); $(RANLIB) $(TCL_LIB_FILE))
+ @$(INSTALL_LIBRARY) $(TCL_LIB_FILE) $(LIB_INSTALL_DIR)/$(TCL_LIB_FILE)
+ @if test "x@DL_OBJS@" = "xtclLoadAout.o"; then \
+ (cd $(LIB_INSTALL_DIR); $(RANLIB) $(TCL_LIB_FILE)); \
+ fi
@chmod 555 $(LIB_INSTALL_DIR)/$(TCL_LIB_FILE)
@if test "$(TCL_BUILD_EXP_FILE)" != ""; then \
echo "Installing $(TCL_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \
@@ -540,11 +550,11 @@
fi
@echo "Installing tclsh as $(BIN_INSTALL_DIR)/tclsh$(VERSION)"
@$(INSTALL_PROGRAM) tclsh $(BIN_INSTALL_DIR)/tclsh$(VERSION)
- @echo "Installing tclConfig.sh to $(LIB_INSTALL_DIR)/"
- @$(INSTALL_DATA) tclConfig.sh $(LIB_INSTALL_DIR)/tclConfig.sh
+ @echo "Installing tclConfig.sh to $(SCRIPT_INSTALL_DIR)/"
+ @$(INSTALL_DATA) tclConfig.sh $(SCRIPT_INSTALL_DIR)/tclConfig.sh
@if test "$(TCL_STUB_LIB_FILE)" != "" ; then \
echo "Installing $(TCL_STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \
- $(INSTALL_DATA) $(STUB_LIB_FILE) \
+ $(INSTALL_LIBRARY) $(STUB_LIB_FILE) \
$(LIB_INSTALL_DIR)/$(TCL_STUB_LIB_FILE); \
fi
Index: tcl/unix/configure.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/configure.in,v
retrieving revision 1.57.2.4
diff -u -3 -r1.57.2.4 configure.in
--- tcl/unix/configure.in 2001/10/15 21:36:22 1.57.2.4
+++ tcl/unix/configure.in 2001/10/16 01:47:31
@@ -380,8 +380,7 @@
if test "x$DL_OBJS" = "xtclLoadAout.o"; then
MAKE_LIB="\${STLIB_LD} \[$]@ \${OBJS}"
else
- MAKE_LIB="\${SHLIB_LD} -o \[$]@ \${OBJS} ${SHLIB_LD_LIBS}"
- RANLIB=":"
+ MAKE_LIB="\${SHLIB_LD} ${TCL_SHLIB_LD_EXTRAS} -o \[$]@ \${OBJS} ${SHLIB_LD_LIBS}"
fi
else
case $system in
Index: tcl/unix/mkLinks
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/mkLinks,v
retrieving revision 1.12.2.2
diff -u -3 -r1.12.2.2 mkLinks
--- tcl/unix/mkLinks 2001/04/03 22:54:39 1.12.2.2
+++ tcl/unix/mkLinks 2001/10/16 01:47:31
@@ -23,10 +23,16 @@
cd $1
echo foo > xyzzyTestingAVeryLongFileName.foo
x=`echo xyzzyTe*`
+echo foo > xyzzyTestingaverylongfilename.foo
+y=`echo xyzzyTestingav*`
rm xyzzyTe*
if test "$x" != "xyzzyTestingAVeryLongFileName.foo"; then
exit
fi
+if test "$y" != "xyzzyTestingaverylongfilename.foo"; then
+ CASEINSENSITIVEFS=1
+fi
+
if test -r Access.3; then
rm -f Tcl_Access.3
@@ -960,10 +966,12 @@
rm -f Tcl_WrongNumArgs.3
ln WrongNumArgs.3 Tcl_WrongNumArgs.3
fi
+if test "${CASEINSENSITIVEFS:-}" != "1"; then
if test -r http.n; then
rm -f Http.n
ln http.n Http.n
fi
+fi
if test -r library.n; then
rm -f auto_execok.n
rm -f auto_import.n
@@ -1006,8 +1014,10 @@
rm -f SafeBase.n
ln safe.n SafeBase.n
fi
+if test "${CASEINSENSITIVEFS:-}" != "1"; then
if test -r tcltest.n; then
rm -f Tcltest.n
ln tcltest.n Tcltest.n
+fi
fi
exit 0
Index: tcl/unix/mkLinks.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/mkLinks.tcl,v
retrieving revision 1.2.10.1
diff -u -3 -r1.2.10.1 mkLinks.tcl
--- tcl/unix/mkLinks.tcl 2000/08/08 00:57:06 1.2.10.1
+++ tcl/unix/mkLinks.tcl 2001/10/16 01:47:31
@@ -30,10 +30,15 @@
cd $1
echo foo > xyzzyTestingAVeryLongFileName.foo
x=`echo xyzzyTe*`
+echo foo > xyzzyTestingaverylongfilename.foo
+y=`echo xyzzyTestingav*`
rm xyzzyTe*
if test "$x" != "xyzzyTestingAVeryLongFileName.foo"; then
exit
fi
+if test "$y" != "xyzzyTestingaverylongfilename.foo"; then
+ CASEINSENSITIVEFS=1
+fi
}
foreach file $argv {
@@ -61,10 +66,17 @@
append lnOutput " ln $tail $name$ext\n"
}
}
+ if { [llength $namelist] == 1 && [string compare -nocase $tail [lindex $namelist 0]] ==0} {
+ puts {if test "${CASEINSENSITIVEFS:-}" != "1"; then}
+ set state fi
+ }
if { [llength $namelist] } {
puts "if test -r $tail; then"
puts -nonewline $rmOutput
puts -nonewline $lnOutput
+ puts "fi"
+ }
+ if { $state == "fi" } {
puts "fi"
}
set state end
Index: tcl/unix/tcl.m4
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tcl.m4,v
retrieving revision 1.22.2.8
diff -u -3 -r1.22.2.8 tcl.m4
--- tcl/unix/tcl.m4 2001/10/03 20:26:09 1.22.2.8
+++ tcl/unix/tcl.m4 2001/10/16 01:47:31
@@ -960,14 +960,16 @@
;;
Rhapsody-*|Darwin-*)
SHLIB_CFLAGS="-fno-common"
- SHLIB_LD="cc -dynamiclib \${LDFLAGS} -compatibility_version ${TCL_MAJOR_VERSION} -current_version \${VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE}"
- SHLIB_LD_LIBS=""
+ SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
+ TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_MAJOR_VERSION} -current_version \${VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr a000000"
+ SHLIB_LD_LIBS="${LIBS}"
SHLIB_SUFFIX=".dylib"
DL_OBJS="tclLoadDyld.o"
DL_LIBS=""
- LDFLAGS=""
+ LDFLAGS="-prebind"
LD_SEARCH_FLAGS=""
CFLAGS_OPTIMIZE="-O3"
+ EXTRA_CFLAGS="-arch ppc -pipe"
;;
NEXTSTEP-*)
SHLIB_CFLAGS=""
Index: tcl/unix/tclLoadDyld.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclLoadDyld.c,v
retrieving revision 1.2.2.1
diff -u -3 -r1.2.2.1 tclLoadDyld.c
--- tcl/unix/tclLoadDyld.c 2001/04/06 18:42:39 1.2.2.1
+++ tcl/unix/tclLoadDyld.c 2001/10/16 01:47:31
@@ -2,10 +2,9 @@
* tclLoadDyld.c --
*
* This procedure provides a version of the TclLoadFile that
- * works with NeXT/Apple's dyld dynamic loading. This file
+ * works with Apple's dyld dynamic loading. This file
* provided by Wilfredo Sanchez ([email protected]).
- * The works on Mac OS X and Mac OS X Server.
- * It should work with OpenStep, but it's not been tried.
+ * This works on Mac OS X.
*
* Copyright (c) 1995 Apple Computer, Inc.
*
@@ -18,11 +17,6 @@
#include "tclInt.h"
#include <mach-o/dyld.h>
-/* For compatibility with older API. */
-#ifndef NSLINKMODULE_OPTION_PRIVATE
-#define NSLINKMODULE_OPTION_PRIVATE TRUE
-#endif
-
/*
*----------------------------------------------------------------------
*
@@ -58,69 +52,53 @@
* file which will be passed back to
* TclpUnloadFile() to unload the file. */
{
- NSObjectFileImageReturnCode err;
- NSObjectFileImage image;
- NSModule module;
- NSSymbol symbol;
- char *name;
-
- err = NSCreateObjectFileImageFromFile(fileName, &image);
- if (err != NSObjectFileImageSuccess) {
- switch (err) {
- case NSObjectFileImageFailure:
- Tcl_SetResult(interp, "dyld: general failure", TCL_STATIC);
- break;
- case NSObjectFileImageInappropriateFile:
- Tcl_SetResult(interp, "dyld: inappropriate Mach-O file",
- TCL_STATIC);
- break;
- case NSObjectFileImageArch:
- Tcl_SetResult(interp,
- "dyld: inappropriate Mach-O architecture", TCL_STATIC);
- break;
- case NSObjectFileImageFormat:
- Tcl_SetResult(interp, "dyld: invalid Mach-O file format",
- TCL_STATIC);
- break;
- case NSObjectFileImageAccess:
- Tcl_SetResult(interp, "dyld: permission denied", TCL_STATIC);
- break;
- default:
- Tcl_SetResult(interp, "dyld: unknown failure", TCL_STATIC);
- break;
- }
+ NSSymbol symbol;
+ enum DYLD_BOOL dyld_return;
+ Tcl_DString newName, ds;
+ char *native;
+
+ native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
+ dyld_return = NSAddLibrary(native);
+ Tcl_DStringFree(&ds);
+
+ if (dyld_return != TRUE) {
+ Tcl_AppendResult(interp, "dyld: couldn't add library \"", fileName,
+ "\": ", Tcl_PosixError(interp), (char *) NULL);
return TCL_ERROR;
}
-
- module = NSLinkModule(image, fileName, NSLINKMODULE_OPTION_PRIVATE);
- if (module == NULL) {
- Tcl_SetResult(interp, "dyld: falied to link module", TCL_STATIC);
- return TCL_ERROR;
+ /*
+ * dyld adds an underscore to the beginning of symbol names.
+ */
+
+ native = Tcl_UtfToExternalDString(NULL, sym1, -1, &ds);
+ Tcl_DStringInit(&newName);
+ Tcl_DStringAppend(&newName, "_", 1);
+ native = Tcl_DStringAppend(&newName, native, -1);
+ if(NSIsSymbolNameDefined(native)) {
+ symbol = NSLookupAndBindSymbol(native);
+ *proc1Ptr = NSAddressOfSymbol(symbol);
+ *clientDataPtr = NSModuleForSymbol(symbol);
+ } else {
+ *proc1Ptr=NULL;
+ *clientDataPtr=NULL;
}
+ Tcl_DStringFree(&newName);
+ Tcl_DStringFree(&ds);
- name = (char*)malloc(sizeof(char)*(strlen(sym1)+2));
- sprintf(name, "_%s", sym1);
-#ifdef NSLINKMODULE_OPTION_PRIVATE
- symbol = NSLookupSymbolInModule(module, name);
-#else
- symbol = NSLookupAndBindSymbol(name);
-#endif
- free(name);
- *proc1Ptr = NSAddressOfSymbol(symbol);
-
- name = (char*)malloc(sizeof(char)*(strlen(sym2)+2));
- sprintf(name, "_%s", sym2);
-#ifdef NSLINKMODULE_OPTION_PRIVATE
- symbol = NSLookupSymbolInModule(module, name);
-#else
- symbol = NSLookupAndBindSymbol(name);
-#endif
- free(name);
- *proc2Ptr = NSAddressOfSymbol(symbol);
-
- *clientDataPtr = module;
-
+ native = Tcl_UtfToExternalDString(NULL, sym2, -1, &ds);
+ Tcl_DStringInit(&newName);
+ Tcl_DStringAppend(&newName, "_", 1);
+ native = Tcl_DStringAppend(&newName, native, -1);
+ if(NSIsSymbolNameDefined(native)) {
+ symbol = NSLookupAndBindSymbol(native);
+ *proc2Ptr = NSAddressOfSymbol(symbol);
+ } else {
+ *proc2Ptr=NULL;
+ }
+ Tcl_DStringFree(&newName);
+ Tcl_DStringFree(&ds);
+
return TCL_OK;
}