You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

313 lines
9.7 KiB

  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. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=iotivity
  9. PKG_VERSION:=1.2.1
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz
  12. PKG_SOURCE_URL:=http://mirrors.kernel.org/${PKG_NAME}/${PKG_VERSION}/
  13. PKG_HASH:=7dcd9f0f48263c6b27a2c3d085dd7278b5c0feed1dfec8872a04899707fa23d8
  14. PKG_USE_MIPS16:=0
  15. PKG_BUILD_DEPENDS:=boost python/host
  16. PKG_MAINTAINER:=Hauke Mehrtens <hauke.mehrtens@intel.com>
  17. PKG_LICENSE:=Apache-2.0
  18. PKG_LICENSE_FILES:=LICENSE.md
  19. PKG_CONFIG_DEPENDS := \
  20. CONFIG_PACKAGE_iotivity \
  21. CONFIG_PACKAGE_iotivity-cpp \
  22. CONFIG_PACKAGE_iotivity-resource-directory-lib \
  23. CONFIG_PACKAGE_iotivity-oic-middle \
  24. CONFIG_PACKAGE_iotivity-resource-container-lib \
  25. CONFIG_PACKAGE_iotivity-resource-container-sample \
  26. CONFIG_PACKAGE_iotivity-resource-container-hue \
  27. CONFIG_PACKAGE_iotivity-example-garage \
  28. CONFIG_PACKAGE_iotivity-example-simple \
  29. CONFIG_PACKAGE_iotivity_DEBUG \
  30. CONFIG_PACKAGE_iotivity_SECURE
  31. include $(INCLUDE_DIR)/package.mk
  32. include $(INCLUDE_DIR)/scons.mk
  33. define Package/iotivity
  34. SECTION:=net
  35. CATEGORY:=Network
  36. DEPENDS:=@!USE_UCLIBC +libpthread +librt +libuuid +libsqlite3 +PACKAGE_iotivity_SECURE:libmbedtls
  37. TITLE:=IoTivity C Library
  38. URL:=https://www.iotivity.org
  39. MENU:=1
  40. endef
  41. define Package/iotivity/description
  42. IoTivity is a framework for the Internet of Things based on the
  43. Open Interconnect Consortium Specification.
  44. endef
  45. define Package/iotivity/config
  46. if PACKAGE_iotivity
  47. config PACKAGE_iotivity_DEBUG
  48. bool "IoTivity with debug support"
  49. help
  50. Build IoTivity with debuging support.
  51. config PACKAGE_iotivity_SECURE
  52. bool "IoTivity with security support"
  53. help
  54. Activate security support.
  55. config PACKAGE_iotivity_LOGGING
  56. bool "IoTivity with logging support"
  57. default y
  58. help
  59. Activate logging support.
  60. This will make IoTivity write a lot of log messages to stdout.
  61. endif
  62. endef
  63. define Package/iotivity-cpp
  64. SECTION:=net
  65. CATEGORY:=Network
  66. DEPENDS:=+iotivity +libpthread +libstdcpp
  67. TITLE:=IoTivity C++ Library
  68. URL:=https://www.iotivity.org
  69. endef
  70. define Package/iotivity-cpp/description
  71. IoTivity is a framework for the Internet of Things based on the
  72. Open Interconnect Consortium Specification.
  73. endef
  74. define Package/iotivity-resource-directory-lib
  75. SECTION:=net
  76. CATEGORY:=Network
  77. DEPENDS:=+iotivity +iotivity-cpp
  78. TITLE:=IoTivity Resource Directory library
  79. URL:=https://www.iotivity.org
  80. endef
  81. define Package/iotivity-oic-middle
  82. SECTION:=net
  83. CATEGORY:=Network
  84. DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib
  85. TITLE:=IoTivity OIC Middle
  86. URL:=https://www.iotivity.org
  87. endef
  88. define Package/iotivity-oic-middle/description
  89. IoTivity OIC Middle
  90. endef
  91. define Package/iotivity-resource-container-lib
  92. SECTION:=net
  93. CATEGORY:=Network
  94. DEPENDS:=+iotivity +iotivity-cpp +boost +boost-system +boost-thread +boost-date_time
  95. TITLE:=IoTivity Resource Container library
  96. URL:=https://www.iotivity.org
  97. endef
  98. define Package/iotivity-resource-container-sample
  99. SECTION:=net
  100. CATEGORY:=Network
  101. DEPENDS:=+iotivity +iotivity-resource-container-lib
  102. TITLE:=IoTivity Resource Container sample Application
  103. URL:=https://www.iotivity.org
  104. endef
  105. define Package/iotivity-resource-container-hue
  106. SECTION:=net
  107. CATEGORY:=Network
  108. DEPENDS:=+iotivity +iotivity-resource-container-lib +libcurl
  109. TITLE:=IoTivity Resource Container Hue Bundle
  110. URL:=https://www.iotivity.org
  111. endef
  112. define Package/iotivity-example-garage
  113. SECTION:=net
  114. CATEGORY:=Network
  115. DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib
  116. TITLE:=IoTivity Garage example
  117. URL:=https://www.iotivity.org
  118. endef
  119. define Package/iotivity-example-garage/description
  120. An IoTivity example application
  121. endef
  122. define Package/iotivity-example-simple
  123. SECTION:=net
  124. CATEGORY:=Network
  125. DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib
  126. TITLE:=IoTivity simple client + server
  127. URL:=https://www.iotivity.org
  128. endef
  129. define Package/iotivity-example-simple/description
  130. The IoTivity simple client and simple server exmaple
  131. endef
  132. PKG_TINYCBOR_NAME:=tinycbor
  133. PKG_TINYCBOR_PROTO:=git
  134. PKG_TINYCBOR_VERSION:=0.4
  135. PKG_TINYCBOR_SOURCE_VERSION:=a088996aa5f59b4f27f20fadad053d88bee357d4
  136. PKG_TINYCBOR_MIRROR_HASH:=77c600bd7362df8291148fa3d94ca780815ea2b74b817dca7565310ea0abff96
  137. PKG_TINYCBOR_SOURCE:=$(PKG_TINYCBOR_NAME)-$(PKG_TINYCBOR_VERSION).tar.bz2
  138. PKG_TINYCBOR_SOURCE_URL:=https://github.com/01org/tinycbor.git
  139. PKG_TINYCBOR_SUBDIR:=$(PKG_TINYCBOR_NAME)
  140. define Download/iotivity-tinycbor
  141. FILE:=$(PKG_TINYCBOR_SOURCE)
  142. URL:=$(PKG_TINYCBOR_SOURCE_URL)
  143. MIRROR_HASH:=$(PKG_TINYCBOR_MIRROR_HASH)
  144. PROTO:=$(PKG_TINYCBOR_PROTO)
  145. VERSION:=$(PKG_TINYCBOR_SOURCE_VERSION)
  146. SUBDIR:=$(PKG_TINYCBOR_SUBDIR)
  147. endef
  148. $(eval $(call Download,iotivity-tinycbor))
  149. EXTRA_CXXFLAGS += -std=gnu++11
  150. SCONS_OPTIONS += \
  151. TARGET_OS=linux \
  152. TARGET_TRANSPORT=IP \
  153. TARGET_ARCH=$(ARCH) \
  154. STAGING_DIR=$(STAGING_DIR) \
  155. WITH_ENV=true \
  156. octbstack oc \
  157. $(if $(CONFIG_PACKAGE_iotivity-oic-middle),examples) \
  158. $(if $(CONFIG_PACKAGE_iotivity-resource-container-lib),libResContainer) \
  159. $(if $(CONFIG_PACKAGE_iotivity-resource-container-sample),containersample) \
  160. $(if $(CONFIG_PACKAGE_iotivity-resource-container-hue),libHueBundle) \
  161. $(if $(CONFIG_PACKAGE_iotivity-example-garage),examples) \
  162. $(if $(CONFIG_PACKAGE_iotivity-example-simple),examples) \
  163. install
  164. ifeq ($(CONFIG_PACKAGE_iotivity_DEBUG),y)
  165. SCONS_OPTIONS += RELEASE=false
  166. APP_OPTIM:=debug
  167. else
  168. SCONS_OPTIONS += RELEASE=true
  169. APP_OPTIM:=release
  170. endif
  171. ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
  172. SCONS_OPTIONS += SECURED=1
  173. else
  174. SCONS_OPTIONS += SECURED=0
  175. endif
  176. ifeq ($(CONFIG_PACKAGE_iotivity_LOGGING),y)
  177. SCONS_OPTIONS += LOGGING=true
  178. endif
  179. ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  180. SCONS_OPTIONS += VERBOSE=true
  181. endif
  182. define Build/Prepare
  183. $(call Build/Prepare/Default)
  184. $(TAR) -C $(PKG_BUILD_DIR)/extlibs/tinycbor/ -xjf $(DL_DIR)/$(PKG_TINYCBOR_SOURCE)
  185. endef
  186. define Build/Configure
  187. (cd $(PKG_BUILD_DIR); \
  188. $(SCONS_VARS) \
  189. python2.7 $(STAGING_DIR_HOST)/bin/scons.py \
  190. $(SCONS_OPTIONS) \
  191. )
  192. endef
  193. define Package/iotivity/install
  194. $(INSTALL_DIR) $(1)/usr/lib
  195. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/
  196. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
  197. ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
  198. $(INSTALL_DIR) $(1)/etc/iotivity/
  199. $(INSTALL_DATA) ./files/etc/iotivity/oic_svr_db.cbor $(1)/etc/iotivity/
  200. endif
  201. endef
  202. define Package/iotivity-cpp/install
  203. $(INSTALL_DIR) $(1)/usr/lib
  204. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/
  205. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
  206. endef
  207. define Package/iotivity-resource-directory-lib/install
  208. $(INSTALL_DIR) $(1)/usr/lib
  209. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/
  210. endef
  211. define Package/iotivity-oic-middle/install
  212. $(INSTALL_DIR) $(1)/usr/bin
  213. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/examples/OICMiddle/OICMiddle $(1)/usr/bin/
  214. endef
  215. define Package/iotivity-resource-container-lib/install
  216. $(INSTALL_DIR) $(1)/usr/lib
  217. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_common.so $(1)/usr/lib/
  218. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_client.so $(1)/usr/lib/
  219. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_server.so $(1)/usr/lib/
  220. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_container.so $(1)/usr/lib/
  221. endef
  222. define Package/iotivity-resource-container-sample/install
  223. $(INSTALL_DIR) $(1)/usr/bin
  224. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/resource-container/ContainerSample $(1)/usr/bin/
  225. endef
  226. define Package/iotivity-resource-container-hue/install
  227. $(INSTALL_DIR) $(1)/usr/lib
  228. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libHueBundle.so $(1)/usr/lib/
  229. endef
  230. define Package/iotivity-example-garage/install
  231. $(INSTALL_DIR) $(1)/usr/bin
  232. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageclient $(1)/usr/bin/
  233. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageserver $(1)/usr/bin/
  234. endef
  235. define Package/iotivity-example-simple/install
  236. $(INSTALL_DIR) $(1)/usr/bin
  237. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleclient $(1)/usr/bin/
  238. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleserver $(1)/usr/bin/
  239. endef
  240. define Build/InstallDev
  241. $(INSTALL_DIR) $(1)/usr/include
  242. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/include $(1)/usr/include/iotivity
  243. $(INSTALL_DIR) $(1)/usr/lib
  244. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/
  245. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
  246. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/
  247. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
  248. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/
  249. endef
  250. $(eval $(call BuildPackage,iotivity))
  251. $(eval $(call BuildPackage,iotivity-cpp))
  252. $(eval $(call BuildPackage,iotivity-resource-directory-lib))
  253. $(eval $(call BuildPackage,iotivity-oic-middle))
  254. $(eval $(call BuildPackage,iotivity-resource-container-lib))
  255. $(eval $(call BuildPackage,iotivity-resource-container-sample))
  256. $(eval $(call BuildPackage,iotivity-resource-container-hue))
  257. $(eval $(call BuildPackage,iotivity-example-garage))
  258. $(eval $(call BuildPackage,iotivity-example-simple))