iotivity: add simple client + server
[feed/packages.git] / net / iotivity / Makefile
1 #
2 # Copyright (C) 2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=iotivity
11 PKG_VERSION:=1.1.0
12 PKG_RELEASE=1
13
14 PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz
15 PKG_SOURCE_URL:=http://mirrors.kernel.org/${PKG_NAME}/${PKG_VERSION}/
16 PKG_MD5SUM:=98f8d5b0304c357520c4343d983491e2
17 PKG_USE_MIPS16:=0
18
19 PKG_BUILD_DEPENDS:=boost
20
21 PKG_MAINTAINER:=Hauke Mehrtens <hauke.mehrtens@intel.com>
22
23 PKG_LICENSE:=Apache-2.0
24 PKG_LICENSE_FILES:=LICENSE.md
25
26 PKG_CONFIG_DEPENDS := \
27 CONFIG_PACKAGE_iotivity \
28 CONFIG_PACKAGE_iotivity-cpp \
29 CONFIG_PACKAGE_iotivity-things-manager-lib \
30 CONFIG_PACKAGE_iotivity-oic-middle \
31 CONFIG_PACKAGE_iotivity-things-manager \
32 CONFIG_PACKAGE_iotivity-resource-container-lib \
33 CONFIG_PACKAGE_iotivity-resource-container-sample \
34 CONFIG_PACKAGE_iotivity-resource-container-hue \
35 CONFIG_PACKAGE_iotivity-example-garage \
36 CONFIG_PACKAGE_iotivity-example-simple \
37 CONFIG_PACKAGE_iotivity_DEBUG \
38 CONFIG_PACKAGE_iotivity_SECURE
39
40 include $(INCLUDE_DIR)/package.mk
41 include $(INCLUDE_DIR)/scons.mk
42
43
44 define Package/iotivity
45 SECTION:=net
46 CATEGORY:=Network
47 DEPENDS:=@!USE_UCLIBC +libpthread +librt +libuuid
48 TITLE:=IoTivity C Library
49 URL:=https://www.iotivity.org
50 MENU:=1
51 endef
52
53 define Package/iotivity/description
54 IoTivity is a framework for the Internet of Things based on the
55 Open Interconnect Consortium Specification.
56 endef
57
58 define Package/iotivity/config
59 if PACKAGE_iotivity
60 config PACKAGE_iotivity_DEBUG
61 bool "IoTivity with debug support"
62 help
63 Build IoTivity with debuging support.
64
65 config PACKAGE_iotivity_SECURE
66 bool "IoTivity with security support"
67 default y
68 help
69 Activate security support.
70
71 endif
72 endef
73
74
75 define Package/iotivity-cpp
76 SECTION:=net
77 CATEGORY:=Network
78 DEPENDS:=+iotivity +libpthread +libstdcpp
79 TITLE:=IoTivity C++ Library
80 URL:=https://www.iotivity.org
81 endef
82
83 define Package/iotivity-cpp/description
84 IoTivity is a framework for the Internet of Things based on the
85 Open Interconnect Consortium Specification.
86 endef
87
88
89 define Package/iotivity-things-manager-lib
90 SECTION:=net
91 CATEGORY:=Network
92 DEPENDS:=+iotivity +iotivity-cpp +libstdcpp
93 TITLE:=IoTivity things manager lib
94 URL:=https://www.iotivity.org
95 endef
96
97 define Package/iotivity-things-manager-lib/description
98 IoTivity things-manager lib
99 endef
100
101
102 define Package/iotivity-oic-middle
103 SECTION:=net
104 CATEGORY:=Network
105 DEPENDS:=+iotivity +iotivity-cpp
106 TITLE:=IoTivity OIC Middle
107 URL:=https://www.iotivity.org
108 endef
109
110 define Package/iotivity-oic-middle/description
111 IoTivity OIC Middle
112 endef
113
114
115 define Package/iotivity-things-manager
116 SECTION:=net
117 CATEGORY:=Network
118 DEPENDS:=+iotivity +iotivity-cpp +iotivity-things-manager-lib
119 TITLE:=IoTivity things manager
120 URL:=https://www.iotivity.org
121 endef
122
123 define Package/iotivity-things-manager/description
124 IoTivity things manager
125 endef
126
127 define Package/iotivity-resource-container-lib
128 SECTION:=net
129 CATEGORY:=Network
130 DEPENDS:=+iotivity +iotivity-cpp +boost +boost-system +boost-thread +boost-date_time
131 TITLE:=IoTivity Resource Container library
132 URL:=https://www.iotivity.org
133 endef
134
135 define Package/iotivity-resource-container-sample
136 SECTION:=net
137 CATEGORY:=Network
138 DEPENDS:=+iotivity +iotivity-resource-container-lib
139 TITLE:=IoTivity Resource Container sample Application
140 URL:=https://www.iotivity.org
141 endef
142
143 define Package/iotivity-resource-container-hue
144 SECTION:=net
145 CATEGORY:=Network
146 DEPENDS:=+iotivity +iotivity-resource-container-lib +libcurl
147 TITLE:=IoTivity Resource Container Hue Bundle
148 URL:=https://www.iotivity.org
149 endef
150
151 define Package/iotivity-example-garage
152 SECTION:=net
153 CATEGORY:=Network
154 DEPENDS:=+iotivity +iotivity-cpp
155 TITLE:=IoTivity Garage example
156 URL:=https://www.iotivity.org
157 endef
158
159 define Package/iotivity-example-garage/description
160 An IoTivity example application
161 endef
162
163 define Package/iotivity-example-simple
164 SECTION:=net
165 CATEGORY:=Network
166 DEPENDS:=+iotivity +iotivity-cpp
167 TITLE:=IoTivity simple client + server
168 URL:=https://www.iotivity.org
169 endef
170
171 define Package/iotivity-example-simple/description
172 The IoTivity simple client and simple server exmaple
173 endef
174
175
176 PKG_TINYCBOR_NAME:=tinycbor
177 PKG_TINYCBOR_VERSION:=43e3ac9490cf19459ec7b7bd13df3b66810fb62a
178 PKG_TINYCBOR_SOURCE:=$(PKG_TINYCBOR_NAME)-$(PKG_TINYCBOR_VERSION).tar.bz2
179 PKG_TINYCBOR_PROTO:=git
180 PKG_TINYCBOR_SOURCE_URL:=https://github.com/01org/tinycbor.git
181 PKG_TINYCBOR_SUBDIR:=$(PKG_TINYCBOR_NAME)
182 #PKG_TINYCBOR_MIRROR_MD5SUM:=?
183
184 define Download/iotivity-tinycbor
185 FILE:=$(PKG_TINYCBOR_SOURCE)
186 URL:=$(PKG_TINYCBOR_SOURCE_URL)
187 PROTO:=$(PKG_TINYCBOR_PROTO)
188 VERSION:=$(PKG_TINYCBOR_VERSION)
189 SUBDIR:=$(PKG_TINYCBOR_SUBDIR)
190 #MIRROR_MD5SUM:=$(PKG_TINYCBOR_MIRROR_MD5SUM)
191 endef
192 $(eval $(call Download,iotivity-tinycbor))
193
194 PKG_SQLITE_NAME:=sqlite
195 PKG_SQLITE_VERSION:=3081101
196 PKG_SQLITE_SOURCE:=$(PKG_SQLITE_NAME)-amalgamation-$(PKG_SQLITE_VERSION).zip
197 PKG_SQLITE_SOURCE_URL:=http://www.sqlite.org/2015/
198 PKG_SQLITE_SUBDIR:=$(PKG_SQLITE_NAME)
199 PKG_SQLITE_MD5SUM:=94907e831502e2080b76e281cfa24dde
200
201 define Download/iotivity-sqlite
202 FILE:=$(PKG_SQLITE_SOURCE)
203 URL:=$(PKG_SQLITE_SOURCE_URL)
204 VERSION:=$(PKG_SQLITE_VERSION)
205 SUBDIR:=$(PKG_SQLITE_SUBDIR)
206 MD5SUM:=$(PKG_SQLITE_MD5SUM)
207 endef
208 $(eval $(call Download,iotivity-sqlite))
209
210
211 SCONS_OPTIONS += \
212 TARGET_OS=linux \
213 TARGET_TRANSPORT=IP \
214 TARGET_ARCH=$(ARCH) \
215 STAGING_DIR=$(STAGING_DIR) \
216 LOGGING=true \
217 $(if $(CONFIG_PACKAGE_iotivity),liboctbstack) \
218 $(if $(CONFIG_PACKAGE_iotivity-cpp),liboc) \
219 $(if $(CONFIG_PACKAGE_iotivity-things-manager-lib),libTGMSDK) \
220 $(if $(CONFIG_PACKAGE_iotivity-oic-middle),examples) \
221 $(if $(CONFIG_PACKAGE_iotivity-things-manager),ConServerApp ConClientApp BootstrapServerApp) \
222 $(if $(CONFIG_PACKAGE_iotivity-resource-container-lib),libResContainer) \
223 $(if $(CONFIG_PACKAGE_iotivity-resource-container-sample),containersample) \
224 $(if $(CONFIG_PACKAGE_iotivity-resource-container-hue),libHueBundle) \
225 $(if $(CONFIG_PACKAGE_iotivity-example-garage),examples) \
226 $(if $(CONFIG_PACKAGE_iotivity-example-simple),examples) \
227
228 ifeq ($(CONFIG_PACKAGE_iotivity_DEBUG),y)
229 SCONS_OPTIONS += RELEASE=false
230 APP_OPTIM:=debug
231 else
232 SCONS_OPTIONS += RELEASE=true
233 APP_OPTIM:=release
234 endif
235
236 ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
237 SCONS_OPTIONS += SECURED=1
238 else
239 SCONS_OPTIONS += SECURED=0
240 endif
241
242 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
243 SCONS_OPTIONS += VERBOSE=true
244 endif
245
246 define Build/Prepare
247 $(call Build/Prepare/Default)
248 $(TAR) -C $(PKG_BUILD_DIR)/extlibs/tinycbor/ -xjf $(DL_DIR)/$(PKG_TINYCBOR_SOURCE)
249 unzip -d $(PKG_BUILD_DIR)/extlibs/sqlite3/ $(DL_DIR)/$(PKG_SQLITE_SOURCE)
250 mv $(PKG_BUILD_DIR)/extlibs/sqlite3/$(PKG_SQLITE_NAME)-amalgamation-$(PKG_SQLITE_VERSION)/sqlite3.h $(PKG_BUILD_DIR)/extlibs/sqlite3/
251 mv $(PKG_BUILD_DIR)/extlibs/sqlite3/$(PKG_SQLITE_NAME)-amalgamation-$(PKG_SQLITE_VERSION)/sqlite3.c $(PKG_BUILD_DIR)/extlibs/sqlite3/
252 endef
253
254
255 define Build/Configure
256 (cd $(PKG_BUILD_DIR); \
257 $(SCONS_VARS) \
258 scons \
259 $(SCONS_OPTIONS) \
260 )
261 endef
262
263
264 define Package/iotivity/install
265 $(INSTALL_DIR) $(1)/usr/lib
266 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
267 ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
268 $(INSTALL_DIR) $(1)/etc/iotivity/
269 $(INSTALL_DATA) ./files/etc/iotivity/oic_svr_db.cbor $(1)/etc/iotivity/
270 endif
271 endef
272
273 define Package/iotivity-cpp/install
274 $(INSTALL_DIR) $(1)/usr/lib
275 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/
276 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
277 endef
278
279 define Package/iotivity-things-manager-lib/install
280 $(INSTALL_DIR) $(1)/usr/lib
281 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libTGMSDKLibrary.so $(1)/usr/lib/
282 endef
283
284 define Package/iotivity-oic-middle/install
285 $(INSTALL_DIR) $(1)/usr/bin
286 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/examples/OICMiddle/OICMiddle $(1)/usr/bin/
287 endef
288
289 define Package/iotivity-things-manager/install
290 $(INSTALL_DIR) $(1)/usr/bin
291 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/things-manager/sampleapp/linux/configuration/bootstrapserver $(1)/usr/bin/
292 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/things-manager/sampleapp/linux/configuration/con-server $(1)/usr/bin/
293 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/things-manager/sampleapp/linux/configuration/con-client $(1)/usr/bin/
294 endef
295
296 define Package/iotivity-resource-container-lib/install
297 $(INSTALL_DIR) $(1)/usr/lib
298 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_common.so $(1)/usr/lib/
299 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_client.so $(1)/usr/lib/
300 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_server.so $(1)/usr/lib/
301 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_container.so $(1)/usr/lib/
302 endef
303
304 define Package/iotivity-resource-container-sample/install
305 $(INSTALL_DIR) $(1)/usr/bin
306 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/resource-container/ContainerSample $(1)/usr/bin/
307 endef
308
309 define Package/iotivity-resource-container-hue/install
310 $(INSTALL_DIR) $(1)/usr/lib
311 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libHueBundle.so $(1)/usr/lib/
312 endef
313
314 define Package/iotivity-example-garage/install
315 $(INSTALL_DIR) $(1)/usr/bin
316 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageclient $(1)/usr/bin/
317 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageserver $(1)/usr/bin/
318 endef
319
320 define Package/iotivity-example-simple/install
321 $(INSTALL_DIR) $(1)/usr/bin
322 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleclient $(1)/usr/bin/
323 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleserver $(1)/usr/bin/
324 endef
325
326
327 $(eval $(call BuildPackage,iotivity))
328 $(eval $(call BuildPackage,iotivity-cpp))
329 $(eval $(call BuildPackage,iotivity-things-manager-lib))
330 $(eval $(call BuildPackage,iotivity-oic-middle))
331 $(eval $(call BuildPackage,iotivity-things-manager))
332 $(eval $(call BuildPackage,iotivity-resource-container-lib))
333 $(eval $(call BuildPackage,iotivity-resource-container-sample))
334 $(eval $(call BuildPackage,iotivity-resource-container-hue))
335 $(eval $(call BuildPackage,iotivity-example-garage))
336 $(eval $(call BuildPackage,iotivity-example-simple))