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
13 Source502: packaging/logger-devices.conf
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
21 BuildRequires: autoconf
22 BuildRequires: automake
23 BuildRequires: libtool
24 BuildRequires: pkgconfig(capi-base-common)
25 BuildRequires: pkgconfig(libtzplatform-config)
32 Summary: Logging service dlog API
33 Group: Development/Libraries
34 Requires(pre): coreutils
35 Requires(post): coreutils
36 Requires(post): /sbin/ldconfig
37 Requires(post): /usr/bin/chsmack
38 Requires(post): /usr/bin/systemctl
39 Requires(posttrans): coreutils
40 Requires(posttrans): /usr/bin/chsmack
41 Requires(postun): /sbin/ldconfig
42 Requires: %{name}-config-persistent-logs
44 %description -n libdlog
45 dlog API library. If dlogbackend isn't installed, pipe backend is selected.
47 %package -n libdlog-devel
48 Summary: Logging service dlog API
49 Group: Development/Libraries
50 Requires: lib%{name} = %{?epoch:%{epoch}:}%{version}-%{release}
52 %description -n libdlog-devel
55 %package -n dlogbackend-logger
56 Summary: Android-logger backend selection for dlog
57 Requires: lib%{name} = %{?epoch:%{epoch}:}%{version}-%{release}
59 %description -n dlogbackend-logger
60 Change dlog backend to logger backend. Require kernel support (Android-logger)
63 Summary: print log data to the screen
64 Group: Development/Libraries
65 Requires: lib%{name} = %{?epoch:%{epoch}:}%{version}-%{release}
67 %description -n dlogutil
68 Utilities for print log data
70 %package -n log-syslog
72 Summary: Logger: syslog-source logging via dlog
74 Requires: lib%{name} = %{?epoch:%{epoch}:}%{version}-%{release}
75 Provides: tizen-log-syslog
77 %description -n log-syslog
78 Systemd unit for syslog socket configation to use with dlog
80 %package config-persistent-logs
81 Summary: enable persistent storage of logs
83 %description config-persistent-logs
84 Enable persistent logs in dlog (stored in /var/log/dlog/)
87 Summary: dlog documentation
88 BuildRequires: doxygen
90 %description -n dlog-doc
91 Documentation for dlog
93 %package -n dlog-tests
94 Summary: dlog integration tests
95 Requires: lib%{name} = %{?epoch:%{epoch}:}%{version}-%{release}
96 Requires(post): /usr/bin/chsmack
98 %description -n dlog-tests
99 Integration tests for dlog.
105 if echo "$CFLAGS" | grep -q -- '-Wl,--as-needed'; then
106 LDFLAGS="${LDFLAGS} -Wl,--as-needed"
108 CFLAGS="$(echo $CFLAGS | sed -e 's/-Wl,--as-needed//g') -Wno-gnu-variable-sized-type-not-at-end"
109 CXXFLAGS="$(echo $CXXFLAGS | sed -e 's/-Wl,--as-needed//g')"
113 %autogen --disable-static
114 %configure --disable-static \
115 %if %{without dlog_dynamic_filters}
116 --disable-dynamic-filters
118 --enable-dynamic-filters
121 make %{?jobs:-j%jobs} CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
123 # autoconf adds a bunch of flags, including -O2.
124 # Clear those so that test coverage can be measured properly
125 make check CFLAGS='-Wno-gnu-variable-sized-type-not-at-end -Wno-logical-op-parentheses'
133 mkdir -p %{buildroot}/usr/bin/
135 mkdir -p %{buildroot}/usr/share/doc/dlog
136 cp -r documentation/* %{buildroot}/usr/share/doc/dlog
138 mkdir -p %{buildroot}%{_unitdir}/basic.target.wants/
139 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants/
140 ln -s ../dlog_logger.service %{buildroot}%{_unitdir}/basic.target.wants/dlog_logger.service
141 ln -s ../dlog_dev-log.socket %{buildroot}%{_unitdir}/sockets.target.wants/dlog_dev-log.socket
143 mkdir -p %{buildroot}%{_udevrulesdir}
144 install -m 0644 %SOURCE501 %{buildroot}%{_udevrulesdir}/01-dlog.rules
146 mkdir -p %{buildroot}%{_unitdir}/dlog_logger.service.d
147 install -m 0644 %SOURCE502 %{buildroot}%{_unitdir}/dlog_logger.service.d/logger-devices.conf
149 mkdir -p %{buildroot}/var/log/dlog
151 mkdir -p %{buildroot}/var/lib/dlog-tests
152 mkdir -p %{buildroot}/usr/share/dlog-filters.conf.test
154 %if %{without dlog_dynamic_filters}
155 rm -f %{buildroot}%{_bindir}/dlogctl
156 sed -i -e 's,^\(dynamic_config_path=\),#\1,g' -e 's,^\(limiter_apply_to_all_buffers=\),#\1,g' %{buildroot}%{_sysconfdir}/dlog.conf
160 %manifest dlog.manifest
161 %license LICENSE.APACHE2.0 LICENSE.MIT
162 %attr(750,log,log) %{_bindir}/dlogutil
163 %attr(755,log,log) %{_bindir}/dlogsend
164 %if %{with dlog_dynamic_filters}
165 %attr(750,log,log) %{_bindir}/dlogctl
169 %if %{with dlog_dynamic_filters}
170 chsmack %{_bindir}/dlogctl -a "System::Tools"
174 %manifest dlog.manifest
175 %license LICENSE.APACHE2.0 LICENSE.MIT
176 %{_libdir}/libdlog.so.0
177 %{_libdir}/libdlog.so.0.0.0
178 %{_sysconfdir}/dlog.conf
179 %{_sysconfdir}/dlog.conf.d/20-pipe.conf
180 %attr(755,log,log) /var/log/dlog
181 %attr(750,log,log) %{_bindir}/dlog_logger
182 %{_unitdir}/basic.target.wants/dlog_logger.service
183 %{_unitdir}/dlog_logger.service
184 %{_unitdir}/dlog_logger.path
185 /usr/lib/tmpfiles.d/dlog-run.conf
186 %{_udevrulesdir}/01-dlog.rules
190 systemctl daemon-reload
191 chsmack -a System /var/log/dlog
193 %postun -n libdlog -p /sbin/ldconfig
195 %files -n libdlog-devel
196 %manifest dlog.manifest
197 %license LICENSE.APACHE2.0 LICENSE.MIT
198 %{_includedir}/dlog/dlog.h
199 %{_includedir}/dlog/dlog-internal.h
200 %{_libdir}/pkgconfig/dlog.pc
201 %{_libdir}/libdlog.so
203 %files -n dlogbackend-logger
204 %manifest dlog.manifest
205 %license LICENSE.APACHE2.0 LICENSE.MIT
206 %{_sysconfdir}/dlog.conf.d/25-logger.conf
207 %{_unitdir}/dlog_logger.service.d/logger-devices.conf
210 %manifest dlog.manifest
211 %license LICENSE.APACHE2.0 LICENSE.MIT
212 %{_unitdir}/sockets.target.wants/dlog_dev-log.socket
213 %{_unitdir}/dlog_dev-log.socket
215 %files config-persistent-logs
216 %{_sysconfdir}/dlog.conf.d/10-persistent-logs.conf
219 %manifest dlog.manifest
220 %license LICENSE.APACHE2.0 LICENSE.MIT
224 %manifest dlog.manifest
225 %license LICENSE.APACHE2.0 LICENSE.MIT
227 /usr/share/doc/dlog/README.testsuite
228 %{_libexecdir}/libdlog/perf_libdlog
229 %{_libexecdir}/libdlog/test_libdlog
230 %{_libexecdir}/libdlog/test_filters
231 %{_datadir}/dlog-pipe.conf.test
232 %{_datadir}/dlog-logger.conf.test
233 %{_sysconfdir}/dlog.conf.d/99-dlog-logger.disable-platform-logging-for-testsuite.conf
234 %dir %attr(755,log,log) /var/lib/dlog-tests
235 %dir %attr(755,log,log) /usr/share/dlog-filters.conf.test
238 chsmack -a System /var/lib/dlog-tests
239 echo "Warning! Installation of dlog-tests will break platform logging."
240 echo "This is done intentionally, to make logger backend testing possible."
241 echo "To restore normal behavior, please uninstall dlog-tests package."
243 echo "For more information please read the /usr/share/doc/dlog/README.testsuite file"
245 echo "A reboot is required to properly configure logger backend for testing."