Set app properties in popup
[platform/upstream/csr-framework.git] / packaging / csr-framework.spec
1 %define platform_version 2.4
2
3 # services timeoout time on idle for on-demand activation.
4 # give it '-1' if don't want to timeout on idle.
5 %define service_idle_timeout_time       60
6 %define popup_service_idle_timeout_time 10
7
8 # Configure engine file system.
9 #
10 # ro_dir_name / rw_dir_name
11 # - dir name is directory name inside of CSR directory.
12 # - 'dbspace' cannot be used as a dir_name.
13 %define engine_ro_dir_name engine
14 %define engine_rw_dir_name engine
15
16 # base of detailed url of content screening engine.
17 # If it's defined, detailed_url for client will be generated by
18 #                  concatenating base url + malware name.
19 # Else it's not defined, detailed_url getter in engine API will be used.
20 %define with_detailed_base_url 0
21 %define detailed_base_url
22
23 Summary: A general purpose content screening and reputation solution
24 Name: csr-framework
25 Version: 2.0.0
26 Release: 0
27 Source: %{name}-%{version}.tar.gz
28 License: Apache-2.0 and BSL-1.0
29 Group: Security/Service
30 URL: http://tizen.org
31 BuildRequires: cmake
32 BuildRequires: pkgconfig(dlog)
33 BuildRequires: pkgconfig(libsystemd-daemon)
34 BuildRequires: pkgconfig(vconf)
35 BuildRequires: pkgconfig(elementary)
36 BuildRequires: pkgconfig(sqlite3)
37 BuildRequires: pkgconfig(pkgmgr)
38 BuildRequires: pkgconfig(pkgmgr-info)
39 BuildRequires: pkgconfig(libsmack)
40 %if "%{platform_version}" == "3.0"
41 BuildRequires: pkgconfig(cynara-client)
42 %else
43 BuildRequires: pkgconfig(libsmack)
44 %endif
45 Requires:      lib%{name}-common = %{version}-%{release}
46 %{?systemd_requires}
47
48 %description
49 General purpose content screening and reputation solution. Can scan
50 file contents and checking url to prevent malicious items.
51
52 %global service_name                 csr
53 %global bin_dir                      %{_bindir}
54 %global sbin_dir                     /sbin
55 %global ro_data_dir                  %{_datadir}
56 %global rw_data_dir                  /opt/share
57 %global ro_db_dir                    %{ro_data_dir}/%{service_name}/dbspace
58 %global rw_db_dir                    %{rw_data_dir}/%{service_name}/dbspace
59 %global ro_res_dir                   %{ro_data_dir}/%{service_name}/res
60 %global engine_rw_working_dir        %{rw_data_dir}/%{service_name}/%{engine_rw_dir_name}
61 %global engine_dir                   %{ro_data_dir}/%{service_name}/%{engine_ro_dir_name}
62 %global test_dir                     %{rw_data_dir}/%{service_name}-test
63
64 %if "%{platform_version}" == "3.0"
65 %global service_user                 security_fw
66 %global service_group                security_fw
67 %global popup_service_env_file_path  /run/tizen-system-env
68 %global smack_domain_name            System
69 %global popup_unitdir                %{_unitdir_user}
70 %else
71 %global service_user                 system
72 %global service_group                system
73 %global smack_domain_name            %{service_name}
74 %global popup_service_env_file_path  /run/tizen-mobile-env
75 %global popup_unitdir                %{_unitdir}
76 %endif
77
78 %package -n lib%{name}-common
79 Summary: Common library package for %{name}
80 License: Apache-2.0
81 Group:   Security/Libraries
82 %if "%{platform_version}" == "3.0"
83 BuildRequires: pkgconfig(cynara-creds-socket)
84 %else
85 BuildRequires: pkgconfig(libsmack)
86 %endif
87 Requires: %{sbin_dir}/ldconfig
88
89 %description -n lib%{name}-common
90 csr-framework common library package.
91
92 %package -n lib%{name}-client
93 Summary: Client library package for %{name}
94 License: Apache-2.0
95 Group:   Security/Libraries
96 BuildRequires: pkgconfig(capi-base-common)
97 Requires: %{name} = %{version}-%{release}
98 Requires: %{sbin_dir}/ldconfig
99
100 %description -n lib%{name}-client
101 csr-framework client library package.
102
103 %package devel
104 Summary: Development files for %{name}
105 LICENSE: Apache-2.0
106 Group:   Security/Development
107 BuildRequires: pkgconfig(capi-base-common)
108 Requires:      %{name} = %{version}-%{release}
109
110 %description devel
111 csr-framework development files including headers and pkgconfig file.
112
113 %package engine-devel
114 Summary: Development files for %{name} engine
115 LICENSE: Apache-2.0
116 Group:   Security/Development
117
118 %description engine-devel
119 csr-framework engine development files including headers and pkgconfig file.
120
121 %package test
122 Summary: test program for %{name}
123 License: Apache-2.0 and BSL-1.0
124 Group:   Security/Testing
125 BuildRequires: boost-devel
126 BuildRequires: pkgconfig(pkgmgr-info)
127 BuildRequires: pkgconfig(glib-2.0)
128 Requires:      %{name} = %{version}
129
130 %description test
131 test program of csr-framework
132
133 %prep
134 %setup -q
135
136 %build
137
138 # define build architecture
139 %ifarch %{ix86}
140 %define test_target emulator
141 %else
142 %define test_target target
143 %endif
144
145 %cmake . \
146     -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}%{!?build_type:RELEASE} \
147     -DCMAKE_VERBOSE_MAKEFILE=ON \
148     -DCMAKE_INSTALL_PREFIX=%{_prefix} \
149     -DSERVICE_USER=%{service_user} \
150     -DSERVICE_GROUP=%{service_group} \
151     -DSMACK_DOMAIN_NAME=%{smack_domain_name} \
152     -DPOPUP_SERVICE_ENV_FILE_PATH:PATH=%{popup_service_env_file_path} \
153     -DSERVICE_NAME=%{service_name} \
154     -DVERSION=%{version} \
155     -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \
156     -DBIN_DIR:PATH=%{bin_dir} \
157     -DSYSTEMD_UNIT_DIR=%{_unitdir} \
158     -DPOPUP_SYSTEMD_UNIT_DIR=%{popup_unitdir} \
159     -DRO_DBSPACE:PATH=%{ro_db_dir} \
160     -DRW_DBSPACE:PATH=%{rw_db_dir} \
161     -DRO_RES_DIR:PATH=%{ro_res_dir} \
162     -DSERVICE_IDLE_TIMEOUT_TIME=%{service_idle_timeout_time} \
163     -DPOPUP_SERVICE_IDLE_TIMEOUT_TIME=%{popup_service_idle_timeout_time} \
164     -DENGINE_RW_WORKING_DIR:PATH=%{engine_rw_working_dir} \
165     -DENGINE_DIR:PATH=%{engine_dir} \
166     -DTEST_TARGET=%{test_target} \
167     -DTEST_DIR:PATH=%{test_dir} \
168 %if 0%{?with_detailed_base_url}
169     -DDETAILED_URL_BASE:STRING=%{detailed_base_url} \
170 %endif
171 %if "%{platform_version}" == "3.0"
172     -DPLATFORM_VERSION_3:BOOL=ON
173 %else
174     -DPLATFORM_VERSION_3:BOOL=OFF
175 %endif
176
177 make %{?jobs:-j%jobs}
178
179 %install
180 %make_install
181 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants
182 mkdir -p %{buildroot}%{popup_unitdir}/sockets.target.wants
183 ln -s ../%{service_name}-cs.socket %{buildroot}%{_unitdir}/sockets.target.wants/%{service_name}-cs.socket
184 ln -s ../%{service_name}-wp.socket %{buildroot}%{_unitdir}/sockets.target.wants/%{service_name}-wp.socket
185 ln -s ../%{service_name}-admin.socket %{buildroot}%{_unitdir}/sockets.target.wants/%{service_name}-admin.socket
186 ln -s ../%{service_name}-popup.socket %{buildroot}%{popup_unitdir}/sockets.target.wants/%{service_name}-popup.socket
187
188 mkdir -p %{buildroot}%{ro_data_dir}/license
189 cp LICENSE %{buildroot}%{ro_data_dir}/license/%{name}
190 cp LICENSE.BSL-1.0 %{buildroot}%{ro_data_dir}/license/%{name}.BSL-1.0
191 cp LICENSE %{buildroot}%{ro_data_dir}/license/lib%{name}-client
192 cp LICENSE %{buildroot}%{ro_data_dir}/license/lib%{name}-common
193 cp LICENSE %{buildroot}%{ro_data_dir}/license/%{name}-test
194 cp LICENSE.BSL-1.0 %{buildroot}%{ro_data_dir}/license/%{name}-test.BSL-1.0
195
196 mkdir -p %{buildroot}%{rw_db_dir}
197 mkdir -p %{buildroot}%{ro_db_dir}
198 cp data/scripts/*.sql %{buildroot}%{ro_db_dir}
199
200 mkdir -p %{buildroot}%{engine_dir}
201 mkdir -p %{buildroot}%{engine_rw_working_dir}
202
203 %post
204 systemctl daemon-reload
205 if [ $1 = 1 ]; then
206     systemctl start %{service_name}-cs.socket
207     systemctl start %{service_name}-wp.socket
208     systemctl start %{service_name}-admin.socket
209     systemctl start %{service_name}-popup.socket
210     systemctl start %{service_name}.service
211 fi
212
213 if [ $1 = 2 ]; then
214     systemctl restart %{service_name}-cs.socket
215     systemctl restart %{service_name}-wp.socket
216     systemctl restart %{service_name}-admin.socket
217     systemctl restart %{service_name}-popup.socket
218     systemctl restart %{service_name}.service
219 fi
220
221 %preun
222 if [ $1 = 0 ]; then
223     systemctl stop %{service_name}.service
224     systemctl stop %{service_name}-cs.socket
225     systemctl stop %{service_name}-wp.socket
226     systemctl stop %{service_name}-admin.socket
227     systemctl stop %{service_name}-popup.socket
228 fi
229
230 %postun
231 if [ $1 = 0 ]; then
232     systemctl daemon-reload
233 fi
234
235 %post -n lib%{name}-common -p %{sbin_dir}/ldconfig
236 %post -n lib%{name}-client -p %{sbin_dir}/ldconfig
237 %postun -n lib%{name}-common -p %{sbin_dir}/ldconfig
238 %postun -n lib%{name}-client -p %{sbin_dir}/ldconfig
239
240 %files
241 %defattr(-,root,root,-)
242 %manifest %{service_name}.manifest
243 %{ro_data_dir}/license/%{name}
244 %{ro_data_dir}/license/%{name}.BSL-1.0
245 %{bin_dir}/%{service_name}-server
246 %{bin_dir}/%{service_name}-popup
247 %{_unitdir}/%{service_name}.service
248 %{_unitdir}/sockets.target.wants/%{service_name}-cs.socket
249 %{_unitdir}/sockets.target.wants/%{service_name}-wp.socket
250 %{_unitdir}/sockets.target.wants/%{service_name}-admin.socket
251 %{_unitdir}/%{service_name}-cs.socket
252 %{_unitdir}/%{service_name}-wp.socket
253 %{_unitdir}/%{service_name}-admin.socket
254 %{popup_unitdir}/%{service_name}-popup.socket
255 %{popup_unitdir}/sockets.target.wants/%{service_name}-popup.socket
256 %{popup_unitdir}/%{service_name}-popup.service
257 %{ro_res_dir}/default-icon.png
258
259 %dir %{ro_data_dir}/%{service_name}
260 %dir %attr(-, %{service_user}, %{service_group}) %{rw_data_dir}/%{service_name}
261 %dir %{ro_db_dir}
262 %dir %attr(-, %{service_user}, %{service_group}) %{rw_db_dir}
263 %attr(444, %{service_user}, %{service_group}) %{ro_db_dir}/*.sql
264
265 %dir %{engine_dir}
266 %dir %attr(775, %{service_user}, %{service_group}) %{engine_rw_working_dir}
267
268 %files -n lib%{name}-common
269 %defattr(-,root,root,-)
270 %manifest %{service_name}-common.manifest
271 %{ro_data_dir}/license/lib%{name}-common
272 %{_libdir}/lib%{service_name}-common.so.*
273
274 %files -n lib%{name}-client
275 %defattr(-,root,root,-)
276 %manifest %{service_name}-client.manifest
277 %{ro_data_dir}/license/lib%{name}-client
278 %{_libdir}/lib%{service_name}-client.so.*
279
280 %files devel
281 %defattr(-,root,root,-)
282 %{_includedir}/csr/csr-content-screening.h
283 %{_includedir}/csr/csr-content-screening-types.h
284 %{_includedir}/csr/csr-web-protection.h
285 %{_includedir}/csr/csr-web-protection-types.h
286 %{_includedir}/csr/csr-error.h
287 %{_includedir}/csr/csr-engine-manager.h
288 %{_libdir}/pkgconfig/%{service_name}.pc
289 %{_libdir}/lib%{service_name}-client.so
290 %{_libdir}/lib%{service_name}-common.so
291
292 %files engine-devel
293 %defattr(-,root,root,-)
294 %{_includedir}/csre/csre-content-screening-engine-info.h
295 %{_includedir}/csre/csre-content-screening.h
296 %{_includedir}/csre/csre-content-screening-types.h
297 %{_includedir}/csre/csre-error.h
298 %{_includedir}/csre/csre-web-protection-engine-info.h
299 %{_includedir}/csre/csre-web-protection.h
300 %{_includedir}/csre/csre-web-protection-types.h
301 %{_libdir}/pkgconfig/%{service_name}-engine.pc
302
303 %files test
304 %defattr(-,root,root,-)
305 %manifest %{service_name}-test.manifest
306 %{ro_data_dir}/license/%{name}-test
307 %{ro_data_dir}/license/%{name}-test.BSL-1.0
308 %{_libdir}/lib%{service_name}-test-common.so
309 %attr(-, %{service_user}, %{service_group}) %{bin_dir}/%{service_name}-test
310 %attr(-, %{service_user}, %{service_group}) %{bin_dir}/%{service_name}-internal-test
311 %attr(-, %{service_user}, %{service_group}) %{bin_dir}/%{service_name}-popup-test
312 %attr(-, %{service_user}, %{service_group}) %{bin_dir}/%{service_name}-threadpool-test
313
314 # test resources
315 %dir %attr(-, %{service_user}, %{service_group}) %{test_dir}
316 %attr(-, %{service_user}, %{service_group}) %{test_dir}/*
317
318 # sample engine related files
319 %{engine_dir}/lib%{service_name}-cs-engine.so
320 %{engine_dir}/lib%{service_name}-wp-engine.so
321 %attr(-, %{service_user}, %{service_group}) %{engine_rw_working_dir}/*