add dependency with security-config to change the owner of font directory
[platform/upstream/fontconfig.git] / packaging / fontconfig.spec
1 %global freetype_version 2.9.0
2
3 Name:           fontconfig
4 Summary:        Font configuration and customization library
5 Version:        2.13.1
6 Release:        1
7 Group:          Graphics & UI Framework/Fonts
8 License:        MIT
9 URL:            http://fontconfig.org
10 Source0:        http://fontconfig.org/release/fontconfig-%{version}.tar.gz
11 Source100:      fontconfig.conf
12 Source1001:     fontconfig.manifest
13 BuildRequires:  pkgconfig(freetype2) >= %{freetype_version}
14 BuildRequires:  gawk
15 BuildRequires:  expat-devel
16 BuildRequires:  perl
17 BuildRequires:  gperf
18 BuildRequires:  python
19 BuildRequires:  systemd-devel
20 BuildRequires:  gettext-tools
21 BuildRequires:  libuuid-devel
22 BuildRequires:  pkgconfig(libtzplatform-config)
23 Requires(pre):  %{TZ_SYS_BIN}/fc-cache, %{TZ_SYS_BIN}/mkdir %{TZ_SYS_BIN}/rm, %{TZ_SYS_BIN}/grep, %{TZ_SYS_BIN}/chsmack
24 Requires(post): /sbin/ldconfig
25 Requires(postun): /sbin/ldconfig
26 Requires: security-config
27
28 %description
29 Fontconfig is designed to locate fonts within the
30 system and select them according to requirements specified by
31 applications.
32
33 %package devel
34 Summary:        Font configuration and customization library
35 Group:          Graphics & UI Framework/Fonts
36 Requires:       %{name} = %{version}
37 Requires:       fontconfig = %{version}
38 Requires:       freetype-devel >= %{freetype_version}
39 Requires:       pkg-config
40
41 %description devel
42 The fontconfig-devel package includes the header files,
43 and developer docs for the fontconfig package.
44
45 Install fontconfig-devel if you want to develop programs which
46 will use fontconfig.
47
48 %prep
49 %setup -q
50 cp %{SOURCE1001} .
51
52 %build
53 # We don't want to rebuild the docs, but we want to install the included ones.
54 export HASDOCBOOK=no
55
56 %reconfigure --disable-static \
57     --with-expat=%{_prefix} \
58     --with-expat-include=%{_includedir} \
59     --with-expat-lib=%{_libdir} \
60     --with-freetype-config=%{TZ_SYS_BIN}/freetype-config \
61     --with-add-fonts=%{TZ_SYS_RO_SHARE}/fonts,%{TZ_SYS_RO_SHARE}/app_fonts,%{TZ_SYS_RO_SHARE}/fallback_fonts,%{TZ_SYS_SHARE}/fonts \
62     --with-cache-dir=%{TZ_SYS_VAR}/cache/fontconfig \
63     --with-baseconfigdir=%{TZ_SYS_RO_ETC}/fonts \
64     --with-configdir=%{TZ_SYS_RO_ETC}/fonts/conf.d \
65     --with-templatedir=%{TZ_SYS_RO_ETC}/fonts/conf.avail \
66     --with-xmldir=%{TZ_SYS_RO_ETC}/fonts \
67     --disable-docs
68
69 make %{?jobs:-j%jobs}
70
71 #make check
72 %install
73 rm -rf %{buildroot}
74
75 %make_install
76
77 mkdir -p %{buildroot}%{_tmpfilesdir}
78 install -m 0644 %SOURCE100 %{buildroot}%{_tmpfilesdir}/fontconfig.conf
79
80 # All font packages depend on this package, so we create
81 # and own /usr/share/fonts
82 mydir=$RPM_BUILD_ROOT%{TZ_SYS_RO_SHARE}/fonts
83 mkdir -p $RPM_BUILD_ROOT%{TZ_SYS_RO_SHARE}/fonts
84
85 # Remove unpackaged files. no need when configure --disable-static
86 #rm $RPM_BUILD_ROOT%{_libdir}/*.la
87 #rm $RPM_BUILD_ROOT%{_libdir}/*.a
88
89 %post
90 /sbin/ldconfig
91
92 umask 0022
93
94 mkdir -p %{TZ_SYS_RO_SHARE}/fonts
95 chmod 755 %{TZ_SYS_RO_SHARE}/fonts
96 chsmack -t %{TZ_SYS_RO_SHARE}/fonts
97 chsmack -a User::App::Shared %{TZ_SYS_RO_SHARE}/fonts
98
99 mkdir -p %{TZ_SYS_RO_SHARE}/fallback_fonts
100 chmod 755 %{TZ_SYS_RO_SHARE}/fallback_fonts
101 chsmack -t %{TZ_SYS_RO_SHARE}/fallback_fonts
102 chsmack -a User::App::Shared %{TZ_SYS_RO_SHARE}/fallback_fonts
103
104 mkdir -p %{TZ_SYS_RO_SHARE}/app_fonts
105 chmod 755 %{TZ_SYS_RO_SHARE}/app_fonts
106 chsmack -t %{TZ_SYS_RO_SHARE}/app_fonts
107 chsmack -a User::App::Shared %{TZ_SYS_RO_SHARE}/app_fonts
108
109 mkdir -p %{TZ_SYS_VAR}/cache/fontconfig
110 chown root:root %{TZ_SYS_VAR}/cache/fontconfig
111 chmod 755 %{TZ_SYS_VAR}/cache/fontconfig
112 chsmack -t %{TZ_SYS_VAR}/cache/fontconfig
113 chsmack -a User::App::Shared %{TZ_SYS_VAR}/cache/fontconfig
114
115 mkdir -p %{TZ_SYS_SHARE}/fonts
116 chown app_fw:users %{TZ_SYS_SHARE}/fonts
117 chmod 755 %{TZ_SYS_SHARE}/fonts
118 chsmack -t %{TZ_SYS_SHARE}/fonts
119 chsmack -a User::App::Shared %{TZ_SYS_SHARE}/fonts
120
121 # Skip making fontconfig cache folder for users. (/opt/home/app/.cache)
122 # The path will be changed according to a name of user.
123 #rm -rf %{TZ_USER_CACHE}/fontconfig
124 #mkdir -p %{TZ_USER_CACHE}/fontconfig
125 #chmod 755 %{TZ_USER_CACHE}
126 #chown app:app %{TZ_USER_CACHE}
127 #chsmack -t %{TZ_USER_CACHE}
128 #chsmack -a System::Shared %{TZ_USER_CACHE}
129 #chmod 755 %{TZ_USER_CACHE}/fontconfig
130 #chown app:app %{TZ_USER_CACHE}/fontconfig
131 #chsmack -t %{TZ_USER_CACHE}/fontconfig
132 #chsmack -a System::Shared %{TZ_USER_CACHE}/fontconfig
133
134 # remove 49-sansserif.conf to fix bmc #9024
135 #rm -rf /usr/%{_sysconfdir}/fonts/conf.d/49-sansserif.conf
136
137 # Force regeneration of all fontconfig cache files
138 # The check for existance is needed on dual-arch installs (the second
139 #  copy of fontconfig might install the binary instead of the first)
140 # The HOME setting is to avoid problems if HOME hasn't been reset
141 #if [ -x %{TZ_SYS_BIN}/fc-cache ] && %{TZ_SYS_BIN}/fc-cache --version 2>&1 | grep -q %{version} ; then
142 #fc-cache -rf --system-only
143 #fi
144
145 %postun -p /sbin/ldconfig
146
147 %files
148 %manifest fontconfig.manifest
149 %defattr(-,root,root,-)
150 %defattr(-, root, root)
151 %doc README AUTHORS COPYING
152 %{_libdir}/libfontconfig.so.*
153 %{TZ_SYS_BIN}/fc-*
154 %{TZ_SYS_RO_ETC}/fonts/*
155 %dir %{TZ_SYS_RO_ETC}/fonts/conf.avail
156 %dir %{TZ_SYS_RO_SHARE}/fonts
157 %{TZ_SYS_RO_SHARE}/gettext/its/fontconfig*
158 %{TZ_SYS_RO_SHARE}/locale/*/*/fontconfig*
159 %doc %{TZ_SYS_RO_ETC}/fonts/conf.d/README
160 %config %{TZ_SYS_RO_ETC}/fonts/conf.avail/*.conf
161 %config(noreplace) %{TZ_SYS_RO_ETC}/fonts/conf.d/*.conf
162 %{_tmpfilesdir}/fontconfig.conf
163 %license COPYING
164
165 %files devel
166 %manifest fontconfig.manifest
167 %defattr(-,root,root,-)
168 %defattr(-, root, root)
169 %{_libdir}/libfontconfig.so
170 %{_libdir}/pkgconfig/*
171 %{_includedir}/fontconfig
172