Friday, June 17, 2005

RPMBuild using a source rpm

Disclaimer: This is just description of what I did for my purpose and what worked for me, if you need actual documentation see here. Anyways correction over some wrong understanding of the process are most welcome.

Digikam developers told me that FC3 was a 'broken distro' with regards to KDE development. Their basic suggestion is to change the distro for development to Suse, Mandrake(iva), Gentoo, Debian etc. The problem in KDE developement in FC3 is that the debug message like kdDebug and kdprintf (?) were patched up by FC3 KDE packagers to disable console printing. This will of course create lot of problem to the developers.

When I asked for an easier solution of this kdDebug problem( I was hopeful that changing some .h file in kde includes might help as changing the kdemacros.h did in case of visibility="visible" bug of kde 3.3.0-5), but it was not that simple. Renchi told me that I can get it to work by downloading source rpms of kdelibs removing the kdDebug patch and building those rpms. For an instant I felt why shouldn't I better install some other distro itself as all this seems to be very risky, in the sense of updating KDELibs which must be very important for KDE.

Finally I had to do what Renchi suggested, I downloaded the src rpm from rpmfind and proceeded as follows(mostly taking help of Renchi on IRC):[ I refer to rpm as kdelib.src.rpm ignoring the actual version number]
$ rpm2cpio kdelib.src.rpm > kdelibs.src.cpio
$ mkdir kdelib; cd kdelib;
$ mv kdelibs.src.cpio kdelib
$ cpio -i < kdelibs.src.cpio
#this unpacked the archive in to a bunch of .diff .patch and a single tar.bz2 file
Then edited kdelib.spec file to comment the line containing
#Patch2: kdelibs-3.0.0-ndebug.patch

and later a set of lines refering to Patch2 in a if else condition.
#%if %{debug} == 0

#%patch2 -p1 -b .debug

Now I didn't go through much of what the documentation on site said as I was in hurry. I did.
$ cd ..
$ cp kdelib/* /usr/src/redhat/SOURCES;
$ cd kdelib
$ rpmbuild -ba kdelib.spec
and then things happened for some 2.5 hours or so on my decent hardware(Athlon 2800, 512 MB RAM). Finally I had 3 kdelibs.rpm(basic, devel and debug) ready in /usr/src/redhat/RPMS
I just installed them using the command

$ rpm -Uvh /usr/src/redhat/RPMS/kdelibs*.rpm
Thats all, I now have kdDebug working on my system.

No comments:

Post a Comment