From Fedora Project Wiki
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
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 [https://fedorahosted.org/rpmdevtools/browser/spectemplate-fonts.spec rpmdevtools package]. | 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 [https://fedorahosted.org/rpmdevtools/browser/spectemplate-fonts.spec rpmdevtools package]. | ||
{| style="font-family:monospace; background-color:#FFFAE9; font-family:monospace;" | {| style="font-family:monospace; background-color:#FFFAE9; font-family:monospace;" | ||
|- | |+ Conventions | ||
| Common directives | |- valign="top" | ||
| style="font-family:sans-serif; font-style:italic; color:#00578E;" | Comment | | style="border-style:hidden;" | Common directives | ||
|- style="background-color:#ffdebc;" | | style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | Comment | ||
| Only if you declare fontconfig rules | |- valign="top" style="background-color:#ffdebc;" | ||
| style="font-family:sans-serif; font-style:italic; color:#990033;" | Comment | | style="border-style:hidden;" | Only if you declare [[Fontconfig_packaging_tips | fontconfig]] rules | ||
|- style="background-color:#ffe4f5;" | | style="font-family:sans-serif; font-style:italic; color:#990033; border-style:hidden;" | Comment | ||
| Some other optional part | |- valign="top" style="background-color:#ffe4f5;" | ||
| style="font-family:sans-serif; font-style:italic; color:#663366;" | Comment | | style="border-style:hidden;" | Some other optional part | ||
| style="font-family:sans-serif; font-style:italic; color:#663366; border-style:hidden;" | Comment | |||
|} | |} | ||
{| style="font-family:monospace; background-color:#FFFAE9; font-family:monospace;" | {| style="font-family:monospace; background-color:#FFFAE9; font-family:monospace; border-style:hidden;" | ||
|- | |+ Annotated fonts spec template | ||
| width="60%" | %define fontname | |- valign="top" | ||
| width="40%" style="font-family:sans-serif; font-style:italic; color:#00578E;" | Upstream lowercased project name. | | width="60%" style="border-style:hidden;" | %define fontname ''…'' | ||
| width="40%" style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | Upstream lowercased project name, without any '''fonts''' or '''font''' affix. | |||
|- | |- | ||
| | | style="border-style:hidden;" | | ||
| | | style="border-style:hidden;" | | ||
|- | |- valign="top" | ||
| %define fontdir %{_datadir}/fonts/%{fontname} | | style="border-style:hidden;" | %define fontdir %{_datadir}/fonts/%{fontname} | ||
| style="font-family:sans-serif; font-style:italic; color:#00578E; | | style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | '''%{_datadir}/fonts''' is owned by the '''filesystem''' package. | ||
|- style="background-color:#ffdebc;" | |- valign="top" style="background-color:#ffdebc;" | ||
| %define fontconfdir %{_sysconfdir}/fonts/conf.d | | style="border-style:hidden;" | %define fontconfdir %{_sysconfdir}/fonts/conf.d | ||
| style="font-family:sans-serif; font-style:italic; color:#990033;" | Owned by the filesystem package. | | style="font-family:sans-serif; font-style:italic; color:#990033; border-style:hidden;" | Owned by the '''filesystem''' package. | ||
|- | |- valign="top" | ||
| | | style="border-style:hidden;" | | ||
| | | style="border-style:hidden;" | | ||
|- style="background-color:#ffe4f5;" | |- valign="top" style="background-color:#ffe4f5;" | ||
| style="border-style:hidden;" | %define archivename ''…'' | |||
| style=" | | style="font-family:sans-serif; font-style:italic; color:#663366; border-style:hidden;" | Usually a mix of '''%{fontname}''' and '''%{version}'''. | ||
|- | |- valign="top" | ||
| | | style="border-style:hidden;" | | ||
| | | style="border-style:hidden;" | | ||
|- | |- valign="top" | ||
| Name: %{fontname}-fonts | | style="border-style:hidden;" | Name: %{fontname}-fonts | ||
| style="font-family:sans-serif; font-style:italic; color:#00578E; | | style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | See also our [[Fonts_packaging_policy#grouping | grouping]] conventions. | ||
|- | |- valign="top" | ||
| Version: | | style="border-style:hidden;" | Version: ''…'' | ||
| style="font-family:sans-serif; font-style:italic; color:#00578E;" | When in doubt check the version field embedded in TTF files<ref>For example | | style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | | ||
|- | * When in doubt check the '''version''' field embedded in TTF or OTF files<ref>For example by double-clicking on them in ''Nautilus''.</ref>. | ||
| Release: | * If upstream is not updating this field regularly, you'll have to resort to [[Packaging/NamingGuidelines#NonNumericRelease | %{alphatag}s]]. | ||
| | * If upstream is never updating this field, use the date of the most recent font file as version. | ||
|- valign="top" | |||
| style="border-style:hidden;" | Release: ''…''%{?dist} | |||
| | | style="border-style:hidden;" | | ||
|- | |- valign="top" | ||
| | | style="border-style:hidden;" | Summary: ''…'' fonts | ||
| | | style="border-style:hidden;" | | ||
|- | |- valign="top" | ||
| | | style="border-style:hidden;" | | ||
| | | style="border-style:hidden;" | | ||
|- | |- valign="top" | ||
| | | style="border-style:hidden;" | Group: User Interface/X | ||
| style=" | | style="border-style:hidden;" | | ||
|- | |- valign="top" | ||
| style="border-style:hidden;" | License: ''…'' | |||
| style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | Make sure you've read and understand our [[Legal_considerations_for_fonts | legal page]]. | |||
|- valign="top" | |||
| style="border-style:hidden;" | URL: ''…'' | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | Source0: ''…''/%{archivename}.''…'' | |||
| style="border-style:hidden;" | | |||
|- valign="top" style="background-color:#ffdebc;" | |||
| style="border-style:hidden;" | Source1: %{name}-fontconfig.conf | |||
| style="font-family:sans-serif; font-style:italic; color:#990033; border-style:hidden;" | [[Fontconfig_packaging_tips | Fontconfig ruleset]] for the fonts being packaged. | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) | |||
| style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | Or any other [[Packaging/Guidelines#BuildRoot | approved choice]]. | |||
|- valign="top" | |||
| style="border-style:hidden;" | BuildArch: noarch | |||
| style="border-style:hidden;" | | |||
|- valign="top" style="background-color:#ffdebc;" | |||
| style="border-style:hidden;" | Conflicts: fontconfig<''…'' | |||
| style="font-family:sans-serif; font-style:italic; color:#990033; border-style:hidden;" | | |||
* This directive will ensure concurrent [[Fontconfig_packaging_tips | 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 [[Fonts_packaging_policy#no-handler-deps | must not]] force the installation of a particular handler. | |||
|- valign="top" | |||
| style="border-style:hidden;" | %description | |||
| rowspan="2" style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | 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? | |||
|- valign="top" | |||
| style="border-style:hidden;" | ''…'' | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %prep | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
% | | style="border-style:hidden;" | %setup -q -n %{archivename} | ||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %build | |||
% | | rowspan="2" style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | Try to [[Fonts_packaging_policy#build-from-sources | build fonts from source]]. | ||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %install | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | rm -fr %{buildroot} | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | install -m 0755 -d %{buildroot}%{fontdir} | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | install -m 0644 -p ''…/*.ttf'' ''…/*.otf'' %{buildroot}%{fontdir} | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
|- valign="top" style="background-color:#ffdebc;" | |||
| style="border-style:hidden;" | install -m 0755 -d %{buildroot}%{fontconfdir} | |||
| rowspan="2" style="font-family:sans-serif; font-style:italic; color:#990033; border-style:hidden;" | For a discussion on the choice of ''…'' visit our [[Fontconfig_packaging_tips | fontconfig page]]. | |||
|- valign="top" style="background-color:#ffdebc;" | |||
| style="border-style:hidden;" | install -m 0644 -p %{SOURCE1} %{buildroot}%{fontconfdir}/''…''-%{fontname}.conf | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %clean | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | rm -fr %{buildroot} | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %post | |||
| rowspan="10" style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | | |||
* This ensures fontconfig indexes are refreshed if fontconfig is present on the system; if not the fontconfig package will create them itself on installation<ref>In compliance of our [[Fonts_packaging_policy#no-handler-deps | no-dependency]] policy.</ref>. | |||
* 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<ref>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.</ref>. It must be used in packages targeting pre-Fedora 9 releases. | |||
|- valign="top | |||
| style="border-style:hidden;" | if [ -x %{_bindir}/fc-cache ] ; then | |||
|- valign="top | |||
| style="border-style:hidden;" | %{_bindir}/fc-cache -f %{fontdir} <nowiki>|| :</nowiki> | |||
|- valign="top | |||
| style="border-style:hidden;" | fi | |||
|- valign="top | |||
| style="border-style:hidden;" | | |||
|- valign="top | |||
| style="border-style:hidden;" | | |||
|- valign="top | |||
| style="border-style:hidden;" | %postun | |||
|- valign="top | |||
| style="border-style:hidden;" | if [ $1 -eq 0 -a -x %{_bindir}/fc-cache ] ; then | |||
|- valign="top | |||
| style="border-style:hidden;" | %{_bindir}/fc-cache -f %{fontdir} <nowiki>|| :</nowiki> | |||
|- valign="top | |||
| style="border-style:hidden;" | fi | |||
% | |- valign="top" | ||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
% | |- valign="top" | ||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %files | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %defattr(0644,root,root,0755) | |||
| style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | Any other set of permission is almost certain to be a fonts packaging bug. | |||
|- valign="top" | |||
| style="border-style:hidden;" | %doc ''*.txt'' | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" style="background-color:#ffdebc;" | |||
| style="border-style:hidden;" | %config(noreplace) %{fontconfdir}/XX-%{fontname}.conf | |||
| style="font-family:sans-serif; font-style:italic; color:#990033; border-style:hidden;" | This is sufficient to drop a [[Fontconfig_packaging_tips | Fontconfig ruleset]] that will be evaluated if fontconfig is installed, and will have no effects otherwise<ref>See also our [[Fonts_packaging_policy#no-handler-deps | no-dependency]] policy.</ref>. | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %dir %{fontdir} | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %{fontdir}/*.ttf | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %{fontdir}/*.otf | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
|- valign="top" | |||
| style="border-style:hidden;" | | |||
| style="border-style:hidden;" | | |||
|- valign="top" | |||
| style="border-style:hidden;" | %changelog | |||
| rowspan="2" style="font-family:sans-serif; font-style:italic; color:#00578E; border-style:hidden;" | Changelog in [[Packaging/Guidelines#Changelogs | approved format]]. | |||
|- valign="top" | |||
| style="border-style:hidden;" | ''…'' | |||
|} | |} | ||
{{:Fonts_SIG_signature}} | {{:Fonts_SIG_signature}} | ||
[[Category:Fonts packaging|Spec template]] | [[Category:Fonts packaging|Spec template]] |
Revision as of 18:10, 15 June 2008
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.
- ↑ For example by double-clicking on them in Nautilus.
- ↑ In compliance of our no-dependency policy.
- ↑ 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.
- ↑ See also our no-dependency policy.