From Fedora Project Wiki
The following annotated template is intended to help you understand the Fedora fonts packaging policy. A plain-text version without formatting or annotations is available in the rpmdevtools package.
Conventions
Common directives | Comment |
Only if you declare fontconfig rules | Comment |
Some other optional part | Comment |
Spec
URL: Source0: …/%{archivename}.xxx Source1: %{name}-fontconfig.conf Fontconfig ruleset for the fonts being packaged. BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) Or any other approved choice. BuildArch: noarch Conflicts: fontconfig<xxx This directive will ensure concurrent fontconfig updating if your ruleset uses some new syntax fontconfig versions shipped in previous Fedora releases do not understand. Do not use a versioned Requires, as this will force fontconfig installation unconditionally. Resources like fonts must not force the installation of a particular handler. %description Is the font style unusual, does it cover remarkable unicode blocks? Is the font intended for screen or print media, plain-text or fancy decoration uses? XXX… %prep %setup -q -n %{archivename} %build Try to build fonts from source. %install rm -fr %{buildroot} install -m 0755 -d %{buildroot}%{fontdir} install -m 0644 -p xxx/*.ttf xxx/*.otf %{buildroot}%{fontdir} install -m 0755 -d %{buildroot}%{fontconfdir} install -m 0644 -p %{SOURCE1} %{buildroot}%{fontconfdir}/XX-%{fontname}.conf For a discussion on the choice of XX, visit our fontconfig section. %clean rm -fr %{buildroot} %post This ensures fontconfig indexes are refreshed if fontconfig is present on the system; if not the fontconfig package will create them itself on installation3. Note that while the use of %{fontdir} ensures fc-cache does not waste time on other fonts, it also makes any later %{fontdir} renaming unsafe. The -f parameter forces a refresh in all cases4. It must be used in packages targeting pre-Fedora 9 releases. if [ -x %{_bindir}/fc-cache ]; then %{_bindir}/fc-cache -f %{fontdir} || : fi %postun if [ "$1" = "0" ]; then if [ -x %{_bindir}/fc-cache ]; then %{_bindir}/fc-cache -f %{fontdir} || : fi fi %files %defattr(0644,root,root,0755) Any other set of permission is almost certain to be a fonts packaging bug. %doc *.txt %config(noreplace) %{fontconfdir}/XX-%{fontname}.conf This is sufficient to drop a fontconfig ruleset that will be evaluated if fontconfig is installed, and will have no effects otherwise5. %dir %{fontdir} %{fontdir}/*.ttf %{fontdir}/*.otf %changelog Changelog in approved format.%define fontname xxx | Upstream lowercased project name. |
%define fontdir %{_datadir}/fonts/%{fontname} | %{_datadir}/fonts is owned by the filesystem package. |
%define fontconfdir %{_sysconfdir}/fonts/conf.d | Owned by the filesystem package. |
%define archivename xxx | Usually a mix of %{fontname} and %{version}. |
Name: %{fontname}-fonts | See also our grouping conventions. |
Version: | When in doubt check the version field embedded in TTF files[1]. If upstream is not updating this field regularly, you'll have to resort to %{alphatag}s. If upstream is never updating this field, use the date of the most recent font file as version. |
Release: X%{?dist} | |
Summary: Xxx fonts | |
Group: User Interface/X | |
License: XXX | Make sure you've read and understand our legal page. |
- ↑ For example unsing nautilus