File fonts-config.spec of Package fonts-config

#
# spec file for package fonts-config
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir /var/adm/fillup-templates
%endif

%define infinality_srcver 1-20130104_1
%define infinality_name    fontconfig-infinality
Name:           fonts-config
Version:        20160921
Release:        0
Summary:        Configures Fonts for X Windows and other applications
# MIT for infinality
License:        GPL-2.0+ and MIT
Group:          System/X11/Fonts
Source0:        fonts-config
Source1:        sysconfig.fonts-config
Source2:        fontconfig.SUSE.properties.template
Source3:        %{infinality_name}-%{infinality_srcver}.tar.bz2
Source4:        10-rendering-options.conf.template
Source5:        11-base-rendering.conf
Source6:        empty.conf
Source7:        12-tt-monospace-rendering.conf
Source8:        13-selective-rendering-ipa.conf
Source9:        49-family-default.conf
Source10:       60-family-prefer.conf
Source11:       70-reject.conf
Source12:       31-metric-aliases-bw.conf
Source13:       59-family-prefer-lang-specific.conf
Patch0:         fontconfig-infinality-generate-tt-groups.patch
BuildRequires:  fontconfig
BuildRequires:  fontpackages-devel
Requires(pre):  %fillup_prereq
%reconfigure_fonts_prereq
Requires:       fontconfig
Requires:       gawk
Requires:       perl(English)
Recommends:     mkfontscale
Recommends:     mkfontdir
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Configures Fonts for X Windows and other applications.

Usually fonts-config is called automatically when package containing 
font is installed, upgraded or removed. But you can also execute 
fonts-config directly, which is mainly useful to debug it (use 
--debug flag).

%prep
%setup -cT -a 3 -n %{infinality_name}-%{infinality_srcver}
%patch0

%build
cd infinality/conf.src/generate60
./generate60.sh
mv 60-group-tt-fonts.conf ../../../10-group-tt-hinted-fonts.conf
mv 60-group-non-tt-fonts.conf ../../../10-group-tt-non-hinted-fonts.conf
cd ../../..
# empty configuration now, should be filled after fonts-config call
cp %{SOURCE6} 10-rendering-options.conf 
# empty configuration now, can be filled after fonts-config call
cp %{SOURCE6} 58-family-prefer-local.conf 
mv infinality/conf.src/80-selective-rendering-inf-win-lin.conf 13-selective-rendering.conf
mv infinality/conf.src/21-aliases-wine-linux.conf 61-wine-aliases.conf
cp -a %{SOURCE5} %{SOURCE7} %{SOURCE8} %{SOURCE9} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} .

%install
mkdir -p %{buildroot}/sbin/conf.d
mkdir -p %{buildroot}%{_prefix}/sbin
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}/%{_mandir}/man1
mkdir -p %{buildroot}/%{_docdir}/%{name}/infinality
mkdir -p %{buildroot}%{_fillupdir}
install -m 755 %{SOURCE0} %{buildroot}%{_prefix}/sbin
install -m 644 %{SOURCE1} \
  %{buildroot}%{_fillupdir}/
install -m 644 %{SOURCE2} %{buildroot}%{_datadir}/fonts-config
install -m 644 infinality/README infinality/LICENSE %{buildroot}%{_docdir}/%{name}/infinality
install -m 644 infinality/conf.src/generate60/60-group-non-tt-fonts.list  %{buildroot}%{_docdir}/%{name}/infinality/good-hinted-tt-fonts.list
install -m 644 infinality/conf.src/generate60/60-group-tt-fonts.list  %{buildroot}%{_docdir}/%{name}/infinality/non-hinted-tt-fonts.list
pod2man --section 1 --center=" " %{SOURCE0} > \
  %{buildroot}/%{_mandir}/man1/fonts-config.1
#
install -m 644 %{SOURCE4} %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_fontsconfavaildir}
# following two conf files can not be under /usr/share/fonts-config
# as they are changed during installation [bnc#882029 (internal)] 
mkdir -p %{buildroot}%{_fontsconfddir}
for conf in     10-rendering-options.conf \
                58-family-prefer-local.conf; do
  install -m 644 $conf %{buildroot}%{_fontsconfddir}
done
#
for conf in 	10-group-tt-hinted-fonts.conf \
		10-group-tt-non-hinted-fonts.conf \
		11-base-rendering.conf \
		12-tt-monospace-rendering.conf \
		13-selective-rendering.conf \
		13-selective-rendering-ipa.conf \
                31-metric-aliases-bw.conf \
		49-family-default.conf \
		59-family-prefer-lang-specific.conf \
		60-family-prefer.conf \
		61-wine-aliases.conf \
		70-reject.conf; do 
  install -m 644 $conf %{buildroot}%{_datadir}/%{name}/conf.avail/
  %link_avail_to_system_fontsconf $conf
done

%post
%{fillup_only -n fonts-config}
%reconfigure_fonts_post -c
exit 0

%postun
%reconfigure_fonts_postun -c

%posttrans
%reconfigure_fonts_posttrans

%files
%defattr(-,root,root)
%dir %{_datadir}/fonts-config
%files_fontsconf_availdir
%{_sbindir}/fonts-config
%{_datadir}/fonts-config/*.template
%{_mandir}/man1/fonts-config.1.gz
%{_docdir}/%{name}
%{_fillupdir}/sysconfig.fonts-config
%{_fontsconfavaildir}/*.conf
%config %{_fontsconfddir}/*.conf

%changelog
openSUSE Build Service is sponsored by