# Copyright 1999-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ EAPI="5" inherit user systemd DESCRIPTION="An Open Source MQTT v3 Broker" HOMEPAGE="http://mosquitto.org/" SRC_URI="http://mosquitto.org/files/source/${P}.tar.gz" LICENSE="EPL-1.0" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="bridge examples +persistence +srv ssl tcpd" RDEPEND="tcpd? ( sys-apps/tcp-wrappers ) ssl? ( >=dev-libs/openssl-1.0.0 )" DEPEND="${RDEPEND} srv? ( net-dns/c-ares )" pkg_setup() { enewuser mosquitto } src_prepare() { if use persistence; then sed -i "s:^#autosave_interval:autosave_interval:" mosquitto.conf || die sed -i "s:^#persistence false$:persistence true:" mosquitto.conf || die sed -i "s:^#persistence_file:persistence_file:" mosquitto.conf || die sed -i "s:^#persistence_location$:persistence_location /var/lib/mosquitto/:" mosquitto.conf || die fi } src_configure() { makeopts="${makeopts} WITH_BRIDGE=$(usex bridge)" makeopts="${makeopts} WITH_PERSISTENCE=$(usex persistence)" makeopts="${makeopts} WITH_SRV=$(usex srv)" makeopts="${makeopts} WITH_TLS=$(usex ssl)" makeopts="${makeopts} WITH_WRAP=$(usex tcpd)" einfo "${makeopts}" } src_compile() { emake ${makeopts} } src_install() { emake DESTDIR="${D}" prefix=/usr install dodir /var/lib/mosquitto dodoc readme.md CONTRIBUTING.md ChangeLog.txt doinitd "${FILESDIR}"/mosquitto insinto /etc/mosquitto newins mosquitto.conf mosquitto.conf systemd_dounit "${FILESDIR}/mosquitto.service" if use examples; then docompress -x "/usr/share/doc/${PF}/examples" insinto "/usr/share/doc/${PF}/examples" doins -r examples/* fi } pkg_postinst() { chown mosquitto: /var/lib/mosquitto elog "" elog "The Python module has been moved out of mosquitto." elog "See http://mosquitto.org/documentation/python/" elog "" elog "To start the mosquitto daemon at boot, add it to the default runlevel with:" elog "" elog " rc-update add mosquitto default" elog " or" elog " systemctl enable mosquitto" }