tk patch

Russty: I am fairly new to tcl/tk. I need to modify some code and test it as a patch. I know where in the code I need to make the changes. I have downloaded the .src.rpm file. What do I need to do after that? Do I need to create a .patch file or should I just modify the code? How do I install my patch?

AMG: I presume you've already unpacked the .src.rpm file, since you say you know where to make the change. Just make the change, recompile, reinstall, and test. You only need a .patch file if you wish to contribute your change, which you are not required to do.

I recommend you avoid .src.rpm and instead work with the latest CVS tree. Failing that, get the latest source .tar.gz. Try compiling and installing that without making any changes, so that you are certain you have the process down. Then make your changes and go from there.

LV If the change that you want to make is only intended for your purpose, I would still recommend creating a patch file, since you will be faced with making this change each time you update your source to a newer version of Tk.

Here's the steps that I can think of:

  1. Obtain the source (via teapot, the tktoolkit.sf.net site, etc.
  2. Extract the source into a working directory
  3. cd into the appropriate source directory
  4. copy the file.c you want to change to a name like file.c.orig
  5. edit file.c to make your changes.
  6. run diff -U 1 file.c.orig file.c > pat.file.c
  7. Now, save the pat.file.c file into a folder outside of the specific source folder. You do not want to chance deleting or overwriting the file when it is time to upgrade.

At this point, your code is changed so you need to compile, test, and then install it.

At the point where you need the patch file (requesting it as a Tk enhancement, or as a bug fix, then you can send the pat.file.c with explanations. If you need to use the patch file against a new copy of file.c, then you use the patch command to apply pat.file.c against file.c. In this case, however, you need to be very careful that your changes go into the correct spot in the file.


Just out of curiousity, what changes do you need to make?

Russty:I am working in Fedora Linux which I am also fairly new to. I haven't been able to get the source to recompile when I've tried just making a change that way. Then I need to reinstall. I thought the src.rpm file would be the easiest way to do all of that. The change I would like to make involves the size of the Menubutton indicator.

AMG: You should try using ttk::menubutton, which allows for themeing as well as minor customization. See ttk::style and ttk::themes.

Again, you should focus on building and installing from source before you worry about customizing said source.

Russty: Ok, but I'm still stuck trying to compile and install this, which is the original purpose of this post. I really am quite new to all of this. I just put in the stuff about the .src.rpm file so you'd know what I'd already tried/done.

AMG: From memory, here's how you do it.

  1. Unpack the Tcl and Tk source archives to a directory of your choice.
  2. cd into the Tcl/unix directory.
  3. Type ./configure .
  4. Type make .
  5. Type make install .
  6. cd up two levels, then into the Tk/unix directory.
  7. Type ./configure .
  8. Type make .
  9. Type make install .
  10. Your done. Tcl and Tk are now installed to /usr/local . You can delete the source trees and archives if you want, or keep them around for reference and patching.