Spec file
The spec file describes how a package is built and it gives the metadata and instructions needed.
It also 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 content of the spec file defines how to build the package, version numbers, dependency information on other applications, etc.
A spec file can include 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 subpackages 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 :