# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" inherit eutils flag-o-matic DESCRIPTION="An Open Source MQTT v3 Broker" HOMEPAGE="http://mosquitto.org/" if [[ "${PV}" == "${PV%%_rc[0-9]}" ]]; then SRC_URI="http://mosquitto.org/files/source/${P}.tar.gz" else SRC_URI="http://mosquitto.org/files/source/rc/${P/_/~}.tar.gz" S="${WORKDIR}/${P/_/~}" fi LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="bridge +persistence ssl tcpd" RDEPEND="tcpd? ( sys-apps/tcp-wrappers ) ssl? ( >=dev-libs/openssl-1.0.0 )" DEPEND="${RDEPEND}" src_configure() { makeopts="" if use bridge ; then makeopts="${makeopts} WITH_BRIDGE=yes" else makeopts="${makeopts} WITH_BRIDGE=no" fi if use persistence ; then makeopts="${makeopts} WITH_PERSISTENCE=yes" else makeopts="${makeopts} WITH_PERSISTENCE=no" fi if use ssl ; then makeopts="${makeopts} WITH_TLS=yes" else makeopts="${makeopts} WITH_TLS=no" fi if use tcpd ; then makeopts="${makeopts} WITH_WRAP=yes" else makeopts="${makeopts} WITH_WRAP=no" fi einfo "${makeopts}" } src_install() { emake install ${makeopts} DESTDIR="${D}" prefix=/usr || die "Install failed" dodir /var/lib/mosquitto dodoc readme.txt ChangeLog.txt || die "dodoc failed" doinitd "${FILESDIR}"/mosquitto if use persistence; then dosed "s:^#autosave_interval:autosave_interval:" /etc/mosquitto/mosquitto.conf dosed "s:^#persistence false$:persistence true:" /etc/mosquitto/mosquitto.conf dosed "s:^#persistence_file:persistence_file:" /etc/mosquitto/mosquitto.conf dosed "s:^#persistence_location$:persistence_location /var/lib/mosquitto/:" /etc/mosquitto/mosquitto.conf fi } pkg_setup() { enewuser mosquitto } pkg_postinst() { chown mosquitto: /var/lib/mosquitto elog "To start mosquitto at boot, add it to the default runlevel with:" elog "" elog " rc-update add mosquitto default" }