On Mar 21, 2007, at 15:07, Kevin Windham wrote:
I am trying to figure out the easiest way to apply a patch to a port and still use the port command to install and uninstall etc.
The port is giflib and the patch file is here.
<http://users.own-hero.net/~decoder/fuzzyocr/giftext-segfault.patch>
Is there a simple way to modify the local portfile to install this patch for me.
Hi Kevin. Let's see what we can do here! First, why do you want to patch? From the name of the patchfile, it sounds like you are attempting to fix a crashing bug in the software. So then this is a patch that you would ultimately want to make available to all MacPorts users, right? This modification won't just stay local to your machine? You just want to try it out now to make sure it works? So then you can just drop the patch into the files directory for the port and add it to the Portfile. First, go to the port directory. Type "cd `port dir giflib`" to get there. If there isn't already a "files" directory next to the Portfile, make one with "sudo mkdir files". Now you can put the patchfile into that directory. The naming convention is that the patchfile's name starts with "patch-" and ends with ".diff" and has the name of the file being patched in between. So you should name it "patch-giftext.c.diff". Also, it should be in unified diff format, not context diff format like you have at the above URL. To generate unified diffs, use "diff -u <oldfile> <newfile>". Now edit the portfile. Type "port edit giflib". Add a line that reads "patchfiles patch-giftext.c.diff". That should do it. Now you can try installing the port and see if it works better. Try enabling the debugging and verbose flags with "sudo port install -dv giflib"; this way you will see the line about whether the patch succeeded or failed. If you find that the patch works, and you would like to submit these changes to the Portfile for all to enjoy, create a ticket in Trac, attach you patchfile, and also a unified diff of your changes for the Portfile, and tell us here what the ticket number is, and someone can commit it. Also, note that giflib has no maintainer; if you would like to become the maintainer, just say so, or you can also just change the maintainers line in the Portfile to your email address and include that in the Portfile diff in the ticket.