From Fedora Project Wiki

Revision as of 16:32, 24 May 2008 by Ravidiip (talk | contribs) (1 revision(s))

Annotated fonts spec template

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 (CVS only for now, will be in 6.5 when released).

Conventions

Only if you declare fontconfig rules style="font-family:sans-serif; font-style:italic; color:#990033;" ) Comment
Some other optional part style="font-family:sans-serif; font-style:italic; color:#663366;" ) Comment

Spec

<^(>%define fontdir  %{_datadir}/fonts/%{fontname} style="font-family:sans-serif; font-style:italic; color:#00578E;" )> %{_datadir}/fonts is owned by the filesystem package[[FootNote(Once bz302141 is closed.) .
%define fontconfdir  %{_sysconfdir}/fonts/conf.d style="font-family:sans-serif; font-style:italic; color:#990033;" ) Owned by the filesystem package.
%define archivename xxx style="font-family:sans-serif; font-style:italic; color:#663366;" ) Usually a mix of %{fontname} and %{version}.
<^(>Name:  %{fontname}-fonts style="font-family:sans-serif; font-style:italic; color:#00578E;" )>See also our grouping conventions.
<^(>Version: style="font-family:sans-serif; font-style:italic; color:#00578E;" )> When in doubt check the version field embedded in TTF files[[FootNote(For example by double-clicking on them in Nautilus.)] . 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 style="font-family:sans-serif; font-style:italic; color:#00578E;" )> Make sure you've read and understand our legal page .
<(>URL:
<(>Source0: /%{archivename}.xxx
Source1:  %{name}-fontconfig.conf style="font-family:sans-serif; font-style:italic; color:#990033;" ) Fontconfig ruleset for the fonts being packaged.
<(>BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) style="font-family:sans-serif; font-style:italic; color:#00578E;" )>Or any other approved choice .
<(>BuildArch: noarch
Conflicts: fontconfig<xxx style="font-family:sans-serif; font-style:italic; color:#990033;" ) This directive will ensure concurrent fontconfig updating if your ruleset uses some new syntax fontconfig versions shipped in previous Fedora releases do not understand.BR Do not use a versioned Requires, as this will force fontconfig installation unconditionally.BR Resources like fonts must not force the installation of a particular handler.
<(>%description 2)> 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 2)>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 style="font-family:sans-serif; font-style:italic; color:#990033;" ) For a discussion on the choice of XX, visit our fontconfig section .
<(>%clean
<(>rm -fr %{buildroot}
<(> %post 12)>This ensures fontconfig indexes are refreshed if fontconfig is present on the system; if not the fontconfig package will create them itself on installationFootNote(In compliance of our policy.) . 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 cases[[FootNote(For example fc-cache currently relies on timestamps to detect if the font cache needs to be regenenerated, and they're not a reliable reference if the system clock was misconfigured in the past (if the BIOS clock was wrong at install-time). This should be fixed in fontconfig-2.5.)] . It must be used in packages targeting pre-Fedora 9 releases.
<(>if [ -x %{_bindir}/fc-cache ] ; then
| :
<(>fi
%postun
if [ "$1" = "0" ] ; then
if [ -x %{_bindir}/fc-cache ] ; then
| :
fi
fi
<(>%files
<^(>%defattr(0644,root,root,0755) style="font-family:sans-serif; font-style:italic; color:#00578E;" )>Any other set of permission is almost certain to be a fonts packaging bug.
<(>%doc *.txt
%config(noreplace) %{fontconfdir}/XX-%{fontname}.conf style="font-family:sans-serif; font-style:italic; color:#990033;" ) This is sufficient to drop a fontconfig ruleset that will be evaluated if fontconfig is installed, and will have no effects otherwiseFootNote(See also our policy.) .
<(> %dir %{fontdir}
<(> %{fontdir}/*.ttf
<(> %{fontdir}/*.otf
<(> %changelog 12)> Changelog in approved format .