packaging: Drop no longer valid mention of Apache2.0 license for libdlog-devel
[platform/core/system/dlog.git] / packaging / dlog.spec
1 %define _with_dlog_dynamic_filters on
2 %bcond_with dlog_dynamic_filters
3
4 Name:       dlog
5 Summary:    Logging service
6 Version:    6.0.13
7 Release:    1
8 Group:      System/Libraries
9 License:    Apache-2.0, MIT
10 Source0:    %{name}-%{version}.tar.gz
11 Source101:  packaging/dlog.manifest
12 Source501:  packaging/01-dlog.rules
13 Source502:  packaging/logger-devices.conf
14
15 # NOTE: hardcoded instead of a build dependency on libudev.
16 #       Needed to prevent a cyclic build dependency in case
17 #       dlog is used in a package dependent on libsystemd,
18 #       since libudev is a part of it
19 %define _udevrulesdir %{_prefix}/lib/udev/rules.d
20
21 BuildRequires: autoconf
22 BuildRequires: automake
23 BuildRequires: libcap-devel
24 BuildRequires: libtool
25 BuildRequires: pkgconfig(capi-base-common)
26 BuildRequires: pkgconfig(libtzplatform-config)
27 %if 0%{?gcov:1}
28 BuildRequires: lcov
29 BuildRequires: zip
30 %endif
31
32 %description
33 dlog API library
34
35 %package -n libdlog
36 Summary:    Logging service dlog API
37 License:    MIT
38 Group:      Development/Libraries
39 Requires(pre): coreutils
40 Requires(post): coreutils
41 Requires(post): /sbin/ldconfig
42 Requires(post): /usr/bin/chsmack
43 Requires(posttrans): coreutils
44 Requires(posttrans): /usr/bin/chsmack
45 Requires(postun): /sbin/ldconfig
46 Requires: %{name}-config-persistent-logs
47 Requires: %{name}-common = %{version}-%{release}
48 Requires: %{name}-logger = %{version}-%{release}
49
50 %description -n libdlog
51 dlog API library. If dlog-config-backend-logger is not installed, pipe backend is selected.
52
53 %package -n libdlog-devel
54 Summary:    Logging service dlog API
55 License:    MIT
56 Group:      Development/Libraries
57 Requires:   lib%{name} = %{version}-%{release}
58 Requires:   pkgconfig(capi-base-common)
59
60 %description -n libdlog-devel
61 dlog API library
62
63 %package    common
64 Summary:    Shared files between libdlog and service
65 License:    Apache-2.0
66 Group:      Development/Libraries
67
68 %description common
69
70 %package    logger
71 Summary:    Logger service
72 License:    Apache-2.0
73 Group:      Development/Libraries
74 Requires:   %{name}-common = %{version}-%{release}
75
76 %description logger
77
78 %package -n libdlogutil
79 Summary:    Log retrieval API
80 Group:      Development/Libraries
81 Requires:   lib%{name} = %{version}-%{release}
82
83 %description -n libdlogutil
84 dlog log retrieval API
85
86 %package -n libdlogutil-devel
87 Summary:    Log retrieval API
88 Group:      Development/Libraries
89 Requires:   libdlog-devel
90 Requires:   lib%{name} = %{version}-%{release}
91
92 %description -n libdlogutil-devel
93 dlog log retrieval API development files
94
95 %package config-backend-logger
96 Summary:        Android-logger backend selection for dlog
97 Requires:       lib%{name} = %{version}-%{release}
98
99 %description config-backend-logger
100 Change dlog backend to logger backend. Require kernel support (Android-logger)
101
102 %package -n dlogutil
103 Summary:    print log data to the screen
104 Group:      Development/Libraries
105 Requires:   lib%{name} = %{version}-%{release}
106
107 %description -n dlogutil
108 Utilities for print log data
109
110 %package config-syslog
111 License:    Apache-2.0
112 Summary:    Logger: syslog-source logging via dlog
113 Group:      Base/Startup
114 Requires:   lib%{name} = %{version}-%{release}
115 Provides:   tizen-log-syslog
116
117 %description config-syslog
118 Systemd unit for syslog socket configation to use with dlog
119
120 %package config-persistent-logs
121 Summary: enable persistent storage of logs
122
123 %description config-persistent-logs
124 Enable persistent logs in dlog (stored in /var/log/dlog/)
125
126 %package doc
127 Summary: dlog documentation
128 BuildRequires: doxygen
129
130 %description doc
131 Documentation for dlog
132
133 %package tests
134 Summary: dlog integration tests
135 Requires: lib%{name} = %{version}-%{release}
136 Requires(post): /usr/bin/chsmack
137
138 %description tests
139 Integration tests for dlog.
140
141 %if 0%{?gcov:1}
142 %package -n libdlog-gcov
143 Summary:  gcov files for libdlog
144 Group:    Development/Libraries
145 %description -n libdlog-gcov
146 This package contains gcov code coverage/profiling files for libdlog.
147 %endif
148
149 %prep
150 %setup -q
151
152 %build
153 CFLAGS="-Wno-gnu-variable-sized-type-not-at-end"
154
155 %if 0%{?gcov:1}
156 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
157 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
158 export LDFLAGS+=" -lgcov"
159 %endif
160
161
162 cp %{SOURCE101} .
163
164 %autogen --disable-static
165 %configure --disable-static \
166 %if %{without dlog_dynamic_filters}
167 --disable-dynamic-filters
168 %else
169 --enable-dynamic-filters
170 %endif
171
172 make %{?jobs:-j%jobs} CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
173
174 # autoconf adds a bunch of flags, including -O2.
175 # Clear those so that test coverage can be measured properly
176 %if 0%{?gcov:1}
177 make check CFLAGS='-Wno-gnu-variable-sized-type-not-at-end -Wno-logical-op-parentheses -ftest-coverage -D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
178 %else
179 make check CFLAGS='-Wno-gnu-variable-sized-type-not-at-end -Wno-logical-op-parentheses -D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
180 %endif
181
182 make dox
183
184 %if 0%{?gcov:1}
185 mkdir -p gcov-obj
186 find ./src/libdlog -name '*.gcno' -exec cp '{}' gcov-obj ';'
187 %endif
188
189 %if 0%{?gcov:1}
190 %check -n libdlog
191 lcov -c --ignore-errors graph --no-external -q -d ./src/libdlog -o libdlog.info
192 genhtml libdlog.info -o libdlog.out
193 zip -r libdlog.zip libdlog.out libdlog.info
194 install -m 0644 libdlog.zip %{buildroot}%{_datadir}/gcov/
195 %endif
196
197 %install
198 rm -rf %{buildroot}
199
200 %make_install
201 mkdir -p %{buildroot}/usr/bin/
202
203 mkdir -p %{buildroot}/usr/share/doc/dlog
204 cp -r documentation/* %{buildroot}/usr/share/doc/dlog
205
206 mkdir -p %{buildroot}%{_unitdir}/basic.target.wants/
207 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants/
208 ln -s ../dlog_logger.service %{buildroot}%{_unitdir}/basic.target.wants/dlog_logger.service
209 ln -s ../dlog_dev-log.socket %{buildroot}%{_unitdir}/sockets.target.wants/dlog_dev-log.socket
210
211 mkdir -p %{buildroot}%{_udevrulesdir}
212 install -m 0644 %SOURCE501 %{buildroot}%{_udevrulesdir}/01-dlog.rules
213
214 mkdir -p %{buildroot}%{_unitdir}/dlog_logger.service.d
215 install -m 0644 %SOURCE502 %{buildroot}%{_unitdir}/dlog_logger.service.d/logger-devices.conf
216
217 mkdir -p %{buildroot}/var/log/dlog
218
219 mkdir -p %{buildroot}/var/lib/dlog-tests
220 mkdir -p %{buildroot}/usr/share/dlog-filters.conf.test
221
222 %if %{without dlog_dynamic_filters}
223 rm -f %{buildroot}%{_bindir}/dlogctl
224 sed -i -e 's,^\(dynamic_config_path=\),#\1,g' -e 's,^\(limiter_apply_to_all_buffers=\),#\1,g' %{buildroot}%{_sysconfdir}/dlog.conf
225 %endif
226
227 %if 0%{?gcov:1}
228 mkdir -p %{buildroot}%{_datadir}/gcov/obj
229 install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
230 %endif
231
232 %files -n dlogutil
233 %manifest dlog.manifest
234 %license LICENSE.APACHE2.0 LICENSE.MIT
235 %attr(750,log,log) %{_bindir}/dlogutil
236 %attr(755,log,log) %{_bindir}/dlogsend
237 %attr(750,log,log) %{_bindir}/dlog_cleanup
238 %attr(750,log,log) %{_bindir}/dlogmetrics
239 %{_unitdir}/dlog_cleanup.service
240
241 %if %{with dlog_dynamic_filters}
242 %attr(750,log,log) %{_bindir}/dlogctl
243 %endif
244
245 %post -n dlogutil
246 %if %{with dlog_dynamic_filters}
247 chsmack %{_bindir}/dlogctl -a "System::Tools"
248 %endif
249
250 %files -n libdlog
251 %manifest dlog.manifest
252 %license LICENSE.MIT
253 %{_libdir}/libdlog.so.0
254 %{_libdir}/libdlog.so.0.0.0
255
256 %post -n libdlog -p /sbin/ldconfig
257 %postun -n libdlog -p /sbin/ldconfig
258
259 %files common
260 %manifest dlog.manifest
261 %license LICENSE.APACHE2.0
262 %{_sysconfdir}/dlog.conf
263 %{_sysconfdir}/dlog.conf.d/20-pipe.conf
264 %attr(755,log,log) /var/log/dlog
265 %attr(2551,log,log) %{_libexecdir}/dlog-log-critical
266 /usr/lib/tmpfiles.d/dlog-run.conf
267 %{_udevrulesdir}/01-dlog.rules
268
269 %post common
270 chsmack -a System /var/log/dlog
271 # set timestamp to beginning of the unix epoch to make rotation work even if we are run on system with no/broken rtc
272 touch -m -t 197001010000.01 /var/log/dlog/critical.a
273 touch -m -t 197001010000.00 /var/log/dlog/critical.b
274 chmod 660 /var/log/dlog/critical*
275 chown log:log /var/log/dlog/critical*
276 chsmack -e 'System' %{_libexecdir}/dlog-log-critical
277
278 %files logger
279 %manifest dlog.manifest
280 %license LICENSE.APACHE2.0
281 %attr(750,log,log) %{_bindir}/dlog_logger
282 %{_unitdir}/basic.target.wants/dlog_logger.service
283 %{_unitdir}/dlog_logger.service
284
285 %files -n libdlog-devel
286 %manifest dlog.manifest
287 %license LICENSE.MIT
288 %{_includedir}/dlog/dlog.h
289 %{_includedir}/dlog/dlog-internal.h
290 %{_libdir}/pkgconfig/dlog.pc
291 %{_libdir}/libdlog.so
292
293 %files -n libdlogutil
294 %manifest dlog.manifest
295 %license LICENSE.APACHE2.0 LICENSE.MIT
296 %{_libdir}/libdlogutil.so.*
297
298 %files -n libdlogutil-devel
299 %manifest dlog.manifest
300 %license LICENSE.APACHE2.0 LICENSE.MIT
301 %{_includedir}/dlog/dlogutil.h
302 %{_libdir}/pkgconfig/dlogutil.pc
303 %{_libdir}/libdlogutil.so
304
305 %files config-backend-logger
306 %manifest dlog.manifest
307 %license LICENSE.APACHE2.0 LICENSE.MIT
308 %{_sysconfdir}/dlog.conf.d/25-logger.conf
309 %{_unitdir}/dlog_logger.service.d/logger-devices.conf
310
311 %files config-syslog
312 %manifest dlog.manifest
313 %license LICENSE.APACHE2.0 LICENSE.MIT
314 %{_unitdir}/sockets.target.wants/dlog_dev-log.socket
315 %{_unitdir}/dlog_dev-log.socket
316
317 %files config-persistent-logs
318 %{_sysconfdir}/dlog.conf.d/10-persistent-logs.conf
319
320 %files doc
321 %manifest dlog.manifest
322 %license LICENSE.APACHE2.0 LICENSE.MIT
323 /usr/share/doc/dlog
324
325 %files tests
326 %manifest dlog.manifest
327 %license LICENSE.APACHE2.0 LICENSE.MIT
328 %{_bindir}/dlog_test
329 %{_bindir}/dlog_cpu
330 /usr/share/doc/dlog/README.testsuite
331 %{_libexecdir}/libdlog/perf_libdlog
332 %{_libexecdir}/libdlog/test_libdlog
333 %{_libexecdir}/libdlog/test_libdlogutil
334 %{_libexecdir}/libdlog/test_filters
335 %{_datadir}/dlog-pipe.conf.test
336 %{_datadir}/dlog-logger.conf.test
337 %{_datadir}/dlog-logger.conf.alias
338 %{_datadir}/dlog-pipe.conf.cpu
339 %{_datadir}/dlog-logger.conf.cpu
340 %{_sysconfdir}/dlog.conf.d/99-dlog-logger.disable-platform-logging-for-testsuite.conf
341 %dir %attr(755,log,log) /var/lib/dlog-tests
342 %dir %attr(755,log,log) /usr/share/dlog-filters.conf.test
343
344 %post tests
345 chsmack -a System /var/lib/dlog-tests
346 echo "Warning! Installation of dlog-tests will break platform logging."
347 echo "This is done intentionally, to make logger backend testing possible."
348 echo "To restore normal behavior, please uninstall dlog-tests package."
349 echo ""
350 echo "For more information please read the /usr/share/doc/dlog/README.testsuite file"
351 echo ""
352 echo "A reboot is required to properly configure logger backend for testing."
353
354 %if 0%{?gcov:1}
355 %files -n libdlog-gcov
356 %{_datadir}/gcov/*
357 %endif