In this how to i will describe how to create binary rpm (installable) using source rpm i.e *.src.rpm. Source rpm is collection of source files in tar.gz, patches and spec file. Spec file defines how the source code will compile with current machine, defining depencies and generate rpm from source rpm. Usually we do this when we need to have some custom changes to be made in required software.
First of all you should have install rpm-devel and rpm-build rpms from your distro repository. Confirm it using following command
rpm -qa | grep rpm
If you see required rpms in the list then you are good to go with source rpm compilation, else you have to install required rpms.
yum -y install rpm-build rpm-devel
rpm -ivh /path/rpm-build* /path/rpm-devel*
The rpm-build and rpm-devel also build following directories for source rpm compilations.
2) Compiling the source
Get your source rpm which you need to compile. Here i will get the ffmpeg source rpm from http://dag.wieers.com/rpm/packages/ffmpeg/ because i need to add libamr-nb and libamr-wb support for converting 3gp clips.
rpm -ivh ffmpeg-0.4.9-0.9.20070530.rf.src.rpm
It will install source files tar.gz, patch files in
and spec file in
I have to add –with-libamrnb and –with-libamrwb in ./configure command specified in ffmpeg.spec and you can edit whatever you are going to change/edit.
After editing now compile the sources and generate rpm using spec file.
rpmbuild -bb ffmpeg.spec
The above command will apply patches if any and compile the source and generate rpm under /usr/src/redhat/RPMS sub-directories regarding to your architecture i.e
/usr/src/redhat/RPMS/i386 for i386,i686
/usr/src/redhat/RPMS/x86_64 for x86_64 etc.
While compiling you will see the verbose output of compilation and you should see clean compilation with notifying of generating rpm at the end.