build: Update version to 2.0.1
[iotivity.git] / tools / tizen / iotivity.spec
1 Name: iotivity
2 Version: %{!?version:2.0.1}%{?version}
3 Release: %{!?release:0}%{?release}
4 Summary: IoT Connectivity sponsored by the OCF
5 Group: Network & Connectivity / IoT Connectivity
6 License: Apache-2.0 and BSD-2-Clause and (MIT or BSL-1.0) and MIT
7 URL: https://www.iotivity.org/
8 Source0: http://mirrors.kernel.org/%{name}/%{version}/%{name}-%{version}.tar.gz
9
10 %if 0%{?manifest:1}
11 Source1001: %{name}.manifest
12 Source1002: %{name}-test.manifest
13 %endif
14
15 %if 0%{?tizen:1}
16 %{!?TARGET_OS: %define TARGET_OS tizen}
17 #TODO: align to default
18 %define LOGGING 1
19 %endif
20
21 %if "%{tizen}" == "2.3"
22 %define TARGET_TRANSPORT IP,BT
23 %endif
24
25 %if "%{tizen}" == "3.0"
26 %define OIC_SUPPORT_TIZEN_TRACE True
27 %endif
28
29 %if "%{profile}" == "ivi"
30 %define TARGET_TRANSPORT IP
31 %endif
32
33 %if "%{TARGET_OS}" == "linux"
34 %define TARGET_TRANSPORT IP
35 %endif
36
37
38 # default is RELEASE mode.
39 # If DEBUG mode is needed, please use tizen_build_devel_mode
40 %define RELEASE True
41 # For Example
42 %if %{RELEASE} == "True"
43 %define build_mode release
44 %else
45 %define build_mode debug
46 %endif
47
48 %if 3 <= 0%{?tizen_version_major}
49 %ifarch armv7l armv7hl armv7nhl armv7tnhl armv7thl
50 BuildRequires: python-accel-armv7l-cross-arm
51 %endif
52 %ifarch aarch64
53 BuildRequires: python-accel-aarch64-cross-aarch64
54 %endif
55 %endif
56
57 %if ! 0%{?license:0}
58 %define license %doc
59 %endif
60
61 # Default values to be eventually overiden BEFORE or as gbs params:
62 %{!?ES_TARGET_ENROLLEE: %define ES_TARGET_ENROLLEE %{TARGET_OS}}
63 %{!?LOGGING: %define LOGGING 0}
64 %{!?RD_MODE: %define RD_MODE CLIENT}
65 %{!?RELEASE: %define RELEASE 1}
66 %{!?ROUTING: %define ROUTING EP}
67 %{!?SECURED: %define SECURED 1}
68 %{!?TARGET_OS: %define TARGET_OS linux}
69 %{!?TARGET_TRANSPORT: %define TARGET_TRANSPORT IP}
70 %{!?VERBOSE: %define VERBOSE 1}
71 %{!?WITH_CLOUD: %define WITH_CLOUD False}
72 %{!?WITH_MQ: %define WITH_MQ OFF}
73 %{!?WITH_PROXY: %define WITH_PROXY 1}
74 %{!?WITH_TCP: %define WITH_TCP 1}
75 %{!?MULTIPLE_OWNER: %define MULTIPLE_OWNER 1}
76 %{!?OIC_SUPPORT_TIZEN_TRACE: %define OIC_SUPPORT_TIZEN_TRACE False}
77 %define BUILD_DIR out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/
78
79 %define SCONSFLAGS \\\
80 --prefix=%{_prefix} \\\
81 %{?_smp_mflags} \\\
82 \\\
83 ES_TARGET_ENROLLEE=%{ES_TARGET_ENROLLEE} \\\
84 LIB_INSTALL_DIR=%{_libdir} \\\
85 LOGGING=%{LOGGING} \\\
86 RD_MODE=%{RD_MODE} \\\
87 RELEASE=%{RELEASE} \\\
88 ROUTING=%{ROUTING} \\\
89 SECURED=%{SECURED} \\\
90 TARGET_OS=%{TARGET_OS} \\\
91 TARGET_TRANSPORT=%{TARGET_TRANSPORT} \\\
92 VERBOSE=%{VERBOSE} \\\
93 WITH_CLOUD=%{WITH_CLOUD} \\\
94 WITH_MQ=%{WITH_MQ} \\\
95 WITH_PROXY=%{WITH_PROXY} \\\
96 WITH_TCP=%{WITH_TCP} \\\
97 MULTIPLE_OWNER=%{MULTIPLE_OWNER} \\\
98 OIC_SUPPORT_TIZEN_TRACE=%{OIC_SUPPORT_TIZEN_TRACE} \\\
99 %{?EXTRA_RPM_SCONSFLAGS}
100
101 BuildRequires:  autoconf
102 BuildRequires:  automake
103 BuildRequires:  libtool
104 BuildRequires:  chrpath
105 BuildRequires:  expat-devel
106 BuildRequires:  python
107 BuildRequires:  scons
108 BuildRequires:  openssl-devel
109 BuildRequires:  boost-devel
110 BuildRequires:  boost-thread
111 BuildRequires:  boost-system
112 BuildRequires:  boost-filesystem
113 BuildRequires:  pkgconfig(uuid)
114 BuildRequires:  pkgconfig(glib-2.0)
115 BuildRequires:  pkgconfig(libcurl)
116 BuildRequires:  pkgconfig(sqlite3)
117 %if "%{TARGET_OS}" == "tizen"
118 BuildRequires:  gettext-tools
119 BuildRequires:  pkgconfig(dlog)
120 %if "%{OIC_SUPPORT_TIZEN_TRACE}" == "True"
121 BuildRequires:  pkgconfig(ttrace)
122 %endif
123 BuildRequires:  pkgconfig(capi-network-connection)
124 BuildRequires:  pkgconfig(capi-network-bluetooth) >= 0.1.52
125 %if 0%{?profile:1} && 3 <= 0%{?tizen_version_major}
126 BuildRequires:  bluetooth-tools-profile_%{profile}
127 %else
128 BuildRequires:  bluetooth-tools
129 %endif
130 %endif
131 Requires(postun): /sbin/ldconfig
132 Requires(post): /sbin/ldconfig
133
134 %description
135 An open source reference implementation of the OIC standard specifications
136 IoTivity Base Libraries are included.
137
138
139 %package service
140 Summary: Development files for %{name}
141 Group: Network & Connectivity/Service
142 Requires: %{name} = %{version}-%{release}
143
144 %description service
145 The %{name}-service package contains service libraries files for
146 developing applications that use %{name}-service.
147
148 %package test
149 Summary: Development files for %{name}
150 Group: Network & Connectivity/Testing
151 Requires: %{name} = %{version}-%{release}
152
153 %description test
154 The %{name}-test package contains example files to show
155 how the iotivity works using %{name}-test
156
157 %package devel
158 Summary: Development files for %{name}
159 Group: Network & Connectivity/Development
160 Requires: %{name} = %{version}-%{release}
161 Requires: pkgconfig
162 Requires: boost-devel
163
164 %description devel
165 The %{name}-devel package contains libraries and header files for
166 developing applications that use %{name}.
167
168 %prep
169 %setup -q
170 chmod g-w %_sourcedir/*
171
172 find . \
173      -iname "LICEN*E*"  \
174      -o -name "*BSD*" \
175      -o -name "*COPYING*" \
176      -o -name "*GPL*" \
177      -o -name "*MIT*" \
178      | sort | uniq \
179      | grep -v 'libcoap-4.1.1/LICENSE.GPL'  \
180      | while read file ; do \
181           dir=$(dirname -- "$file")
182           echo "Files: ${dir}/*"
183           echo "License: ${file}"
184           sed 's/^/ /' "${file}"
185           echo ""
186           echo ""
187      done > tmp.tmp && mv tmp.tmp LICENSE
188
189 cat LICENSE
190
191 [ -r 'config.md' ] || cat<<EOF | sed -e 's|%{buildroot}|(...BUILDROOT...)|g' | tee config.md
192 # Build configuration info #
193 SCONSFLAGS: %{SCONSFLAGS}
194 $(scons --version)
195 EOF
196
197 %if 0%{?manifest:1}
198 cp %{SOURCE1001} .
199 %if 0%{?tizen_version_major} < 3
200 cp %{SOURCE1002} .
201 %else
202 cp %{SOURCE1001} ./%{name}-test.manifest
203 %endif
204 %endif
205
206 %build
207 SCONSFLAGS="%{SCONSFLAGS}" ; export SCONSFLAGS;
208 scons
209
210 %install
211 rm -rf %{buildroot}
212 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
213 SCONSFLAGS="%{SCONSFLAGS}" ; export SCONSFLAGS;
214 scons --install-sandbox=%{buildroot} install
215
216 # Support legacy path (transitional, use pkg-config)
217 ln -fs iotivity/resource %{buildroot}%{_includedir}/
218 ln -fs iotivity/service %{buildroot}%{_includedir}/
219 ln -fs iotivity/c_common %{buildroot}%{_includedir}/
220
221 rm -rfv out %{buildroot}/out %{buildroot}/${HOME} ||:
222
223
224 %post -p /sbin/ldconfig
225
226 %postun -p /sbin/ldconfig
227
228 %files
229 %if 0%{?manifest:1}
230 %manifest %{name}.manifest
231 %endif
232 %defattr(-,root,root,-)
233 %license LICENSE
234 %{_libdir}/liboc.so
235 %{_libdir}/liboc_logger.so
236 %{_libdir}/liboc_logger_core.so
237 %{_libdir}/liboctbstack.so
238 %{_libdir}/libconnectivity_abstraction.so
239 %{_libdir}/libresource_directory.so
240 %if 0%{?SECURED} == 1
241 %{_libdir}/libocpmapi.so
242 %{_libdir}/libocprovision.so
243 %endif
244
245 %files service
246 %if 0%{?manifest:1}
247 %manifest %{name}.manifest
248 %endif
249 %defattr(-,root,root,-)
250 %license LICENSE
251 %{_libdir}/libBMISensorBundle.so
252 %{_libdir}/libDISensorBundle.so
253 %{_libdir}/libHueBundle.so
254 %{_libdir}/librcs_client.so
255 %{_libdir}/librcs_common.so
256 %{_libdir}/librcs_container.so
257 %{_libdir}/librcs_server.so
258 %{_libdir}/libESEnrolleeSDK.so
259 %{_libdir}/libESMediatorRich.so
260 %{_libdir}/libnotification*.so
261 %if 0%{?WITH_PROXY} == 1
262 %{_libdir}/libcoap_http_proxy.so
263 %endif
264 %if "%{TARGET_OS}" == "linux"
265 %{_libdir}/lib*plugin.so
266 %{_libdir}/lib*ipca.so
267 %endif
268
269 %files test
270 %if 0%{?manifest:1}
271 %manifest %{name}-test.manifest
272 %endif
273 %defattr(-,root,root,-)
274 %license LICENSE
275 %{_libdir}/%{name}/*
276
277 %files devel
278 %defattr(-,root,root,-)
279 %license LICENSE
280 %doc *.md
281 %{_libdir}/lib*.a
282 %{_libdir}/pkgconfig/%{name}.pc
283 %{_includedir}/*
284