Add redirector binary and lib
[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.16
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(postun): /sbin/ldconfig
44 Requires: %{name}-config-persistent-logs
45 Requires: %{name}-common = %{version}-%{release}
46 Requires: %{name}-logger = %{version}-%{release}
47
48 %description -n libdlog
49 dlog API library. If dlog-config-backend-logger is not installed, pipe backend is selected.
50
51 %package -n libdlog-devel
52 Summary:    Logging service dlog API
53 License:    MIT
54 Group:      Development/Libraries
55 Requires:   lib%{name} = %{version}-%{release}
56 Requires:   pkgconfig(capi-base-common)
57
58 %description -n libdlog-devel
59 dlog API library
60
61 %package    common
62 Summary:    Shared files between libdlog and service
63 License:    Apache-2.0
64 Group:      Development/Libraries
65
66 %description common
67
68 %package    logger
69 Summary:    Logger service
70 License:    Apache-2.0
71 Group:      Development/Libraries
72 Requires:   %{name}-common = %{version}-%{release}
73
74 %description logger
75
76 %package -n libdlogutil
77 Summary:    Log retrieval API
78 Group:      Development/Libraries
79 Requires:   lib%{name} = %{version}-%{release}
80
81 %description -n libdlogutil
82 dlog log retrieval API
83
84 %package -n libdlogutil-devel
85 Summary:    Log retrieval API
86 Group:      Development/Libraries
87 Requires:   libdlog-devel
88 Requires:   lib%{name} = %{version}-%{release}
89
90 %description -n libdlogutil-devel
91 dlog log retrieval API development files
92
93 %package config-backend-logger
94 Summary:        Android-logger backend selection for dlog
95 Requires:       lib%{name} = %{version}-%{release}
96
97 %description config-backend-logger
98 Change dlog backend to logger backend. Require kernel support (Android-logger)
99
100 %package -n dlogutil
101 Summary:    print log data to the screen
102 Group:      Development/Libraries
103 Requires:   lib%{name} = %{version}-%{release}
104
105 %description -n dlogutil
106 Utilities for print log data
107
108 %package config-syslog
109 License:    Apache-2.0
110 Summary:    Logger: syslog-source logging via dlog
111 Group:      Base/Startup
112 Requires:   lib%{name} = %{version}-%{release}
113 Provides:   tizen-log-syslog
114
115 %description config-syslog
116 Systemd unit for syslog socket configation to use with dlog
117
118 %package config-persistent-logs
119 Summary: enable persistent storage of logs
120
121 %description config-persistent-logs
122 Enable persistent logs in dlog (stored in /var/log/dlog/)
123
124 %package config-qos
125 Summary: enable quality of service module
126
127 %description config-qos
128 Enables Quality of Service module in dlog
129
130 %package -n libdlog-redirect-stdout
131 Summary:    Redirect standard streams to dlog log buffers
132 Group:      Development/Libraries
133 Requires:   lib%{name} = %{version}-%{release}
134
135 %description -n libdlog-redirect-stdout
136 Redirect standard streams to dlog log buffers
137
138 %package -n libdlog-redirect-stdout-devel
139 Summary:    Redirect standard streams to dlog log buffers
140 Group:      Development/Libraries
141 Requires:   libdlog-devel
142 Requires:   lib%{name} = %{version}-%{release}
143
144 %description -n libdlog-redirect-stdout-devel
145 Redirect standard streams to dlog log buffers
146
147 %package -n dlog-redirect-stdout
148 Summary:    Utility to launch any binary with output redirected to dlog
149 Group:      Development/Libraries
150 Requires:   lib%{name} = %{version}-%{release}
151
152 %description -n dlog-redirect-stdout
153 Utility to launch any binary with output redirected to dlog
154
155 %package doc
156 Summary: dlog documentation
157 BuildRequires: doxygen
158
159 %description doc
160 Documentation for dlog
161
162 %package tests
163 Summary: dlog integration tests
164 Requires: lib%{name} = %{version}-%{release}
165 Requires(post): /usr/bin/chsmack
166
167 %description tests
168 Integration tests for dlog.
169
170 %if 0%{?gcov:1}
171 %package -n libdlog-gcov
172 Summary:  gcov files for libdlog
173 Group:    Development/Libraries
174 %description -n libdlog-gcov
175 This package contains gcov code coverage/profiling files for libdlog.
176 %endif
177
178 %prep
179 %setup -q
180
181 %build
182 # TODO: Respect the defaults, and have all custom flags in one place
183 CFLAGS="-Wno-gnu-variable-sized-type-not-at-end -g"
184
185 %if 0%{?gcov:1}
186 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
187 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
188 export LDFLAGS+=" -lgcov"
189 %endif
190
191
192 cp %{SOURCE101} .
193
194 %autogen --disable-static
195 %configure --disable-static \
196 %if %{without dlog_dynamic_filters}
197 --disable-dynamic-filters
198 %else
199 --enable-dynamic-filters
200 %endif
201
202 make %{?jobs:-j%jobs} CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
203
204 # autoconf adds a bunch of flags, including -O2.
205 # Clear those so that test coverage can be measured properly
206 %if 0%{?gcov:1}
207 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}\"'
208 %else
209 make check CFLAGS='-Wno-gnu-variable-sized-type-not-at-end -Wno-logical-op-parentheses -D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
210 %endif
211
212 make dox
213
214 %if 0%{?gcov:1}
215 mkdir -p gcov-obj
216 find ./src/libdlog -name '*.gcno' -exec cp '{}' gcov-obj ';'
217 %endif
218
219 %if 0%{?gcov:1}
220 %check -n libdlog
221 lcov -c --ignore-errors graph --no-external -q -d ./src/libdlog -o libdlog.info
222 genhtml libdlog.info -o libdlog.out
223 zip -r libdlog.zip libdlog.out libdlog.info
224 install -m 0644 libdlog.zip %{buildroot}%{_datadir}/gcov/
225 %endif
226
227 %install
228 rm -rf %{buildroot}
229
230 %make_install
231 mkdir -p %{buildroot}/usr/bin/
232
233 mkdir -p %{buildroot}/usr/share/doc/dlog
234 cp -r documentation/* %{buildroot}/usr/share/doc/dlog
235
236 mkdir -p %{buildroot}%{_unitdir}/basic.target.wants/
237 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants/
238 ln -s ../dlog_logger.service %{buildroot}%{_unitdir}/basic.target.wants/dlog_logger.service
239 ln -s ../dlog_dev-log.socket %{buildroot}%{_unitdir}/sockets.target.wants/dlog_dev-log.socket
240
241 mkdir -p %{buildroot}%{_udevrulesdir}
242 install -m 0644 %SOURCE501 %{buildroot}%{_udevrulesdir}/01-dlog.rules
243
244 mkdir -p %{buildroot}%{_unitdir}/dlog_logger.service.d
245 install -m 0644 %SOURCE502 %{buildroot}%{_unitdir}/dlog_logger.service.d/logger-devices.conf
246
247 mkdir -p %{buildroot}/var/log/dlog
248
249 mkdir -p %{buildroot}/var/lib/dlog-tests
250 mkdir -p %{buildroot}/usr/share/dlog-filters.conf.test
251
252 %if %{without dlog_dynamic_filters}
253 rm -f %{buildroot}%{_bindir}/dlogctl
254 sed -i -e 's,^\(dynamic_config_path=\),#\1,g' -e 's,^\(limiter_apply_to_all_buffers=\),#\1,g' %{buildroot}%{_sysconfdir}/dlog.conf
255 %endif
256
257 %if 0%{?gcov:1}
258 mkdir -p %{buildroot}%{_datadir}/gcov/obj
259 install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
260 %endif
261
262 %files -n dlogutil
263 %manifest dlog.manifest
264 %license LICENSE.APACHE2.0 LICENSE.MIT
265 %attr(750,log,log) %{_bindir}/dlogutil
266 %attr(755,log,log) %{_bindir}/dlogsend
267 %attr(750,log,log) %{_bindir}/dlog_cleanup
268 %attr(750,log,log) %{_bindir}/dlogmetrics
269 %{_unitdir}/dlog_cleanup.service
270
271 %if %{with dlog_dynamic_filters}
272 %attr(750,log,log) %{_bindir}/dlogctl
273 %endif
274
275 %post -n dlogutil
276 %if %{with dlog_dynamic_filters}
277 chsmack %{_bindir}/dlogctl -a "System::Tools"
278 %endif
279
280 %files -n libdlog
281 %manifest dlog.manifest
282 %license LICENSE.MIT
283 %{_libdir}/libdlog.so.0
284 %{_libdir}/libdlog.so.0.0.0
285
286 %post -n libdlog -p /sbin/ldconfig
287 %postun -n libdlog -p /sbin/ldconfig
288
289 %files common
290 %manifest dlog.manifest
291 %license LICENSE.APACHE2.0
292 %{_sysconfdir}/dlog.conf
293 %{_sysconfdir}/dlog.conf.d/20-pipe.conf
294 %attr(755,log,log) /var/log/dlog
295 %attr(2551,log,log) %{_libexecdir}/dlog-log-critical
296 /usr/lib/tmpfiles.d/dlog-run.conf
297 %{_udevrulesdir}/01-dlog.rules
298
299 %post common
300 chsmack -a System /var/log/dlog
301 # set timestamp to beginning of the unix epoch to make rotation work even if we are run on system with no/broken rtc
302 touch -m -t 197001010000.01 /var/log/dlog/critical.a
303 touch -m -t 197001010000.00 /var/log/dlog/critical.b
304 chmod 660 /var/log/dlog/critical*
305 chown log:log /var/log/dlog/critical*
306 chsmack -e 'System' %{_libexecdir}/dlog-log-critical
307
308 %files logger
309 %manifest dlog.manifest
310 %license LICENSE.APACHE2.0
311 %attr(750,log,log) %{_bindir}/dlog_logger
312 %{_unitdir}/basic.target.wants/dlog_logger.service
313 %{_unitdir}/dlog_logger.service
314
315 %files -n libdlog-devel
316 %manifest dlog.manifest
317 %license LICENSE.MIT
318 %{_includedir}/dlog/dlog.h
319 %{_includedir}/dlog/dlog-internal.h
320 %{_libdir}/pkgconfig/dlog.pc
321 %{_libdir}/libdlog.so
322
323 %files -n libdlogutil
324 %manifest dlog.manifest
325 %license LICENSE.MIT
326 %{_libdir}/libdlogutil.so.*
327
328 %files -n libdlogutil-devel
329 %manifest dlog.manifest
330 %license LICENSE.MIT
331 %{_includedir}/dlog/dlogutil.h
332 %{_libdir}/pkgconfig/dlogutil.pc
333 %{_libdir}/libdlogutil.so
334
335 %files config-backend-logger
336 %manifest dlog.manifest
337 %license LICENSE.APACHE2.0 LICENSE.MIT
338 %{_sysconfdir}/dlog.conf.d/25-logger.conf
339 %{_unitdir}/dlog_logger.service.d/logger-devices.conf
340
341 %files config-syslog
342 %manifest dlog.manifest
343 %license LICENSE.APACHE2.0 LICENSE.MIT
344 %{_unitdir}/sockets.target.wants/dlog_dev-log.socket
345 %{_unitdir}/dlog_dev-log.socket
346
347 %files config-persistent-logs
348 %{_sysconfdir}/dlog.conf.d/10-persistent-logs.conf
349
350 %files config-qos
351 %{_sysconfdir}/dlog.conf.d/15-qos.conf
352
353 %files -n libdlog-redirect-stdout
354 %manifest dlog.manifest
355 %license LICENSE.MIT
356 %{_libdir}/libdlog_redirect_stdout.so.*
357
358 %files -n libdlog-redirect-stdout-devel
359 %manifest dlog.manifest
360 %license LICENSE.MIT
361 %{_includedir}/dlog/dlog-redirect-stdout.h
362 %{_libdir}/pkgconfig/dlog-redirect-stdout.pc
363 %{_libdir}/libdlog_redirect_stdout.so
364
365 %files -n dlog-redirect-stdout
366 %manifest dlog.manifest
367 %license LICENSE.APACHE2.0 LICENSE.MIT
368 %attr(755,log,log) %{_bindir}/dlog_redirect_stdout
369
370 %files doc
371 %manifest dlog.manifest
372 %license LICENSE.APACHE2.0 LICENSE.MIT
373 /usr/share/doc/dlog
374
375 %files tests
376 %manifest dlog.manifest
377 %license LICENSE.APACHE2.0 LICENSE.MIT
378 %{_bindir}/dlog_test
379 %{_bindir}/dlog_cpu
380 /usr/share/doc/dlog/README.testsuite
381 %{_libexecdir}/libdlog/perf_libdlog
382 %{_libexecdir}/libdlog/test_libdlog
383 %{_libexecdir}/libdlog/test_libdlogutil
384 %{_libexecdir}/libdlog/test_filters
385 %{_datadir}/dlog-pipe.conf.test
386 %{_datadir}/dlog-logger.conf.test
387 %{_datadir}/dlog-logger.conf.alias
388 %{_datadir}/dlog-pipe.conf.cpu
389 %{_datadir}/dlog-logger.conf.cpu
390 %{_datadir}/dlog-pipe.conf.qos
391 %{_datadir}/dlog-logger.conf.qos
392 %{_sysconfdir}/dlog.conf.d/99-dlog-logger.disable-platform-logging-for-testsuite.conf
393 %dir %attr(755,log,log) /var/lib/dlog-tests
394 %dir %attr(755,log,log) /usr/share/dlog-filters.conf.test
395
396 %post tests
397 chsmack -a System /var/lib/dlog-tests
398 echo "Warning! Installation of dlog-tests will break platform logging."
399 echo "This is done intentionally, to make logger backend testing possible."
400 echo "To restore normal behavior, please uninstall dlog-tests package."
401 echo ""
402 echo "For more information please read the /usr/share/doc/dlog/README.testsuite file"
403 echo ""
404 echo "A reboot is required to properly configure logger backend for testing."
405
406 %if 0%{?gcov:1}
407 %files -n libdlog-gcov
408 %{_datadir}/gcov/*
409 %endif