Quote:
Originally Posted by hazel I have installed tk but it fails to run and says it hasn't been properly installed. This is a known bug caused by an incompatibility with xproto; there is a patch for it which I have copied into a file called tkpatch. But I have never patched source code before so I need a bit of reassurance from the younger and wiser  before actually doing the job.
I have copied the source tarball from /usr/portage/distfiles and unpacked it in my home directory. The problem is in the file generic/tkBind.c. Is the solution really as simple as going into the generic directory and running Code: patch <~/tkpatchfile
, then retarring the whole thing and copying it back to distfiles? And then re-emerging it? I don't want to screw up. |
That will give you an error because the checksums will not match, hence the modified package will be wiped from distfiles, and then re-downloaded again.
The "proper" way to do it is to use a modified ebuild in your local overlay. To create a local overlay you need a line like this in your /etc/make.conf file:
Code:
PORTDIR_OVERLAY="/usr/local/portage"
You may skip this if you already have a local overlay.
Or whatever location you prefer for it. Then you must make sure that the directory exist. From that moment, you can put ebuilds there and they will be recognized by portage. So, if you want to modify the tk ebuild, you can copy it to use it as a base. The ebiulds in this dir must preserve the tipical portage structure, for example, if you need to modify the qt ebuild, you would do this:
Code:
cd /usr/local/portage
mkdir -p x11-libs/qt
Then you need to copy the ebuild that you want to modify inside your new directory.
Once you have done that, we need to add the patch into the ebuild, for that, you usually put the patch inside the files subdir, then we edit the ebuild. So the whole process would be:
Code:
cd /usr/local/portage
mkdir -p x11-libs/qt
cd x11-libs/qt
mkdir files
cp $HOME/mypatch.diff files/
The patch can be also compressed if it's big. Portage can handle many formats without any hassle.
Now, to the ebuild: open it in any editor of your choice. Then locate the function called "src_unpack". You need to add a line like this in that section:
Code:
epatch "${FILESDIR}/mypatch.diff"
You might need to create that function if the ebuild doesn't define one. Just ask here if that's the case, telling me the exact ebuild that you want to edit so I can give more concrete instructions.
Once everything is set, you need to do the manifest as usual:
Code:
ebuild whatever-x.y.z.ebuild manifest
And that's the basic procedure. This assumes that the patch works of course. Please, ask for clarifications if you don't understand any step or something.