fix errata and revise build script
[platform/upstream/iotivity.git] / packaging / iotivity.spec
1 Name: iotivity
2 Version: 1.0.0
3 Release: 0
4 Summary: IoTivity Base Stack & IoTivity Services
5 Group: Network & Connectivity/Other
6 License: Apache-2.0
7 URL: https://www.iotivity.org/
8 Source0: %{name}-%{version}.tar.bz2
9 Source1001: %{name}.manifest
10 Source1002: %{name}-test.manifest
11 BuildRequires:  gettext, expat-devel
12 BuildRequires:  python, libcurl-devel
13 BuildRequires:  scons
14 BuildRequires:  openssl-devel
15 BuildRequires:  boost-devel
16 BuildRequires:  boost-thread
17 BuildRequires:  boost-system
18 BuildRequires:  boost-filesystem
19 BuildRequires:  pkgconfig(dlog)
20 BuildRequires:  pkgconfig(uuid)
21 BuildRequires:  pkgconfig(capi-network-wifi)
22 BuildRequires:  pkgconfig(capi-network-bluetooth)
23 BuildRequires:  pkgconfig(capi-appfw-app-common)
24 BuildRequires:  pkgconfig(glib-2.0)
25 BuildRequires:  pkgconfig(sqlite3)
26 Requires(postun): /sbin/ldconfig
27 Requires(post): /sbin/ldconfig
28
29
30 ## If tizen 2.x, RELEASE follows tizen_build_binary_release_type_eng. ##
31 ## and if tizen 3.0, RELEASE follows tizen_build_devel_mode. ##
32 %if 0%{?tizen_build_devel_mode} == 1 || 0%{?tizen_build_binary_release_type_eng} == 1
33 %define RELEASE False
34 %else
35 %define RELEASE True
36 %endif
37
38 %{!?TARGET_TRANSPORT: %define TARGET_TRANSPORT IP,BT}
39 %{!?SECURED: %define SECURED 0}
40 %{!?LOGGING: %define LOGGING True}
41 %{!?ROUTING: %define ROUTING GW}
42
43 %description
44 IoTivity Base (RICH & LITE) Stack & IoTivity Services
45
46 %package service
47 Summary: Development files for %{name}
48 Group: Network & Connectivity/Service
49 Requires: %{name} = %{version}-%{release}
50
51 %description service
52 The %{name}-service package contains service libraries files for
53 developing applications that use %{name}-service.
54
55 %package test
56 Summary: Development files for %{name}
57 Group: Network & Connectivity/Testing
58 Requires: %{name} = %{version}-%{release}
59
60 %description test
61 The %{name}-test package contains example files to show
62 how the iotivity works using %{name}-test
63
64 %package devel
65 Summary: Development files for %{name}
66 Group: Network & Connectivity/Development
67 Requires: %{name} = %{version}-%{release}
68 Requires: pkgconfig
69
70 %description devel
71 The %{name}-devel package contains libraries and header files for
72 developing applications that use %{name}.
73
74 %prep
75 %setup -q -n %{name}-%{version}
76 cp LICENSE.md LICENSE.APLv2
77 cp %{SOURCE1001} .
78 %if 0%{?tizen_version_major} < 3
79 cp %{SOURCE1002} .
80 %else
81 cp %{SOURCE1001} ./%{name}-test.manifest
82 %endif
83
84 %build
85 %define RPM_ARCH %{_arch}
86
87 %ifarch armv7l armv7hl armv7nhl armv7tnhl armv7thl
88 %define RPM_ARCH "armeabi-v7a"
89 %endif
90
91 %ifarch aarch64
92 %define RPM_ARCH "arm64"
93 %endif
94
95 %ifarch x86_64
96 %define RPM_ARCH "x86_64"
97 %endif
98
99 %ifarch %{ix86}
100 %define RPM_ARCH "x86"
101 %endif
102
103
104 scons -j 4 --prefix=%{_prefix} \
105                 TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \
106                 RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
107                 INSTALL_ROOT=%{buildroot}
108
109 %install
110 rm -rf %{buildroot}
111 scons install --prefix=%{_prefix} \
112                 TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \
113                 RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
114                 INSTALL_ROOT=%{buildroot}
115
116
117 mkdir -p %{buildroot}%{_includedir}
118 mkdir -p %{buildroot}%{_libdir}
119 mkdir -p %{buildroot}%{_libdir}/pkgconfig
120 mkdir -p %{buildroot}%{_bindir}
121
122
123 %if %{RELEASE} == "True"
124 %define build_mode release
125 %else
126 %define build_mode debug
127 %endif
128
129 # For Example
130 cp out/tizen/*/%{build_mode}/examples/OICMiddle/OICMiddle %{buildroot}%{_bindir}
131 cp out/tizen/*/%{build_mode}/resource/examples/devicediscoveryclient %{buildroot}%{_bindir}
132 cp out/tizen/*/%{build_mode}/resource/examples/devicediscoveryserver %{buildroot}%{_bindir}
133 cp out/tizen/*/%{build_mode}/resource/examples/fridgeclient %{buildroot}%{_bindir}
134 cp out/tizen/*/%{build_mode}/resource/examples/fridgeserver %{buildroot}%{_bindir}
135 cp out/tizen/*/%{build_mode}/resource/examples/garageclient %{buildroot}%{_bindir}
136 cp out/tizen/*/%{build_mode}/resource/examples/garageserver %{buildroot}%{_bindir}
137 cp out/tizen/*/%{build_mode}/resource/examples/groupclient %{buildroot}%{_bindir}
138 cp out/tizen/*/%{build_mode}/resource/examples/groupserver %{buildroot}%{_bindir}
139 cp out/tizen/*/%{build_mode}/resource/examples/lightserver %{buildroot}%{_bindir}
140 cp out/tizen/*/%{build_mode}/resource/examples/presenceclient %{buildroot}%{_bindir}
141 cp out/tizen/*/%{build_mode}/resource/examples/presenceserver %{buildroot}%{_bindir}
142 cp out/tizen/*/%{build_mode}/resource/examples/roomclient %{buildroot}%{_bindir}
143 cp out/tizen/*/%{build_mode}/resource/examples/roomserver %{buildroot}%{_bindir}
144 cp out/tizen/*/%{build_mode}/resource/examples/simpleclient %{buildroot}%{_bindir}
145 cp out/tizen/*/%{build_mode}/resource/examples/simpleclientHQ %{buildroot}%{_bindir}
146 cp out/tizen/*/%{build_mode}/resource/examples/simpleclientserver %{buildroot}%{_bindir}
147 cp out/tizen/*/%{build_mode}/resource/examples/simpleserver %{buildroot}%{_bindir}
148 cp out/tizen/*/%{build_mode}/resource/examples/simpleserverHQ %{buildroot}%{_bindir}
149 cp out/tizen/*/%{build_mode}/resource/examples/threadingsample %{buildroot}%{_bindir}
150 cp out/tizen/*/%{build_mode}/resource/examples/oic_svr_db_server.json %{buildroot}%{_bindir}
151 cp out/tizen/*/%{build_mode}/resource/examples/oic_svr_db_client.json %{buildroot}%{_bindir}
152
153 # For iotcon
154 cp resource/csdk/stack/include/ocpayload.h %{buildroot}%{_includedir}/resource
155 cp resource/csdk/ocrandom/include/ocrandom.h %{buildroot}%{_includedir}/resource
156
157 %if 0%{?tizen_version_major} < 3
158 mkdir -p %{buildroot}/%{_datadir}/license
159 cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}
160 cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-service
161 cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-test
162 %endif
163
164 %post -p /sbin/ldconfig
165
166 %postun -p /sbin/ldconfig
167
168 %files
169 %manifest %{name}.manifest
170 %defattr(-,root,root,-)
171 %{_libdir}/liboc.so
172 %{_libdir}/liboc_logger.so
173 %{_libdir}/liboc_logger_core.so
174 %{_libdir}/liboctbstack.so
175 %{_libdir}/libconnectivity_abstraction.so
176 %if 0%{?tizen_version_major} < 3
177 %{_datadir}/license/%{name}
178 %else
179 %license LICENSE.APLv2
180 %endif
181
182 %files service
183 %manifest %{name}.manifest
184 %defattr(-,root,root,-)
185 %{_libdir}/libBMISensorBundle.so
186 %{_libdir}/libDISensorBundle.so
187 %{_libdir}/libresource_hosting.so
188 %{_libdir}/libTGMSDKLibrary.so
189 %{_libdir}/libHueBundle.so
190 %{_libdir}/librcs_client.so
191 %{_libdir}/librcs_common.so
192 %{_libdir}/librcs_container.so
193 %{_libdir}/librcs_server.so
194 %if 0%{?tizen_version_major} < 3
195 %{_datadir}/license/%{name}-service
196 %else
197 %license LICENSE.APLv2
198 %endif
199
200 %files test
201 %manifest %{name}-test.manifest
202 %defattr(-,root,root,-)
203 %{_bindir}/OICMiddle
204 %{_bindir}/devicediscoveryclient
205 %{_bindir}/devicediscoveryserver
206 %{_bindir}/fridgeclient
207 %{_bindir}/fridgeserver
208 %{_bindir}/garageclient
209 %{_bindir}/garageserver
210 %{_bindir}/groupclient
211 %{_bindir}/groupserver
212 %{_bindir}/lightserver
213 %{_bindir}/presenceclient
214 %{_bindir}/presenceserver
215 %{_bindir}/roomclient
216 %{_bindir}/roomserver
217 %{_bindir}/simpleclient
218 %{_bindir}/simpleclientHQ
219 %{_bindir}/simpleclientserver
220 %{_bindir}/simpleserver
221 %{_bindir}/simpleserverHQ
222 %{_bindir}/threadingsample
223 %{_bindir}/oic_svr_db_server.json
224 %{_bindir}/oic_svr_db_client.json
225 %if 0%{?tizen_version_major} < 3
226 %{_datadir}/license/%{name}-test
227 %else
228 %license LICENSE.APLv2
229 %endif
230
231 %files devel
232 %defattr(-,root,root,-)
233 %{_libdir}/lib*.a
234 %{_libdir}/pkgconfig/%{name}.pc
235 %{_includedir}/*