From d04f59a81ff80ea6eb511673695659964190056b Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Jan 31 2009 10:42:34 +0000 Subject: move rpm stuff in a single place --- diff --git a/macros/macros.fonts b/macros/macros.fonts deleted file mode 100644 index de3aef1..0000000 --- a/macros/macros.fonts +++ /dev/null @@ -1,70 +0,0 @@ -# RPM macros for font packages. -# -# © 2008-2009 Nicolas Mailhot - -## Default directories - -# Font installation directory root -%_fontbasedir %{_datadir}/fonts - -# Actual font installation directory -%_fontdir %{_fontbasedir}/%{?fontname:%{fontname}}%{?!fontname:%{name}} - -# Master fontconfig configuration directory -# Only needed to avoid a circular directory dependency with the fontconfig -# package — you should *not* use this -%_fontconfig_masterdir %{_sysconfdir}/fonts - -# Fontconfig directory for active configuration snippets -%_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:) \ -\ -%define subpkg_name %{-n: %{lua: \ -if rpm.expand("%{name}") == rpm.expand("%{fontname}-fonts") \ -then print(rpm.expand("-n %{fontname}-%{-n*}-fonts")) \ -else print(rpm.expand("%{-n*}-fonts")) \ -end } } \ -\ -%post %{subpkg_name} \ -if [ -x %{_bindir}/fc-cache ]; then \ - %{_bindir}/fc-cache %{_fontdir} || : \ -fi \ -\ -\ -%postun %{subpkg_name} \ -if [ $1 -eq 0 -a -x %{_bindir}/fc-cache ] ; then \ - %{_bindir}/fc-cache %{_fontdir} || : \ -fi\ -\ -\ -%files %{subpkg_name} \ -%defattr(0644,root,root,0755) \ -\ -%{-f:%{_fontconfig_templatedir}/%{-f*}} \ -%{-f:%config(noreplace) %{_fontconfig_confdir}/%{-f*}} \ -\ -\ -%{lua: for arg=1,rpm.expand("%#") do \ -print(rpm.expand("%{_fontdir}/%"..arg).."\\n") \ -end} diff --git a/rpm/macros.fonts b/rpm/macros.fonts new file mode 100644 index 0000000..de3aef1 --- /dev/null +++ b/rpm/macros.fonts @@ -0,0 +1,70 @@ +# RPM macros for font packages. +# +# © 2008-2009 Nicolas Mailhot + +## Default directories + +# Font installation directory root +%_fontbasedir %{_datadir}/fonts + +# Actual font installation directory +%_fontdir %{_fontbasedir}/%{?fontname:%{fontname}}%{?!fontname:%{name}} + +# Master fontconfig configuration directory +# Only needed to avoid a circular directory dependency with the fontconfig +# package — you should *not* use this +%_fontconfig_masterdir %{_sysconfdir}/fonts + +# Fontconfig directory for active configuration snippets +%_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:) \ +\ +%define subpkg_name %{-n: %{lua: \ +if rpm.expand("%{name}") == rpm.expand("%{fontname}-fonts") \ +then print(rpm.expand("-n %{fontname}-%{-n*}-fonts")) \ +else print(rpm.expand("%{-n*}-fonts")) \ +end } } \ +\ +%post %{subpkg_name} \ +if [ -x %{_bindir}/fc-cache ]; then \ + %{_bindir}/fc-cache %{_fontdir} || : \ +fi \ +\ +\ +%postun %{subpkg_name} \ +if [ $1 -eq 0 -a -x %{_bindir}/fc-cache ] ; then \ + %{_bindir}/fc-cache %{_fontdir} || : \ +fi\ +\ +\ +%files %{subpkg_name} \ +%defattr(0644,root,root,0755) \ +\ +%{-f:%{_fontconfig_templatedir}/%{-f*}} \ +%{-f:%config(noreplace) %{_fontconfig_confdir}/%{-f*}} \ +\ +\ +%{lua: for arg=1,rpm.expand("%#") do \ +print(rpm.expand("%{_fontdir}/%"..arg).."\\n") \ +end}