diff options
4 files changed, 278 insertions, 0 deletions
diff --git a/meta-oe/recipes-connectivity/mosquitto/files/build.patch b/meta-oe/recipes-connectivity/mosquitto/files/build.patch new file mode 100644 index 0000000000..0d0912b7ad --- /dev/null +++ b/meta-oe/recipes-connectivity/mosquitto/files/build.patch | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | From ebd7c8e548e9b8e096ee4c390173db9a701f2604 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Bruno Bottazzini <bruno.bottazzini@intel.com> | ||
| 3 | Date: Wed, 23 Mar 2016 11:18:26 -0300 | ||
| 4 | Subject: [PATCH] build | ||
| 5 | |||
| 6 | Disable stripping and allow easily overriding prefix | ||
| 7 | |||
| 8 | Upstream-Status: Pending | ||
| 9 | |||
| 10 | Signed-off-by: Bruno Bottazzini <bruno.bottazzini@intel.com> | ||
| 11 | --- | ||
| 12 | client/Makefile | 4 ++-- | ||
| 13 | config.mk | 2 +- | ||
| 14 | lib/Makefile | 2 +- | ||
| 15 | lib/cpp/Makefile | 2 +- | ||
| 16 | src/Makefile | 4 ++-- | ||
| 17 | 5 files changed, 7 insertions(+), 7 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/client/Makefile b/client/Makefile | ||
| 20 | index bd65355..4e5a640 100644 | ||
| 21 | --- a/client/Makefile | ||
| 22 | +++ b/client/Makefile | ||
| 23 | @@ -24,8 +24,8 @@ client_shared.o : client_shared.c client | ||
| 24 | |||
| 25 | install : all | ||
| 26 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin | ||
| 27 | - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub | ||
| 28 | - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub | ||
| 29 | + $(INSTALL) mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub | ||
| 30 | + $(INSTALL) mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub | ||
| 31 | |||
| 32 | uninstall : | ||
| 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub | ||
| 34 | diff --git a/config.mk b/config.mk | ||
| 35 | index c0f175f..3427b83 100644 | ||
| 36 | --- a/config.mk | ||
| 37 | +++ b/config.mk | ||
| 38 | @@ -241,7 +241,7 @@ ifeq ($(WITH_DOCS),yes) | ||
| 39 | endif | ||
| 40 | |||
| 41 | INSTALL?=install | ||
| 42 | -prefix=/usr/local | ||
| 43 | +prefix?=/usr | ||
| 44 | mandir=${prefix}/share/man | ||
| 45 | localedir=${prefix}/share/locale | ||
| 46 | STRIP?=strip | ||
| 47 | diff --git a/lib/Makefile b/lib/Makefile | ||
| 48 | index 825fcea..9b7c05c 100644 | ||
| 49 | --- a/lib/Makefile | ||
| 50 | +++ b/lib/Makefile | ||
| 51 | @@ -25,7 +25,7 @@ all : libmosquitto.so.${SOVERSION} libmo | ||
| 52 | |||
| 53 | install : all | ||
| 54 | $(INSTALL) -d ${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/ | ||
| 55 | - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} libmosquitto.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so.${SOVERSION} | ||
| 56 | + $(INSTALL) libmosquitto.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so.${SOVERSION} | ||
| 57 | ln -sf libmosquitto.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so | ||
| 58 | $(INSTALL) -d ${DESTDIR}${prefix}/include/ | ||
| 59 | $(INSTALL) mosquitto.h ${DESTDIR}${prefix}/include/mosquitto.h | ||
| 60 | diff --git a/lib/cpp/Makefile b/lib/cpp/Makefile | ||
| 61 | index 8b627d3..cdb2923 100644 | ||
| 62 | --- a/lib/cpp/Makefile | ||
| 63 | +++ b/lib/cpp/Makefile | ||
| 64 | @@ -10,7 +10,7 @@ all : libmosquittopp.so.${SOVERSION} | ||
| 65 | |||
| 66 | install : all | ||
| 67 | $(INSTALL) -d ${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/ | ||
| 68 | - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} libmosquittopp.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so.${SOVERSION} | ||
| 69 | + $(INSTALL) libmosquittopp.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so.${SOVERSION} | ||
| 70 | ln -sf libmosquittopp.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so | ||
| 71 | $(INSTALL) -d ${DESTDIR}${prefix}/include/ | ||
| 72 | $(INSTALL) mosquittopp.h ${DESTDIR}${prefix}/include/mosquittopp.h | ||
| 73 | diff --git a/src/Makefile b/src/Makefile | ||
| 74 | index 2cfb7d4..9a97644 100644 | ||
| 75 | --- a/src/Makefile | ||
| 76 | +++ b/src/Makefile | ||
| 77 | @@ -103,12 +103,12 @@ mosquitto_passwd.o : mosquitto_passwd.c | ||
| 78 | |||
| 79 | install : all | ||
| 80 | $(INSTALL) -d ${DESTDIR}$(prefix)/sbin | ||
| 81 | - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto ${DESTDIR}${prefix}/sbin/mosquitto | ||
| 82 | + $(INSTALL) mosquitto ${DESTDIR}${prefix}/sbin/mosquitto | ||
| 83 | $(INSTALL) -d ${DESTDIR}$(prefix)/include | ||
| 84 | $(INSTALL) mosquitto_plugin.h ${DESTDIR}${prefix}/include/mosquitto_plugin.h | ||
| 85 | ifeq ($(WITH_TLS),yes) | ||
| 86 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin | ||
| 87 | - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_passwd ${DESTDIR}${prefix}/bin/mosquitto_passwd | ||
| 88 | + $(INSTALL) mosquitto_passwd ${DESTDIR}${prefix}/bin/mosquitto_passwd | ||
| 89 | endif | ||
| 90 | |||
| 91 | uninstall : | ||
| 92 | -- | ||
| 93 | 2.7.1 | ||
| 94 | |||
diff --git a/meta-oe/recipes-connectivity/mosquitto/files/mosquitto.init b/meta-oe/recipes-connectivity/mosquitto/files/mosquitto.init new file mode 100644 index 0000000000..d2a27b2732 --- /dev/null +++ b/meta-oe/recipes-connectivity/mosquitto/files/mosquitto.init | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | |||
| 3 | # Based on the Debian initscript for mosquitto | ||
| 4 | |||
| 5 | ### BEGIN INIT INFO | ||
| 6 | # Provides: mosquitto | ||
| 7 | # Required-Start: $remote_fs $syslog | ||
| 8 | # Required-Stop: $remote_fs $syslog | ||
| 9 | # Default-Start: 2 3 4 5 | ||
| 10 | # Default-Stop: 0 1 6 | ||
| 11 | # Short-Description: mosquitto MQTT v3.1 message broker | ||
| 12 | # Description: | ||
| 13 | # This is a message broker that supports version 3.1 of the MQ Telemetry | ||
| 14 | # Transport (MQTT) protocol. | ||
| 15 | # | ||
| 16 | # MQTT provides a method of carrying out messaging using a publish/subscribe | ||
| 17 | # model. It is lightweight, both in terms of bandwidth usage and ease of | ||
| 18 | # implementation. This makes it particularly useful at the edge of the network | ||
| 19 | # where a sensor or other simple device may be implemented using an arduino for | ||
| 20 | # example. | ||
| 21 | ### END INIT INFO | ||
| 22 | |||
| 23 | set -e | ||
| 24 | |||
| 25 | PIDFILE=@LOCALSTATEDIR@/run/mosquitto.pid | ||
| 26 | DAEMON=@SBINDIR@/mosquitto | ||
| 27 | |||
| 28 | # start and stop the mosquitto MQTT message broker | ||
| 29 | |||
| 30 | test -x ${DAEMON} || exit 0 | ||
| 31 | |||
| 32 | umask 022 | ||
| 33 | |||
| 34 | . @SYSCONFDIR@/init.d/functions | ||
| 35 | |||
| 36 | export PATH="${PATH:+$PATH:}@SBINDIR@:@BASE_SBINDIR@" | ||
| 37 | |||
| 38 | case "$1" in | ||
| 39 | start) | ||
| 40 | echo "Starting Mosquitto message broker" "mosquitto" | ||
| 41 | if start-stop-daemon --start --quiet --oknodo --background --make-pidfile --pidfile ${PIDFILE} --exec ${DAEMON} ; then | ||
| 42 | exit 0 | ||
| 43 | else | ||
| 44 | exit 1 | ||
| 45 | fi | ||
| 46 | ;; | ||
| 47 | stop) | ||
| 48 | echo "Stopping Mosquitto message broker" "mosquitto" | ||
| 49 | if start-stop-daemon --stop --quiet --oknodo --pidfile ${PIDFILE}; then | ||
| 50 | rm -f ${PIDFILE} | ||
| 51 | exit 0 | ||
| 52 | else | ||
| 53 | exit 1 | ||
| 54 | fi | ||
| 55 | ;; | ||
| 56 | |||
| 57 | |||
| 58 | reload|force-reload) | ||
| 59 | if [ -f ${PIDFILE} ] ; then | ||
| 60 | echo "Reloading configuration for mosquitto" | ||
| 61 | pid=`cat ${PIDFILE}` | ||
| 62 | kill -HUP $pid | ||
| 63 | else | ||
| 64 | echo "mosquitto does not seem to be running" | ||
| 65 | fi | ||
| 66 | ;; | ||
| 67 | |||
| 68 | restart) | ||
| 69 | echo "Restarting Mosquitto message broker" "mosquitto" | ||
| 70 | if start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile ${PIDFILE}; then | ||
| 71 | rm -f ${PIDFILE} | ||
| 72 | fi | ||
| 73 | if start-stop-daemon --start --quiet --oknodo --background --make-pidfile --pidfile ${PIDFILE} --exec ${DAEMON} -- -c @SYSCONFDIR@/mosquitto/mosquitto.conf ; then | ||
| 74 | exit 0 | ||
| 75 | else | ||
| 76 | exit 1 | ||
| 77 | fi | ||
| 78 | ;; | ||
| 79 | |||
| 80 | status) | ||
| 81 | status ${DAEMON} && exit 0 || exit $? | ||
| 82 | ;; | ||
| 83 | |||
| 84 | *) | ||
| 85 | echo "Usage: $0 {start|stop|reload|force-reload|restart|status}" | ||
| 86 | exit 1 | ||
| 87 | esac | ||
| 88 | |||
| 89 | exit 0 | ||
diff --git a/meta-oe/recipes-connectivity/mosquitto/files/mosquitto.service b/meta-oe/recipes-connectivity/mosquitto/files/mosquitto.service new file mode 100644 index 0000000000..25f68fae05 --- /dev/null +++ b/meta-oe/recipes-connectivity/mosquitto/files/mosquitto.service | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=Mosquitto - lightweight server implementation of the MQTT and MQTT-SN protocols | ||
| 3 | ConditionPathExists=/etc/mosquitto/mosquitto.conf | ||
| 4 | After=network.target | ||
| 5 | |||
| 6 | [Service] | ||
| 7 | Type=simple | ||
| 8 | ExecStartPre=/bin/rm -f /var/run/mosquitto.pid | ||
| 9 | ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf | ||
| 10 | ExecReload=/bin/kill -HUP $MAINPID | ||
| 11 | PIDFile=/var/run/mosquitto.pid | ||
| 12 | Restart=on-failure | ||
| 13 | |||
| 14 | [Install] | ||
| 15 | WantedBy=multi-user.target | ||
diff --git a/meta-oe/recipes-connectivity/mosquitto/mosquitto_1.4.14.bb b/meta-oe/recipes-connectivity/mosquitto/mosquitto_1.4.14.bb new file mode 100644 index 0000000000..7554248e48 --- /dev/null +++ b/meta-oe/recipes-connectivity/mosquitto/mosquitto_1.4.14.bb | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | SUMMARY = "Open source MQTT v3.1/3.1.1 implemention" | ||
| 2 | DESCRIPTION = "Mosquitto is an open source (Eclipse licensed) message broker that implements the MQ Telemetry Transport protocol version 3.1 and 3.1.1. MQTT provides a lightweight method of carrying out messaging using a publish/subscribe model. " | ||
| 3 | HOMEPAGE = "http://mosquitto.org/" | ||
| 4 | SECTION = "console/network" | ||
| 5 | LICENSE = "EPL-1.0 | EDL-1.0" | ||
| 6 | LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=62ddc846179e908dc0c8efec4a42ef20 \ | ||
| 7 | file://edl-v10;md5=c09f121939f063aeb5235972be8c722c \ | ||
| 8 | file://epl-v10;md5=8d383c379e91d20ba18a52c3e7d3a979 \ | ||
| 9 | file://notice.html;md5=a00d6f9ab542be7babc2d8b80d5d2a4c \ | ||
| 10 | " | ||
| 11 | |||
| 12 | SRC_URI = "http://mosquitto.org/files/source/mosquitto-${PV}.tar.gz \ | ||
| 13 | file://build.patch \ | ||
| 14 | file://mosquitto.service \ | ||
| 15 | file://mosquitto.init \ | ||
| 16 | " | ||
| 17 | |||
| 18 | SRC_URI[md5sum] = "6b0966e93f118bc71ad7b61600a6c2d3" | ||
| 19 | SRC_URI[sha256sum] = "156b1fa731d12baad4b8b22f7b6a8af50ba881fc711b81e9919ec103cf2942d1" | ||
| 20 | |||
| 21 | inherit systemd update-rc.d useradd | ||
| 22 | |||
| 23 | PACKAGECONFIG ??= "ssl uuid" | ||
| 24 | |||
| 25 | PACKAGECONFIG[dns-srv] = ",,c-ares" | ||
| 26 | PACKAGECONFIG[ssl] = ",,openssl" | ||
| 27 | PACKAGECONFIG[uuid] = ",,util-linux" | ||
| 28 | EXTRA_OEMAKE = "${@bb.utils.contains('PACKAGECONFIG', 'dns-srv', 'WITH_SRV=yes', 'WITH_SRV=no', d)} \ | ||
| 29 | WITH_DOCS=no \ | ||
| 30 | ${@bb.utils.contains('PACKAGECONFIG', 'ssl', 'WITH_TLS=yes WITH_TLS_PSK=yes', 'WITH_TLS=no WITH_TLS_PSK=no', d)} \ | ||
| 31 | ${@bb.utils.contains('PACKAGECONFIG', 'uuid', 'WITH_UUID=yes', 'WITH_UUID=no', d)}" | ||
| 32 | |||
| 33 | export LIB_SUFFIX="${@d.getVar('baselib', True).replace('lib', '')}" | ||
| 34 | |||
| 35 | do_compile() { | ||
| 36 | oe_runmake PREFIX=${prefix} | ||
| 37 | } | ||
| 38 | |||
| 39 | do_install() { | ||
| 40 | oe_runmake install DESTDIR=${D} | ||
| 41 | install -d ${D}${libdir} | ||
| 42 | install -m 0644 lib/libmosquitto.a ${D}${libdir}/ | ||
| 43 | |||
| 44 | install -d ${D}${systemd_unitdir}/system/ | ||
| 45 | install -m 0644 ${WORKDIR}/mosquitto.service ${D}${systemd_unitdir}/system/ | ||
| 46 | |||
| 47 | install -d ${D}${sysconfdir}/init.d/ | ||
| 48 | install -m 0755 ${WORKDIR}/mosquitto.init ${D}${sysconfdir}/init.d/mosquitto | ||
| 49 | sed -i -e 's,@SBINDIR@,${sbindir},g' \ | ||
| 50 | -e 's,@BASE_SBINDIR@,${base_sbindir},g' \ | ||
| 51 | -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ | ||
| 52 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | ||
| 53 | ${D}${sysconfdir}/init.d/mosquitto | ||
| 54 | } | ||
| 55 | |||
| 56 | PACKAGES += "libmosquitto1 libmosquittopp1 ${PN}-clients" | ||
| 57 | |||
| 58 | FILES_${PN} = "${sbindir}/mosquitto \ | ||
| 59 | ${bindir}/mosquitto_passwd \ | ||
| 60 | ${sysconfdir}/mosquitto \ | ||
| 61 | ${sysconfdir}/init.d \ | ||
| 62 | ${systemd_unitdir}/system/mosquitto.service \ | ||
| 63 | " | ||
| 64 | |||
| 65 | FILES_libmosquitto1 = "${libdir}/libmosquitto.so.1" | ||
| 66 | |||
| 67 | FILES_libmosquittopp1 = "${libdir}/libmosquittopp.so.1" | ||
| 68 | |||
| 69 | FILES_${PN}-clients = "${bindir}/mosquitto_pub \ | ||
| 70 | ${bindir}/mosquitto_sub \ | ||
| 71 | " | ||
| 72 | |||
| 73 | SYSTEMD_SERVICE_${PN} = "mosquitto.service" | ||
| 74 | |||
| 75 | INITSCRIPT_NAME = "mosquitto" | ||
| 76 | INITSCRIPT_PARAMS = "defaults 30" | ||
| 77 | |||
| 78 | USERADD_PACKAGES = "${PN}" | ||
| 79 | USERADD_PARAM_${PN} = "--system --no-create-home --shell /bin/false \ | ||
| 80 | --user-group mosquitto" | ||
