Replace the external xorg-x11-fonts-update-dirs script with an rpm macro

doing the same thing, removing our runtime reliance on
  xorg-x11-font-utils (1938074)
This commit is contained in:
Peter Hutterer 2021-03-12 12:54:04 +10:00
parent b2e2d961c5
commit ff20ebf08a

View File

@ -1,11 +1,38 @@
%global _catalogue /etc/X11/fontpath.d
# NOTE: Fonts strictly intended for X core fonts, should be installed into _x11fontdir.
%global _x11fontdir %{_datadir}/X11/fonts
%global _x11fontencodingsdir %{_x11fontdir}/encodings
# A macro to de-duplicate a set of calls used in multiple fonts.
# Usage: font_update_dirs [-f] [-t] <directory>
# -f ... run fontscale
# -t ... run ttmkfdir
# -u ... uninstall mode, only perform actions if the target directory exists
# <directory>
%global font_update_dirs(ftu) ( \
if [ -z "%*" ]; then \
echo "Missing directory argument"; \
exit 1; \
fi \
fontdir="%{_x11fontdir}/%%1" \
if [ -z "%%{-u}" -o -d $fontdir ]; then \
if [ ! -z "%%{-f}" ]; then \
mkfontscale "$fontdir"; \
fi \
if [ ! -z "%%{-t}" ]; then \
ttmkfdir -d "$fontdir" -o "$fontdir/fonts.scale"; \
fi \
mkfontdir "$fontdir"; \
fc-cache "$fontdir"; \
mkdir -p "%{_x11fontencodingsdir}/large"; \
mkfontscale -n -e "%{_x11fontencodingsdir}" -e "%{_x11fontencodingsdir}/large" "%{_x11fontencodingsdir}"; \
fi \
)
Summary: X.Org X11 fonts
Name: xorg-x11-fonts
Version: 7.5
Release: 29%{?dist}
Release: 30%{?dist}
License: MIT and Lucida and Public Domain
URL: https://www.x.org
@ -292,52 +319,43 @@ done
done
}
# xorg-x11-fonts-update-dirs is provided by xorg-x11-font-utils to deduplicate
# stuff run in %%post
%post misc
{
# Only run fc-cache in the Type1 dir, gzipped pcf's take forever
xorg-x11-fonts-update-dirs --skip-fontscale %{_x11fontdir}/misc || :
%font_update_dirs misc || :
}
%postun misc
{
# Rebuild fonts.dir when uninstalling package. (exclude the local, CID dirs)
if [ "$1" = "0" -a -d %{_x11fontdir}/misc ]; then
xorg-x11-fonts-update-dirs --skip-fontscale %{_x11fontdir}/misc || :
if [ "$1" = "0" ]; then
%font_update_dirs -u misc || :
fi
}
%post Type1
{
xorg-x11-fonts-update-dirs %{_x11fontdir}/Type1 || :
}
%font_update_dirs -f Type1 || :
}
%postun Type1
{
FONTDIR=%{_x11fontdir}/Type1
if [ "$1" = "0" -a -d $FONTDIR ]; then
xorg-x11-fonts-update-dirs $FONTDIR || :
if [ "$1" = "0" ]; then
%font_update_dirs -u -f Type1 || :
fi
}
%post ethiopic
{
xorg-x11-fonts-update-dirs --skip-fontscale --need-ttmkfdir %{_x11fontdir}/TTF || :
xorg-x11-fonts-update-dirs %{_x11fontdir}/OTF || :
%font_update_dirs -t TTF || :
%font_update_dirs -f OTF || :
}
%postun ethiopic
{
FONTDIR=%{_x11fontdir}/TTF
if [ "$1" = "0" -a -d $FONTDIR ]; then
xorg-x11-fonts-update-dirs --skip-fontscale --need-ttmkfdir $FONTDIR || :
fi
FONTDIR=%{_x11fontdir}/OTF
if [ "$1" = "0" -a -d $FONTDIR ]; then
xorg-x11-fonts-update-dirs $FONTDIR || :
if [ "$1" = "0" ]; then
%font_update_dirs -u -t TTF || :
%font_update_dirs -u -f OTF || :
fi
}
@ -931,6 +949,11 @@ mkfontdir %{_x11fontdir}/cyrillic || :
%ghost %verify(not md5 size mtime) %{_x11fontdir}/cyrillic/fonts.cache-*
%changelog
* Fri Mar 12 2021 Peter Hutterer <peter.hutterer@redhat.com> 7.5-30
- Replace the external xorg-x11-fonts-update-dirs script with an rpm macro
doing the same thing, removing our runtime reliance on
xorg-x11-font-utils (#1938074)
* Fri Mar 12 2021 Peter Hutterer <peter.hutterer@redhat.com> 7.5-29
- BuildRequire mkfontscale now that it's separated out from
xorg-x11-font-utils (#1938069)
@ -1064,7 +1087,7 @@ mkfontdir %{_x11fontdir}/cyrillic || :
* Tue Jun 08 2010 Peter Hutterer <peter.hutterer@redhat.com> 7.2-11
- Require xorg-x11-font-utils >= 7.2-11 for font-utils 1.1.0
- Fix bashism in spec file (&>)
- Remove perl hack for DEFAULT_FONTS_DIR, fixed upstream
- Remove perl hack for DEFAULT_FONTS_DIR, fixed upstream
- Remove perl and autoconf requirement.
- Create %%ghost files {misc|705dpi|...}/fonts.scale.
- Drop fontdir alias patches