summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Timo Gurr <tgurr@exherbo.org> 2017-08-11 16:51:36 +0200
committerAvatar Timo Gurr <tgurr@exherbo.org> 2017-08-11 17:04:42 +0200
commit292171bc4d23936908d2c22b65742fb1881d4427 (patch)
treef1e6d11930e6b3fdb275f70094baf749452f54ee
parent414c379493b7ed4169361ac2c9c939e9083c96c9 (diff)
downloadnet-292171bc4d23936908d2c22b65742fb1881d4427.tar.gz
net-292171bc4d23936908d2c22b65742fb1881d4427.tar.xz
mosquitto: initial exheres
Change-Id: I35447191e2d574cbfb27bab7cd13f672cf21f66d Reviewed-on: https://galileo.mailstation.de/gerrit/9832 Reviewed-by: Jenkins <wk@mailstation.de> Reviewed-by: Timo Gurr <tgurr@exherbo.org>
-rw-r--r--metadata/accounts/groups/mosquitto.conf0
-rw-r--r--metadata/accounts/users/mosquitto.conf4
-rw-r--r--packages/net/mosquitto/files/mosquitto-1.4.14-cmake.patch48
-rw-r--r--packages/net/mosquitto/files/systemd/mosquitto.service12
-rw-r--r--packages/net/mosquitto/mosquitto-1.4.14.exheres-082
5 files changed, 146 insertions, 0 deletions
diff --git a/metadata/accounts/groups/mosquitto.conf b/metadata/accounts/groups/mosquitto.conf
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/metadata/accounts/groups/mosquitto.conf
diff --git a/metadata/accounts/users/mosquitto.conf b/metadata/accounts/users/mosquitto.conf
new file mode 100644
index 0000000..ac0a601
--- /dev/null
+++ b/metadata/accounts/users/mosquitto.conf
@@ -0,0 +1,4 @@
+gecos = User for Mosquitto
+home = /dev/null
+shell = /sbin/nologin
+primary_group = mosquitto
diff --git a/packages/net/mosquitto/files/mosquitto-1.4.14-cmake.patch b/packages/net/mosquitto/files/mosquitto-1.4.14-cmake.patch
new file mode 100644
index 0000000..df8814f
--- /dev/null
+++ b/packages/net/mosquitto/files/mosquitto-1.4.14-cmake.patch
@@ -0,0 +1,48 @@
+Source: Timo Gurr <tgurr@exherbo.org>
+Upstream: No, not upstreamable in this condition
+Reason: At least fix the install in this CMake mess
+
+diff -Naur mosquitto-1.4.14/CMakeLists.txt mosquitto-1.4.14.new/CMakeLists.txt
+--- mosquitto-1.4.14/CMakeLists.txt 2017-07-11 00:46:01.000000000 +0200
++++ mosquitto-1.4.14.new/CMakeLists.txt 2017-08-11 15:57:11.866060242 +0200
+@@ -8,6 +8,8 @@
+
+ project(mosquitto)
+
++include(GNUInstallDirs)
++
+ cmake_minimum_required(VERSION 2.8)
+ # Only for version 3 and up. cmake_policy(SET CMP0042 NEW)
+
+@@ -92,4 +94,4 @@
+ # Install config file
+ # ========================================
+
+-install(FILES mosquitto.conf aclfile.example pskfile.example pwfile.example DESTINATION "${SYSCONFDIR}")
++install(FILES mosquitto.conf aclfile.example pskfile.example pwfile.example DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}")
+diff -Naur mosquitto-1.4.14/man/CMakeLists.txt mosquitto-1.4.14.new/man/CMakeLists.txt
+--- mosquitto-1.4.14/man/CMakeLists.txt 2017-07-11 00:46:01.000000000 +0200
++++ mosquitto-1.4.14.new/man/CMakeLists.txt 2017-08-11 15:51:28.842434344 +0200
+@@ -1,5 +1,5 @@
+-install(FILES mosquitto_passwd.1 mosquitto_pub.1 mosquitto_sub.1 DESTINATION ${MANDIR}/man1)
+-install(FILES libmosquitto.3 DESTINATION ${MANDIR}/man3)
+-install(FILES mosquitto.conf.5 DESTINATION ${MANDIR}/man5)
+-install(FILES mosquitto-tls.7 mqtt.7 DESTINATION ${MANDIR}/man7)
+-install(FILES mosquitto.8 DESTINATION ${MANDIR}/man8)
++install(FILES mosquitto_passwd.1 mosquitto_pub.1 mosquitto_sub.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
++install(FILES libmosquitto.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
++install(FILES mosquitto.conf.5 DESTINATION ${CMAKE_INSTALL_MANDIR}/man5)
++install(FILES mosquitto-tls.7 mqtt.7 DESTINATION ${CMAKE_INSTALL_MANDIR}/man7)
++install(FILES mosquitto.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
+diff -Naur mosquitto-1.4.14/src/CMakeLists.txt mosquitto-1.4.14.new/src/CMakeLists.txt
+--- mosquitto-1.4.14/src/CMakeLists.txt 2017-07-11 00:46:01.000000000 +0200
++++ mosquitto-1.4.14.new/src/CMakeLists.txt 2017-08-11 16:34:38.182911484 +0200
+@@ -131,7 +131,7 @@
+ endif (APPLE)
+ endif (UNIX)
+
+-install(TARGETS mosquitto RUNTIME DESTINATION "${SBINDIR}" LIBRARY DESTINATION "${LIBDIR}")
++install(TARGETS mosquitto RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${LIBDIR}")
+ install(FILES mosquitto_plugin.h DESTINATION "${INCLUDEDIR}")
+
+ if (${WITH_TLS} STREQUAL ON)
diff --git a/packages/net/mosquitto/files/systemd/mosquitto.service b/packages/net/mosquitto/files/systemd/mosquitto.service
new file mode 100644
index 0000000..ee3ccb1
--- /dev/null
+++ b/packages/net/mosquitto/files/systemd/mosquitto.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Mosquitto MQTT Broker daemon
+ConditionPathExists=/etc/mosquitto/mosquitto.conf
+Requires=network.target
+
+[Service]
+Type=simple
+ExecStart=/usr/host/bin/mosquitto -c /etc/mosquitto/mosquitto.conf
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/packages/net/mosquitto/mosquitto-1.4.14.exheres-0 b/packages/net/mosquitto/mosquitto-1.4.14.exheres-0
new file mode 100644
index 0000000..a47c792
--- /dev/null
+++ b/packages/net/mosquitto/mosquitto-1.4.14.exheres-0
@@ -0,0 +1,82 @@
+# Copyright 2017 Timo Gurr <tgurr@exherbo.org>
+# Distributed under the terms of the GNU General Public License v2
+
+require cmake [ api=2 ] systemd-service
+
+SUMMARY="Message broker that implements the MQTT protocol versions 3.1 and 3.1.1"
+DESCRIPTION="
+Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT
+protocol versions 3.1 and 3.1.1. MQTT provides a lightweight method of carrying out messaging using
+a publish/subscribe model. This makes it suitable for \"Internet of Things\" messaging such as with
+low power sensors or mobile devices such as phones, embedded computers or microcontrollers like the
+Arduino.
+"
+HOMEPAGE="https://mosquitto.org"
+DOWNLOADS="${HOMEPAGE}/files/source/${PNV}.tar.gz"
+
+UPSTREAM_DOCUMENTATION="${HOMEPAGE}/documentation [[ lang = en ]]"
+UPSTREAM_RELEASE_NOTES="${HOMEPAGE}/category/releases [[ lang = en ]]"
+
+LICENCES="EDL-1.0 EPL-1.0"
+SLOT="0"
+PLATFORMS="~amd64"
+MYOPTIONS="
+ tcpd
+ ( providers: libressl openssl ) [[ number-selected = exactly-one ]]
+"
+
+DEPENDENCIES="
+ build+run:
+ group/${PN}
+ user/${PN}
+ net-dns/c-ares
+ sys-apps/util-linux [[ note = [ for libuuid ] ]]
+ providers:libressl? ( dev-libs/libressl:= )
+ providers:openssl? ( dev-libs/openssl )
+ tcpd? ( sys-apps/tcp-wrappers )
+"
+
+DEFAULT_SRC_PREPARE_PATCHES=(
+ "${FILES}"/${PN}-1.4.14-cmake.patch
+)
+
+# TODO: Report upstream, passing -DWITH_TLS disables the build of mosquitto_passwd
+CMAKE_SRC_CONFIGURE_PARAMS=(
+ -DCMAKE_INSTALL_BINDIR:PATH=bin
+ -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc/${PN}
+ -DWITH_EC:BOOL=TRUE
+ -DWITH_PERSISTENCE:BOOL=TRUE
+ -DWITH_SOCKS:BOOL=TRUE
+ -DWITH_SRV:BOOL=TRUE
+ -DWITH_SYS_TREE=BOOL=TRUE
+ -DWITH_THREADING:BOOL=TRUE
+ -DWITH_TLS_PSK:BOOL=TRUE
+ -DWITH_WEBSOCKETS:BOOL=FALSE
+)
+
+src_prepare() {
+ cmake_src_prepare
+
+ edo sed \
+ -e "s:^#autosave_interval:autosave_interval:" \
+ -e "s:^#persistence false$:persistence true:" \
+ -e "s:^#persistence_file:persistence_file:" \
+ -e "s:^#persistence_location$:persistence_location /var/lib/mosquitto/:" \
+ -i mosquitto.conf
+}
+
+src_configure() {
+ ecmake \
+ -DUSE_LIBWRAP:BOOL=$(option tcpd TRUE FALSE) \
+ "${CMAKE_SRC_CONFIGURE_PARAMS[@]}"
+}
+
+src_install() {
+ cmake_src_install
+
+ keepdir /var/lib/${PN}
+ edo chown -R mosquitto:mosquitto "${IMAGE}"/var/lib/${PN}
+
+ install_systemd_files
+}
+