Applying remove re-build command patchset in the public spec file
[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 0}
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}/mbedtls
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 cp resource/c_common/*.h %{buildroot}%{_includedir}
259 cp resource/c_common/ocrandom/include/*.h %{buildroot}%{_includedir}
260 cp resource/c_common/oic_string/include/*.h %{buildroot}%{_includedir}
261 cp resource/c_common/oic_malloc/include/*.h %{buildroot}%{_includedir}
262 cp resource/csdk/stack/include/*.h %{buildroot}%{_includedir}
263 cp resource/csdk/logger/include/*.h %{buildroot}%{_includedir}
264
265 cp service/easy-setup/inc/*.h %{buildroot}%{_includedir}
266 cp service/easy-setup/enrollee/inc/*.h %{buildroot}%{_includedir}
267 cp service/easy-setup/mediator/richsdk/inc/*.h %{buildroot}%{_includedir}
268 cp service/easy-setup/enrollee/inc/samsung/*.h %{buildroot}%{_includedir}
269
270 install -d %{buildroot}%{_includedir}/iotivity
271 ln -fs ../resource %{buildroot}%{_includedir}/iotivity/
272 ln -fs ../service %{buildroot}%{_includedir}/iotivity/
273 ln -fs ../c_common %{buildroot}%{_includedir}/iotivity/
274
275 rm -rfv out %{buildroot}/out %{buildroot}/${HOME} ||:
276
277
278 %post -p /sbin/ldconfig
279
280 %postun -p /sbin/ldconfig
281
282 %files
283 %manifest %{name}.manifest
284 %defattr(-,root,root,-)
285 %if 0%{?tizen_version_major} < 3
286 %{_datadir}/license/%{name}
287 %else
288 %license LICENSE
289 %endif
290 %{_libdir}/liboc.so
291 %{_libdir}/liboc_logger.so
292 %{_libdir}/liboc_logger_core.so
293 %{_libdir}/liboctbstack.so
294 %{_libdir}/libconnectivity_abstraction.so
295 %if 0%{?SECURED} == 1
296 %{_libdir}/libmbedtls.so
297 %{_libdir}/libocpmapi.so
298 %{_libdir}/libocprovision.so
299 %endif
300
301 %files service
302 %manifest %{name}.manifest
303 %defattr(-,root,root,-)
304 %if 0%{?tizen_version_major} < 3
305 %{_datadir}/license/%{name}
306 %else
307 %license LICENSE
308 %endif
309 #%{_libdir}/libBMISensorBundle.so
310 #%{_libdir}/libDISensorBundle.so
311 #%{_libdir}/libHueBundle.so
312 %{_libdir}/librcs_client.so
313 %{_libdir}/librcs_common.so
314 #%{_libdir}/librcs_container.so
315 %{_libdir}/librcs_server.so
316 %{_libdir}/libresource_directory.so
317 %{_libdir}/libESEnrolleeSDK.so
318 %{_libdir}/libESMediatorRich.so
319 %{_libdir}/libnotification*.so
320 %if 0%{?WITH_PROXY} == 1
321 %{_libdir}/libcoap_http_proxy.so
322 %endif
323 %if "%{TARGET_OS}" == "linux"
324 %{_libdir}/libnotification*.so
325 %endif
326
327 %files test
328 %manifest %{name}-test.manifest
329 %defattr(-,root,root,-)
330 %if 0%{?tizen_version_major} < 3
331 %{_datadir}/license/%{name}
332 %else
333 %license LICENSE
334 %endif
335 %{_bindir}/*
336
337 %files devel
338 %defattr(-,root,root,-)
339 %if 0%{?tizen_version_major} < 3
340 %{_datadir}/license/%{name}
341 %else
342 %license LICENSE
343 %endif
344 %if 0%{?SECURED} == 1
345 %endif
346 %{_libdir}/*.a
347 %{_libdir}/pkgconfig/%{name}.pc
348 %{_includedir}/*