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