Release 7.0.10
[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:    7.0.10
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
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
19
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
26 %if 0%{?gcov:1}
27 BuildRequires: lcov
28 BuildRequires: zip
29 %endif
30
31 Requires:      %{name}-config-persistent-logs
32 Obsoletes:     %{name}-common < 6.5.3
33
34 %description
35 Shared files between libdlog and service
36
37 %package -n libdlog
38 Summary:    dlog library APIs
39 License:    MIT
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
54
55 %package -n libdlog-devel
56 Summary:    Logging service dlog API
57 License:    MIT
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
64
65 %package    logger
66 Summary:    Logger service
67 License:    Apache-2.0
68 Group:      Development/Libraries
69 Requires:   %{name} = %{version}-%{release}
70 %description logger
71
72 %package -n dlogutil
73 Summary:    print log data to the screen
74 Group:      Development/Libraries
75 %description -n dlogutil
76
77 %package    config-backend-zero-copy
78 License:    Apache-2.0
79 Summary:    Force usage of zero-copy dlog backend
80 Group:      Base/Startup
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
84 dynamic filtering)
85
86 %package config-syslog
87 License:    Apache-2.0
88 Summary:    Logger: syslog-source logging via dlog
89 Group:      Base/Startup
90 Provides:   tizen-log-syslog
91 %description config-syslog
92 Systemd unit for syslog socket configation to use with dlog
93
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/)
98
99 %package config-qos
100 Summary: enable quality of service module
101 %description config-qos
102 Enables Quality of Service module in dlog
103
104 %package doc
105 Summary: dlog documentation
106 BuildRequires: doxygen
107 %description doc
108 Documentation for dlog
109
110 %package tests
111 Summary: dlog integration tests
112 Requires: lib%{name} = %{version}-%{release}
113 Requires(post): /usr/bin/chsmack
114 %description tests
115 Integration tests for dlog.
116
117 %if 0%{?gcov:1}
118 %package gcov
119 Summary:  gcov files for libdlog
120 Group:    Development/Libraries
121 %description gcov
122 This package contains gcov code coverage/profiling files for libdlog.
123 %endif
124
125 %prep
126 %setup -q
127
128 %build
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"
132
133 %if 0%{?gcov:1}
134 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
135 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
136 export LDFLAGS+=" -lgcov"
137 TEST_CFLAGS+=" -ftest-coverage"
138 %endif
139
140 %if 0%{?asan:1}
141 export CFLAGS+=" -DASAN_BUILD=True"
142 export CXXFLAGS+=" -DASAN_BUILD=True"
143 TEST_CFLAGS+=" -DASAN_BUILD=True"
144 %endif
145
146 cp %{SOURCE101} .
147
148 %autogen --disable-static
149 %configure --disable-static \
150 %if %{without dlog_dynamic_filters}
151 --disable-dynamic-filters
152 %else
153 --enable-dynamic-filters
154 %endif
155
156 make %{?jobs:-j%jobs} CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
157
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}\"'
162
163 make dox
164
165 %if 0%{?gcov:1}
166 mkdir -p gcov-obj
167 find ./src/libdlog -name '*.gcno' -exec cp '{}' gcov-obj ';'
168 %endif
169
170 %if 0%{?gcov:1}
171 %check -n libdlog
172 lcov -c --ignore-errors graph --no-external -q -d ./src/libdlog -o dlog.info
173 genhtml dlog.info -o dlog.out
174 zip -r dlog.zip dlog.out dlog.info
175 install -m 0644 dlog.zip %{buildroot}%{_datadir}/gcov/
176 %endif
177
178 %install
179 rm -rf %{buildroot}
180
181 %make_install
182 mkdir -p %{buildroot}/usr/bin/
183
184 mkdir -p %{buildroot}/usr/share/doc/dlog
185 cp -r documentation/* %{buildroot}/usr/share/doc/dlog
186
187 mkdir -p %{buildroot}%{_unitdir}/basic.target.wants/
188 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants/
189 ln -s ../dlog_logger.service %{buildroot}%{_unitdir}/basic.target.wants/dlog_logger.service
190 ln -s ../dlog_dev-log.socket %{buildroot}%{_unitdir}/sockets.target.wants/dlog_dev-log.socket
191
192 mkdir -p %{buildroot}%{_udevrulesdir}
193 install -m 0644 %SOURCE501 %{buildroot}%{_udevrulesdir}/01-dlog.rules
194
195 mkdir -p %{buildroot}/var/log/dlog
196
197 mkdir -p %{buildroot}/var/lib/dlog-tests
198 mkdir -p %{buildroot}/usr/share/dlog-filters.conf.test
199
200 %if %{without dlog_dynamic_filters}
201 rm -f %{buildroot}%{_bindir}/dlogctl
202 sed -i -e 's,^\(dynamic_config_path=\),#\1,g' -e 's,^\(limiter_apply_to_all_buffers=\),#\1,g' %{buildroot}%{_sysconfdir}/dlog.conf
203 %endif
204
205 %if 0%{?gcov:1}
206 mkdir -p %{buildroot}%{_datadir}/gcov/obj/%{name}
207 install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name}
208 %endif
209
210 %files -n dlogutil
211 %manifest dlog.manifest
212 %license LICENSE.APACHE2.0 LICENSE.MIT
213 %attr(750,log,log) %{_bindir}/dlogutil
214 %attr(755,log,log) %{_bindir}/dlogsend
215 %attr(750,log,log) %{_bindir}/dlog_cleanup
216 %attr(750,log,log) %{_bindir}/dlogmetrics
217 %attr(755,log,log) %{_bindir}/dlog_redirect_stdout
218 %{_unitdir}/dlog_cleanup.service
219
220 %if %{with dlog_dynamic_filters}
221 %attr(750,log,log) %{_bindir}/dlogctl
222 %endif
223
224 %post -n dlogutil
225 %if %{with dlog_dynamic_filters}
226 chsmack %{_bindir}/dlogctl -a "System::Tools"
227 %endif
228
229 %post -n libdlog -p /sbin/ldconfig
230
231 %post
232 chsmack -a System /var/log/dlog
233 # set timestamp to beginning of the unix epoch to make rotation work even if we are run on system with no/broken rtc
234 touch -m -t 197001010000.01 /var/log/dlog/critical.a
235 touch -m -t 197001010000.00 /var/log/dlog/critical.b
236 chmod 660 /var/log/dlog/critical*
237 chown log:log /var/log/dlog/critical*
238 chsmack -e 'System' %{_libexecdir}/dlog-log-critical
239
240 %files
241 %manifest dlog.manifest
242 %license LICENSE.APACHE2.0
243 %{_sysconfdir}/dlog.conf
244 %{_sysconfdir}/dlog.conf.d/20-pipe.conf
245 %{_sysconfdir}/dlog.conf.d/25-logger.conf
246 %attr(755,log,log) /var/log/dlog
247 %attr(2551,log,log) %{_libexecdir}/dlog-log-critical
248 /usr/lib/tmpfiles.d/dlog-run.conf
249 %{_udevrulesdir}/01-dlog.rules
250
251 %files -n libdlog
252 %manifest dlog.manifest
253 %license LICENSE.MIT
254 %{_libdir}/libdlog.so.0
255 %{_libdir}/libdlog.so.0.0.0
256 %{_libdir}/libdlogutil.so.*
257 %{_libdir}/libdlog_redirect_stdout.so.*
258
259 %files -n libdlog-devel
260 %manifest dlog.manifest
261 %license LICENSE.MIT
262 %{_includedir}/dlog/dlog.h
263 %{_includedir}/dlog/dlog-internal.h
264 %{_includedir}/dlog/dlogutil.h
265 %{_includedir}/dlog/dlog-redirect-stdout.h
266 %{_libdir}/libdlog.so
267 %{_libdir}/libdlogutil.so
268 %{_libdir}/libdlog_redirect_stdout.so
269 %{_libdir}/pkgconfig/dlog.pc
270 %{_libdir}/pkgconfig/dlogutil.pc
271 %{_libdir}/pkgconfig/dlog-redirect-stdout.pc
272
273 %files logger
274 %manifest dlog.manifest
275 %license LICENSE.APACHE2.0
276 %attr(750,log,log) %{_bindir}/dlog_logger
277 %{_unitdir}/basic.target.wants/dlog_logger.service
278 %{_unitdir}/dlog_logger.service
279 /usr/lib/systemd/system-generators/dlog-unit-generator
280
281 %files config-backend-zero-copy
282 %manifest dlog.manifest
283 %license LICENSE.APACHE2.0 LICENSE.MIT
284 /usr/lib/modules/modules-load.d/tizen-modules-dlog-zero-copy.conf
285 %{_sysconfdir}/dlog.conf.d/30-zero-copy.conf
286
287 %files config-syslog
288 %manifest dlog.manifest
289 %license LICENSE.APACHE2.0 LICENSE.MIT
290 %{_unitdir}/sockets.target.wants/dlog_dev-log.socket
291 %{_unitdir}/dlog_dev-log.socket
292
293 %files config-persistent-logs
294 %{_sysconfdir}/dlog.conf.d/10-persistent-logs.conf
295
296 %files config-qos
297 %{_sysconfdir}/dlog.conf.d/15-qos.conf
298
299 %files doc
300 %manifest dlog.manifest
301 %license LICENSE.APACHE2.0 LICENSE.MIT
302 /usr/share/doc/dlog
303
304 %files tests
305 %manifest dlog.manifest
306 %license LICENSE.APACHE2.0 LICENSE.MIT
307 %{_bindir}/dlog_test
308 %{_bindir}/dlog_cpu
309 /usr/share/doc/dlog/README.testsuite
310 %{_libexecdir}/libdlog/perf_libdlog
311 %{_libexecdir}/libdlog/dlog_stdout_benchmark
312 %{_libexecdir}/libdlog/test_libdlog
313 %{_libexecdir}/libdlog/test_libdlogutil
314 %{_libexecdir}/libdlog/test_verifytime
315 %{_libexecdir}/libdlog/test_libredirect
316 %{_libexecdir}/libdlog/test_libredirect_multi
317 %{_libexecdir}/libdlog/test_filters
318 %{_datadir}/dlog-pipe.conf.test
319 %{_datadir}/dlog-logger.conf.test
320 %{_datadir}/dlog-logger.conf.alias
321 %{_datadir}/dlog-pipe.conf.cpu
322 %{_datadir}/dlog-logger.conf.cpu
323 %{_datadir}/dlog-pipe.conf.qos
324 %{_datadir}/dlog-logger.conf.qos
325 %{_datadir}/dlog-pipe.conf.autodetect
326 %{_datadir}/dlog-logger.conf.autodetect
327 %{_sysconfdir}/dlog.conf.d/99-dlog-logger.disable-platform-logging-for-testsuite.conf
328 %dir %attr(755,log,log) /var/lib/dlog-tests
329 %dir %attr(755,log,log) /usr/share/dlog-filters.conf.test
330
331 %post tests
332 chsmack -a System /var/lib/dlog-tests
333 echo "Warning! Installation of dlog-tests will break platform logging."
334 echo "This is done intentionally, to make logger backend testing possible."
335 echo "To restore normal behavior, please uninstall dlog-tests package."
336 echo ""
337 echo "For more information please read the /usr/share/doc/dlog/README.testsuite file"
338 echo ""
339 echo "A reboot is required to properly configure logger backend for testing."
340
341 %if 0%{?gcov:1}
342 %files gcov
343 %{_datadir}/gcov/*
344 %endif