6.3. Step 3: Create a .spec File With This Template
To build an RPM package you'll have to create a .spec file that provides instructions to the package builder on how to organize the files, package description, author, copyright, etc. We provide a template here that you can use to start your work. The template looks like this:
Example 1. The .spec file template
  Â
Name: myfonts
Summary: Collection of My Funny Fonts
Version: 1.0
Release: 1
License: GPL
Group: User Interface/X
Source: %{name}.tar.gz
BuildRoot: %{_tmppath}/build-root-%{name}
BuildArch: noarch
Requires: freetype
Packager: Avi Alkalay <avi unix sh>
Prefix: /usr/share/fonts
Url: http://myfonts.com/
%description
These are the fonts used in our marketing campaign, designed by our marketing agency specially for us.
The package includes the following fonts: Bodoni, Bodoni Black, Company Logo, Outline Company Logo, etc.
%prep
%setup -q -n %{name}
%build
%install
mkdir -p $RPM_BUILD_ROOT/%{prefix}
cp -r %{name}/ $RPM_BUILD_ROOT/%{prefix}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,0755)
%{prefix}/%{name}
%post
{
ttmkfdir -d %{prefix}/%{name} \
-o %{prefix}/%{name}/fonts.scale
umask 133
/usr/X11R6/bin/mkfontdir %{prefix}/%{name}
/usr/sbin/chkfontpath -q -a %{prefix}/%{name}
[ -x /usr/bin/fc-cache ] && /usr/bin/fc-cache
} &> /dev/null || :
%preun
{
if [ "$1" = "0" ]; then
cd %{prefix}/%{name}
rm -f fonts.dir fonts.scale fonts.cache*
fi
} &> /dev/null || :
%postun
if [ "$1" = "0" ]; then
/usr/sbin/chkfontpath -q -r %{prefix}/%{name}
fi
[ -x /usr/bin/fc-cache ] && /usr/bin/fc-cache
%changelog
* Thu Dec 14 2002 Avi Alkalay <avi unix sh> 1.0
- Tested
- Ready for deployment
* Thu Dec 10 2002 Avi Alkalay <avi unix sh> 0.9
- First version of the template
You must change the following items to meet your package characteristic's (leave everything else untouched):
- Â Â Â Put the name of your package or font collection here.
- Â Â Â Put a brief summary about your package here.
- Â Â Â The version of the package.
- Â Â Â The usage license of your package here.
- Â Â Â The name of the person responsible for this package here.
- Â Â Â URL to get more info about this package or fonts here. This entire line can be removed if there is no URL to point to.
- Â Â Â A more detailed description about this fonts here.
- Â Â Â The evolution history of this package here. Must follow this layout.
This file must be named as the name of the package - myfonts.spec in our example. And you must put it under the main directory of the package. So in the end we'll have something like this:
  Â
bash$ cd ~/src
bash$ find myfonts
myfonts/
myfonts/myfonts.spec
myfonts/myfonts/
myfonts/myfonts/font1.ttf
myfonts/myfonts/font2.ttf
myfonts/myfonts/font3.ttf
...
* License

