diff --git a/net-im/prosody/files/prosody-0.9.2-cfg.lua.patch b/net-im/prosody/files/prosody-0.9.2-cfg.lua.patch new file mode 100644 index 0000000..15c09a2 --- /dev/null +++ b/net-im/prosody/files/prosody-0.9.2-cfg.lua.patch @@ -0,0 +1,52 @@ +diff -ru prosody-0.9.2/prosody.cfg.lua.dist prosody-0.9.2-gentoo/prosody.cfg.lua.dist +--- prosody-0.9.2/prosody.cfg.lua.dist 2013-12-08 19:05:39.000000000 +0100 ++++ prosody-0.9.2-gentoo/prosody.cfg.lua.dist 2014-01-27 03:00:44.929196948 +0100 +@@ -1,5 +1,3 @@ +--- Prosody Example Configuration File +--- + -- Information on configuring Prosody can be found on our + -- website at http://prosody.im/doc/configure + -- +@@ -7,9 +5,6 @@ + -- when you have finished by running: luac -p prosody.cfg.lua + -- If there are any errors, it will let you know what and where + -- they are, otherwise it will keep quiet. +--- +--- The only thing left to do is rename this file to remove the .dist ending, and fill in the +--- blanks. Good luck, and happy Jabbering! + + + ---------- Server-wide settings ---------- +@@ -63,7 +58,7 @@ + --"http_files"; -- Serve static files from a directory over HTTP + + -- Other specific functionality +- --"posix"; -- POSIX functionality, sends server to background, enables syslog, etc. ++ "posix"; -- POSIX functionality, sends server to background, enables syslog, etc. (Keep enabled for Gentoo.) + --"groups"; -- Shared roster support + --"announce"; -- Send announcement to all online users + --"welcome"; -- Welcome users who register accounts +@@ -72,6 +67,12 @@ + --"legacyauth"; -- Legacy authentication. Only used by some old clients and bots. + }; + ++-- Settings for Gentoo init script and net-im/jabber-base permissions system: ++daemonize = true; ++prosody_user = "jabber"; ++prosody_group = "jabber"; ++pidfile = "/var/run/jabber/prosody.pid"; ++ + -- These modules are auto-loaded, but should you want + -- to disable them then uncomment them here: + modules_disabled = { +@@ -139,8 +140,8 @@ + -- Logging configuration + -- For advanced logging see http://prosody.im/doc/logging + log = { +- info = "prosody.log"; -- Change 'info' to 'debug' for verbose logging +- error = "prosody.err"; ++ info = "/var/log/jabber/prosody.log"; -- Change 'info' to 'debug' for verbose logging ++ error = "/var/log/jabber/prosody.err"; + -- "*syslog"; -- Uncomment this for logging to syslog + -- "*console"; -- Log to the console, useful for debugging with daemonize=false + } diff --git a/net-im/prosody/files/prosody.initd-r2 b/net-im/prosody/files/prosody.initd-r2 new file mode 100644 index 0000000..77f4338 --- /dev/null +++ b/net-im/prosody/files/prosody.initd-r2 @@ -0,0 +1,46 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="Prosody is a server for Jabber/XMPP written in Lua." +description_reload="Reload configuration and reopen log files." +extra_started_commands="reload" +pidfile="/var/run/jabber/prosody.pid" + +depend() { + use dns + need net + provide jabber-server +} + +checkconfig() { + if [ ! -e /etc/jabber/prosody.cfg.lua ] ; then + eerror "You need a /etc/jabber/prosody.cfg.lua file to run prosody" + return 1 + fi + luac -p /etc/jabber/prosody.cfg.lua + return $? +} + +start() { + checkconfig || return 1 + checkpath -q -d -m 0770 -o jabber:jabber "$(dirname ${pidfile})" + checkpath -q -f -m 0770 -o jabber:jabber "${pidfile}" + checkpath -q -d -m 0750 -o jabber:jabber /var/log/jabber + ebegin "Starting Prosody XMPP Server" + prosodyctl start + eend $? +} + +stop() { + ebegin "Stopping Prosody XMPP Server" + prosodyctl stop + eend $? +} + +reload() { + checkconfig || return 1 + ebegin "Reloading configuration of Prosody XMPP Server" + prosodyctl reload + eend $? +} diff --git a/net-im/prosody/files/prosody.service b/net-im/prosody/files/prosody.service new file mode 100644 index 0000000..ec00e54 --- /dev/null +++ b/net-im/prosody/files/prosody.service @@ -0,0 +1,12 @@ +[Unit] +Description=Prosody XMPP (Jabber) server +After=network.target + +[Service] +Type=forking +PIDFile=/var/run/jabber/prosody.pid +ExecStart=/usr/bin/prosodyctl start +ExecStop=/usr/bin/prosodyctl stop + +[Install] +WantedBy=multi-user.target diff --git a/net-im/prosody/files/prosody.tmpfilesd b/net-im/prosody/files/prosody.tmpfilesd new file mode 100644 index 0000000..924ba43 --- /dev/null +++ b/net-im/prosody/files/prosody.tmpfilesd @@ -0,0 +1 @@ +d /var/run/jabber 710 jabber jabber diff --git a/net-im/prosody/metadata.xml b/net-im/prosody/metadata.xml new file mode 100644 index 0000000..323107a --- /dev/null +++ b/net-im/prosody/metadata.xml @@ -0,0 +1,13 @@ + + + + + tk-gentoo@meskal.net + + + Use libevent for event handling + Support for compressing XMPP streams with mod_compression + Use LuaJIT instead of vanilla Lua + Generate example certs + + diff --git a/net-im/prosody/prosody-0.10.9999.ebuild b/net-im/prosody/prosody-0.10.9999.ebuild new file mode 100644 index 0000000..68ed5bd --- /dev/null +++ b/net-im/prosody/prosody-0.10.9999.ebuild @@ -0,0 +1,87 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +EHG_REPO_URI="http://hg.prosody.im/0.10" + +inherit flag-o-matic multilib systemd versionator mercurial + +MY_PV=$(replace_version_separator 3 '') +MY_P="${PN}-${MY_PV}" +DESCRIPTION="Prosody is a flexible communications server for Jabber/XMPP written in Lua" +HOMEPAGE="http://prosody.im/" +#SRC_URI="http://prosody.im/tmp/${MY_PV}/${MY_P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +#KEYWORDS="~amd64 ~arm ~x86" +IUSE="ipv6 libevent mysql postgres sqlite ssl zlib jit cert" + +DEPEND="net-im/jabber-base + !jit? ( >=dev-lang/lua-5.1:0 ) + jit? ( dev-lang/luajit:2 ) + >=net-dns/libidn-1.1 + dev-libs/openssl:0" +RDEPEND="${DEPEND} + >=dev-lua/luaexpat-1.3.0 + dev-lua/luafilesystem + ipv6? ( >=dev-lua/luasocket-3 ) + !ipv6? ( dev-lua/luasocket ) + libevent? ( >=dev-lua/luaevent-0.4.3 ) + mysql? ( dev-lua/luadbi[mysql] ) + postgres? ( dev-lua/luadbi[postgres] ) + sqlite? ( dev-lua/luadbi[sqlite] ) + ssl? ( dev-lua/luasec ) + zlib? ( dev-lua/lua-zlib )" + +S=${WORKDIR}/${MY_P} + +JABBER_ETC="/etc/jabber" +JABBER_SPOOL="/var/spool/jabber" + +src_prepare() { + sed -i -e "s!MODULES = \$(DESTDIR)\$(PREFIX)/lib/!MODULES = \$(DESTDIR)\$(PREFIX)/$(get_libdir)/!"\ + -e "s!SOURCE = \$(DESTDIR)\$(PREFIX)/lib/!SOURCE = \$(DESTDIR)\$(PREFIX)/$(get_libdir)/!"\ + -e "s!INSTALLEDSOURCE = \$(PREFIX)/lib/!INSTALLEDSOURCE = \$(PREFIX)/$(get_libdir)/!"\ + -e "s!INSTALLEDMODULES = \$(PREFIX)/lib/!INSTALLEDMODULES = \$(PREFIX)/$(get_libdir)/!"\ + Makefile || die +} + +src_configure() { + # the configure script is handcrafted (and yells at unknown options) + # hence do not use 'econf' + luajit="" + if use jit; then + luajit="--runwith=luajit" + fi + if use cert; then + gencert="" + else + gencert="--no-example-certs" + fi + ./configure \ + --ostype=linux $luajit ${gencert}\ + --prefix="${EPREFIX}/usr" \ + --libdir="${EPREFIX}/usr/lib64" \ + --sysconfdir="${JABBER_ETC}" \ + --datadir="${JABBER_SPOOL}" \ + --with-lua-include=/usr/include \ + --with-lua-lib=/usr/$(get_libdir)/lua \ + --cflags="${CFLAGS} -Wall -fPIC" \ + --ldflags="${LDFLAGS} -shared" \ + --c-compiler="$(tc-getCC)" \ + --linker="$(tc-getCC)" || die "configure failed" +} + +src_install() { + emake DESTDIR="${D}" install + systemd_dounit "${FILESDIR}/${PN}".service + systemd_newtmpfilesd "${FILESDIR}/${PN}".tmpfilesd "${PN}".conf + newinitd "${FILESDIR}/${PN}".initd-r2 ${PN} +} + +src_test() { + cd tests || die + ./run_tests.sh || die +}