spec: Standarize field justification to spaces
[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:        Coredump handler and report generator for Tizen
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 BuildRequires:  pkgconfig(libunwind-generic)
31 BuildRequires:  libelf-devel libelf
32 BuildRequires:  libebl-devel libebl
33 BuildRequires:  libdw-devel libdw
34 %if %{with doc}
35 BuildRequires:  doxygen
36 %endif
37
38 %if %{with livedumper}
39 BuildRequires:  boost-devel
40 %endif
41
42 Requires(post): coreutils
43 Requires(post): tar
44 Requires(post): gzip
45 Requires:       zip
46 Requires:       libelf
47 Requires:       libdw
48 Requires:       minicoredumper >= 2.1.0
49 Requires:       %{_bindir}/buxton2ctl
50 %if %{with crashservice}
51 Requires:       %{name}-livedumper = %{version}-%{release}
52 %endif
53 %description
54
55 %package -n     libcrash-service
56 Summary:        libcrash-service provides API to communicate with crash-service
57 %description -n libcrash-service
58
59 %package        devel
60 Requires:       libcrash-service
61 Summary:        Crash-manager headers and library for linking
62 %description    devel
63
64 %if %{with doc}
65 %package        doc
66 Summary:        Documentation package for crash-worker
67 Group:          Framework/System
68 %description    doc
69 %endif
70
71 %if %{with tests}
72 %package        tests
73 Summary:        Package with binaries and data for crash-worker tests
74 %description    tests
75 %endif
76
77 %if %{with livedumper}
78 %package        livedumper
79 Summary:        Livedumper allows to dump core of live process
80 %description    livedumper
81 %endif
82
83 %prep
84 %setup -q
85
86 #Path to store logs and coredump files
87 %define crash_root_path %{TZ_SYS_CRASH_ROOT}
88 %define crash_path      %{TZ_SYS_CRASH}
89 %define crash_temp      %{crash_root_path}/temp
90
91 #Debug mode path - existence of file at path below mean that core file should be generated
92 %define debugmode_path      %{TZ_SYS_ETC}/.debugmode
93
94 %define upgrade_script_path %{TZ_SYS_RO_SHARE}/upgrade/scripts
95
96 %build
97 cp %{SOURCE1001} .
98
99 export CFLAGS+=" -Werror"
100
101 %ifarch %{arm} aarch64
102         %define ARCH arm
103 %else
104         %define ARCH x86
105 %endif
106
107 %ifarch %{arm} %ix86
108         %define ARCH_BIT 32
109 %else
110         %define ARCH_BIT 64
111 %endif
112
113 %cmake . \
114            -DCMAKE_INSTALL_PREFIX=%{_prefix} \
115            -DTMP_FILES_DIR=%{_sysconfdir}/tmpfiles.d \
116            -DARCH=%{ARCH} \
117            -DARCH_BIT=%{ARCH_BIT} \
118            -DDUMP_SYSTEMSTATE_CONFIG_DIR_PATH=%{_sysconfdir}/dump_systemstate.conf.d \
119            -DCRASH_MANAGER_CONFIG_PATH=%{_sysconfdir}/crash-manager.conf \
120            -DCRASH_ROOT_PATH=%{crash_root_path} \
121            -DCRASH_PATH=%{crash_path} \
122            -DCRASH_TEMP=%{crash_temp} \
123            -DDEBUGMODE_PATH=%{debugmode_path} \
124            -DMINICOREDUMPER_BIN_PATH=%{_sbindir}/minicoredumper \
125            -DMINICOREDUMPER_CONFIG_PATH=%{_sysconfdir}/minicoredumper/minicoredumper.cfg.json \
126            -DLIVEDUMPER_BIN_PATH=%{_bindir}/livedumper \
127            -DDUMP_SYSTEMSTATE_BIN_PATH=%{_bindir}/dump_systemstate \
128            -DCRASH_STACK_BIN_PATH=%{_libexecdir}/crash-stack \
129            -DCRASH_POPUP_BIN_PATH=%{_libexecdir}/crash-popup-launch \
130            -DCRASH_NOTIFY_BIN_PATH=%{_libexecdir}/crash-notify-send \
131            -DCRASH_TESTS_PATH=%{_libdir}/crash-worker-tests \
132            -DLIVEDUMPER=%{on_off livedumper} \
133            -DCRASH_SERVICE=%{on_off crashservice} \
134            -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \
135            -DLOGGER=dlog \
136            -DVERSION=%{version}
137
138 make %{?jobs:-j%jobs}
139 %if %{with doc}
140 make doc
141 %endif
142
143 %install
144 rm -rf %{buildroot}
145 %make_install
146 mkdir -p %{buildroot}%{crash_root_path}
147 mkdir -p %{buildroot}%{crash_path}
148 mkdir -p %{buildroot}%{crash_temp}
149
150 %post
151 /usr/bin/chsmack -a "System" -t %{crash_path}
152 /usr/bin/chsmack -a "System" -t %{crash_temp}
153
154 %files
155 %license LICENSE LICENSE.BSD
156 %manifest crash-worker.manifest
157 %defattr(-,system_fw,system_fw,-)
158 %dir %{crash_root_path}
159 %dir %{crash_path}
160 %dir %{crash_temp}
161 %{_sysconfdir}/crash-manager.conf
162 %attr(-,root,root) %{_prefix}/lib/sysctl.d/70-crash-manager.conf
163 %attr(0750,system_fw,system_fw) %{_bindir}/crash-manager
164 %attr(0750,system_fw,system_fw) %{_bindir}/dump_systemstate
165 %{_sysconfdir}/dump_systemstate.conf.d/files/files.conf.example
166 %{_sysconfdir}/dump_systemstate.conf.d/programs/programs.conf.example
167 %{_libexecdir}/crash-stack
168 %{_libexecdir}/crash-popup-launch
169 %{_libexecdir}/crash-notify-send
170 %{_libdir}/libcrash-manager.so.*
171
172 %if %{with crashservice}
173 %attr(0750,system_fw,system_fw) %{_bindir}/crash-service
174 %attr(-,root,root) %{_unitdir}/crash-service.service
175 %attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/crash-service.conf
176 %attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.livedump.service
177 %endif
178
179 #upgrade script
180 %attr(-,root,root) %{upgrade_script_path}/500.crash-manager-upgrade.sh
181
182 %files -n libcrash-service
183 %{_libdir}/libcrash-service.so.*
184
185 %files devel
186 %{_includedir}/crash-manager.h
187 %{_libdir}/libcrash-manager.so
188 %{_libdir}/pkgconfig/crash-manager.pc
189 %if %{with crashservice}
190 %{_includedir}/libcrash-service.h
191 %{_libdir}/libcrash-service.so
192 %{_libdir}/pkgconfig/crash-service.pc
193 %endif
194
195 %if %{with doc}
196 %files doc
197 %{_datadir}/doc/crash-worker
198 %endif
199
200 %if %{with tests}
201 %files tests
202 %manifest %{name}.manifest
203 %defattr(-,root,root)
204 %{_libdir}/crash-worker-tests/test1-default-crash
205 %{_libdir}/crash-worker-tests/test1-default-sleep
206 %{_libdir}/crash-worker-tests/test1-default-ill
207 %{_libdir}/crash-worker-tests/test1-custom-crash
208 %{_libdir}/crash-worker-tests/test1-custom-sleep
209 %{_libdir}/crash-worker-tests/test1-custom-ill
210 %{_libdir}/crash-worker-tests/run_tests.sh
211 %{_libdir}/crash-worker-tests/tests_common.sh
212 %{_libdir}/crash-worker-tests/crash_common.sh
213
214 %endif
215
216 %if %{with livedumper}
217 %files livedumper
218 %manifest %{name}.manifest
219 %{_bindir}/livedumper
220 %endif