Tcl Source Code

Artifact [3967bacd55]
Login

Artifact 3967bacd5568df493ea42771800c72563bd66d47:

Attachment "tcl.diff" to ticket [624509ffff] added by das 2002-10-17 15:03:38.
Index: library/auto.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/auto.tcl,v
retrieving revision 1.10
diff -u -w -r1.10 auto.tcl
--- library/auto.tcl	31 Aug 2002 06:09:45 -0000	1.10
+++ library/auto.tcl	17 Oct 2002 07:31:45 -0000
@@ -103,6 +103,7 @@
 		[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]
 	    }
 	}
     }
Index: library/package.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/package.tcl,v
retrieving revision 1.19
diff -u -w -r1.19 package.tcl
--- library/package.tcl	31 May 2002 23:21:12 -0000	1.19
+++ library/package.tcl	17 Oct 2002 07:31:45 -0000
@@ -510,6 +510,25 @@
 		}
 	    }
 	}
+	# 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
Index: macosx/Tcl.pbproj/project.pbxproj
===================================================================
RCS file: /cvsroot/tcl/tcl/macosx/Tcl.pbproj/project.pbxproj,v
retrieving revision 1.6
diff -u -w -r1.6 project.pbxproj
--- macosx/Tcl.pbproj/project.pbxproj	26 Sep 2002 17:06:14 -0000	1.6
+++ macosx/Tcl.pbproj/project.pbxproj	17 Oct 2002 07:31:46 -0000
@@ -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 = {
Index: unix/tclUnixInit.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixInit.c,v
retrieving revision 1.33
diff -u -w -r1.33 tclUnixInit.c
--- unix/tclUnixInit.c	2 Sep 2002 19:27:42 -0000	1.33
+++ unix/tclUnixInit.c	17 Oct 2002 07:31:46 -0000
@@ -404,9 +404,9 @@
 			      
     {
 #ifdef HAVE_CFBUNDLE
-    char tclLibPath[1024];
+    char tclLibPath[PATH_MAX + 1];
     
-    if (Tcl_MacOSXGetLibraryPath(NULL, 1024, tclLibPath) == TCL_OK) {
+    if (Tcl_MacOSXGetLibraryPath(NULL, PATH_MAX, tclLibPath) == TCL_OK) {
         str = tclLibPath;
     } else
 #endif /* HAVE_CFBUNDLE */
@@ -700,15 +700,60 @@
     Tcl_DString ds;
 
 #ifdef HAVE_CFBUNDLE
-    char tclLibPath[1024];
+    char tclLibPath[PATH_MAX + 1];
+    
+    if (Tcl_MacOSXGetLibraryPath(interp, PATH_MAX, tclLibPath) == TCL_OK) {
+        CONST char *str;
+        Tcl_DString ds;
+        CFBundleRef bundleRef;
     
-    if (Tcl_MacOSXGetLibraryPath(interp, 1024, tclLibPath) == TCL_OK) {
         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, PATH_MAX) &&
+                        ! 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, PATH_MAX) &&
+                        ! 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