--- rpm/macros.fonts.orig 2019-02-17 07:23:35.184027171 +0000 +++ rpm/macros.fonts 2019-02-17 07:26:58.775108598 +0000 @@ -1,14 +1,16 @@ # RPM macros for font packages. # # © 2008-2009 Nicolas Mailhot +# adapted for ALTLinux by Igor Vlasenko ## Default directories # Font installation directory root %_fontbasedir %{_datadir}/fonts +%_fontstem %{?fontname:%{fontname}}%{?!fontname:%{name}} # Actual font installation directory -%_fontdir %{_fontbasedir}/%{?fontname:%{fontname}}%{?!fontname:%{name}} +%_fontdir %{_fontbasedir}/%{_fontstem} # Master fontconfig configuration directory # Only needed to avoid a circular directory dependency with the fontconfig @@ -22,67 +24,3 @@ # Templates are activated by symlinking in _fontconfig_confdir %_fontconfig_templatedir %{_datadir}/fontconfig/conf.avail -## Magic - -# Utility macro that computes a canonical font (sub)package name -# -# Expects an (optional) subpackage name as argument - -%_font_pkg_name() %{lua: -local function rpmeval(name) - local sname = rpm.expand(name) - if sname == name - then return "" - else - sname = string.lower("-" .. sname .. "-") - sname = string.gsub(sname, "[_%-]+", "-") - sname = string.gsub(sname, "%-font(s?)%-", "-") - sname = string.gsub(sname, "^%-", "") - sname = string.gsub(sname, "%-$", "") - return sname - end -end -local function meld(name1,name2) - local name3 = "-" .. name2 .. "-" - for token in string.gmatch(name1 .. "-" , "..-%-") do - token = string.gsub(token, "%-", "%%-") - name3 = string.gsub(name3, "%-" .. token, "-") - end - return string.gsub( name1 .. name3 , "%-+$", "") -end -local pkgname = rpmeval("%{name}") -local fontname = rpmeval("%{fontname}") -local subname = rpmeval("%1") -print(meld(meld(pkgname,fontname),subname) .. "-fonts") -} %{nil} - - -# Macro to generate file sections and scriptlets for font (sub)packages -# -# 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 spn %_font_pkg_name %{-n:%{-n*}} \ -%files -n %{spn} \ -\ -%dir %{_fontdir} \ -%ghost %{_fontdir}/.uuid \ -%{lua: \ -for arg=1,rpm.expand("%#") do \ - print(rpm.expand("%{_fontdir}/%" .. arg) .. "\\n") \ -end} \ -%{-f:%{_fontconfig_templatedir}/%{-f*}} \ -%{-f:%config(noreplace) %{_fontconfig_confdir}/%{-f*} \ -} %{nil} -