# RPM macros for font packages. # # © 2008 Nicolas Mailhot ## Default directories # Font installation directory root %_fontbasedir %{_datadir}/fonts # Actual font installation directory %_fontdir %{_fontbasedir}/%{?fontname:%{fontname}}%{?!fontname:%{name}} # Main fontconfig configuration directory %_fontconfig_confdir %{_sysconfdir}/fonts/conf.d # Fontconfig configuration template directory # Templates are activated by symlinking in _fontconfig_confdir %_fontconfig_templatedir %{_datadir}/fontconfig/conf.avail ## Magic # Font (sub)packaging magic # Expects: # – an (optional) subpackage name as argument: -n # without -n the macro will work on the core package # – an (optional) fontconfig file pattern as argument: -f # — a variable number of file patterns corresponding to the font files # installed in _fontdir and associated to this (sub)package # # Files corresponding to the file pattern must be installed in # _fontconfig_templatedir and symlinked to _fontconfig_confdir # # If you want to install a configuration template disabled by default, make # the corresponding symlink point to /dev/null %_font_pkg(n:f:) \ \ %post %{-n*} \ if [ -x %{_bindir}/fc-cache ]; then \ %{_bindir}/fc-cache %{_fontdir} || : \ fi \ \ \ %postun %{-n*} \ if [ $1 -eq 0 -a -x %{_bindir}/fc-cache ] ; then \ %{_bindir}/fc-cache %{_fontdir} || : \ fi\ \ \ %files %{-n*} \ %defattr(0644,root,root,0755) \ \ %{-f:%{_fontconfig_templatedir}/%{-f*}} \ %{-f:%config(noreplace) %{_fontconfig_confdir}/%{-f*}} \ \ %(echo %* | sed "s+ +\\n+g"| sed "s+^+%{_fontdir}/+g")