RPMs, Sources and all that

Rick Stevens rstevens at vitalstream.com
Tue Nov 16 20:56:50 UTC 2004


roger at audiblefaith.com wrote:
>>Well, sorta.  If you install a ".src.rpm", you don't end up with source
>>that you do the normal "./configure;make;make install" operations.  The
>>source ends up in "/usr/src/redhat", with files distributed among the
>>various directories in there.  To make a batch of files that you can
>>do the "./configure;make;make install", you have to go to the
>>"/usr/src/redhat/SPECS" directory and run:
>>
>>    rpmbuild -bp name-of-spec-file
> 
> 
> I'm not clear on the above. What is contained in the spec file? Is this done without first installing the .src.rpm? Or when I install the .src.rpm will I get a spec file? I looked at a spec file that was there, and that helped some, but I am not clear on where the PHP spec file will come from. The rpmbuild man pages did not help in this.

Yes, you "rpm -ivh name-of-source-rpm.rpm".  rpm then distributes the
various files and such around the "/usr/src/redhat" directory.  Once
that's done, you can go to "/usr/src/redhat/SPECS".  In there, you
should find one or more "*.spec" files.  The ".spec" files control the
"rpmbuild" command.

To have rpmbuild create a batch of files similar to what you'd get in a
tarball, you'd "rpmbuild -bp name-of-spec-file.spec" which makes
rpmbuild perform the "%prep" part of the .spec file.  That's usually
roughly equivalant of unpacking the source files and performing any
patches that may need to be done.

At that point, in the "/usr/src/redhat/SOURCES" directory should have a
directory named after what you're trying to build, e.g. "kernel-2.6.9".
You can then either move that directory somewhere convenient or leave it
where it is.  You can then enter the directory and typically do the
normal "./configure;make;make install" as you would from a tarball.

In a nutshell, once you have the .spec files, rpmbuild can do a lot of
the work for you.  Here are the rough equivalences between rpmbuild and
the tarball method:

	rpmbuild	tarball
	option		equivalent
	---------	----------------------------------------------
	-bp		tar xzf file.tgz (extraction)
	-bc		tar;cd /newdir;./configure;make
	-bi		tar;cd /newdir;./configure;make;make install

The best way to learn is to play with it.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-       A squeegee, by any other name, wouldn't sound as funny.      -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list