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