To start our spec file, we'll create the SPECS directory to contain our spec files.
[build@client11 ~]$ cd rpmbuild [build@client11 rpmbuild]$ mkdir SPECS [build@client11 rpmbuild]$ cd SPECSNow our package will be called tar, tar is "A GNU file archiving program". Like most GNU software it is released under the GPL. So we can put all that information into our spec file.
Summary: A GNU file archiving program Name: tar License: GPL
Name: tar
License: GPL
Version: 1.22
Source: http://ftp.gnu.org/gnu/tar/%{name}-%{version}.tar.bz2
Release: 1
Group: Applications/Archiving
BuildRoot: /tmp/rpm-buildroot-%{name}-%{version}
Version: 1.22 Source: http://ftp.gnu.org/gnu/tar/%{name}-%{version}.tar.bz2In the source line instead of using tar and 1.22, we used the variables that we already defined of name and version. Any of the lines that you specify in your spec can be used as variables later in your spec file. The advantage to doing things this way is that when tar 1.23 comes out, you only have to change the version (assuming ftp.gnu.org names version 1.23 as tar-1.23.tar.bz2)
Next we need to identify the release of our package, since this is our initial build of the package, we'll set our release tag to 1. You could put in your name here or some other identifier. Dag Wiers sometimes has dag, Red Hat will put el[4|5] here, fedora will put f11 etc. If you aren't too grandiose, use a number.
Release: 1Next is a bit of housekeeping, we need to tell rpm what this package contains, is it System software, a Game, or an Office or Productivity package, etc. In this case we'll use Applications/Archiving
Group: Applications/Archiving
One important thing to set at this point is the BuildRoot, this is the location where files created by this rpm should live temporarily during the build process. You need this set in order to make clean rpms that don't touch the system on which they are building.
BuildRoot: /tmp/rpm-buildroot-%{name}-%{version}
This should be enough of a header, some other things you can add in the header are:
Packager: Requires: |
Vendor: BuildRequires:+ |