897a48c161f9da005faab1ff0ee06a1f8bedb872
[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:    5.5.1
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: libtool
24 BuildRequires: pkgconfig(capi-base-common)
25 BuildRequires: pkgconfig(libtzplatform-config)
26 BuildRequires: lcov
27
28 %description
29 dlog API library
30
31 %package -n libdlog
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
43
44 %description -n libdlog
45 dlog API library. If dlogbackend isn't installed, pipe backend is selected.
46
47 %package -n libdlog-devel
48 Summary:    Logging service dlog API
49 Group:      Development/Libraries
50 Requires:   lib%{name} = %{?epoch:%{epoch}:}%{version}-%{release}
51
52 %description -n libdlog-devel
53 dlog API library
54
55 %package -n dlogbackend-logger
56 Summary:        Android-logger backend selection for dlog
57 Requires:       lib%{name} = %{?epoch:%{epoch}:}%{version}-%{release}
58
59 %description -n dlogbackend-logger
60 Change dlog backend to logger backend. Require kernel support (Android-logger)
61
62 %package -n dlogutil
63 Summary:    print log data to the screen
64 Group:      Development/Libraries
65 Requires:   lib%{name} = %{?epoch:%{epoch}:}%{version}-%{release}
66
67 %description -n dlogutil
68 Utilities for print log data
69
70 %package -n log-syslog
71 License:    Apache-2.0
72 Summary:    Logger: syslog-source logging via dlog
73 Group:      Base/Startup
74 Requires:   lib%{name} = %{?epoch:%{epoch}:}%{version}-%{release}
75 Provides:   tizen-log-syslog
76
77 %description -n log-syslog
78 Systemd unit for syslog socket configation to use with dlog
79
80 %package config-persistent-logs
81 Summary: enable persistent storage of logs
82
83 %description config-persistent-logs
84 Enable persistent logs in dlog (stored in /var/log/dlog/)
85
86 %package -n dlog-doc
87 Summary: dlog documentation
88 BuildRequires: doxygen
89
90 %description -n dlog-doc
91 Documentation for dlog
92
93 %package -n dlog-tests
94 Summary: dlog integration tests
95 Requires: lib%{name} = %{?epoch:%{epoch}:}%{version}-%{release}
96 Requires(post): /usr/bin/chsmack
97
98 %description -n dlog-tests
99 Integration tests for dlog.
100
101 %prep
102 %setup -q
103
104 %build
105 if echo "$CFLAGS" | grep -q -- '-Wl,--as-needed'; then
106   LDFLAGS="${LDFLAGS} -Wl,--as-needed"
107 fi
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')"
110
111 cp %{SOURCE101} .
112
113 %autogen --disable-static
114 %configure --disable-static \
115 %if %{without dlog_dynamic_filters}
116 --disable-dynamic-filters
117 %else
118 --enable-dynamic-filters
119 %endif
120
121 make %{?jobs:-j%jobs} CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
122
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'
126
127 make dox
128
129 %install
130 rm -rf %{buildroot}
131
132 %make_install
133 mkdir -p %{buildroot}/usr/bin/
134
135 mkdir -p %{buildroot}/usr/share/doc/dlog
136 cp -r documentation/* %{buildroot}/usr/share/doc/dlog
137
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
142
143 mkdir -p %{buildroot}%{_udevrulesdir}
144 install -m 0644 %SOURCE501 %{buildroot}%{_udevrulesdir}/01-dlog.rules
145
146 mkdir -p %{buildroot}%{_unitdir}/dlog_logger.service.d
147 install -m 0644 %SOURCE502 %{buildroot}%{_unitdir}/dlog_logger.service.d/logger-devices.conf
148
149 mkdir -p %{buildroot}/var/log/dlog
150
151 mkdir -p %{buildroot}/var/lib/dlog-tests
152 mkdir -p %{buildroot}/usr/share/dlog-filters.conf.test
153
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
157 %endif
158
159 %files -n dlogutil
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
166 %endif
167
168 %post -n dlogutil
169 %if %{with dlog_dynamic_filters}
170 chsmack %{_bindir}/dlogctl -a "System::Tools"
171 %endif
172
173 %files -n libdlog
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
187
188 %post -n libdlog
189 /sbin/ldconfig
190 systemctl daemon-reload
191 chsmack -a System /var/log/dlog
192
193 %postun -n libdlog -p /sbin/ldconfig
194
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
202
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
208
209 %files -n log-syslog
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
214
215 %files config-persistent-logs
216 %{_sysconfdir}/dlog.conf.d/10-persistent-logs.conf
217
218 %files -n dlog-doc
219 %manifest dlog.manifest
220 %license LICENSE.APACHE2.0 LICENSE.MIT
221 /usr/share/doc/dlog
222
223 %files -n dlog-tests
224 %manifest dlog.manifest
225 %license LICENSE.APACHE2.0 LICENSE.MIT
226 %{_bindir}/dlog_test
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
236
237 %post -n dlog-tests
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."
242 echo ""
243 echo "For more information please read the /usr/share/doc/dlog/README.testsuite file"
244 echo ""
245 echo "A reboot is required to properly configure logger backend for testing."