3.7. Working with SPEC files

To package new software, you need to create a new SPEC file.

There are two ways to achieve this:

  • Writing the new SPEC file manually from scratch
  • Use the rpmdev-newspec utility

    This utility creates an unpopulated SPEC file, and you fill in the necessary directives and fields.

Note

Some programmer-focused text editors pre-populate a new .spec file with their own SPEC template. The rpmdev-newspec utility provides an editor-agnostic method.

The following sections use the three example implementations of the Hello World! program that were described in What is source code.

Each of the programs is also fully described in the table below.

Software Name

Explanation of example

bello

A program written in a raw interpreted programming language. It demonstrates when the source code does not need to be built, but only needs to be installed. If a pre-compiled binary needs to be packaged, you can also use this method since the binary would also just be a file.

pello

A program written in a byte-compiled interpreted programming language. It demonstrates byte-compiling the source code and installating the bytecode - the resulting pre-optimized files.

cello

A program written in a natively compiled programming language. It demonstrates a common process of compiling the source code into machine code and installing the resulting executables.

The implementations of Hello World! are:

As a prerequisite, these implementations need to be placed into the ~/rpmbuild/SOURCES directory.