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