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.

311 lines
9.5 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=1
  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
  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_SOURCE:=$(PKG_TINYCBOR_NAME)-$(PKG_TINYCBOR_VERSION).tar.bz2
  137. PKG_TINYCBOR_SOURCE_URL:=https://github.com/01org/tinycbor.git
  138. PKG_TINYCBOR_SUBDIR:=$(PKG_TINYCBOR_NAME)
  139. define Download/iotivity-tinycbor
  140. FILE:=$(PKG_TINYCBOR_SOURCE)
  141. URL:=$(PKG_TINYCBOR_SOURCE_URL)
  142. PROTO:=$(PKG_TINYCBOR_PROTO)
  143. VERSION:=$(PKG_TINYCBOR_SOURCE_VERSION)
  144. SUBDIR:=$(PKG_TINYCBOR_SUBDIR)
  145. endef
  146. $(eval $(call Download,iotivity-tinycbor))
  147. EXTRA_CXXFLAGS += -std=gnu++11
  148. SCONS_OPTIONS += \
  149. TARGET_OS=linux \
  150. TARGET_TRANSPORT=IP \
  151. TARGET_ARCH=$(ARCH) \
  152. STAGING_DIR=$(STAGING_DIR) \
  153. WITH_ENV=true \
  154. octbstack oc \
  155. $(if $(CONFIG_PACKAGE_iotivity-oic-middle),examples) \
  156. $(if $(CONFIG_PACKAGE_iotivity-resource-container-lib),libResContainer) \
  157. $(if $(CONFIG_PACKAGE_iotivity-resource-container-sample),containersample) \
  158. $(if $(CONFIG_PACKAGE_iotivity-resource-container-hue),libHueBundle) \
  159. $(if $(CONFIG_PACKAGE_iotivity-example-garage),examples) \
  160. $(if $(CONFIG_PACKAGE_iotivity-example-simple),examples) \
  161. install
  162. ifeq ($(CONFIG_PACKAGE_iotivity_DEBUG),y)
  163. SCONS_OPTIONS += RELEASE=false
  164. APP_OPTIM:=debug
  165. else
  166. SCONS_OPTIONS += RELEASE=true
  167. APP_OPTIM:=release
  168. endif
  169. ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
  170. SCONS_OPTIONS += SECURED=1
  171. else
  172. SCONS_OPTIONS += SECURED=0
  173. endif
  174. ifeq ($(CONFIG_PACKAGE_iotivity_LOGGING),y)
  175. SCONS_OPTIONS += LOGGING=true
  176. endif
  177. ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  178. SCONS_OPTIONS += VERBOSE=true
  179. endif
  180. define Build/Prepare
  181. $(call Build/Prepare/Default)
  182. $(TAR) -C $(PKG_BUILD_DIR)/extlibs/tinycbor/ -xjf $(DL_DIR)/$(PKG_TINYCBOR_SOURCE)
  183. endef
  184. define Build/Configure
  185. (cd $(PKG_BUILD_DIR); \
  186. $(SCONS_VARS) \
  187. scons \
  188. $(SCONS_OPTIONS) \
  189. )
  190. endef
  191. define Package/iotivity/install
  192. $(INSTALL_DIR) $(1)/usr/lib
  193. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/
  194. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
  195. ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
  196. $(INSTALL_DIR) $(1)/etc/iotivity/
  197. $(INSTALL_DATA) ./files/etc/iotivity/oic_svr_db.cbor $(1)/etc/iotivity/
  198. endif
  199. endef
  200. define Package/iotivity-cpp/install
  201. $(INSTALL_DIR) $(1)/usr/lib
  202. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/
  203. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
  204. endef
  205. define Package/iotivity-resource-directory-lib/install
  206. $(INSTALL_DIR) $(1)/usr/lib
  207. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/
  208. endef
  209. define Package/iotivity-oic-middle/install
  210. $(INSTALL_DIR) $(1)/usr/bin
  211. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/examples/OICMiddle/OICMiddle $(1)/usr/bin/
  212. endef
  213. define Package/iotivity-resource-container-lib/install
  214. $(INSTALL_DIR) $(1)/usr/lib
  215. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_common.so $(1)/usr/lib/
  216. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_client.so $(1)/usr/lib/
  217. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_server.so $(1)/usr/lib/
  218. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_container.so $(1)/usr/lib/
  219. endef
  220. define Package/iotivity-resource-container-sample/install
  221. $(INSTALL_DIR) $(1)/usr/bin
  222. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/resource-container/ContainerSample $(1)/usr/bin/
  223. endef
  224. define Package/iotivity-resource-container-hue/install
  225. $(INSTALL_DIR) $(1)/usr/lib
  226. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libHueBundle.so $(1)/usr/lib/
  227. endef
  228. define Package/iotivity-example-garage/install
  229. $(INSTALL_DIR) $(1)/usr/bin
  230. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageclient $(1)/usr/bin/
  231. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageserver $(1)/usr/bin/
  232. endef
  233. define Package/iotivity-example-simple/install
  234. $(INSTALL_DIR) $(1)/usr/bin
  235. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleclient $(1)/usr/bin/
  236. $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleserver $(1)/usr/bin/
  237. endef
  238. define Build/InstallDev
  239. $(INSTALL_DIR) $(1)/usr/include
  240. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/include $(1)/usr/include/iotivity
  241. $(INSTALL_DIR) $(1)/usr/lib
  242. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/
  243. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
  244. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/
  245. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
  246. $(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/
  247. endef
  248. $(eval $(call BuildPackage,iotivity))
  249. $(eval $(call BuildPackage,iotivity-cpp))
  250. $(eval $(call BuildPackage,iotivity-resource-directory-lib))
  251. $(eval $(call BuildPackage,iotivity-oic-middle))
  252. $(eval $(call BuildPackage,iotivity-resource-container-lib))
  253. $(eval $(call BuildPackage,iotivity-resource-container-sample))
  254. $(eval $(call BuildPackage,iotivity-resource-container-hue))
  255. $(eval $(call BuildPackage,iotivity-example-garage))
  256. $(eval $(call BuildPackage,iotivity-example-simple))