summaryrefslogtreecommitdiff
path: root/packaging/fontconfig.spec
blob: 289f8a0ef1834d302bc2aac00418020775e6e889 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
%global freetype_version 2.5.0

Name:           fontconfig
Summary:        Font configuration and customization library
Version:        2.11.93
Release:        1
Group:          Graphics & UI Framework/Fonts
License:        MIT
URL:            http://fontconfig.org
Source0:        http://fontconfig.org/release/fontconfig-%{version}.tar.gz
Source1001:     packaging/fontconfig.manifest
BuildRequires:  pkgconfig(freetype2) >= %{freetype_version}
BuildRequires:  gawk
BuildRequires:  expat-devel
BuildRequires:  perl
BuildRequires:  gperf
BuildRequires:  python
BuildRequires:  pkgconfig(libtzplatform-config)
Requires(pre):  %{TZ_SYS_BIN}/fc-cache, %{TZ_SYS_BIN}/mkdir %{TZ_SYS_BIN}/rm, %{TZ_SYS_BIN}/grep, %{TZ_SYS_BIN}/chsmack
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig

%description
Fontconfig is designed to locate fonts within the
system and select them according to requirements specified by
applications.

%package devel
Summary:        Font configuration and customization library
Group:          Graphics & UI Framework/Fonts
Requires:       %{name} = %{version}
Requires:       fontconfig = %{version}
Requires:       freetype-devel >= %{freetype_version}
Requires:       pkg-config

%description devel
The fontconfig-devel package includes the header files,
and developer docs for the fontconfig package.

Install fontconfig-devel if you want to develop programs which
will use fontconfig.

%prep
%setup -q
cp %{SOURCE1001} .

%build
# We don't want to rebuild the docs, but we want to install the included ones.
export HASDOCBOOK=no

%reconfigure --disable-static \
    --with-expat=%{_prefix} \
    --with-expat-include=%{_includedir} \
    --with-expat-lib=%{_libdir} \
    --with-freetype-config=%{TZ_SYS_BIN}/freetype-config \
    --with-add-fonts=%{TZ_SYS_RO_SHARE}/fonts,%{TZ_SYS_RO_SHARE}/app_fonts,%{TZ_SYS_RO_SHARE}/fallback_fonts \
    --with-cache-dir=%{TZ_SYS_VAR}/cache/fontconfig \
    --with-baseconfigdir=%{TZ_SYS_RO_ETC}/fonts \
    --with-configdir=%{TZ_SYS_RO_ETC}/fonts/conf.d \
    --with-templatedir=%{TZ_SYS_RO_ETC}/fonts/conf.avail \
    --with-xmldir=%{TZ_SYS_RO_ETC}/fonts \
    --disable-docs

make %{?jobs:-j%jobs}

#make check
%install
rm -rf %{buildroot}

%make_install

# All font packages depend on this package, so we create
# and own /usr/share/fonts
mydir=$RPM_BUILD_ROOT%{TZ_SYS_RO_SHARE}/fonts
mkdir -p $RPM_BUILD_ROOT%{TZ_SYS_RO_SHARE}/fonts
mkdir -p %{buildroot}%{TZ_SYS_RO_SHARE}/license
cat COPYING > %{buildroot}%{TZ_SYS_RO_SHARE}/license/%{name}

# Remove unpackaged files. no need when configure --disable-static
#rm $RPM_BUILD_ROOT%{_libdir}/*.la
#rm $RPM_BUILD_ROOT%{_libdir}/*.a

%post
/sbin/ldconfig

umask 0022

mkdir -p %{TZ_SYS_VAR}/cache/fontconfig
# Remove stale caches
rm -f %{TZ_SYS_VAR}/cache/fontconfig/*
mkdir -p %{TZ_SYS_VAR}/cache/fontconfig
mkdir -p %{TZ_SYS_RO_SHARE}/fonts
mkdir -p %{TZ_SYS_RO_SHARE}/fallback_fonts
mkdir -p %{TZ_SYS_RO_SHARE}/app_fonts
chsmack -t %{TZ_SYS_VAR}/cache/fontconfig
chsmack -a System::Shared %{TZ_SYS_VAR}/cache/fontconfig

# Skip making fontconfig cache folder for users. (/opt/home/app/.cache)
# The path will be changed according to a name of user.
#rm -rf %{TZ_USER_CACHE}/fontconfig
#mkdir -p %{TZ_USER_CACHE}/fontconfig
#chmod 755 %{TZ_USER_CACHE}
#chown app:app %{TZ_USER_CACHE}
#chsmack -t %{TZ_USER_CACHE}
#chsmack -a System::Shared %{TZ_USER_CACHE}
#chmod 755 %{TZ_USER_CACHE}/fontconfig
#chown app:app %{TZ_USER_CACHE}/fontconfig
#chsmack -t %{TZ_USER_CACHE}/fontconfig
#chsmack -a System::Shared %{TZ_USER_CACHE}/fontconfig

# remove 49-sansserif.conf to fix bmc #9024
#rm -rf /usr/%{_sysconfdir}/fonts/conf.d/49-sansserif.conf

# Force regeneration of all fontconfig cache files
# The check for existance is needed on dual-arch installs (the second
#  copy of fontconfig might install the binary instead of the first)
# The HOME setting is to avoid problems if HOME hasn't been reset
if [ -x %{TZ_SYS_BIN}/fc-cache ] && %{TZ_SYS_BIN}/fc-cache --version 2>&1 | grep -q %{version} ; then
fc-cache -rf --system-only
fi

%postun -p /sbin/ldconfig

%files
%manifest fontconfig.manifest
%defattr(-,root,root,-)
%defattr(-, root, root)
%doc README AUTHORS COPYING
%{_libdir}/libfontconfig.so.*
%{TZ_SYS_BIN}/fc-*
%{TZ_SYS_RO_ETC}/fonts/*
%dir %{TZ_SYS_RO_ETC}/fonts/conf.avail
%dir %{TZ_SYS_RO_SHARE}/fonts
%doc %{TZ_SYS_RO_ETC}/fonts/conf.d/README
%config %{TZ_SYS_RO_ETC}/fonts/conf.avail/*.conf
%config(noreplace) %{TZ_SYS_RO_ETC}/fonts/conf.d/*.conf
%dir %{TZ_SYS_VAR}/cache/fontconfig
%{TZ_SYS_RO_SHARE}/license/%{name}

%files devel
%manifest fontconfig.manifest
%defattr(-,root,root,-)
%defattr(-, root, root)
%{_libdir}/libfontconfig.so
%{_libdir}/pkgconfig/*
%{_includedir}/fontconfig