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.

251 lines
7.9 KiB

  1. #
  2. # Copyright (C) 2011-2013 OpenWrt.org
  3. # Copyright (C) 2010 Jo-Philipp Wich <xm@subsignal.org>
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=mosquitto
  10. PKG_VERSION:=2.0.9
  11. PKG_RELEASE:=1
  12. PKG_LICENSE:=EPL-2.0
  13. PKG_LICENSE_FILES:=LICENSE.txt
  14. PKG_CPE_ID:=cpe:/a:eclipse:mosquitto
  15. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  16. PKG_SOURCE_URL:=https://mosquitto.org/files/source/
  17. PKG_HASH:=1b8553ef64a1cf5e4f4cfbe098330ae612adccd3d37f35b2db6f6fab501b01d4
  18. include $(INCLUDE_DIR)/package.mk
  19. define Package/mosquitto/default
  20. SECTION:=net
  21. CATEGORY:=Network
  22. TITLE:=mosquitto - an MQTT message broker
  23. URL:=http://www.mosquitto.org/
  24. MAINTAINER:=Karl Palsson <karlp@etactica.com>
  25. DEPENDS:= +librt
  26. USERID:=mosquitto=200:mosquitto=200
  27. endef
  28. define Package/mosquitto-ssl
  29. $(call Package/mosquitto/default)
  30. TITLE+= (with SSL support)
  31. DEPENDS+= +libopenssl +MOSQUITTO_LWS:libwebsockets-openssl +MOSQUITTO_DYNAMIC_SECURITY:cJSON
  32. VARIANT:=ssl
  33. PROVIDES:=mosquitto
  34. endef
  35. define Package/mosquitto-nossl
  36. $(call Package/mosquitto/default)
  37. TITLE+= (without SSL support)
  38. VARIANT:=nossl
  39. PROVIDES:=mosquitto
  40. endef
  41. define Package/mosquitto-ssl/config
  42. source "$(SOURCE)/Config.in"
  43. endef
  44. define Package/mosquitto/default/description
  45. Mosquitto is an open source (BSD licensed) message broker that implements
  46. the MQTT protocol version 3.1, 3.1.1 and 5. MQTT provides a lightweight
  47. method of carrying out messaging using a publish/subscribe model.
  48. This package also includes some basic support for configuring via UCI
  49. endef
  50. define Package/mosquitto-ssl/description
  51. $(call Package/mosquitto/default/description)
  52. This package is built with SSL support. TLS-PSK will be included (in both
  53. the client and broker) if OpenSSL is built with TLS-PSK support.
  54. endef
  55. define Package/mosquitto-nossl/description
  56. $(call Package/mosquitto/default/description)
  57. This package is built WITHOUT SSL support.
  58. endef
  59. define Package/mosquitto-client/default
  60. $(Package/mosquitto/default)
  61. TITLE:= mosquitto - client tools
  62. DEPENDS+=+libcares +cJSON
  63. PROVIDES:=mosquitto-client
  64. endef
  65. define Package/mosquitto-client-ssl
  66. $(call Package/mosquitto-client/default)
  67. TITLE+= (With SSL support)
  68. DEPENDS+=+libmosquitto-ssl
  69. VARIANT:=ssl
  70. endef
  71. define Package/mosquitto-client-nossl
  72. $(call Package/mosquitto-client/default)
  73. TITLE+= (Without SSL support)
  74. DEPENDS+=+libmosquitto-nossl
  75. VARIANT:=nossl
  76. endef
  77. define Package/mosquitto-client/default/description
  78. Command line client tools for working with mosquitto.
  79. This includes mosquitto_sub, mosquitto_pub, mosquitto_rr
  80. and the mosquitto_ctrl tool.
  81. endef
  82. define Package/mosquitto-client-ssl/description
  83. $(call Package/mosquitto-client/default/description)
  84. This package is built with SSL support
  85. endef
  86. define Package/mosquitto-client-nossl/description
  87. $(call Package/mosquitto-client/default/description)
  88. This package is built without SSL support
  89. endef
  90. define Package/libmosquitto/default
  91. $(Package/mosquitto/default)
  92. SECTION:=libs
  93. CATEGORY:=Libraries
  94. DEPENDS:=+libpthread +librt +libcares
  95. TITLE:= mosquitto - client library
  96. PROVIDES:=libmosquitto
  97. endef
  98. define Package/libmosquitto-ssl
  99. $(call Package/libmosquitto/default)
  100. TITLE+= (With SSL Support)
  101. DEPENDS+= +libopenssl
  102. VARIANT=ssl
  103. endef
  104. define Package/libmosquitto-nossl
  105. $(call Package/libmosquitto/default)
  106. TITLE+= (Without SSL Support)
  107. VARIANT=nossl
  108. endef
  109. define Package/libmosquitto/default/description
  110. Library required for mosquitto's command line client tools, also for
  111. use by any third party software that wants to communicate with _any_
  112. MQTT server.
  113. Should be useable for communicating with any MQTT v3.1/3.1.1/5 compatible
  114. server, in addition to Mosquitto.
  115. endef
  116. define Package/libmosquitto-ssl/description
  117. $(call Package/libmosquitto/default/description)
  118. This package is built with SSL support
  119. endef
  120. define Package/libmosquitto-nossl/description
  121. $(call Package/libmosquitto/default/description)
  122. This package is built without SSL support
  123. endef
  124. define Package/libmosquittopp
  125. SECTION:=libs
  126. CATEGORY:=Libraries
  127. DEPENDS:=libmosquitto +libstdcpp
  128. TITLE:= mosquitto - client c++ library
  129. endef
  130. define Package/libmosquittopp/description
  131. C++ Library wrapper for libmosquitto.
  132. endef
  133. define Package/mosquitto-ssl/conffiles
  134. /etc/mosquitto/mosquitto.conf
  135. /etc/config/mosquitto
  136. endef
  137. Package/mosquitto-nossl/conffiles = $(Package/mosquitto-ssl/conffiles)
  138. define Package/mosquitto/install/default
  139. $(INSTALL_DIR) $(1)/usr/sbin
  140. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mosquitto $(1)/usr/sbin/mosquitto
  141. $(INSTALL_DIR) $(1)/etc/mosquitto
  142. $(INSTALL_CONF) $(PKG_BUILD_DIR)/mosquitto.conf $(1)/etc/mosquitto/mosquitto.conf
  143. $(CP) ./files/* $(1)/
  144. endef
  145. define Package/mosquitto-nossl/install
  146. $(call Package/mosquitto/install/default,$(1))
  147. endef
  148. define Package/mosquitto-ssl/install
  149. $(call Package/mosquitto/install/default,$(1))
  150. ifeq ($(CONFIG_MOSQUITTO_PASSWD),y)
  151. $(INSTALL_DIR) $(1)/usr/bin
  152. $(INSTALL_BIN) $(PKG_BUILD_DIR)/apps/mosquitto_passwd/mosquitto_passwd $(1)/usr/bin
  153. endif
  154. ifeq ($(CONFIG_MOSQUITTO_DYNAMIC_SECURITY),y)
  155. $(INSTALL_DIR) $(1)/usr/lib
  156. $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/dynamic-security/mosquitto_dynamic_security.so $(1)/usr/lib
  157. endif
  158. endef
  159. define Package/mosquitto-client-nossl/install
  160. $(INSTALL_DIR) $(1)/usr/bin
  161. $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_pub $(1)/usr/bin
  162. $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_sub $(1)/usr/bin
  163. $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_rr $(1)/usr/bin
  164. endef
  165. define Package/mosquitto-client-ssl/install
  166. $(call Package/mosquitto-client-nossl/install,$(1))
  167. ifeq ($(CONFIG_MOSQUITTO_CTRL),y)
  168. $(INSTALL_BIN) $(PKG_BUILD_DIR)/apps/mosquitto_ctrl/mosquitto_ctrl $(1)/usr/bin
  169. endif
  170. endef
  171. # This installs files into ./staging_dir/. so that you can cross compile from the host
  172. define Build/InstallDev
  173. $(INSTALL_DIR) $(1)/usr/include
  174. $(CP) $(PKG_BUILD_DIR)/include/*.h $(1)/usr/include
  175. $(CP) $(PKG_BUILD_DIR)/lib/cpp/mosquittopp.h $(1)/usr/include
  176. $(INSTALL_DIR) $(1)/usr/lib
  177. $(CP) $(PKG_BUILD_DIR)/lib/libmosquitto.so.1 $(1)/usr/lib/
  178. $(CP) $(PKG_BUILD_DIR)/lib/cpp/libmosquittopp.so.1 $(1)/usr/lib/
  179. $(LN) libmosquitto.so.1 $(1)/usr/lib/libmosquitto.so
  180. $(LN) libmosquittopp.so.1 $(1)/usr/lib/libmosquittopp.so
  181. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  182. $(CP) $(PKG_BUILD_DIR)/libmosquitto.pc.in $(1)/usr/lib/pkgconfig/libmosquitto.pc
  183. sed -i -e "s#@CMAKE_INSTALL_PREFIX@#/usr#" \
  184. -e "s#@VERSION@#$(PKG_VERSION)#" \
  185. $(1)/usr/lib/pkgconfig/libmosquitto.pc
  186. $(CP) $(PKG_BUILD_DIR)/libmosquittopp.pc.in $(1)/usr/lib/pkgconfig/libmosquittopp.pc
  187. sed -i -e "s#@CMAKE_INSTALL_PREFIX@#/usr#" \
  188. -e "s#@VERSION@#$(PKG_VERSION)#" \
  189. $(1)/usr/lib/pkgconfig/libmosquittopp.pc
  190. endef
  191. # This installs files on the target. Compare with Build/InstallDev
  192. define Package/libmosquitto-ssl/install
  193. $(INSTALL_DIR) $(1)/usr/lib
  194. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/libmosquitto.so.1 $(1)/usr/lib/
  195. $(LN) libmosquitto.so.1 $(1)/usr/lib/libmosquitto.so
  196. endef
  197. Package/libmosquitto-nossl/install = $(Package/libmosquitto-ssl/install)
  198. define Package/libmosquittopp/install
  199. $(INSTALL_DIR) $(1)/usr/lib
  200. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/cpp/libmosquittopp.so.1 $(1)/usr/lib/
  201. $(LN) libmosquittopp.so.1 $(1)/usr/lib/libmosquittopp.so
  202. endef
  203. # Applies to all...
  204. MAKE_FLAGS += WITH_DOCS=no UNAME=Linux
  205. ifeq ($(BUILD_VARIANT),nossl)
  206. MAKE_FLAGS += WITH_TLS=no WITH_WEBSOCKETS=no
  207. else
  208. MAKE_FLAGS += WITH_WEBSOCKETS=$(if $(CONFIG_MOSQUITTO_LWS),"yes","no")
  209. MAKE_FLAGS += WITH_TLS_PSK=$(if $(CONFIG_OPENSSL_WITH_PSK),"yes","no")
  210. endif
  211. $(eval $(call BuildPackage,mosquitto-ssl))
  212. $(eval $(call BuildPackage,mosquitto-nossl))
  213. $(eval $(call BuildPackage,libmosquitto-ssl))
  214. $(eval $(call BuildPackage,libmosquitto-nossl))
  215. $(eval $(call BuildPackage,libmosquittopp))
  216. $(eval $(call BuildPackage,mosquitto-client-ssl))
  217. $(eval $(call BuildPackage,mosquitto-client-nossl))