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