3.14. Building source RPMs

The following procedure describes how to build a source RPM.

Conditions préalables

  • A SPEC file for the program that we want to package must already exist.

Procédure

  • Run the rpmbuild command with the specified SPEC file:

    $ rpmbuild -bs SPECFILE

    Substitute SPECFILE with the SPEC file. The -bs option stands for the build source.

The following example shows building source RPMs for the bello, pello, and cello projects.

Building source RPMs for bello, pello, and cello.

$ cd ~/rpmbuild/SPECS/

8$ rpmbuild -bs bello.spec
Wrote: /home/admiller/rpmbuild/SRPMS/bello-0.1-1.el8.src.rpm

$ rpmbuild -bs pello.spec
Wrote: /home/admiller/rpmbuild/SRPMS/pello-0.1.2-1.el8.src.rpm

$ rpmbuild -bs cello.spec
Wrote: /home/admiller/rpmbuild/SRPMS/cello-1.0-1.el8.src.rpm

Verification steps

  • Make sure that the rpmbuild/SRPMS directory includes the resulting source RPMs. The directory is a part of the structure expected by rpmbuild.