1 # services timeoout time on idle for on-demand activation.
2 # give it '-1' if don't want to timeout on idle.
3 %define service_idle_timeout_time 60
4 %define popup_service_idle_timeout_time 10
6 # Configure engine file system.
8 # ro_dir_name / rw_dir_name
9 # - dir name is directory name inside of CSR directory.
10 # - 'dbspace' cannot be used as a dir_name.
11 %define engine_ro_dir_name engine
12 %define engine_rw_dir_name engine
14 # base of detailed url of content screening engine.
15 # If it's defined, detailed_url for client will be generated by
16 # concatenating base url + malware name.
17 # Else it's not defined, detailed_url getter in engine API will be used.
18 %define with_detailed_base_url 0
19 %define detailed_base_url %nil
21 %define with_sample_engine 0
23 Summary: A general purpose content screening and reputation solution
27 Source: %{name}-%{version}.tar.gz
28 License: Apache-2.0 and BSL-1.0
29 Group: Security/Service
32 BuildRequires: pkgconfig(dlog)
33 BuildRequires: pkgconfig(libsystemd-daemon)
34 BuildRequires: pkgconfig(vconf)
35 BuildRequires: pkgconfig(sqlite3)
36 BuildRequires: pkgconfig(pkgmgr)
37 BuildRequires: pkgconfig(pkgmgr-info)
38 BuildRequires: pkgconfig(libsmack)
39 BuildRequires: pkgconfig(capi-appfw-application)
40 BuildRequires: pkgconfig(elementary)
41 %if "%{?tizen_version}" == "3.0"
42 BuildRequires: pkgconfig(cynara-client)
44 BuildRequires: pkgconfig(libsmack)
46 Requires: lib%{name}-common = %{version}-%{release}
50 General purpose content screening and reputation solution. Can scan
51 file contents and checking url to prevent malicious items.
53 %global service_name csr
54 %global bin_dir %{_bindir}
55 %global sbin_dir /sbin
56 %global ro_data_dir %{_datadir}
57 %global rw_data_dir /opt/share
58 %global ro_db_dir %{ro_data_dir}/%{service_name}/dbspace
59 %global rw_db_dir %{rw_data_dir}/%{service_name}/dbspace
60 %global ro_res_dir %{ro_data_dir}/%{service_name}/res
61 %global engine_rw_working_dir %{rw_data_dir}/%{service_name}/%{engine_rw_dir_name}
62 %global engine_dir %{ro_data_dir}/%{service_name}/%{engine_ro_dir_name}
63 %global test_dir %{rw_data_dir}/%{service_name}-test
64 %global test_res_dir %{ro_data_dir}/%{service_name}-test
66 %if "%{?tizen_version}" == "3.0"
67 %global service_user security_fw
68 %global service_group security_fw
69 %global test_user owner
70 %global popup_service_env_file_path /run/tizen-system-env
71 %global smack_domain_name System
72 %global popup_unitdir %{_unitdir_user}
74 %global service_user system
75 %global service_group system
76 %global test_user system
77 %global smack_domain_name %{service_name}
78 %global popup_service_env_file_path /run/tizen-mobile-env
79 %global popup_unitdir %{_unitdir}
82 %package -n lib%{name}-common
83 Summary: Common library package for %{name}
85 Group: Security/Libraries
86 %if "%{?tizen_version}" == "3.0"
87 BuildRequires: pkgconfig(cynara-creds-socket)
89 BuildRequires: pkgconfig(libsmack)
91 Requires: %{sbin_dir}/ldconfig
93 %description -n lib%{name}-common
94 csr-framework common library package.
96 %package -n lib%{name}-client
97 Summary: Client library package for %{name}
99 Group: Security/Libraries
100 BuildRequires: pkgconfig(capi-base-common)
101 Requires: %{name} = %{version}-%{release}
102 Requires: %{sbin_dir}/ldconfig
104 %description -n lib%{name}-client
105 csr-framework client library package.
108 Summary: Development files for %{name}
110 Group: Security/Development
111 BuildRequires: pkgconfig(capi-base-common)
112 Requires: %{name} = %{version}-%{release}
115 csr-framework development files including headers and pkgconfig file.
117 %package engine-devel
118 Summary: Development files for %{name} engine
120 Group: Security/Development
122 %description engine-devel
123 csr-framework engine development files including headers and pkgconfig file.
126 Summary: test program for %{name}
127 License: Apache-2.0 and BSL-1.0
128 Group: Security/Testing
129 BuildRequires: boost-devel
130 BuildRequires: pkgconfig(pkgmgr-info)
131 BuildRequires: pkgconfig(glib-2.0)
132 Requires: %{name} = %{version}
135 test program of csr-framework
142 # define build architecture
144 %define test_target emulator
146 %define test_target target
150 -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}%{!?build_type:RELEASE} \
151 -DCMAKE_VERBOSE_MAKEFILE=ON \
152 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
153 -DSERVICE_USER=%{service_user} \
154 -DSERVICE_GROUP=%{service_group} \
155 -DSMACK_DOMAIN_NAME=%{smack_domain_name} \
156 -DPOPUP_SERVICE_ENV_FILE_PATH:PATH=%{popup_service_env_file_path} \
157 -DSERVICE_NAME=%{service_name} \
158 -DVERSION=%{version} \
159 -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \
160 -DBIN_DIR:PATH=%{bin_dir} \
161 -DSYSTEMD_UNIT_DIR=%{_unitdir} \
162 -DPOPUP_SYSTEMD_UNIT_DIR=%{popup_unitdir} \
163 -DRO_DBSPACE:PATH=%{ro_db_dir} \
164 -DRW_DBSPACE:PATH=%{rw_db_dir} \
165 -DRO_RES_DIR:PATH=%{ro_res_dir} \
166 -DSERVICE_IDLE_TIMEOUT_TIME=%{service_idle_timeout_time} \
167 -DPOPUP_SERVICE_IDLE_TIMEOUT_TIME=%{popup_service_idle_timeout_time} \
168 -DENGINE_RW_WORKING_DIR:PATH=%{engine_rw_working_dir} \
169 -DENGINE_DIR:PATH=%{engine_dir} \
170 -DTEST_TARGET=%{test_target} \
171 -DTEST_DIR:PATH=%{test_dir} \
172 -DTEST_RES_DIR:PATH=%{test_res_dir} \
173 %if 0%{?with_detailed_base_url}
174 -DDETAILED_URL_BASE:STRING=%{detailed_base_url} \
176 %if 0%{?with_sample_engine}
177 -DWITH_SAMPLE_ENGINE:BOOL=ON \
179 -DWITH_SAMPLE_ENGINE:BOOL=OFF \
181 %if "%{?tizen_version}" == "3.0"
182 -DPLATFORM_VERSION_3:BOOL=ON
184 -DPLATFORM_VERSION_3:BOOL=OFF
187 make %{?jobs:-j%jobs}
191 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants
192 mkdir -p %{buildroot}%{popup_unitdir}/sockets.target.wants
193 ln -s ../%{service_name}-cs.socket %{buildroot}%{_unitdir}/sockets.target.wants/%{service_name}-cs.socket
194 ln -s ../%{service_name}-wp.socket %{buildroot}%{_unitdir}/sockets.target.wants/%{service_name}-wp.socket
195 ln -s ../%{service_name}-admin.socket %{buildroot}%{_unitdir}/sockets.target.wants/%{service_name}-admin.socket
196 ln -s ../%{service_name}-popup.socket %{buildroot}%{popup_unitdir}/sockets.target.wants/%{service_name}-popup.socket
198 mkdir -p %{buildroot}%{ro_data_dir}/license
199 cp LICENSE %{buildroot}%{ro_data_dir}/license/%{name}
200 cp LICENSE.BSL-1.0 %{buildroot}%{ro_data_dir}/license/%{name}.BSL-1.0
201 cp LICENSE %{buildroot}%{ro_data_dir}/license/lib%{name}-client
202 cp LICENSE %{buildroot}%{ro_data_dir}/license/lib%{name}-common
204 cp LICENSE %{buildroot}%{ro_data_dir}/license/%{name}-test
205 cp LICENSE.BSL-1.0 %{buildroot}%{ro_data_dir}/license/%{name}-test.BSL-1.0
207 mkdir -p %{buildroot}%{rw_db_dir}
208 mkdir -p %{buildroot}%{ro_db_dir}
209 cp data/scripts/*.sql %{buildroot}%{ro_db_dir}
211 mkdir -p %{buildroot}%{engine_dir}
212 mkdir -p %{buildroot}%{engine_rw_working_dir}
215 systemctl daemon-reload
217 systemctl start %{service_name}-cs.socket
218 systemctl start %{service_name}-wp.socket
219 systemctl start %{service_name}-admin.socket
220 systemctl start %{service_name}-popup.socket
221 systemctl start %{service_name}.service
225 systemctl restart %{service_name}-cs.socket
226 systemctl restart %{service_name}-wp.socket
227 systemctl restart %{service_name}-admin.socket
228 systemctl restart %{service_name}-popup.socket
229 systemctl restart %{service_name}.service
234 systemctl stop %{service_name}.service
235 systemctl stop %{service_name}-cs.socket
236 systemctl stop %{service_name}-wp.socket
237 systemctl stop %{service_name}-admin.socket
238 systemctl stop %{service_name}-popup.socket
243 systemctl daemon-reload
246 %post -n lib%{name}-common -p %{sbin_dir}/ldconfig
247 %post -n lib%{name}-client -p %{sbin_dir}/ldconfig
248 %postun -n lib%{name}-common -p %{sbin_dir}/ldconfig
249 %postun -n lib%{name}-client -p %{sbin_dir}/ldconfig
251 %post -n %{name}-test
252 chsmack -a "_" %{test_dir}/test_dir/dir1
255 %defattr(-,root,root,-)
256 %manifest %{service_name}.manifest
257 %{ro_data_dir}/license/%{name}
258 %{ro_data_dir}/license/%{name}.BSL-1.0
259 %{bin_dir}/%{service_name}-server
260 %{bin_dir}/%{service_name}-popup
261 %{_unitdir}/%{service_name}.service
262 %{_unitdir}/sockets.target.wants/%{service_name}-cs.socket
263 %{_unitdir}/sockets.target.wants/%{service_name}-wp.socket
264 %{_unitdir}/sockets.target.wants/%{service_name}-admin.socket
265 %{_unitdir}/%{service_name}-cs.socket
266 %{_unitdir}/%{service_name}-wp.socket
267 %{_unitdir}/%{service_name}-admin.socket
268 %{popup_unitdir}/%{service_name}-popup.socket
269 %{popup_unitdir}/sockets.target.wants/%{service_name}-popup.socket
270 %{popup_unitdir}/%{service_name}-popup.service
271 %{ro_res_dir}/default-icon.png
273 %dir %{ro_data_dir}/%{service_name}
274 %dir %attr(-, %{service_user}, %{service_group}) %{rw_data_dir}/%{service_name}
276 %dir %attr(-, %{service_user}, %{service_group}) %{rw_db_dir}
277 %attr(444, %{service_user}, %{service_group}) %{ro_db_dir}/*.sql
280 %dir %attr(775, %{service_user}, %{service_group}) %{engine_rw_working_dir}
282 %files -n lib%{name}-common
283 %defattr(-,root,root,-)
284 %manifest %{service_name}-common.manifest
285 %{ro_data_dir}/license/lib%{name}-common
286 %{_libdir}/lib%{service_name}-common.so.*
288 %files -n lib%{name}-client
289 %defattr(-,root,root,-)
290 %manifest %{service_name}-client.manifest
291 %{ro_data_dir}/license/lib%{name}-client
292 %{_libdir}/lib%{service_name}-client.so.*
295 %defattr(-,root,root,-)
296 %{_includedir}/csr/csr-content-screening.h
297 %{_includedir}/csr/csr-content-screening-types.h
298 %{_includedir}/csr/csr-web-protection.h
299 %{_includedir}/csr/csr-web-protection-types.h
300 %{_includedir}/csr/csr-error.h
301 %{_includedir}/csr/csr-engine-manager.h
302 %{_libdir}/pkgconfig/%{service_name}.pc
303 %{_libdir}/lib%{service_name}-client.so
304 %{_libdir}/lib%{service_name}-common.so
307 %defattr(-,root,root,-)
308 %{_includedir}/csre/csre-content-screening-engine-info.h
309 %{_includedir}/csre/csre-content-screening.h
310 %{_includedir}/csre/csre-content-screening-types.h
311 %{_includedir}/csre/csre-error.h
312 %{_includedir}/csre/csre-web-protection-engine-info.h
313 %{_includedir}/csre/csre-web-protection.h
314 %{_includedir}/csre/csre-web-protection-types.h
315 %{_libdir}/pkgconfig/%{service_name}-engine.pc
318 %defattr(-,root,root,-)
319 %manifest %{service_name}-test.manifest
320 %{ro_data_dir}/license/%{name}-test
321 %{ro_data_dir}/license/%{name}-test.BSL-1.0
322 %{_libdir}/lib%{service_name}-test-common.so
323 %attr(-, %{test_user}, %{service_group}) %{bin_dir}/%{service_name}-test
324 %attr(-, %{test_user}, %{service_group}) %{bin_dir}/%{service_name}-internal-test
325 %attr(-, %{test_user}, %{service_group}) %{bin_dir}/%{service_name}-popup-test
326 %attr(-, %{test_user}, %{service_group}) %{bin_dir}/%{service_name}-threadpool-test
329 %dir %attr(777, %{test_user}, %{service_group}) %{test_dir}
330 %attr(777, %{test_user}, %{service_group}) %{test_dir}/*
332 %dir %attr(777, %{test_user}, %{service_group}) %{test_res_dir}
333 %attr(777, %{test_user}, %{service_group}) %{test_res_dir}/*
335 # sample engine related files
336 %if 0%{?with_sample_engine}
337 %{engine_dir}/lib%{service_name}-cs-engine.so
338 %{engine_dir}/lib%{service_name}-wp-engine.so
339 %attr(-, %{service_user}, %{service_group}) %{engine_rw_working_dir}/*