ac06ceee1bba71a1c6d8bb50f1784ac5354c6b7a
[platform/upstream/iotivity.git] / packaging / iotivity.spec
1 Name: iotivity
2 Version: 1.0.1
3 Release: 0
4 Summary: IoT Connectivity sponsored by the OIC
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-tools, 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 An open source reference implementation of the OIC standard specifications
45 IoTivity Base Libraries are included.
46
47
48 %package service
49 Summary: Development files for %{name}
50 Group: Network & Connectivity/Service
51 Requires: %{name} = %{version}-%{release}
52
53 %description service
54 The %{name}-service package contains service libraries files for
55 developing applications that use %{name}-service.
56
57 %package test
58 Summary: Development files for %{name}
59 Group: Network & Connectivity/Testing
60 Requires: %{name} = %{version}-%{release}
61
62 %description test
63 The %{name}-test package contains example files to show
64 how the iotivity works using %{name}-test
65
66 %package devel
67 Summary: Development files for %{name}
68 Group: Network & Connectivity/Development
69 Requires: %{name} = %{version}-%{release}
70 Requires: pkgconfig
71
72 %description devel
73 The %{name}-devel package contains libraries and header files for
74 developing applications that use %{name}.
75
76 %prep
77 %setup -q
78 chmod g-w %_sourcedir/*
79
80 cp LICENSE.md LICENSE.APLv2
81 cp %{SOURCE1001} .
82 %if 0%{?tizen_version_major} < 3
83 cp %{SOURCE1002} .
84 %else
85 cp %{SOURCE1001} ./%{name}-test.manifest
86 %endif
87
88 %build
89 %define RPM_ARCH %{_arch}
90
91 %ifarch armv7l armv7hl armv7nhl armv7tnhl armv7thl
92 %define RPM_ARCH "armeabi-v7a"
93 %endif
94
95 %ifarch aarch64
96 %define RPM_ARCH "arm64"
97 %endif
98
99 %ifarch x86_64
100 %define RPM_ARCH "x86_64"
101 %endif
102
103 %ifarch %{ix86}
104 %define RPM_ARCH "x86"
105 %endif
106
107 #VERBOSE=1
108 scons -j2 --prefix=%{_prefix} \
109         TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \
110         RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
111         LIB_INSTALL_DIR=%{_libdir}
112
113
114 %install
115 rm -rf %{buildroot}
116 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
117 scons install --install-sandbox=%{buildroot} --prefix=%{_prefix} \
118         TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \
119         RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
120         LIB_INSTALL_DIR=%{_libdir}
121
122
123 # For Example
124 %if %{RELEASE} == "True"
125 %define build_mode release
126 %else
127 %define build_mode debug
128 %endif
129 %define ex_install_dir %{buildroot}%{_bindir}
130 mkdir -p %{ex_install_dir}
131 cp out/tizen/*/%{build_mode}/examples/OICMiddle/OICMiddle %{ex_install_dir}
132 cp out/tizen/*/%{build_mode}/resource/examples/devicediscoveryclient %{ex_install_dir}
133 cp out/tizen/*/%{build_mode}/resource/examples/devicediscoveryserver %{ex_install_dir}
134 cp out/tizen/*/%{build_mode}/resource/examples/fridgeclient %{ex_install_dir}
135 cp out/tizen/*/%{build_mode}/resource/examples/fridgeserver %{ex_install_dir}
136 cp out/tizen/*/%{build_mode}/resource/examples/garageclient %{ex_install_dir}
137 cp out/tizen/*/%{build_mode}/resource/examples/garageserver %{ex_install_dir}
138 cp out/tizen/*/%{build_mode}/resource/examples/groupclient %{ex_install_dir}
139 cp out/tizen/*/%{build_mode}/resource/examples/groupserver %{ex_install_dir}
140 cp out/tizen/*/%{build_mode}/resource/examples/lightserver %{ex_install_dir}
141 cp out/tizen/*/%{build_mode}/resource/examples/presenceclient %{ex_install_dir}
142 cp out/tizen/*/%{build_mode}/resource/examples/presenceserver %{ex_install_dir}
143 cp out/tizen/*/%{build_mode}/resource/examples/roomclient %{ex_install_dir}
144 cp out/tizen/*/%{build_mode}/resource/examples/roomserver %{ex_install_dir}
145 cp out/tizen/*/%{build_mode}/resource/examples/simpleclient %{ex_install_dir}
146 cp out/tizen/*/%{build_mode}/resource/examples/simpleclientHQ %{ex_install_dir}
147 cp out/tizen/*/%{build_mode}/resource/examples/simpleclientserver %{ex_install_dir}
148 cp out/tizen/*/%{build_mode}/resource/examples/simpleserver %{ex_install_dir}
149 cp out/tizen/*/%{build_mode}/resource/examples/simpleserverHQ %{ex_install_dir}
150 cp out/tizen/*/%{build_mode}/resource/examples/threadingsample %{ex_install_dir}
151 cp out/tizen/*/%{build_mode}/resource/examples/oic_svr_db_server.json %{ex_install_dir}
152 cp out/tizen/*/%{build_mode}/resource/examples/oic_svr_db_client.json %{ex_install_dir}
153 %if 0%{?SECURED} == 1
154 mkdir -p %{ex_install_dir}/provisioning
155 cp out/tizen/*/%{build_mode}/resource/provisioning/examples/oic_svr_db_client.json %{ex_install_dir}/provisioning/
156 cp out/tizen/*/%{build_mode}/resource/provisioning/examples/provisioningclient %{ex_install_dir}/provisioning/
157 %endif
158
159 # For iotcon
160 cp resource/csdk/stack/include/ocpayload.h %{buildroot}%{_includedir}/resource
161 cp resource/c_common/ocrandom/include/ocrandom.h %{buildroot}%{_includedir}/resource
162
163 %if 0%{?tizen_version_major} < 3
164 mkdir -p %{buildroot}/%{_datadir}/license
165 cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}
166 cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-service
167 cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-test
168 %endif
169
170 %post -p /sbin/ldconfig
171
172 %postun -p /sbin/ldconfig
173
174 %files
175 %manifest %{name}.manifest
176 %defattr(-,root,root,-)
177 %{_libdir}/liboc.so
178 %{_libdir}/liboc_logger.so
179 %{_libdir}/liboc_logger_core.so
180 %{_libdir}/liboctbstack.so
181 %{_libdir}/libconnectivity_abstraction.so
182 %if 0%{?tizen_version_major} < 3
183 %{_datadir}/license/%{name}
184 %else
185 %license LICENSE.APLv2
186 %endif
187
188 %files service
189 %manifest %{name}.manifest
190 %defattr(-,root,root,-)
191 %{_libdir}/libBMISensorBundle.so
192 %{_libdir}/libDISensorBundle.so
193 %{_libdir}/libresource_hosting.so
194 %{_libdir}/libTGMSDKLibrary.so
195 %{_libdir}/libHueBundle.so
196 %{_libdir}/librcs_client.so
197 %{_libdir}/librcs_common.so
198 %{_libdir}/librcs_container.so
199 %{_libdir}/librcs_server.so
200 %if 0%{?tizen_version_major} < 3
201 %{_datadir}/license/%{name}-service
202 %else
203 %license LICENSE.APLv2
204 %endif
205
206 %files test
207 %manifest %{name}-test.manifest
208 %defattr(-,root,root,-)
209 %{_bindir}/*
210 %if 0%{?tizen_version_major} < 3
211 %{_datadir}/license/%{name}-test
212 %else
213 %license LICENSE.APLv2
214 %endif
215
216 %files devel
217 %defattr(-,root,root,-)
218 %{_libdir}/lib*.a
219 %{_libdir}/pkgconfig/%{name}.pc
220 %{_includedir}/*