This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Tcl/Tk8.3 upgrade



Hi,

so this is my main patch for Insight.

This is aimed at removing Insights depenacies on
Cygnus local changes to Tcl/Tk.

I didn't change the package name to Insight, I
made the changes required but it kept giving
me an error message (can't find Insight package)
so I left that out. Probably a job for somebody
who knows more about Insight than I.

The patch will work fine on current Tcl (hey, you
could even start removing local hacks there if
you wanted to) and Tcl8.3 (hopefully Tcl8.4 as well).

The last patch I sent in didn't get applied so it's
rolled into this one.

Please test this patch and let me know of any problems,
question or changes needed.  Once applied you won't
notice the Tcl/Tk upgrade happen.

Thanks,

   Ian.


Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.1366
diff -u -r1.1366 ChangeLog
--- ChangeLog	2001/06/19 20:30:10	1.1366
+++ ChangeLog	2001/06/20 22:57:49
@@ -1,3 +1,8 @@
+2001-06-19  Ian Roxborough  <irox@redhat.com>
+
+	* Makefile.in: Changed all references to the install directory
+	"gdbtcl" to read "insight1.0".
+
 2001-06-19  Andrew Cagney  <ac131313@redhat.com>
 
 	* cli-out.c: Include "gdb_assert.h'.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.90
diff -u -r1.90 Makefile.in
--- Makefile.in	2001/06/10 00:47:02	1.90
+++ Makefile.in	2001/06/20 22:57:56
@@ -772,7 +772,7 @@
 		  true ; \
 		fi ; \
 		rm -f $(bindir)/$$transformed_name$(EXEEXT) $(man1dir)/$$transformed_name.1
-	rm -rf $(datadir)/gdbtcl
+	rm -rf $(datadir)/insight1.0
 	@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do 
 
 # We do this by grepping through sources.  If that turns out to be too slow,
@@ -1361,35 +1361,35 @@
 # It should now be possible to run GDBtk from the build directory
 # without the link in place.
 all-gdbtk:
-	@if test ! -d gdbtcl/images ; then \
+	@if test ! -d insight1.0/images ; then \
 	  if test "$(LN_S)" = "ln -s" ; then \
-	    echo linking ${srcdir}/gdbtk/library to gdbtcl ; \
-	    rm -f gdbtcl ; \
-	    test ! -r gdbtcl || exit 1 ; \
-	    $(LN_S) ${srcdir}/gdbtk/library gdbtcl ; \
+	    echo linking ${srcdir}/gdbtk/library to insight1.0 ; \
+	    rm -f insight1.0 ; \
+	    test ! -r insight1.0 || exit 1 ; \
+	    $(LN_S) ${srcdir}/gdbtk/library insight1.0 ; \
 	  else \
 	    echo "Warning:" ; \
-	    echo "Unable to link ${srcdir}/gdbtk/library to gdbtcl." ; \
+	    echo "Unable to link ${srcdir}/gdbtk/library to insight1.0." ; \
 	    echo "You will need to do a \`make install' before you are" ; \
 	    echo "able to run the GUI." ; \
 	  fi ; \
 	else true ; fi
 
 clean-gdbtk:
-	rm -f gdbtcl
+	rm -f insight1.0
 
 install-gdbtk:
-	$(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/gdbtcl ; \
+	$(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/insight1.0 ; \
 	$(SHELL) $(srcdir)/../mkinstalldirs \
-		$(datadir)/gdbtcl/images \
-		$(datadir)/gdbtcl/images2 ; \
-	$(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/gdbtcl/help \
-		$(datadir)/gdbtcl/help/images \
-		$(datadir)/gdbtcl/help/trace ; \
+		$(datadir)/insight1.0/images \
+		$(datadir)/insight1.0/images2 ; \
+	$(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/insight1.0/help \
+		$(datadir)/insight1.0/help/images \
+		$(datadir)/insight1.0/help/trace ; \
 	cd $(srcdir)/gdbtk/library ; \
 	for i in *.tcl *.itcl *.ith *.itb images/*.gif images2/*.gif images/icons.txt images2/icons.txt tclIndex help/*.html  help/trace/*.html help/trace/index.toc help/images/*.gif; \
 	  do \
-		$(INSTALL_DATA) $$i $(datadir)/gdbtcl/$$i ; \
+		$(INSTALL_DATA) $$i $(datadir)/insight1.0/$$i ; \
 	  done ;
 
 gdbres.o: $(srcdir)/gdbtk/gdb.rc $(srcdir)/gdbtk/gdbtool.ico
@@ -1403,7 +1403,7 @@
 	$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \
         $(ITK_CFLAGS) $(TIX_CFLAGS) \
 	$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\
-		$(srcdir)/gdbtk/generic/gdbtk.c -DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\"
+		$(srcdir)/gdbtk/generic/gdbtk.c -DGDBTK_LIBRARY=\"$(datadir)/insight1.0\"
 
 gdbtk-bp.o: $(srcdir)/gdbtk/generic/gdbtk-bp.c \
 	$(srcdir)/gdbtk/generic/gdbtk.h $(srcdir)/gdbtk/generic/gdbtk-cmds.h \
@@ -1411,7 +1411,7 @@
 	$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \
 	$(TIX_CFLAGS) $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS)   \
 	$(GDBTK_CFLAGS) $(srcdir)/gdbtk/generic/gdbtk-bp.c \
-	-DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\"
+	-DGDBTK_LIBRARY=\"$(datadir)/insight1.0\"
 
 gdbtk-cmds.o: $(srcdir)/gdbtk/generic/gdbtk-cmds.c \
 	$(srcdir)/gdbtk/generic/gdbtk.h $(srcdir)/gdbtk/generic/gdbtk-cmds.h \
@@ -1421,7 +1421,7 @@
 	$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS)	\
 	$(TIX_CFLAGS) $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS)		\
 	$(GDBTK_CFLAGS) $(srcdir)/gdbtk/generic/gdbtk-cmds.c		\
-	-DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\"
+	-DGDBTK_LIBRARY=\"$(datadir)/insight1.0\"
 
 gdbtk-hooks.o: $(srcdir)/gdbtk/generic/gdbtk-hooks.c \
 	$(srcdir)/gdbtk/generic/gdbtk.h $(defs_h) \
@@ -1429,7 +1429,7 @@
 	$(bfd_h) $(symfile_h) objfiles.h $(target_h) $(gdb_string_h) $(tracepoint_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) $(TIX_CFLAGS) \
 	$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\
-		$(srcdir)/gdbtk/generic/gdbtk-hooks.c -DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\"
+		$(srcdir)/gdbtk/generic/gdbtk-hooks.c -DGDBTK_LIBRARY=\"$(datadir)/insight1.0\"
 
 gdbtk-register.o: $(srcdir)/gdbtk/generic/gdbtk-register.c \
 	$(srcdir)/gdbtk/generic/gdbtk.h $(srcdir)/gdbtk/generic/gdbtk-cmds.h \
@@ -1437,7 +1437,7 @@
 	$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \
 	$(TIX_CFLAGS) $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS)   \
 	$(GDBTK_CFLAGS) $(srcdir)/gdbtk/generic/gdbtk-register.c \
-	-DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\"
+	-DGDBTK_LIBRARY=\"$(datadir)/insight1.0\"
 
 gdbtk-stack.o: $(srcdir)/gdbtk/generic/gdbtk-stack.c \
 	$(srcdir)/gdbtk/generic/gdbtk.h $(srcdir)/gdbtk/generic/gdbtk-cmds.h \
@@ -1447,7 +1447,7 @@
 	$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \
 	$(TIX_CFLAGS) $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS)   \
 	$(GDBTK_CFLAGS) $(srcdir)/gdbtk/generic/gdbtk-stack.c \
-	-DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\"
+	-DGDBTK_LIBRARY=\"$(datadir)/insight1.0\"
 
 gdbtk-varobj.o: $(srcdir)/gdbtk/generic/gdbtk-varobj.c \
 	$(srcdir)/gdbtk/generic/gdbtk.h \
Index: gdbtk/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/ChangeLog,v
retrieving revision 1.100
diff -u -r1.100 ChangeLog
--- ChangeLog	2001/06/18 17:13:26	1.100
+++ ChangeLog	2001/06/20 22:58:03
@@ -1,3 +1,19 @@
+2001-06-18  Ian Roxborough  <irox@redhat.com>
+
+	* generic/gdbtk.c (gdbtk_init): If Insight isn't
+	being ran from inside a directory called "bin",
+	assume that we are being ran from the build
+	directory and set the *_LIBRARY variables to point
+	to (hopefully) the correct source directory.
+
+2001-05-14  Ian Roxborough  <irox@redhat.com>
+
+	* generic/gdbtk-hooks.c (x_event): Minor
+	API changes with Tcl version update.
+	Use the Tcl_ObjGetVar2 call with Tcl8.3.
+	(gdbtk_trace_find): Use Tcl_GlobalEvalObj
+	call with Tcl8.3.
+
 2001-06-18  Keith Seitz  <keiths@redhat.com>
 
 	* library/managedwin.itb (_create): When creating a
Index: gdbtk/generic/gdbtk-hooks.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-hooks.c,v
retrieving revision 1.16
diff -u -r1.16 gdbtk-hooks.c
--- gdbtk-hooks.c	2001/06/13 20:01:42	1.16
+++ gdbtk-hooks.c	2001/06/20 22:58:04
@@ -460,7 +460,7 @@
       int val;
       if (varname == NULL)
 	{
-#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 1
+#if TCL_MAJOR_VERSION == 8 && (TCL_MINOR_VERSION < 1 || TCL_MINOR_VERSION > 2)
 	  Tcl_Obj *varnamestrobj = Tcl_NewStringObj ("download_cancel_ok", -1);
 	  varname = Tcl_ObjGetVar2 (gdbtk_interp, varnamestrobj, NULL, TCL_GLOBAL_ONLY);
 #else
@@ -731,7 +731,7 @@
 			Tcl_NewStringObj ("gdbtk_tcl_trace_find_hook", -1));
   Tcl_ListObjAppendElement (gdbtk_interp, cmdObj, Tcl_NewStringObj (arg, -1));
   Tcl_ListObjAppendElement (gdbtk_interp, cmdObj, Tcl_NewIntObj (from_tty));
-#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 1
+#if TCL_MAJOR_VERSION == 8 && (TCL_MINOR_VERSION < 1 || TCL_MINOR_VERSION > 2)
   if (Tcl_GlobalEvalObj (gdbtk_interp, cmdObj) != TCL_OK)
     report_error ();
 #else
Index: gdbtk/generic/gdbtk.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk.c,v
retrieving revision 1.15
diff -u -r1.15 gdbtk.c
--- gdbtk.c	2001/06/07 14:43:01	1.15
+++ gdbtk.c	2001/06/20 22:58:06
@@ -365,6 +365,9 @@
 {
   struct cleanup *old_chain;
   char *s;
+  int element_count;
+  char **exec_path;
+  CONST char *internal_exec_name;
 
   /* If there is no DISPLAY environment variable, Tk_Init below will fail,
      causing gdb to abort.  If instead we simply return here, gdb will
@@ -388,6 +391,87 @@
   if (!gdbtk_interp)
     error ("Tcl_CreateInterp failed");
 
+  /* We need to check if we are being ran from
+     a bin directory, if not then we may have to
+     set some environment variables. */
+
+  internal_exec_name = Tcl_GetNameOfExecutable ();
+
+  Tcl_SplitPath (internal_exec_name, &element_count, &exec_path);
+
+  if (strcmp (exec_path[element_count - 2],"bin") != 0)
+    {
+      /* We check to see if TCL_LIBRARY, TK_LIBRARY,
+	 ITCL_LIBRARY, ITK_LIBRARY, TIX_LIBRARY and maybe
+	 a couple other environment variables have been
+	 set (we don't want to override the User's settings).
+         If the *_LIBRARY variable is not set, point it at
+         the source directory. */
+
+      static char set_libs_path_script[] = "\
+          set srcDir [file dirname [file dirname $env(TCL_LIBRARY)]];\n\
+\
+          if {![info exists env(TCL_LIBRARY)]} {\n\
+              set env(TCL_LIBRARY) [file join $srcDir tcl library]\n\
+          }\n\
+\
+          if {![info exists env(TK_LIBRARY)]} {\n\
+              set env(TK_LIBRARY) [file join $srcDir tk library]\n\
+          }\n\
+\
+          if {![info exists env(ITCL_LIBRARY)]} {\n\
+              set env(ITCL_LIBRARY) [file join $srcDir itcl itcl library]\n\
+          }\n\
+\
+          if {![info exists env(ITK_LIBRARY)]} {\n\
+              set env(ITK_LIBRARY) [file join $srcDir itcl itk library]\n\
+          }\n\
+\
+          if {![info exists env(TIX_LIBRARY)]} {\n\
+              set env(TIX_LIBRARY) [file join $srcDir tix library]\n\
+          }\n\
+\
+          if {![info exists env(GDBTK_LIBRARY)]} {\n\
+              set env(GDBTK_LIBRARY) [file join $srcDir gdb gdbtk library]\n\
+          }\n";
+
+      Tcl_Obj *commandObj;
+
+
+      /* Before we can run our script we must set TCL_LIBRARY. */
+      if (Tcl_GetVar2 (gdbtk_interp, "env", "TCL_LIBRARY", TCL_GLOBAL_ONLY) == NULL)
+        {
+          Tcl_DString lib_pathDString;
+          static char *tcl_src_dir[] = {"src", "tcl", "library"};
+          char *lib_path;
+
+          Tcl_DStringInit (&lib_pathDString);
+
+          /* Remove the build/gdb/gdb part of the path
+	     and add the src/tcl/library part. */
+
+          exec_path[element_count - 3] = tcl_src_dir[0];
+          exec_path[element_count - 2] = tcl_src_dir[1];
+          exec_path[element_count - 1] = tcl_src_dir[2];
+
+          Tcl_JoinPath (element_count, exec_path, &lib_pathDString);
+
+	  lib_path = xmalloc(Tcl_DStringLength (&lib_pathDString) + 1);
+	  strcpy(lib_path, Tcl_DStringValue (&lib_pathDString));
+	  Tcl_DStringFree (&lib_pathDString);
+
+	  Tcl_SetVar2 (gdbtk_interp, "env", "TCL_LIBRARY", lib_path, TCL_GLOBAL_ONLY);
+          xfree (lib_path);
+	}
+
+      commandObj = Tcl_NewStringObj (set_libs_path_script, -1);
+      Tcl_IncrRefCount (commandObj);
+      Tcl_EvalObj (gdbtk_interp, commandObj);
+      Tcl_DecrRefCount (commandObj);
+    }
+
+  Tcl_Free (exec_path);
+
   if (Tcl_Init (gdbtk_interp) != TCL_OK)
     error ("Tcl_Init failed: %s", gdbtk_interp->result);
 
@@ -467,7 +551,7 @@
       error ("Gdbtk_Init failed: %s", gdbtk_interp->result);
     }
 
-  Tcl_StaticPackage (gdbtk_interp, "Gdbtk", Gdbtk_Init, NULL);
+  Tcl_StaticPackage (gdbtk_interp, "Insight", Gdbtk_Init, NULL);
 
   /* This adds all the hooks that call up from the bowels of gdb
    *  back into Tcl-land...
@@ -511,7 +595,7 @@
 proc gdbtk_find_main {} {\n\
     global Paths GDBTK_LIBRARY\n\
     rename gdbtk_find_main {}\n\
-    tcl_findLibrary gdb 1.0 {} main.tcl GDBTK_LIBRARY GDBTK_LIBRARY gdbtk/library gdbtcl {}\n\
+    tcl_findLibrary insight 1.0 {} main.tcl GDBTK_LIBRARY GDBTKLIBRARY\n\
     set Paths(appdir) $GDBTK_LIBRARY\n\
 }\n\
 gdbtk_find_main";
@@ -527,7 +611,7 @@
     } else {\n\
         set debug_startup 0\n\
     }\n\
-    tcl_findLibrary gdb 1.0 {} main.tcl GDBTK_LIBRARY GDBTK_LIBRARY gdbtk/library gdbtcl {} $debug_startup\n\
+    tcl_findLibrary insight 1.0 {} main.tcl GDBTK_LIBRARY GDBTK_LIBRARY\n\
     set Paths(appdir) $GDBTK_LIBRARY\n\
 }\n\
 gdbtk_find_main";
Index: testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.129
diff -u -r1.129 ChangeLog
--- ChangeLog	2001/06/14 00:12:31	1.129
+++ ChangeLog	2001/06/20 22:58:29
@@ -1,3 +1,8 @@
+2001-06-18  Ian Roxborough  <irox@redhat.com>
+
+	* lib/gdb.exp (gdbtk_start): Set ITK_LIBRARY before starting
+	gdb.
+
 2001-06-13  Jim Blandy  <jimb@redhat.com>
 
 	* lib/gdb.exp (gdb_test): Doc fix.
Index: testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.9
diff -u -r1.9 gdb.exp
--- gdb.exp	2001/06/14 00:12:32	1.9
+++ gdb.exp	2001/06/20 22:58:35
@@ -1673,6 +1673,7 @@
   set env(TK_LIBRARY) [to_tcl_path -abs [file join $abs_srcdir .. .. tk library]]
   set env(TIX_LIBRARY) [to_tcl_path -abs [file join $abs_srcdir .. .. tix library]]
   set env(ITCL_LIBRARY) [to_tcl_path -abs [file join $abs_srcdir .. .. itcl itcl library]]
+  set env(ITK_LIBRARY) [to_tcl_path -abs [file join $abs_srcdir .. .. itcl itk library]]
   set env(CYGNUS_GUI_LIBRARY) [to_tcl_path -abs [file join .. $abs_srcdir .. .. libgui library]]
   set env(DEFS) [to_tcl_path -abs [file join $abs_srcdir $subdir defs]]
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]