Previous Section  < Day Day Up >  Next Section

Recipe 2.11. Installing Source RPMs

2.11.1 Problem

You can't install an RPM because of binary incompatibilities with your system, or you just prefer to compile applications on your system, or you want to edit the source code then build the package.

2.11.2 Solution

Build your new program from source RPMs.

Download the SRPM—in this example, tuxpaint-2002.10.20-1.src.rpm—into your directory of choice. Be sure to get the SRPM for your Linux distribution.

Then run the package installer:

# rpm -ivh tuxpaint-2002.10.20-1.src.rpm

This will place sources in /usr/src/SOURCES and the spec file in /usr/src/SPECS:

$ ls /usr/src/SOURCES

tuxpaint-2002.09.29.tar.gz ruxpaint-Makefile.patch tuxpaint-stamps-2002.09.29.tar.gz 

tuxpaint.desktop tuxpaint-opt.patch

$ ls /usr/src/SPECS


Build the spec file:

# rpmbuild -bb tuxpaint.spec

This creates a new RPM in /usr/src/RPMS/i386:

# ls /usr/src/RPMS/i386


You now have a nice, new Tuxpaint RPM, compiled for your system.

2.11.3 Discussion

The source directory on your particular distribution may be different. Fedora 1 uses /usr/src/redhat/RPMS/, as did some early versions of Mandrake. Other distributions use /usr/src/RPM/RPMS. Poke around and you'll find the right one.

This is not an escape from RPM hell. It simply lets you build an RPM from sources compiled on your system, so you have binary compatibility with system libraries and the RPM is optimized for your architecture. You still need to manually satisfy dependencies, which is not as much fun as it sounds.

Note that rpmbuild is a separate package from rpm.

2.11.4 See Also

    Previous Section  < Day Day Up >  Next Section