c4ddbfc38300d77ebbbeb806775d5b1fd73c33c1
[platform/core/system/crash-worker.git] / packaging / crash-worker.spec
1 # "on_off foo" wil turn into "ON" or "OFF"
2 %define on_off() %{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
3
4 %define _with_tests on
5 %define _with_livedumper on
6 %define _with_crashservice on
7 %bcond_with doc
8 %bcond_with tests
9 %bcond_with livedumper
10 %bcond_with crashservice
11
12 # NOTE: To disable coredump set DumpCore=0 in configuration file
13
14 Name:      crash-worker
15 Summary:    Crash-manager
16 Version:    5.5.26
17 Release:    1
18 Group:      Framework/system
19 License:    Apache-2.0 and BSD
20 Source0:    %{name}-%{version}.tar.gz
21 Source1001:    crash-worker.manifest
22 BuildRequires:  pkgconfig(dlog)
23 BuildRequires:  pkgconfig(libtzplatform-config)
24 BuildRequires:  pkgconfig(iniparser)
25 BuildRequires:  pkgconfig(capi-system-info)
26 BuildRequires:  pkgconfig(glib-2.0)
27 BuildRequires:  pkgconfig(rpm)
28 BuildRequires:  cmake
29 BuildRequires:  pkgconfig(pkgmgr-info)
30
31 BuildRequires:  pkgconfig(libunwind-generic)
32 BuildRequires:  libelf-devel libelf
33 BuildRequires:  libebl-devel libebl
34 BuildRequires:  libdw-devel libdw
35
36 %if %{with doc}
37 BuildRequires:  doxygen
38 %endif
39
40 %if %{with livedumper}
41 BuildRequires:  boost-devel
42 %endif
43
44 Requires(post): coreutils
45 Requires(post): tar
46 Requires(post): gzip
47 Requires: zip
48 Requires: libelf
49 Requires: libdw
50 Requires: minicoredumper >= 2.1.0
51 Requires: %{_bindir}/buxton2ctl
52 %if %{with crashservice}
53 Requires: %{name}-livedumper = %{version}-%{release}
54 %endif
55
56 %description
57 crash-manager
58
59
60 %package -n     libcrash-service
61 Summary:        libcrash-service provides API to communicate with crash-service
62 %description -n libcrash-service
63
64 %package devel
65 Summary:    Crash-manager development package
66 %description devel
67 Requires:       libcrash-service
68 This package provides library and header files.
69
70 %if %{with doc}
71 %package doc
72 Summary:       Documentation package for crash-worker
73 Group:         Framework/System
74
75 %description doc
76 This package provides development documentation for crash-worker.
77 %endif
78
79 %if %{with tests}
80 %package tests
81 Summary:        Package with binaries and data for crash-worker tests
82
83 %description tests
84 This package contains installable tests in Bash.
85 %endif
86
87 %if %{with livedumper}
88 %package livedumper
89 Summary:        Livedumper allows to dump core of live process
90
91 %description livedumper
92 %endif
93
94 %prep
95 %setup -q
96
97 #Path to store logs and coredump files
98 %define crash_root_path %{TZ_SYS_CRASH_ROOT}
99 %define crash_path      %{TZ_SYS_CRASH}
100 %define crash_temp      %{crash_root_path}/temp
101
102 #Debug mode path - existence of file at path below mean that core file should be generated
103 %define debugmode_path      %{TZ_SYS_ETC}/.debugmode
104
105 %define upgrade_script_path %{TZ_SYS_RO_SHARE}/upgrade/scripts
106
107 %build
108 cp %{SOURCE1001} .
109
110 export CFLAGS+=" -Werror"
111
112 %ifarch %{arm} aarch64
113         %define ARCH arm
114 %else
115         %define ARCH x86
116 %endif
117
118 %ifarch %{arm} %ix86
119         %define ARCH_BIT 32
120 %else
121         %define ARCH_BIT 64
122 %endif
123
124 %cmake . \
125            -DCMAKE_INSTALL_PREFIX=%{_prefix} \
126            -DTMP_FILES_DIR=%{_sysconfdir}/tmpfiles.d \
127            -DARCH=%{ARCH} \
128            -DARCH_BIT=%{ARCH_BIT} \
129            -DDUMP_SYSTEMSTATE_CONFIG_DIR_PATH=%{_sysconfdir}/dump_systemstate.conf.d \
130            -DCRASH_MANAGER_CONFIG_PATH=%{_sysconfdir}/crash-manager.conf \
131            -DCRASH_ROOT_PATH=%{crash_root_path} \
132            -DCRASH_PATH=%{crash_path} \
133            -DCRASH_TEMP=%{crash_temp} \
134            -DDEBUGMODE_PATH=%{debugmode_path} \
135            -DMINICOREDUMPER_BIN_PATH=%{_sbindir}/minicoredumper \
136            -DMINICOREDUMPER_CONFIG_PATH=%{_sysconfdir}/minicoredumper/minicoredumper.cfg.json \
137            -DLIVEDUMPER_BIN_PATH=%{_bindir}/livedumper \
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            -DLIVEDUMPER=%{on_off livedumper} \
144            -DCRASH_SERVICE=%{on_off crashservice} \
145            -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \
146            -DLOGGER=dlog \
147            -DVERSION=%{version}
148
149 make %{?jobs:-j%jobs}
150 %if %{with doc}
151 make doc
152 %endif
153
154 %install
155 rm -rf %{buildroot}
156 %make_install
157 mkdir -p %{buildroot}%{crash_root_path}
158 mkdir -p %{buildroot}%{crash_path}
159 mkdir -p %{buildroot}%{crash_temp}
160
161 %post
162 /usr/bin/chsmack -a "System" -t %{crash_path}
163 /usr/bin/chsmack -a "System" -t %{crash_temp}
164
165 %files
166 %license LICENSE LICENSE.BSD
167 %manifest crash-worker.manifest
168 %defattr(-,system_fw,system_fw,-)
169 %dir %{crash_root_path}
170 %dir %{crash_path}
171 %dir %{crash_temp}
172 %{_sysconfdir}/crash-manager.conf
173 %attr(-,root,root) %{_prefix}/lib/sysctl.d/70-crash-manager.conf
174 %attr(0750,system_fw,system_fw) %{_bindir}/crash-manager
175 %attr(0750,system_fw,system_fw) %{_bindir}/dump_systemstate
176 %{_sysconfdir}/dump_systemstate.conf.d/files/files.conf.example
177 %{_sysconfdir}/dump_systemstate.conf.d/programs/programs.conf.example
178 %{_libexecdir}/crash-stack
179 %{_libexecdir}/crash-popup-launch
180 %{_libexecdir}/crash-notify-send
181 %{_libdir}/libcrash-manager.so.*
182
183 %if %{with crashservice}
184 %attr(0750,system_fw,system_fw) %{_bindir}/crash-service
185 %attr(-,root,root) %{_unitdir}/crash-service.service
186 %attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/crash-service.conf
187 %attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.livedump.service
188 %endif
189
190 #upgrade script
191 %attr(-,root,root) %{upgrade_script_path}/500.crash-manager-upgrade.sh
192
193 %files -n libcrash-service
194 %{_libdir}/libcrash-service.so.*
195
196 %files devel
197 %{_includedir}/crash-manager.h
198 %{_libdir}/libcrash-manager.so
199 %{_libdir}/pkgconfig/crash-manager.pc
200 %if %{with crashservice}
201 %{_includedir}/libcrash-service.h
202 %{_libdir}/libcrash-service.so
203 %{_libdir}/pkgconfig/crash-service.pc
204 %endif
205
206 %if %{with doc}
207 %files doc
208 %{_datadir}/doc/crash-worker
209 %endif
210
211 %if %{with tests}
212 %files tests
213 %manifest %{name}.manifest
214 %defattr(-,root,root)
215 %{_libdir}/crash-worker-tests/test1-default-crash
216 %{_libdir}/crash-worker-tests/test1-default-sleep
217 %{_libdir}/crash-worker-tests/test1-default-ill
218 %{_libdir}/crash-worker-tests/test1-custom-crash
219 %{_libdir}/crash-worker-tests/test1-custom-sleep
220 %{_libdir}/crash-worker-tests/test1-custom-ill
221 %{_libdir}/crash-worker-tests/run_tests.sh
222 %{_libdir}/crash-worker-tests/tests_common.sh
223 %{_libdir}/crash-worker-tests/crash_common.sh
224
225 %endif
226
227 %if %{with livedumper}
228 %files livedumper
229 %manifest %{name}.manifest
230 %{_bindir}/livedumper
231 %endif