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