What I do, as the ROOT user:
Install the SRPM as you would any other package (rpm --install [source-rpm-filename])
Examine /root/rpmbuild/SPECS directory and find the specs file that matches your package
rpmbuild -bb /root/rpmbuild/SPECS/[found-filename]
The resulting binary packages are then located in the /root/rpmbuild/RPMS/ directory which are ready to be installed via the standard rpm --install command.
NOTE: This just builds what is in the standard binary package. I am posting this answering the specific question, not how to go about making changes to the source and generating new packages.
To do the modifications, you could either provide patches as input and changing the SPECS file....or you could replace the standard *.tar.bz2 located in /root/rpmbuild/SOURCES with your own with the change and then do the build as described above. Beware you might have to change the SPECS package to make it work (usually by pulling out the patching, and changing some filenames that is programmed by the SPECS file).
It seems building rpms as root is a bad practice (source). It works fine as a non-root user.
Step by step instructions to add a patch (from here):
- Copy your patch to
- Edit the
rpmbuild/SPECS/package.spec and add a
Patch0: mypatch.patch right after the
Source0: ... line.
- After the
%setup ... line add a
%patch0 -p1 line
Now it will build normally, ie. with:
rpmbuild -ba SPECS/package.spec