Spec file

The spec file describes how a package is built and it gives metadata and instructions needed.

Defines all the actions the RPMBuild command should take to build an application, as well as all the actions necessary for the rpm command to install and remove the application.

Each source RPM should have the necessary spec file for building a binary RPM.

Example: the hello-world package spec file would be named hello-world.spec

The syntax inside the spec defines how to build the package, version numbers, dependency information on other applications, etc.

Inside a spec file, there can be 5 main sections:

  • Metadata : Contains name, version, license, text information about the package. Also defines which files to use, patch and build.
  • Preparation: Contains the snippet of shell commands to execute and prepare the sources before building. In general it consists of un-compressing and patching the source code files.
  • Build: Describes how the package has to be built
  • Install: Describes how to install the built application.
  • Files: File distribution among the package and sub-packages of the spec file.

OPTIONAL: You can set other optional sections like:

  • Check: Holds the unit tests configuration and instructions

_If you are having trouble modifying the spec file from your application, you can check these guides :