1 # "on_off foo" wil turn into "ON" or "OFF"
2 %define on_off() %{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
5 %define _with_logdump on
6 %define _with_livedumper on
7 %define _with_crashservice on
12 %bcond_with livedumper
13 %bcond_with crashservice
15 # NOTE: To disable coredump set DumpCore=0 in configuration file
18 Summary: Crash-manager
21 Group: Framework/system
22 License: Apache-2.0 and BSD
23 Source0: %{name}-%{version}.tar.gz
24 Source1001: crash-worker.manifest
25 BuildRequires: pkgconfig(dlog)
26 BuildRequires: pkgconfig(libtzplatform-config)
27 BuildRequires: pkgconfig(iniparser)
28 BuildRequires: pkgconfig(capi-system-info)
29 BuildRequires: pkgconfig(glib-2.0)
30 BuildRequires: pkgconfig(rpm)
32 BuildRequires: pkgconfig(pkgmgr-info)
34 BuildRequires: pkgconfig(libunwind-generic)
35 BuildRequires: libelf-devel libelf
36 BuildRequires: libebl-devel libebl
37 BuildRequires: libdw-devel libdw
40 BuildRequires: doxygen
43 %if %{with livedumper}
44 BuildRequires: boost-devel
47 Requires(post): coreutils
53 Requires: %{_sbindir}/minicoredumper
54 Requires: %{_bindir}/buxton2ctl
60 Requires: crash-worker
61 Summary: Crash-manager development package
63 This package provides library and header files.
67 Summary: Documentation package for crash-worker
68 Group: Framework/System
71 This package provides development documentation for crash-worker.
76 Summary: Package with binaries and data for crash-worker tests
79 This package contains installable tests in Bash.
82 %if %{with livedumper}
84 Summary: Livedumper allows to dump core of live process
86 %description livedumper
92 #Path to store logs and coredump files
93 %define crash_root_path %{TZ_SYS_CRASH_ROOT}
94 %define crash_path %{TZ_SYS_CRASH}
95 %define crash_temp %{crash_root_path}/temp
97 #Debug mode path - existence of file at path below mean that core file should be generated
98 %define debugmode_path %{TZ_SYS_ETC}/.debugmode
100 #Path for log_dump module
101 %define crash_all_log %{TZ_SYS_ALLLOGS}
102 %define crash_dump_gen %{TZ_SYS_DUMPGEN}
104 %define upgrade_script_path %{TZ_SYS_RO_SHARE}/upgrade/scripts
109 export CFLAGS+=" -Werror"
111 %ifarch %{arm} aarch64
124 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
125 -DTMP_FILES_DIR=%{_sysconfdir}/tmpfiles.d \
127 -DARCH_BIT=%{ARCH_BIT} \
128 -DDUMP_SYSTEMSTATE_CONFIG_DIR_PATH=%{_sysconfdir}/dump_systemstate.conf.d \
129 -DCRASH_MANAGER_CONFIG_PATH=%{_sysconfdir}/crash-manager.conf \
130 -DCRASH_ROOT_PATH=%{crash_root_path} \
131 -DCRASH_PATH=%{crash_path} \
132 -DCRASH_TEMP=%{crash_temp} \
133 -DDEBUGMODE_PATH=%{debugmode_path} \
134 -DMINICOREDUMPER_BIN_PATH=%{_sbindir}/minicoredumper \
135 -DMINICOREDUMPER_CONFIG_PATH=%{_sysconfdir}/minicoredumper/minicoredumper.cfg.json \
136 -DLIVEDUMPER_BIN_PATH=%{_bindir}/livedumper \
137 -DLOG_DUMP_BIN_PATH=%{_bindir}/log_dump \
138 -DDUMP_SYSTEMSTATE_BIN_PATH=%{_bindir}/dump_systemstate \
139 -DCRASH_STACK_BIN_PATH=%{_libexecdir}/crash-stack \
140 -DCRASH_POPUP_BIN_PATH=%{_libexecdir}/crash-popup-launch \
141 -DCRASH_NOTIFY_BIN_PATH=%{_libexecdir}/crash-notify-send \
142 -DCRASH_TESTS_PATH=%{_libdir}/crash-worker-tests \
143 -DSYS_ASSERT=%{on_off sys_assert} \
144 -DLOG_DUMP=%{on_off logdump} \
145 -DLIVEDUMPER=%{on_off livedumper} \
146 -DCRASH_SERVICE=%{on_off crashservice} \
147 -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \
151 make %{?jobs:-j%jobs}
159 mkdir -p %{buildroot}%{crash_root_path}
160 mkdir -p %{buildroot}%{crash_path}
161 mkdir -p %{buildroot}%{crash_temp}
165 mkdir -p %{buildroot}%{crash_all_log}
166 mkdir -p %{buildroot}%{crash_dump_gen}
167 cp dump_scripts/* %{buildroot}%{crash_dump_gen}
168 chmod 755 %{buildroot}%{crash_dump_gen}/*
172 %if %{with sys_assert}
173 if [ ! -d /.build ]; then
174 orig="%{_libdir}/libsys-assert.so"
175 pattern=$(echo $orig | sed -e 's|/|\\/|g')
176 ret=$(sed -n "/${pattern}/p" %{_sysconfdir}/ld.so.preload)
177 if [ -z "$ret" ]; then
178 echo "%{_libdir}/libsys-assert.so" >> %{_sysconfdir}/ld.so.preload
180 chmod 644 %{_sysconfdir}/ld.so.preload
186 /usr/bin/chsmack -a "System" -t %{crash_path}
187 /usr/bin/chsmack -a "System" -t %{crash_temp}
190 /usr/bin/chsmack -a "System" -t %{crash_dump_gen}
191 /usr/bin/chsmack -a "System" -t %{crash_dump_gen}/module.d
192 /usr/bin/chsmack -a "System::Shared" -t %{crash_all_log}
193 /usr/bin/chsmack -a "_" %{crash_dump_gen}/module.d/*
197 %if %{with sys_assert}
198 orig="%{_libdir}/libsys-assert.so"
199 pattern=$(echo $orig | sed -e 's|/|\\/|g')
200 sed -i "/${pattern}/D" %{_sysconfdir}/ld.so.preload
205 %license LICENSE LICENSE.BSD
206 %manifest crash-worker.manifest
207 %defattr(-,system_fw,system_fw,-)
208 %dir %{crash_root_path}
211 %{_sysconfdir}/crash-manager.conf
212 %attr(-,root,root) %{_prefix}/lib/sysctl.d/70-crash-manager.conf
213 %attr(0750,system_fw,system_fw) %{_bindir}/crash-manager
214 %attr(0750,system_fw,system_fw) %{_bindir}/dump_systemstate
215 %{_sysconfdir}/dump_systemstate.conf.d/files/files.conf.example
216 %{_sysconfdir}/dump_systemstate.conf.d/programs/programs.conf.example
217 %{_libexecdir}/crash-stack
218 %{_libexecdir}/crash-popup-launch
219 %{_libexecdir}/crash-notify-send
220 %{_libdir}/libcrash-manager.so.*
222 %if %{with crashservice}
223 %attr(0750,system_fw,system_fw) %{_bindir}/crash-service
224 %attr(-,root,root) %{_unitdir}/crash-service.service
225 %attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/crash-service.conf
226 %attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.livedump.service
227 %{_libdir}/libcrash-service.so.*
231 %dir %{crash_all_log}
233 %attr(-,root,root) %{_unitdir}/log_dump.service
234 %attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/log_dump.conf
235 %attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.service
236 %attr(0750,system_fw,system_fw) %{_bindir}/log_dump
239 %if %{with sys_assert}
240 %{_libdir}/libsys-assert.so
241 %{_sysconfdir}/tmpfiles.d/sys-assert.conf
245 %attr(-,root,root) %{upgrade_script_path}/500.crash-manager-upgrade.sh
248 %{_includedir}/crash-manager.h
249 %{_libdir}/libcrash-manager.so
250 %{_datadir}/pkgconfig/crash-manager.pc
251 %if %{with crashservice}
252 %{_includedir}/libcrash-service.h
253 %{_libdir}/libcrash-service.so
254 %{_datadir}/pkgconfig/crash-service.pc
259 %{_datadir}/doc/crash-worker
264 %manifest %{name}.manifest
265 %defattr(-,root,root)
266 %{_libdir}/crash-worker-tests/test1-default-crash
267 %{_libdir}/crash-worker-tests/test1-default-sleep
268 %{_libdir}/crash-worker-tests/test1-default-ill
269 %{_libdir}/crash-worker-tests/test1-custom-crash
270 %{_libdir}/crash-worker-tests/test1-custom-sleep
271 %{_libdir}/crash-worker-tests/test1-custom-ill
272 %{_libdir}/crash-worker-tests/run_tests.sh
273 %{_libdir}/crash-worker-tests/tests_common.sh
274 %{_libdir}/crash-worker-tests/crash_common.sh
278 %if %{with livedumper}
280 %manifest %{name}.manifest
281 %{_bindir}/livedumper