These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX01/Compiling From Source RPM

Classnotes | UNIX01 | RecentChanges | Preferences

RPMs are binary packages. They contain executable binary applications built specifically for a particular architecture. Intel x86 RPMs will not run on Sparc or Motorola systems. Thus, in order for RPMs to support arbitrary systems, there exists a mechanism by which RPMs can be rebuilt for specific systems.

Source RPMs

Source RPMs are ones which contain all the source code for a particular RPM package as well as information for building that package on an arbitrary system. Source RPMs have an extension of .srpm.

When you encounter a SRPM, the comman you use to build a binary RPM is "rpmbuild". It actually has many options which can be found in the man page for it, but the only ones we will concern ourselves with are:

 rpmbuild {--rebuild|--recompile} SOURCEPKG ...

When run from either of these modes, rpmbuild will build the package, compile it, and install it. In addition, --rebuild will clean out the source directory (useful if you are not planning on working with the source directly).

When finished, a binary RPM will be placed in the RPM final directory (usually under /var/lib/rpm). However, the act of building an RPM will install the RPM on your system, so the extra binary RPM is only useful if you wish to place it on another machine.

NOTE: If you are developing an application and distributing it via RPM, by building a test RPM from SRPM you will be modifying your systems RPM database and installed library. This can make testing said application more difficult, especially if your RPM clean-up scripts are not perfect.

For example, if I had an updated SRPM package for PHP, "php-4.2.2-17.2.src.rpm", I could build it and install it thusly:

 # rpmbuild --rebuild php-4.2.2-17.2.src.rpm



Classnotes | UNIX01 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited August 9, 2003 7:18 pm (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.