e1491f7794242bccc19f3ae7ab1ab13c427dd2db
[librecmc/package-feed.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_MD5SUM:=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_SOURCE:=$(PKG_TINYCBOR_NAME)-$(PKG_TINYCBOR_VERSION).tar.bz2
167 PKG_TINYCBOR_SOURCE_URL:=https://github.com/01org/tinycbor.git
168 PKG_TINYCBOR_SUBDIR:=$(PKG_TINYCBOR_NAME)
169
170 define Download/iotivity-tinycbor
171   FILE:=$(PKG_TINYCBOR_SOURCE)
172   URL:=$(PKG_TINYCBOR_SOURCE_URL)
173   PROTO:=$(PKG_TINYCBOR_PROTO)
174   VERSION:=$(PKG_TINYCBOR_SOURCE_VERSION)
175   SUBDIR:=$(PKG_TINYCBOR_SUBDIR)
176 endef
177 $(eval $(call Download,iotivity-tinycbor))
178
179
180 EXTRA_CXXFLAGS += -std=gnu++11
181
182 SCONS_OPTIONS += \
183         TARGET_OS=linux \
184         TARGET_TRANSPORT=IP \
185         TARGET_ARCH=$(ARCH) \
186         STAGING_DIR=$(STAGING_DIR) \
187         WITH_ENV=true \
188         octbstack oc \
189         $(if $(CONFIG_PACKAGE_iotivity-oic-middle),examples) \
190         $(if $(CONFIG_PACKAGE_iotivity-resource-container-lib),libResContainer) \
191         $(if $(CONFIG_PACKAGE_iotivity-resource-container-sample),containersample) \
192         $(if $(CONFIG_PACKAGE_iotivity-resource-container-hue),libHueBundle) \
193         $(if $(CONFIG_PACKAGE_iotivity-example-garage),examples) \
194         $(if $(CONFIG_PACKAGE_iotivity-example-simple),examples) \
195         install
196
197 ifeq ($(CONFIG_PACKAGE_iotivity_DEBUG),y)
198   SCONS_OPTIONS += RELEASE=false
199   APP_OPTIM:=debug
200 else
201   SCONS_OPTIONS += RELEASE=true
202   APP_OPTIM:=release
203 endif
204
205 ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
206   SCONS_OPTIONS += SECURED=1
207 else
208   SCONS_OPTIONS += SECURED=0
209 endif
210
211 ifeq ($(CONFIG_PACKAGE_iotivity_LOGGING),y)
212   SCONS_OPTIONS += LOGGING=true
213 endif
214
215 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
216   SCONS_OPTIONS += VERBOSE=true
217 endif
218
219 define Build/Prepare
220         $(call Build/Prepare/Default)
221         $(TAR) -C $(PKG_BUILD_DIR)/extlibs/tinycbor/ -xjf $(DL_DIR)/$(PKG_TINYCBOR_SOURCE)
222 endef
223
224
225 define Build/Configure
226         (cd $(PKG_BUILD_DIR); \
227                 $(SCONS_VARS) \
228                 scons \
229                         $(SCONS_OPTIONS) \
230         )
231 endef
232
233
234 define Package/iotivity/install
235         $(INSTALL_DIR) $(1)/usr/lib
236         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/
237         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
238 ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
239         $(INSTALL_DIR) $(1)/etc/iotivity/
240         $(INSTALL_DATA) ./files/etc/iotivity/oic_svr_db.cbor $(1)/etc/iotivity/
241 endif
242 endef
243
244 define Package/iotivity-cpp/install
245         $(INSTALL_DIR) $(1)/usr/lib
246         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/
247         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
248 endef
249
250 define Package/iotivity-resource-directory-lib/install
251         $(INSTALL_DIR) $(1)/usr/lib
252         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/
253 endef
254
255 define Package/iotivity-oic-middle/install
256         $(INSTALL_DIR) $(1)/usr/bin
257         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/examples/OICMiddle/OICMiddle $(1)/usr/bin/
258 endef
259
260 define Package/iotivity-resource-container-lib/install
261         $(INSTALL_DIR) $(1)/usr/lib
262         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_common.so $(1)/usr/lib/
263         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_client.so $(1)/usr/lib/
264         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_server.so $(1)/usr/lib/
265         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_container.so $(1)/usr/lib/
266 endef
267
268 define Package/iotivity-resource-container-sample/install
269         $(INSTALL_DIR) $(1)/usr/bin
270         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/resource-container/ContainerSample  $(1)/usr/bin/
271 endef
272
273 define Package/iotivity-resource-container-hue/install
274         $(INSTALL_DIR) $(1)/usr/lib
275         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libHueBundle.so $(1)/usr/lib/
276 endef
277
278 define Package/iotivity-example-garage/install
279         $(INSTALL_DIR) $(1)/usr/bin
280         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageclient $(1)/usr/bin/
281         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageserver $(1)/usr/bin/
282 endef
283
284 define Package/iotivity-example-simple/install
285         $(INSTALL_DIR) $(1)/usr/bin
286         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleclient $(1)/usr/bin/
287         $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleserver $(1)/usr/bin/
288 endef
289
290 define Build/InstallDev
291         $(INSTALL_DIR) $(1)/usr/include
292         $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/include $(1)/usr/include/iotivity
293
294         $(INSTALL_DIR) $(1)/usr/lib
295         $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/
296         $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
297         $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/
298         $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
299         $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/
300 endef
301         
302
303 $(eval $(call BuildPackage,iotivity))
304 $(eval $(call BuildPackage,iotivity-cpp))
305 $(eval $(call BuildPackage,iotivity-resource-directory-lib))
306 $(eval $(call BuildPackage,iotivity-oic-middle))
307 $(eval $(call BuildPackage,iotivity-resource-container-lib))
308 $(eval $(call BuildPackage,iotivity-resource-container-sample))
309 $(eval $(call BuildPackage,iotivity-resource-container-hue))
310 $(eval $(call BuildPackage,iotivity-example-garage))
311 $(eval $(call BuildPackage,iotivity-example-simple))