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.

240 lines
7.5 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:=1.5.3
  11. PKG_RELEASE:=3
  12. PKG_LICENSE:=BSD-3-Clause
  13. PKG_LICENSE_FILES:=LICENSE.txt
  14. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  15. PKG_SOURCE_URL:=https://mosquitto.org/files/source/
  16. PKG_HASH:=3081a998d303a883b1cd064009beabc88aa9159e26f5258a4ae6007160491d10
  17. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  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 +libuuid
  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
  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 and 3.1.1. 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
  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 publishing messages to MQTT servers
  79. and subscribing to topics.
  80. endef
  81. define Package/mosquitto-client-ssl/description
  82. $(call Package/mosquitto-client/default/description)
  83. This package is built with SSL support
  84. endef
  85. define Package/mosquitto-client-nossl/description
  86. $(call Package/mosquitto-client/default/description)
  87. This package is built without SSL support
  88. endef
  89. define Package/libmosquitto/default
  90. $(Package/mosquitto/default)
  91. SECTION:=libs
  92. CATEGORY:=Libraries
  93. DEPENDS:=+libpthread +librt +libcares
  94. TITLE:= mosquitto - client library
  95. PROVIDES:=libmosquitto
  96. endef
  97. define Package/libmosquitto-ssl
  98. $(call Package/libmosquitto/default)
  99. TITLE+= (With SSL Support)
  100. DEPENDS+= +libopenssl
  101. VARIANT=ssl
  102. endef
  103. define Package/libmosquitto-nossl
  104. $(call Package/libmosquitto/default)
  105. TITLE+= (Without SSL Support)
  106. VARIANT=nossl
  107. endef
  108. define Package/libmosquitto/default/description
  109. Library required for mosquitto's command line client tools, also for
  110. use by any third party software that wants to communicate with a
  111. mosquitto server.
  112. Should be useable for communicating with any MQTT v3.1/3.1.1 compatible
  113. server, such as IBM's RSMB, in addition to Mosquitto
  114. endef
  115. define Package/libmosquitto-ssl/description
  116. $(call Package/libmosquitto/default/description)
  117. This package is built with SSL support
  118. endef
  119. define Package/libmosquitto-nossl/description
  120. $(call Package/libmosquitto/default/description)
  121. This package is built without SSL support
  122. endef
  123. define Package/libmosquittopp
  124. SECTION:=libs
  125. CATEGORY:=Libraries
  126. DEPENDS:=libmosquitto +libstdcpp
  127. TITLE:= mosquitto - client c++ library
  128. endef
  129. define Package/libmosquittopp/description
  130. C++ Library wrapper for libmosquitto.
  131. endef
  132. define Package/mosquitto-ssl/conffiles
  133. /etc/mosquitto/mosquitto.conf
  134. /etc/config/mosquitto
  135. endef
  136. Package/mosquitto-nossl/conffiles = $(Package/mosquitto-ssl/conffiles)
  137. define Package/mosquitto/install/default
  138. $(INSTALL_DIR) $(1)/usr/sbin
  139. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mosquitto $(1)/usr/sbin/mosquitto
  140. $(INSTALL_DIR) $(1)/etc/mosquitto
  141. $(INSTALL_CONF) $(PKG_BUILD_DIR)/mosquitto.conf $(1)/etc/mosquitto/mosquitto.conf
  142. $(CP) ./files/* $(1)/
  143. endef
  144. define Package/mosquitto-nossl/install
  145. $(call Package/mosquitto/install/default,$(1))
  146. endef
  147. define Package/mosquitto-ssl/install
  148. $(call Package/mosquitto/install/default,$(1))
  149. ifeq ($(CONFIG_MOSQUITTO_PASSWD),y)
  150. $(INSTALL_DIR) $(1)/usr/bin
  151. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mosquitto_passwd $(1)/usr/bin
  152. endif
  153. endef
  154. define Package/mosquitto-client-ssl/install
  155. $(INSTALL_DIR) $(1)/usr/bin
  156. $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_pub $(1)/usr/bin/mosquitto_pub
  157. $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_sub $(1)/usr/bin/mosquitto_sub
  158. endef
  159. Package/mosquitto-client-nossl/install = $(Package/mosquitto-client-ssl/install)
  160. # This installs files into ./staging_dir/. so that you can cross compile from the host
  161. define Build/InstallDev
  162. $(INSTALL_DIR) $(1)/usr/include
  163. $(CP) $(PKG_BUILD_DIR)/lib/mosquitto.h $(1)/usr/include
  164. $(CP) $(PKG_BUILD_DIR)/lib/cpp/mosquittopp.h $(1)/usr/include
  165. $(INSTALL_DIR) $(1)/usr/lib
  166. $(CP) $(PKG_BUILD_DIR)/lib/libmosquitto.so.1 $(1)/usr/lib/
  167. $(CP) $(PKG_BUILD_DIR)/lib/cpp/libmosquittopp.so.1 $(1)/usr/lib/
  168. $(LN) libmosquitto.so.1 $(1)/usr/lib/libmosquitto.so
  169. $(LN) libmosquittopp.so.1 $(1)/usr/lib/libmosquittopp.so
  170. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  171. $(CP) $(PKG_BUILD_DIR)/libmosquitto.pc.in $(1)/usr/lib/pkgconfig/libmosquitto.pc
  172. sed -i -e "s#@CMAKE_INSTALL_PREFIX@#/usr#" \
  173. -e "s#@VERSION@#$(PKG_VERSION)#" \
  174. $(1)/usr/lib/pkgconfig/libmosquitto.pc
  175. $(CP) $(PKG_BUILD_DIR)/libmosquittopp.pc.in $(1)/usr/lib/pkgconfig/libmosquittopp.pc
  176. sed -i -e "s#@CMAKE_INSTALL_PREFIX@#/usr#" \
  177. -e "s#@VERSION@#$(PKG_VERSION)#" \
  178. $(1)/usr/lib/pkgconfig/libmosquittopp.pc
  179. endef
  180. # This installs files on the target. Compare with Build/InstallDev
  181. define Package/libmosquitto-ssl/install
  182. $(INSTALL_DIR) $(1)/usr/lib
  183. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/libmosquitto.so.1 $(1)/usr/lib/
  184. $(LN) libmosquitto.so.1 $(1)/usr/lib/libmosquitto.so
  185. endef
  186. Package/libmosquitto-nossl/install = $(Package/libmosquitto-ssl/install)
  187. define Package/libmosquittopp/install
  188. $(INSTALL_DIR) $(1)/usr/lib
  189. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/cpp/libmosquittopp.so.1 $(1)/usr/lib/
  190. $(LN) libmosquittopp.so.1 $(1)/usr/lib/libmosquittopp.so
  191. endef
  192. # Applies to all...
  193. MAKE_FLAGS += WITH_DOCS=no UNAME=Linux
  194. ifeq ($(BUILD_VARIANT),nossl)
  195. MAKE_FLAGS += WITH_TLS=no WITH_WEBSOCKETS=no
  196. else
  197. MAKE_FLAGS += WITH_WEBSOCKETS=$(if $(CONFIG_MOSQUITTO_LWS),"yes","no")
  198. MAKE_FLAGS += WITH_TLS_PSK=$(if $(CONFIG_OPENSSL_WITH_PSK),"yes","no")
  199. endif
  200. $(eval $(call BuildPackage,mosquitto-ssl))
  201. $(eval $(call BuildPackage,mosquitto-nossl))
  202. $(eval $(call BuildPackage,libmosquitto-ssl))
  203. $(eval $(call BuildPackage,libmosquitto-nossl))
  204. $(eval $(call BuildPackage,libmosquittopp))
  205. $(eval $(call BuildPackage,mosquitto-client-ssl))
  206. $(eval $(call BuildPackage,mosquitto-client-nossl))