1 %define _with_dlog_dynamic_filters on
2 %bcond_with dlog_dynamic_filters
5 Summary: Logging service
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
14 # NOTE: hardcoded instead of a build dependency on libudev.
15 # Needed to prevent a cyclic build dependency in case
16 # dlog is used in a package dependent on libsystemd,
17 # since libudev is a part of it
18 %define _udevrulesdir %{_prefix}/lib/udev/rules.d
20 BuildRequires: autoconf
21 BuildRequires: automake
22 BuildRequires: libtool
23 BuildRequires: pkgconfig(capi-base-common)
24 BuildRequires: pkgconfig(libtzplatform-config)
25 BuildRequires: linux-tizen-modules-headers
31 Requires: %{name}-config-persistent-logs
32 Obsoletes: %{name}-common < 6.5.3
35 Shared files between libdlog and service
38 Summary: dlog library APIs
40 Group: Development/Libraries
41 Requires(pre): coreutils
42 Requires(post): coreutils
43 Requires(post): /sbin/ldconfig
44 Requires(post): /usr/bin/chsmack
45 Requires(postun): /sbin/ldconfig
46 Requires: %{name} = %{version}-%{release}
47 Requires: %{name}-logger = %{version}-%{release}
48 Obsoletes: libdlogutil < 6.5.3
49 Obsoletes: libdlog-redirect-stdout < 6.5.3
50 %description -n libdlog
51 * libdlog - client API
52 * libdlogutil - log retrieval library
53 * libdlog_redirect_stdout - client library for attaching stdout/stderr
55 %package -n libdlog-devel
56 Summary: Logging service dlog API
58 Group: Development/Libraries
59 Requires: libdlog = %{version}-%{release}
60 Requires: pkgconfig(capi-base-common)
61 Obsoletes: libdlogutil-devel < 6.5.3
62 Obsoletes: libdlog-redirect-stdout-devel < 6.5.3
63 %description -n libdlog-devel
66 Summary: Logger service
68 Group: Development/Libraries
69 Requires: %{name} = %{version}-%{release}
73 Summary: print log data to the screen
74 Group: Development/Libraries
75 %description -n dlogutil
77 %package config-backend-zero-copy
79 Summary: Force usage of zero-copy dlog backend
81 %description config-backend-zero-copy
82 Provides dlog config to enable zero-copy backend and tunes libdlog
83 performance while sacrificing some of dlog features (static and
86 %package config-syslog
88 Summary: Logger: syslog-source logging via dlog
90 Provides: tizen-log-syslog
91 %description config-syslog
92 Systemd unit for syslog socket configation to use with dlog
94 %package config-persistent-logs
95 Summary: enable persistent storage of logs
96 %description config-persistent-logs
97 Enable persistent logs in dlog (stored in /var/log/dlog/)
100 Summary: enable quality of service module
101 %description config-qos
102 Enables Quality of Service module in dlog
105 Summary: dlog documentation
106 BuildRequires: doxygen
108 Documentation for dlog
111 Summary: dlog integration tests
112 Requires: lib%{name} = %{version}-%{release}
113 Requires(post): /usr/bin/chsmack
115 Integration tests for dlog.
119 Summary: gcov files for libdlog
120 Group: Development/Libraries
122 This package contains gcov code coverage/profiling files for libdlog.
129 # TODO: Respect the defaults, and have all custom flags in one place
130 CFLAGS="-Wno-gnu-variable-sized-type-not-at-end -g"
131 TEST_CFLAGS="-Wno-gnu-variable-sized-type-not-at-end -Wno-logical-op-parentheses"
134 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
135 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
136 export LDFLAGS+=" -lgcov"
137 TEST_CFLAGS+=" -ftest-coverage"
141 export CFLAGS+=" -DASAN_BUILD=True"
142 export CXXFLAGS+=" -DASAN_BUILD=True"
143 TEST_CFLAGS+=" -DASAN_BUILD=True"
148 %autogen --disable-static
149 %configure --disable-static \
150 %if %{without dlog_dynamic_filters}
151 --disable-dynamic-filters
153 --enable-dynamic-filters
156 make %{?jobs:-j%jobs} CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
158 # autoconf adds a bunch of flags, including -O2.
159 # Clear those so that test coverage can be measured properly
160 CFLAGS="$TEST_CFLAGS"
161 make check CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
167 lcov -c --ignore-errors graph --no-external -q -d ./src -o dlog.info
168 genhtml dlog.info -o dlog.out
169 zip -r dlog.zip dlog.out dlog.info
170 install -m 0644 dlog.zip %{buildroot}%{_datadir}/gcov/
177 mkdir -p %{buildroot}/usr/bin/
179 mkdir -p %{buildroot}/usr/share/doc/dlog
180 cp -r documentation/* %{buildroot}/usr/share/doc/dlog
182 mkdir -p %{buildroot}%{_unitdir}/basic.target.wants/
183 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants/
184 ln -s ../dlog_logger.service %{buildroot}%{_unitdir}/basic.target.wants/dlog_logger.service
185 ln -s ../dlog_dev-log.socket %{buildroot}%{_unitdir}/sockets.target.wants/dlog_dev-log.socket
187 mkdir -p %{buildroot}%{_udevrulesdir}
188 install -m 0644 %SOURCE501 %{buildroot}%{_udevrulesdir}/01-dlog.rules
190 mkdir -p %{buildroot}/var/log/dlog
192 mkdir -p %{buildroot}/var/lib/dlog-tests
193 mkdir -p %{buildroot}/usr/share/dlog-filters.conf.test
195 %if %{without dlog_dynamic_filters}
196 rm -f %{buildroot}%{_bindir}/dlogctl
197 sed -i -e 's,^\(dynamic_config_path=\),#\1,g' -e 's,^\(limiter_apply_to_all_buffers=\),#\1,g' %{buildroot}%{_sysconfdir}/dlog.conf
201 builddir=$(basename $PWD)
202 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
203 mkdir -p "$gcno_obj_dir"
204 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
208 %manifest dlog.manifest
209 %license LICENSE.APACHE2.0 LICENSE.MIT
210 %attr(750,log,log) %{_bindir}/dlogutil
211 %attr(755,log,log) %{_bindir}/dlogsend
212 %attr(750,log,log) %{_bindir}/dlog_cleanup
213 %attr(750,log,log) %{_bindir}/dlogmetrics
214 %attr(755,log,log) %{_bindir}/dlog_redirect_stdout
215 %{_unitdir}/dlog_cleanup.service
217 %if %{with dlog_dynamic_filters}
218 %attr(750,log,log) %{_bindir}/dlogctl
222 %if %{with dlog_dynamic_filters}
223 chsmack %{_bindir}/dlogctl -a "System::Tools"
226 %post -n libdlog -p /sbin/ldconfig
229 chsmack -a System /var/log/dlog
230 # set timestamp to beginning of the unix epoch to make rotation work even if we are run on system with no/broken rtc
231 touch -m -t 197001010000.01 /var/log/dlog/critical.a
232 touch -m -t 197001010000.00 /var/log/dlog/critical.b
233 chmod 660 /var/log/dlog/critical*
234 chown log:log /var/log/dlog/critical*
235 chsmack -e 'System' %{_libexecdir}/dlog-log-critical
238 %manifest dlog.manifest
239 %license LICENSE.APACHE2.0
240 %{_sysconfdir}/dlog.conf
241 %{_sysconfdir}/dlog.conf.d/20-pipe.conf
242 %{_sysconfdir}/dlog.conf.d/25-logger.conf
243 # not in a separate package for debugging convenience
244 %{_sysconfdir}/dlog.conf.d/86-disable-dlog.conf_inactive
245 %attr(755,log,log) /var/log/dlog
246 %attr(2551,log,log) %{_libexecdir}/dlog-log-critical
247 /usr/lib/tmpfiles.d/dlog-run.conf
248 %{_udevrulesdir}/01-dlog.rules
251 %manifest dlog.manifest
253 %{_libdir}/libdlog.so.0
254 %{_libdir}/libdlog.so.0.0.0
255 %{_libdir}/libdlogutil.so.*
256 %{_libdir}/libdlog_redirect_stdout.so.*
258 %files -n libdlog-devel
259 %manifest dlog.manifest
261 %{_includedir}/dlog/dlog.h
262 %{_includedir}/dlog/dlog-internal.h
263 %{_includedir}/dlog/dlogutil.h
264 %{_includedir}/dlog/dlog-redirect-stdout.h
265 %{_libdir}/libdlog.so
266 %{_libdir}/libdlogutil.so
267 %{_libdir}/libdlog_redirect_stdout.so
268 %{_libdir}/pkgconfig/dlog.pc
269 %{_libdir}/pkgconfig/dlogutil.pc
270 %{_libdir}/pkgconfig/dlog-redirect-stdout.pc
273 %manifest dlog.manifest
274 %license LICENSE.APACHE2.0
275 %attr(750,log,log) %{_bindir}/dlog_logger
276 %{_unitdir}/basic.target.wants/dlog_logger.service
277 %{_unitdir}/dlog_logger.service
278 /usr/lib/systemd/system-generators/dlog-unit-generator
280 %files config-backend-zero-copy
281 %manifest dlog.manifest
282 %license LICENSE.APACHE2.0 LICENSE.MIT
283 /usr/lib/modules/modules-load.d/tizen-modules-dlog-zero-copy.conf
284 %{_sysconfdir}/dlog.conf.d/30-zero-copy.conf
287 %manifest dlog.manifest
288 %license LICENSE.APACHE2.0 LICENSE.MIT
289 %{_unitdir}/sockets.target.wants/dlog_dev-log.socket
290 %{_unitdir}/dlog_dev-log.socket
292 %files config-persistent-logs
293 %{_sysconfdir}/dlog.conf.d/10-persistent-logs.conf
296 %{_sysconfdir}/dlog.conf.d/15-qos.conf
299 %manifest dlog.manifest
300 %license LICENSE.APACHE2.0 LICENSE.MIT
304 %manifest dlog.manifest
305 %license LICENSE.APACHE2.0 LICENSE.MIT
307 %{_bindir}/dlog_test_header
309 /usr/share/doc/dlog/README.testsuite
310 %{_libexecdir}/libdlog/perf_libdlog
311 %{_libexecdir}/libdlog/dlog_stdout_benchmark
312 %{_libexecdir}/libdlog/dlog_compression_benchmark
313 %{_libexecdir}/libdlog/test_libdlog
314 %{_libexecdir}/libdlog/test_libdlogutil
315 %{_libexecdir}/libdlog/test_verifytime
316 %{_libexecdir}/libdlog/test_libredirect
317 %{_libexecdir}/libdlog/test_libredirect_multi
318 %{_libexecdir}/libdlog/test_filters
319 %{_datadir}/dlog-pipe.conf.test
320 %{_datadir}/dlog-logger.conf.test
321 %{_datadir}/dlog-zero-copy.conf.test
322 %{_datadir}/dlog-logger.conf.alias
323 %{_datadir}/dlog-pipe.conf.cpu
324 %{_datadir}/dlog-logger.conf.cpu
325 %{_datadir}/dlog-pipe.conf.qos
326 %{_datadir}/dlog-logger.conf.qos
327 %{_datadir}/dlog-pipe.conf.plog
328 %{_datadir}/dlog-logger.conf.plog
329 %{_datadir}/dlog-pipe.conf.autodetect
330 %{_datadir}/dlog-logger.conf.autodetect
331 %{_sysconfdir}/dlog.conf.d/99-dlog-logger.disable-platform-logging-for-testsuite.conf
332 %dir %attr(755,log,log) /var/lib/dlog-tests
333 %dir %attr(755,log,log) /usr/share/dlog-filters.conf.test
336 chsmack -a System /var/lib/dlog-tests
337 echo "Warning! Installation of dlog-tests will break platform logging."
338 echo "This is done intentionally, to make logger and zero-copy backend testing possible."
339 echo "To restore normal behavior, please uninstall dlog-tests package."
341 echo "For more information please read the /usr/share/doc/dlog/README.testsuite file"
343 echo "A reboot is required to properly configure logger and zero-copy backend for testing."