Merge pull request #4853 from StevenHessing/noddos
[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.2.1
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_HASH:=7dcd9f0f48263c6b27a2c3d085dd7278b5c0feed1dfec8872a04899707fa23d8
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-resource-directory-lib \
30 CONFIG_PACKAGE_iotivity-oic-middle \
31 CONFIG_PACKAGE_iotivity-resource-container-lib \
32 CONFIG_PACKAGE_iotivity-resource-container-sample \
33 CONFIG_PACKAGE_iotivity-resource-container-hue \
34 CONFIG_PACKAGE_iotivity-example-garage \
35 CONFIG_PACKAGE_iotivity-example-simple \
36 CONFIG_PACKAGE_iotivity_DEBUG \
37 CONFIG_PACKAGE_iotivity_SECURE
38
39 include $(INCLUDE_DIR)/package.mk
40 include $(INCLUDE_DIR)/scons.mk
41
42
43 define Package/iotivity
44 SECTION:=net
45 CATEGORY:=Network
46 DEPENDS:=@!USE_UCLIBC +libpthread +librt +libuuid +libsqlite3 +PACKAGE_iotivity_SECURE:libmbedtls
47 TITLE:=IoTivity C Library
48 URL:=https://www.iotivity.org
49 MENU:=1
50 endef
51
52 define Package/iotivity/description
53 IoTivity is a framework for the Internet of Things based on the
54 Open Interconnect Consortium Specification.
55 endef
56
57 define Package/iotivity/config
58 if PACKAGE_iotivity
59 config PACKAGE_iotivity_DEBUG
60 bool "IoTivity with debug support"
61 help
62 Build IoTivity with debuging support.
63
64 config PACKAGE_iotivity_SECURE
65 bool "IoTivity with security support"
66 help
67 Activate security support.
68
69 config PACKAGE_iotivity_LOGGING
70 bool "IoTivity with logging support"
71 default y
72 help
73 Activate logging support.
74 This will make IoTivity write a lot of log messages to stdout.
75 endif
76 endef
77
78
79 define Package/iotivity-cpp
80 SECTION:=net
81 CATEGORY:=Network
82 DEPENDS:=+iotivity +libpthread +libstdcpp
83 TITLE:=IoTivity C++ Library
84 URL:=https://www.iotivity.org
85 endef
86
87 define Package/iotivity-cpp/description
88 IoTivity is a framework for the Internet of Things based on the
89 Open Interconnect Consortium Specification.
90 endef
91
92 define Package/iotivity-resource-directory-lib
93 SECTION:=net
94 CATEGORY:=Network
95 DEPENDS:=+iotivity +iotivity-cpp
96 TITLE:=IoTivity Resource Directory library
97 URL:=https://www.iotivity.org
98 endef
99
100
101 define Package/iotivity-oic-middle
102 SECTION:=net
103 CATEGORY:=Network
104 DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib
105 TITLE:=IoTivity OIC Middle
106 URL:=https://www.iotivity.org
107 endef
108
109 define Package/iotivity-oic-middle/description
110 IoTivity OIC Middle
111 endef
112
113 define Package/iotivity-resource-container-lib
114 SECTION:=net
115 CATEGORY:=Network
116 DEPENDS:=+iotivity +iotivity-cpp +boost +boost-system +boost-thread +boost-date_time
117 TITLE:=IoTivity Resource Container library
118 URL:=https://www.iotivity.org
119 endef
120
121 define Package/iotivity-resource-container-sample
122 SECTION:=net
123 CATEGORY:=Network
124 DEPENDS:=+iotivity +iotivity-resource-container-lib
125 TITLE:=IoTivity Resource Container sample Application
126 URL:=https://www.iotivity.org
127 endef
128
129 define Package/iotivity-resource-container-hue
130 SECTION:=net
131 CATEGORY:=Network
132 DEPENDS:=+iotivity +iotivity-resource-container-lib +libcurl
133 TITLE:=IoTivity Resource Container Hue Bundle
134 URL:=https://www.iotivity.org
135 endef
136
137 define Package/iotivity-example-garage
138 SECTION:=net
139 CATEGORY:=Network
140 DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib
141 TITLE:=IoTivity Garage example
142 URL:=https://www.iotivity.org
143 endef
144
145 define Package/iotivity-example-garage/description
146 An IoTivity example application
147 endef
148
149 define Package/iotivity-example-simple
150 SECTION:=net
151 CATEGORY:=Network
152 DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib
153 TITLE:=IoTivity simple client + server
154 URL:=https://www.iotivity.org
155 endef
156
157 define Package/iotivity-example-simple/description
158 The IoTivity simple client and simple server exmaple
159 endef
160
161
162 PKG_TINYCBOR_NAME:=tinycbor
163 PKG_TINYCBOR_PROTO:=git
164 PKG_TINYCBOR_VERSION:=0.4
165 PKG_TINYCBOR_SOURCE_VERSION:=a088996aa5f59b4f27f20fadad053d88bee357d4
166 PKG_TINYCBOR_MIRROR_HASH:=77c600bd7362df8291148fa3d94ca780815ea2b74b817dca7565310ea0abff96
167 PKG_TINYCBOR_SOURCE:=$(PKG_TINYCBOR_NAME)-$(PKG_TINYCBOR_VERSION).tar.bz2
168 PKG_TINYCBOR_SOURCE_URL:=https://github.com/01org/tinycbor.git
169 PKG_TINYCBOR_SUBDIR:=$(PKG_TINYCBOR_NAME)
170
171 define Download/iotivity-tinycbor
172 FILE:=$(PKG_TINYCBOR_SOURCE)
173 URL:=$(PKG_TINYCBOR_SOURCE_URL)
174 MIRROR_HASH:=$(PKG_TINYCBOR_MIRROR_HASH)
175 PROTO:=$(PKG_TINYCBOR_PROTO)
176 VERSION:=$(PKG_TINYCBOR_SOURCE_VERSION)
177 SUBDIR:=$(PKG_TINYCBOR_SUBDIR)
178 endef
179 $(eval $(call Download,iotivity-tinycbor))
180
181
182 EXTRA_CXXFLAGS += -std=gnu++11
183
184 SCONS_OPTIONS += \
185 TARGET_OS=linux \
186 TARGET_TRANSPORT=IP \
187 TARGET_ARCH=$(ARCH) \
188 STAGING_DIR=$(STAGING_DIR) \
189 WITH_ENV=true \
190 octbstack oc \
191 $(if $(CONFIG_PACKAGE_iotivity-oic-middle),examples) \
192 $(if $(CONFIG_PACKAGE_iotivity-resource-container-lib),libResContainer) \
193 $(if $(CONFIG_PACKAGE_iotivity-resource-container-sample),containersample) \
194 $(if $(CONFIG_PACKAGE_iotivity-resource-container-hue),libHueBundle) \
195 $(if $(CONFIG_PACKAGE_iotivity-example-garage),examples) \
196 $(if $(CONFIG_PACKAGE_iotivity-example-simple),examples) \
197 install
198
199 ifeq ($(CONFIG_PACKAGE_iotivity_DEBUG),y)
200 SCONS_OPTIONS += RELEASE=false
201 APP_OPTIM:=debug
202 else
203 SCONS_OPTIONS += RELEASE=true
204 APP_OPTIM:=release
205 endif
206
207 ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
208 SCONS_OPTIONS += SECURED=1
209 else
210 SCONS_OPTIONS += SECURED=0
211 endif
212
213 ifeq ($(CONFIG_PACKAGE_iotivity_LOGGING),y)
214 SCONS_OPTIONS += LOGGING=true
215 endif
216
217 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
218 SCONS_OPTIONS += VERBOSE=true
219 endif
220
221 define Build/Prepare
222 $(call Build/Prepare/Default)
223 $(TAR) -C $(PKG_BUILD_DIR)/extlibs/tinycbor/ -xjf $(DL_DIR)/$(PKG_TINYCBOR_SOURCE)
224 endef
225
226
227 define Build/Configure
228 (cd $(PKG_BUILD_DIR); \
229 $(SCONS_VARS) \
230 scons \
231 $(SCONS_OPTIONS) \
232 )
233 endef
234
235
236 define Package/iotivity/install
237 $(INSTALL_DIR) $(1)/usr/lib
238 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/
239 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
240 ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
241 $(INSTALL_DIR) $(1)/etc/iotivity/
242 $(INSTALL_DATA) ./files/etc/iotivity/oic_svr_db.cbor $(1)/etc/iotivity/
243 endif
244 endef
245
246 define Package/iotivity-cpp/install
247 $(INSTALL_DIR) $(1)/usr/lib
248 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/
249 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
250 endef
251
252 define Package/iotivity-resource-directory-lib/install
253 $(INSTALL_DIR) $(1)/usr/lib
254 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/
255 endef
256
257 define Package/iotivity-oic-middle/install
258 $(INSTALL_DIR) $(1)/usr/bin
259 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/examples/OICMiddle/OICMiddle $(1)/usr/bin/
260 endef
261
262 define Package/iotivity-resource-container-lib/install
263 $(INSTALL_DIR) $(1)/usr/lib
264 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_common.so $(1)/usr/lib/
265 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_client.so $(1)/usr/lib/
266 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_server.so $(1)/usr/lib/
267 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_container.so $(1)/usr/lib/
268 endef
269
270 define Package/iotivity-resource-container-sample/install
271 $(INSTALL_DIR) $(1)/usr/bin
272 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/resource-container/ContainerSample $(1)/usr/bin/
273 endef
274
275 define Package/iotivity-resource-container-hue/install
276 $(INSTALL_DIR) $(1)/usr/lib
277 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libHueBundle.so $(1)/usr/lib/
278 endef
279
280 define Package/iotivity-example-garage/install
281 $(INSTALL_DIR) $(1)/usr/bin
282 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageclient $(1)/usr/bin/
283 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageserver $(1)/usr/bin/
284 endef
285
286 define Package/iotivity-example-simple/install
287 $(INSTALL_DIR) $(1)/usr/bin
288 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleclient $(1)/usr/bin/
289 $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleserver $(1)/usr/bin/
290 endef
291
292 define Build/InstallDev
293 $(INSTALL_DIR) $(1)/usr/include
294 $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/include $(1)/usr/include/iotivity
295
296 $(INSTALL_DIR) $(1)/usr/lib
297 $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/
298 $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
299 $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/
300 $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
301 $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/
302 endef
303
304
305 $(eval $(call BuildPackage,iotivity))
306 $(eval $(call BuildPackage,iotivity-cpp))
307 $(eval $(call BuildPackage,iotivity-resource-directory-lib))
308 $(eval $(call BuildPackage,iotivity-oic-middle))
309 $(eval $(call BuildPackage,iotivity-resource-container-lib))
310 $(eval $(call BuildPackage,iotivity-resource-container-sample))
311 $(eval $(call BuildPackage,iotivity-resource-container-hue))
312 $(eval $(call BuildPackage,iotivity-example-garage))
313 $(eval $(call BuildPackage,iotivity-example-simple))