summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--library/auto.tcl3
-rw-r--r--library/package.tcl21
-rw-r--r--macosx/Tcl.pbproj/project.pbxproj2
-rw-r--r--unix/tclUnixInit.c55
5 files changed, 86 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 5dd8996..164aa8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2002-10-22 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/auto.tcl (tcl_findLibrary):
+ * library/package.tcl (tclPkgUnknown): on macosx, search inside the
+ Resources/Scripts subdirectory of any potential package directory
+ * macosx/Tcl.pbproj/project.pbxproj: add standard Frameworks dirs
+ to TCL_PACKAGE_PATH make argument.
+ * unix/tclUnixInit.c (TclpSetVariables): on macosx, add embedded
+ framework dirs to tcl_pkgPath: @executable_path/../Frameworks and
+ @executable_path/../PrivateFrameworks (if they exist), as well as
+ the dirs in DYLD_FRAMEWORK_PATH (if set). [Patch #624509]
+ use standard MAXPATHLEN instead of literal 1024
+
2002-10-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
* doc/StringObj.3, doc/Object.3: Documented that Tcl_Obj's
diff --git a/library/auto.tcl b/library/auto.tcl
index b023f59..dcea2b5 100644
--- a/library/auto.tcl
+++ b/library/auto.tcl
@@ -3,7 +3,7 @@
# utility procs formerly in init.tcl dealing with auto execution
# of commands and can be auto loaded themselves.
#
-# RCS: @(#) $Id: auto.tcl,v 1.10 2002/08/31 06:09:45 das Exp $
+# RCS: @(#) $Id: auto.tcl,v 1.11 2002/10/22 16:41:27 das Exp $
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
@@ -103,6 +103,7 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} {
[string equal $::tcl_platform(os) "Darwin"]} {
foreach d $::tcl_pkgPath {
lappend dirs [file join $d $basename$version]
+ lappend dirs [file join $d $basename$version Resources Scripts]
}
}
}
diff --git a/library/package.tcl b/library/package.tcl
index 91b5831..83a7692 100644
--- a/library/package.tcl
+++ b/library/package.tcl
@@ -3,7 +3,7 @@
# utility procs formerly in init.tcl which can be loaded on demand
# for package management.
#
-# RCS: @(#) $Id: package.tcl,v 1.19 2002/05/31 23:21:12 dgp Exp $
+# RCS: @(#) $Id: package.tcl,v 1.20 2002/10/22 16:41:28 das Exp $
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
@@ -510,6 +510,25 @@ proc tclPkgUnknown {name version {exact {}}} {
}
}
}
+ # On MacOSX also search the Resources/Scripts directories in
+ # the subdirectories for pkgIndex files
+ if {[string equal $::tcl_platform(platform) "unix"] && \
+ [string equal $::tcl_platform(os) "Darwin"]} {
+ set dir [lindex $use_path end]
+ catch {
+ foreach file [glob -directory $dir -join -nocomplain \
+ * Resources Scripts pkgIndex.tcl] {
+ set dir [file dirname $file]
+ if {[file readable $file] && ![info exists procdDirs($dir)]} {
+ if {[catch {source $file} msg]} {
+ tclLog "error reading package index file $file: $msg"
+ } else {
+ set procdDirs($dir) 1
+ }
+ }
+ }
+ }
+ }
set dir [lindex $use_path end]
set file [file join $dir pkgIndex.tcl]
# safe interps usually don't have "file readable", nor stderr channel
diff --git a/macosx/Tcl.pbproj/project.pbxproj b/macosx/Tcl.pbproj/project.pbxproj
index 3baee15..a7c1edf 100644
--- a/macosx/Tcl.pbproj/project.pbxproj
+++ b/macosx/Tcl.pbproj/project.pbxproj
@@ -113,7 +113,7 @@
shouldUseHeadermap = 0;
};
00E2F84C016E8B780ACA28DC = {
- buildArgumentsString = "-c \"if [ \\\"${ACTION}\\\" != \\\"clean\\\" ]; then gnumake tclsh tcltest TCL_LIBRARY=\\\"@TCL_IN_FRAMEWORK@\\\" TCL_PACKAGE_PATH=\\\"~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl\\\" DYLIB_INSTALL_DIR=\\\"${DYLIB_INSTALL_DIR}\\\" ${EXTRA_MAKE_FLAGS}; else gnumake distclean; fi\"";
+ buildArgumentsString = "-c \"if [ \\\"${ACTION}\\\" != \\\"clean\\\" ]; then gnumake tclsh tcltest TCL_LIBRARY=\\\"@TCL_IN_FRAMEWORK@\\\" TCL_PACKAGE_PATH=\\\"~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl ~/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks\\\" DYLIB_INSTALL_DIR=\\\"${DYLIB_INSTALL_DIR}\\\" ${EXTRA_MAKE_FLAGS}; else gnumake distclean; fi\"";
buildPhases = (
);
buildSettings = {
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 092330d..5be58f5 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclUnixInit.c,v 1.33 2002/09/02 19:27:42 hobbs Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.34 2002/10/22 16:41:28 das Exp $
*/
#if defined(HAVE_CFBUNDLE)
@@ -404,9 +404,9 @@ CONST char *path; /* Path to the executable in native
{
#ifdef HAVE_CFBUNDLE
- char tclLibPath[1024];
+ char tclLibPath[MAXPATHLEN + 1];
- if (Tcl_MacOSXGetLibraryPath(NULL, 1024, tclLibPath) == TCL_OK) {
+ if (Tcl_MacOSXGetLibraryPath(NULL, MAXPATHLEN, tclLibPath) == TCL_OK) {
str = tclLibPath;
} else
#endif /* HAVE_CFBUNDLE */
@@ -700,15 +700,60 @@ TclpSetVariables(interp)
Tcl_DString ds;
#ifdef HAVE_CFBUNDLE
- char tclLibPath[1024];
+ char tclLibPath[MAXPATHLEN + 1];
- if (Tcl_MacOSXGetLibraryPath(interp, 1024, tclLibPath) == TCL_OK) {
+ if (Tcl_MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) {
+ CONST char *str;
+ Tcl_DString ds;
+ CFBundleRef bundleRef;
+
Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath,
TCL_GLOBAL_ONLY);
Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath,
TCL_GLOBAL_ONLY);
Tcl_SetVar(interp, "tcl_pkgPath", " ",
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
+ str = TclGetEnv("DYLD_FRAMEWORK_PATH", &ds);
+ if ((str != NULL) && (str[0] != '\0')) {
+ char *p = Tcl_DStringValue(&ds);
+ /* convert DYLD_FRAMEWORK_PATH from colon to space separated */
+ do {
+ if(*p == ':') *p = ' ';
+ } while (*p++);
+ Tcl_SetVar(interp, "tcl_pkgPath", Tcl_DStringValue(&ds),
+ TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
+ Tcl_SetVar(interp, "tcl_pkgPath", " ",
+ TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
+ Tcl_DStringFree(&ds);
+ }
+ if ((bundleRef = CFBundleGetMainBundle())) {
+ CFURLRef frameworksURL;
+ Tcl_StatBuf statBuf;
+ if((frameworksURL = CFBundleCopyPrivateFrameworksURL(bundleRef))) {
+ if(CFURLGetFileSystemRepresentation(frameworksURL, TRUE,
+ tclLibPath, MAXPATHLEN) &&
+ ! TclOSstat(tclLibPath, &statBuf) &&
+ S_ISDIR(statBuf.st_mode)) {
+ Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath,
+ TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
+ Tcl_SetVar(interp, "tcl_pkgPath", " ",
+ TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
+ }
+ CFRelease(frameworksURL);
+ }
+ if((frameworksURL = CFBundleCopySharedFrameworksURL(bundleRef))) {
+ if(CFURLGetFileSystemRepresentation(frameworksURL, TRUE,
+ tclLibPath, MAXPATHLEN) &&
+ ! TclOSstat(tclLibPath, &statBuf) &&
+ S_ISDIR(statBuf.st_mode)) {
+ Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath,
+ TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
+ Tcl_SetVar(interp, "tcl_pkgPath", " ",
+ TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
+ }
+ CFRelease(frameworksURL);
+ }
+ }
Tcl_SetVar(interp, "tcl_pkgPath", pkgPath,
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
} else