Enable Multiple Ownership feature
[platform/upstream/iotivity.git] / packaging / iotivity.spec
1 Name: iotivity
2 Version: 1.2.1
3 Release: 0
4 Summary: Samsung IoT Connectivity
5 Group: Network & Connectivity / IoT Connectivity
6 License: Apache-2.0
7 URL: https://www.iotivity.org/
8 Source0: http://mirrors.kernel.org/%{name}/%{version}/%{name}-%{version}.tar.gz
9 Source1001: %{name}.manifest
10 Source1002: %{name}-test.manifest
11
12 %if 0%{?tizen:1}
13 %define TARGET_OS tizen
14 %else
15 %define TARGET_OS linux
16 %endif
17
18 %if "%{tizen}" == "2.3"
19 %define TARGET_TRANSPORT IP
20 %endif
21
22 %if "%{profile}" == "ivi"
23 %define TARGET_TRANSPORT IP
24 %endif
25
26 %if "%{TARGET_OS}" == "linux"
27 %define TARGET_TRANSPORT IP
28 %endif
29
30 %define JOB %{?_smp_mflags}
31
32 # default is RELEASE mode.
33 # If DEBUG mode is needed, please use tizen_build_devel_mode
34 %define RELEASE True
35 # For Example
36 %if %{RELEASE} == "True"
37 %define build_mode release
38 %else
39 %define build_mode debug
40 %endif
41
42 %ifarch armv7l armv7hl armv7nhl armv7tnhl armv7thl
43 %define TARGET_ARCH "armeabi-v7a"
44 %endif
45 %ifarch aarch64
46 %define TARGET_ARCH "arm64"
47 %endif
48 %ifarch x86_64
49 %define TARGET_ARCH "x86_64"
50 %endif
51 %ifarch %{ix86}
52 %define TARGET_ARCH "x86"
53 %endif
54
55 %define ex_install_dir %{buildroot}%{_bindir}
56 %define ex_lib_dir %{buildroot}%{_libdir}
57 %define ex_include_dir %{buildroot}%{_includedir}
58
59 %if 0%{?tizen_version_major} < 3
60 %if ! 0%{?license:0}
61 %define license %doc
62 %endif
63
64 %if ! 0%{?manifest:0}
65 %define manifest %doc
66 %endif
67 %endif
68
69 # Default values to be eventually overiden BEFORE or as gbs params:
70 %{!?ES_TARGET_ENROLLEE: %define ES_TARGET_ENROLLEE tizen}
71 %{!?LOGGING: %define LOGGING 1}
72 %{!?RD_MODE: %define RD_MODE CLIENT}
73 %{!?RELEASE: %define RELEASE 1}
74 %{!?ROUTING: %define ROUTING EP}
75 %{!?SECURED: %define SECURED 1}
76 %{!?TARGET_ARCH: %define TARGET_ARCH %{_arch}}
77 %{!?TARGET_OS: %define TARGET_OS tizen}
78 %{!?TARGET_TRANSPORT: %define TARGET_TRANSPORT IP,BLE}
79 %{!?VERBOSE: %define VERBOSE 1}
80 %{!?WITH_CLOUD: %define WITH_CLOUD 1}
81 %{!?WITH_MQ: %define WITH_MQ OFF}
82 %{!?WITH_PROXY: %define WITH_PROXY 0}
83 %{!?WITH_TCP: %define WITH_TCP 1}
84 %{!?DISABLE_TCP_SERVER: %define DISABLE_TCP_SERVER 1}
85 %{!?RD_MODE: %define RD_MODE CLIENT}
86 %{!?BLE_CUSTOM_ADV: %define BLE_CUSTOM_ADV False}
87 %{!?BLE_DIVISION: %define BLE_DIVISION VD}
88 %{!?BLE_TIZEN_30: %define BLE_TIZEN_30 True}
89 %{!?MULTIPLE_OWNER: %define MULTIPLE_OWNER 1}
90
91 BuildRequires:  expat-devel
92 BuildRequires:  python, libcurl-devel
93 BuildRequires:  scons
94 BuildRequires:  openssl-devel
95 BuildRequires:  boost-devel
96 BuildRequires:  boost-thread
97 BuildRequires:  boost-system
98 BuildRequires:  boost-filesystem
99 BuildRequires:  pkgconfig(uuid)
100 BuildRequires:  pkgconfig(glib-2.0)
101 BuildRequires:  pkgconfig(sqlite3)
102 %if "%{TARGET_OS}" == "tizen"
103 BuildRequires:  gettext-tools
104 BuildRequires:  pkgconfig(dlog)
105 BuildRequires:  pkgconfig(capi-network-connection)
106 BuildRequires:  pkgconfig(capi-network-wifi)
107 BuildRequires:  pkgconfig(capi-network-bluetooth) >= 0.1.52
108 %else
109 %if 0%{?fedora:1}
110 BuildRequires:  sqlite-devel
111 BuildRequires:  gettext-devel
112 %endif
113 %endif
114 Requires(postun): /sbin/ldconfig
115 Requires(post): /sbin/ldconfig
116
117 %description
118 An open source reference implementation of the OIC standard specifications
119 IoTivity Base Libraries are included.
120
121
122 %package service
123 Summary: Development files for %{name}
124 Group: Network & Connectivity/Service
125 Requires: %{name} = %{version}-%{release}
126
127 %description service
128 The %{name}-service package contains service libraries files for
129 developing applications that use %{name}-service.
130
131 %package test
132 Summary: Development files for %{name}
133 Group: Network & Connectivity/Testing
134 Requires: %{name} = %{version}-%{release}
135
136 %description test
137 The %{name}-test package contains example files to show
138 how the iotivity works using %{name}-test
139
140 %package devel
141 Summary: Development files for %{name}
142 Group: Network & Connectivity/Development
143 Requires: %{name} = %{version}-%{release}
144 Requires: pkgconfig
145
146 %description devel
147 The %{name}-devel package contains libraries and header files for
148 developing applications that use %{name}.
149
150 %prep
151 %setup -q
152 chmod g-w %_sourcedir/*
153
154 cp LICENSE.md LICENSE
155
156 cp %{SOURCE1001} .
157 %if 0%{?tizen_version_major} < 3
158 cp %{SOURCE1002} .
159 %else
160 cp %{SOURCE1001} ./%{name}-test.manifest
161 %endif
162
163 %build
164 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
165 scons %{JOB} --prefix=%{_prefix} \
166     ES_TARGET_ENROLLEE=%{ES_TARGET_ENROLLEE} \
167     LIB_INSTALL_DIR=%{_libdir} \
168     LOGGING=%{LOGGING} \
169     RD_MODE=%{RD_MODE} \
170     RELEASE=%{RELEASE} \
171     ROUTING=%{ROUTING} \
172     SECURED=%{SECURED} \
173     TARGET_ARCH=%{TARGET_ARCH} \
174     TARGET_OS=%{TARGET_OS} \
175     TARGET_TRANSPORT=%{TARGET_TRANSPORT} \
176     VERBOSE=%{VERBOSE} \
177     WITH_CLOUD=%{WITH_CLOUD} \
178     WITH_MQ=%{WITH_MQ} \
179     WITH_PROXY=%{WITH_PROXY} \
180     WITH_TCP=%{WITH_TCP} \
181     DISABLE_TCP_SERVER=%{DISABLE_TCP_SERVER} \
182     RD_MODE=%{RD_MODE} \
183     BLE_CUSTOM_ADV=%{BLE_CUSTOM_ADV} \
184     BLE_DIVISION=%{BLE_DIVISION} \
185     BLE_TIZEN_30=%{BLE_TIZEN_30} \
186     MULTIPLE_OWNER=%{MULTIPLE_OWNER} \
187     #eol
188
189 %install
190 %if 0%{?tizen_version_major} < 3
191 mkdir -p %{buildroot}/%{_datadir}/license
192 cp LICENSE %{buildroot}/%{_datadir}/license/%{name}
193 %endif
194
195 mkdir -p %{ex_install_dir}
196 mkdir -p %{ex_include_dir}
197 mkdir -p %{ex_lib_dir}/pkgconfig
198 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/examples/OICMiddle/OICMiddle %{ex_install_dir}
199 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/devicediscoveryclient %{ex_install_dir}
200 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/devicediscoveryserver %{ex_install_dir}
201 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/fridgeclient %{ex_install_dir}
202 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/fridgeserver %{ex_install_dir}
203 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/garageclient %{ex_install_dir}
204 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/garageserver %{ex_install_dir}
205 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/groupclient %{ex_install_dir}
206 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/groupserver %{ex_install_dir}
207 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/lightserver %{ex_install_dir}
208 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/presenceclient %{ex_install_dir}
209 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/presenceserver %{ex_install_dir}
210 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/roomclient %{ex_install_dir}
211 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/roomserver %{ex_install_dir}
212 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/simpleclient %{ex_install_dir}
213 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/simpleclientHQ %{ex_install_dir}
214 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/simpleclientserver %{ex_install_dir}
215 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/simpleserver %{ex_install_dir}
216 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/simpleserverHQ %{ex_install_dir}
217 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/threadingsample %{ex_install_dir}
218 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/oic_svr_db_server.dat %{ex_install_dir}
219 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/oic_svr_db_client.dat %{ex_install_dir}
220 #cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/libcoap.a %{buildroot}%{_libdir}
221 cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/lib*.a  %{buildroot}%{_libdir}
222
223 # Install so files
224 cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/lib*.so  %{buildroot}%{_libdir}
225 cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/src/lib*.so  %{buildroot}%{_libdir}
226 cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/csdk/lib*.so  %{buildroot}%{_libdir}
227 cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/oc_logger/lib*.so  %{buildroot}%{_libdir}
228 cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/service/easy-setup/mediator/richsdk/lib*.so  %{buildroot}%{_libdir}
229
230 # Install pc file
231 cp ./*.pc %{buildroot}%{_libdir}/pkgconfig
232
233 %if 0%{?WITH_PROXY} == 1
234 mkdir -p %{ex_install_dir}/proxy-sample
235 cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/service/coap-http-proxy/samples/proxy_main %{ex_install_dir}/proxy-sample/
236 cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/service/coap-http-proxy/samples/proxy_client %{ex_install_dir}/proxy-sample/
237 %endif
238
239 %if 0%{?SECURED} == 1
240 mkdir -p %{ex_install_dir}/provisioning
241 mkdir -p %{ex_install_dir}/provision-sample
242 mkdir -p %{ex_include_dir}/mbedtls
243
244 cp -R ./extlibs/mbedtls/mbedtls/include/mbedtls/ %{buildroot}%{_includedir}
245 cp ./resource/csdk/security/include/*.h %{buildroot}%{_includedir}
246 cp ./resource/csdk/connectivity/api/*.h %{buildroot}%{_includedir}/
247 cp ./resource/csdk/security/include/internal/*.h %{buildroot}%{_includedir}/
248 cp ./resource/csdk/security/provisioning/include/oxm/*.h %{buildroot}%{_includedir}
249 cp ./resource/csdk/security/provisioning/include/internal/*.h %{buildroot}%{_includedir}
250 cp ./resource/csdk/security/provisioning/include/*.h %{buildroot}%{_includedir}
251 cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/csdk/security/provisioning/sample/sampleserver_justworks %{ex_install_dir}/provision-sample/
252 cp ./resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.dat %{ex_install_dir}/provision-sample/
253 cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/csdk/security/provisioning/sample/sampleserver_randompin %{ex_install_dir}/provision-sample/
254 cp ./resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.dat %{ex_install_dir}/provision-sample/
255
256 %endif
257
258
259 mkdir -p %{ex_include_dir}/service/resource-encapsulation
260 mkdir -p %{ex_include_dir}/service/notification
261 mkdir -p %{ex_include_dir}/service/easy-setup
262 mkdir -p %{ex_include_dir}/resource/targets
263 mkdir -p %{ex_include_dir}/c_common
264
265 # Install missed header files
266 cp service/resource-encapsulation/include/*.h %{buildroot}%{_includedir}/service/resource-encapsulation
267 cp service/resource-encapsulation/include/*.h %{buildroot}%{_includedir}/service/resource-encapsulation
268 cp service/notification/include/*.h %{buildroot}%{_includedir}/service/notification
269 cp service/notification/cpp-wrapper/common/*.h %{buildroot}%{_includedir}/service/notification
270 cp service/notification/cpp-wrapper/provider/inc/*.h %{buildroot}%{_includedir}/service/notification
271 cp service/notification/cpp-wrapper/consumer/inc/*.h %{buildroot}%{_includedir}/service/notification
272 cp service/easy-setup/inc/*.h %{buildroot}%{_includedir}/service/easy-setup
273 cp service/easy-setup/mediator/richsdk/inc/* %{buildroot}%{_includedir}/service/easy-setup
274 cp service/easy-setup/enrollee/inc/*.h %{buildroot}%{_includedir}/service/easy-setup
275 cp resource/oc_logger/include/targets/*.h %{buildroot}%{_includedir}/resource/targets
276 cp resource/include/* %{buildroot}%{_includedir}/resource
277 cp resource/c_common/platform_features.h %{buildroot}%{_includedir}/c_common
278 cp resource/c_common/iotivity_config.h %{buildroot}%{_includedir}/c_common
279 cp resource/csdk/resource-directory/include/*.h %{buildroot}%{_includedir}/resource
280 cp resource/csdk/stack/include/*.h %{buildroot}%{_includedir}/resource
281 cp resource/oc_logger/include/*.h %{buildroot}%{_includedir}/resource
282 cp resource/oc_logger/include/*.hpp %{buildroot}%{_includedir}/resource
283
284 cp resource/c_common/*.h %{buildroot}%{_includedir}
285 cp resource/c_common/ocrandom/include/*.h %{buildroot}%{_includedir}
286 cp resource/c_common/oic_string/include/*.h %{buildroot}%{_includedir}
287 cp resource/c_common/oic_malloc/include/*.h %{buildroot}%{_includedir}
288 cp resource/csdk/stack/include/*.h %{buildroot}%{_includedir}
289 cp resource/csdk/logger/include/*.h %{buildroot}%{_includedir}
290
291 cp service/easy-setup/inc/*.h %{buildroot}%{_includedir}
292 cp service/easy-setup/enrollee/inc/*.h %{buildroot}%{_includedir}
293 cp service/easy-setup/mediator/richsdk/inc/*.h %{buildroot}%{_includedir}
294 cp service/easy-setup/enrollee/inc/samsung/*.h %{buildroot}%{_includedir}
295
296 install -d %{buildroot}%{_includedir}/iotivity
297 ln -fs ../resource %{buildroot}%{_includedir}/iotivity/
298 ln -fs ../service %{buildroot}%{_includedir}/iotivity/
299 ln -fs ../c_common %{buildroot}%{_includedir}/iotivity/
300
301 rm -rfv out %{buildroot}/out %{buildroot}/${HOME} ||:
302
303
304 %post -p /sbin/ldconfig
305
306 %postun -p /sbin/ldconfig
307
308 %files
309 %manifest %{name}.manifest
310 %defattr(-,root,root,-)
311 %if 0%{?tizen_version_major} < 3
312 %{_datadir}/license/%{name}
313 %else
314 %license LICENSE
315 %endif
316 %{_libdir}/liboc.so
317 %{_libdir}/liboc_logger.so
318 %{_libdir}/liboc_logger_core.so
319 %{_libdir}/liboctbstack.so
320 %{_libdir}/libconnectivity_abstraction.so
321 %if 0%{?SECURED} == 1
322 %{_libdir}/libmbedtls.so
323 %{_libdir}/libocpmapi.so
324 %{_libdir}/libocprovision.so
325 %endif
326
327 %files service
328 %manifest %{name}.manifest
329 %defattr(-,root,root,-)
330 %if 0%{?tizen_version_major} < 3
331 %{_datadir}/license/%{name}
332 %else
333 %license LICENSE
334 %endif
335 #%{_libdir}/libBMISensorBundle.so
336 #%{_libdir}/libDISensorBundle.so
337 #%{_libdir}/libHueBundle.so
338 %{_libdir}/librcs_client.so
339 %{_libdir}/librcs_common.so
340 #%{_libdir}/librcs_container.so
341 %{_libdir}/librcs_server.so
342 %{_libdir}/libresource_directory.so
343 %{_libdir}/libESEnrolleeSDK.so
344 %{_libdir}/libESMediatorRich.so
345 %{_libdir}/libnotification*.so
346 %if 0%{?WITH_PROXY} == 1
347 %{_libdir}/libcoap_http_proxy.so
348 %endif
349 %if "%{TARGET_OS}" == "linux"
350 %{_libdir}/libnotification*.so
351 %endif
352
353 %files test
354 %manifest %{name}-test.manifest
355 %defattr(-,root,root,-)
356 %if 0%{?tizen_version_major} < 3
357 %{_datadir}/license/%{name}
358 %else
359 %license LICENSE
360 %endif
361 %{_bindir}/*
362
363 %files devel
364 %defattr(-,root,root,-)
365 %if 0%{?tizen_version_major} < 3
366 %{_datadir}/license/%{name}
367 %else
368 %license LICENSE
369 %endif
370 %if 0%{?SECURED} == 1
371 %endif
372 %{_libdir}/*.a
373 %{_libdir}/pkgconfig/%{name}.pc
374 %{_includedir}/*