summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-im/prosody')
-rw-r--r--net-im/prosody/Manifest3
-rw-r--r--net-im/prosody/files/prosody-0.11.2-r1-gentoo.patch16
-rw-r--r--net-im/prosody/files/prosody-0.11.7-bit32.patch20
-rw-r--r--net-im/prosody/files/prosody-0.12.0-gentoo.patch (renamed from net-im/prosody/files/prosody-0.11.7-gentoo.patch)20
-rw-r--r--net-im/prosody/files/prosody.initd-r246
-rw-r--r--net-im/prosody/files/prosody.initd-r6 (renamed from net-im/prosody/files/prosody.initd-r4)27
-rw-r--r--net-im/prosody/files/prosody.service13
-rw-r--r--net-im/prosody/files/prosody.service-r213
-rw-r--r--net-im/prosody/files/prosody.service-r317
-rw-r--r--net-im/prosody/files/prosody.tmpfilesd1
-rw-r--r--net-im/prosody/files/prosody.tmpfilesd-r11
-rw-r--r--net-im/prosody/files/prosody.tmpfilesd-r21
-rw-r--r--net-im/prosody/metadata.xml3
-rw-r--r--net-im/prosody/prosody-0.11.5-r1.ebuild72
-rw-r--r--net-im/prosody/prosody-0.11.7-r2.ebuild96
-rw-r--r--net-im/prosody/prosody-0.12.4.ebuild164
16 files changed, 209 insertions, 304 deletions
diff --git a/net-im/prosody/Manifest b/net-im/prosody/Manifest
index ded27dd5ec24..8454059a66ea 100644
--- a/net-im/prosody/Manifest
+++ b/net-im/prosody/Manifest
@@ -1,2 +1 @@
-DIST prosody-0.11.5.tar.gz 425122 BLAKE2B d65720a0c9d533a4be70847b690ecf037ae4b2fcbd090c81e2346d515599f3f148061103df2ffe46122a55694a3d35d53ab2b379fb5fb317e3b84a0ff5e82c29 SHA512 43a9facee8d61b69e277e7e8a9091fbfa60be71d6141195dff991f6020c8afadacce26f356b869cb2d7edd9be285e9ce1bcd822f9628cc845d91757e818a0dff
-DIST prosody-0.11.7.tar.gz 429369 BLAKE2B 8ef7377810702d5e1f480d84c09d6e3cc6aab674cca56fc1ce5e211d32df63ffeb57869c9d98429a81ea715ee19fca2ac015daa6b88b8c140efbeccb906defa6 SHA512 923aa92598ef851ed8408931942859f78f1e3d700fee251f4f5ca67abdcdae43448318ed90a9a1cdc7824d5f4dc5a4732fad4b9ed36d97455fa9b3bff0881a20
+DIST prosody-0.12.4.tar.gz 616043 BLAKE2B 6bbe779424a6de6b5d266c3f6301282e010b96c9baca79d8dff46ab91365e6c5fdaa1b52c3caaaf33dad0990fa2c298f0447d37fcc018067f6efcc23d633b4fc SHA512 e035ec9af3831c596ababbc0320f352b7253d3ee968c9937998ffc255839173c9278912a0897fa9f0a0665bc43603f8570b5e15dfd1cba4571599e86a98d8cf4
diff --git a/net-im/prosody/files/prosody-0.11.2-r1-gentoo.patch b/net-im/prosody/files/prosody-0.11.2-r1-gentoo.patch
deleted file mode 100644
index 94423a834ae1..000000000000
--- a/net-im/prosody/files/prosody-0.11.2-r1-gentoo.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/prosody.cfg.lua.dist 2019-03-19 15:11:16.355743969 +0100
-+++ b/prosody.cfg.lua.dist 2019-03-19 15:14:42.810995725 +0100
-@@ -32,6 +32,13 @@
- -- will look for modules first. For community modules, see https://modules.prosody.im/
- --plugin_paths = {}
-
-+-- Gentoo uses the jabber:jabber uid/gid for all Jabber-related services
-+prosody_user = "jabber"
-+prosody_group = "jabber"
-+
-+-- Make sure prosodyctl checks in the right spot for the PID file
-+pidfile = "/run/jabber/prosody.pid"
-+
- -- This is the list of modules Prosody will load on startup.
- -- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too.
- -- Documentation for bundled modules can be found at: https://prosody.im/doc/modules
diff --git a/net-im/prosody/files/prosody-0.11.7-bit32.patch b/net-im/prosody/files/prosody-0.11.7-bit32.patch
deleted file mode 100644
index fb7b55f6bbef..000000000000
--- a/net-im/prosody/files/prosody-0.11.7-bit32.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-# HG changeset patch
-# User Kim Alvefur <zash@zash.se>
-# Date 1601928749 -7200
-# Node ID e17b98feb0b7cad6539ee25c5cc7728911349a6d
-# Parent c3eefb517b7b934dbf4f78244c18f7e91b852846
-util.dependencies: Check for bitop library same way as net.websocket.frames (fixes #1594)
-
-diff -r c3eefb517b7b -r e17b98feb0b7 util/dependencies.lua
---- a/util/dependencies.lua
-+++ b/util/dependencies.lua
-@@ -90,7 +90,7 @@
- }, "SSL/TLS support will not be available");
- end
-
-- local bit = _G.bit32 or softreq"bit";
-+ local bit = softreq"bit" or softreq"bit32";
-
- if not bit then
- missingdep("lua-bitops", {
-
diff --git a/net-im/prosody/files/prosody-0.11.7-gentoo.patch b/net-im/prosody/files/prosody-0.12.0-gentoo.patch
index e571066874b7..3b2ba75b15c8 100644
--- a/net-im/prosody/files/prosody-0.11.7-gentoo.patch
+++ b/net-im/prosody/files/prosody-0.12.0-gentoo.patch
@@ -5,25 +5,25 @@
-- for any virtual hosts
+-- Prosody will use this user and group for launching the service.
-+-- Gentoo uses by default jabber:jabber (uid:gid) for all Jabber related services.
-+prosody_user = "jabber"
-+prosody_group = "jabber"
++-- Gentoo uses by default prosody:prosody (uid:gid) for all Jabber related services.
++prosody_user = "prosody"
++prosody_group = "prosody"
+
+-- Prosody will create this pid file after it has been successfully started.
+-- Please don't change that path, as it's being used by the Gentoo init scripts.
-+pidfile = "/run/jabber/prosody.pid"
++pidfile = "/run/prosody/prosody.pid"
+
-- This is a (by default, empty) list of accounts that are admins
-- for the server. Note that you must create the accounts separately
-- (see https://prosody.im/doc/creating_accounts for info)
-@@ -30,7 +39,9 @@
- -- Prosody will always look in its source directory for modules, but
- -- this option allows you to specify additional locations where Prosody
- -- will look for modules first. For community modules, see https://modules.prosody.im/
+@@ -26,7 +35,9 @@
+ -- This option allows you to specify additional locations where Prosody
+ -- will search first for modules. For additional modules you can install, see
+ -- the community module repository at https://modules.prosody.im/
---plugin_paths = {}
+-- The default included path is for the optional net-im/prosody-modules package,
+-- which provides additional community maintained modules.
-+plugin_paths = { "/usr/GENTOO_LIBDIR/prosody/community-modules" };
++plugin_paths = { "/usr/GENTOO_LIBDIR/prosody/modules", "/usr/GENTOO_LIBDIR/prosody/community-modules" };
-- This is the list of modules Prosody will load on startup.
- -- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too.
+ -- Documentation for bundled modules can be found at: https://prosody.im/doc/modules
diff --git a/net-im/prosody/files/prosody.initd-r2 b/net-im/prosody/files/prosody.initd-r2
deleted file mode 100644
index a6b623dd6225..000000000000
--- a/net-im/prosody/files/prosody.initd-r2
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2014 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.initd-r4 b/net-im/prosody/files/prosody.initd-r6
index 1282e9dc4561..e4138c597b23 100644
--- a/net-im/prosody/files/prosody.initd-r4
+++ b/net-im/prosody/files/prosody.initd-r6
@@ -1,17 +1,20 @@
#!/sbin/openrc-run
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-name="Prosody XMPP server"
extra_started_commands="reload"
-jabber_pid="/run/jabber"
-jabber_logs="/var/log/jabber"
-pidfile="${jabber_pid}/prosody.pid"
-prosody_config="/etc/jabber/prosody.cfg.lua"
+name="Prosody XMPP server"
+prosody_config="/etc/prosody/prosody.cfg.lua"
+prosody_data="/var/lib/prosody"
+prosody_logs="/var/log/prosody"
+prosody_pid="/run/prosody"
+pidfile="${prosody_pid}/prosody.pid"
command="/usr/bin/prosody"
-command_group="jabber"
-command_user="jabber"
+command_args="--daemonize"
+commandctl="/usr/bin/prosodyctl"
+command_group="prosody"
+command_user="prosody"
checkconfig() {
if [ ! -f "${prosody_config}" ]; then
@@ -19,13 +22,12 @@ checkconfig() {
return 1
fi
- luac -p "${prosody_config}"
+ ${commandctl} check config
return $?
}
depend() {
need net
- provide jabber-server
use dns postgresql
}
@@ -38,6 +40,7 @@ reload() {
start_pre() {
checkconfig || return 1
- checkpath -d -m 0750 -o "${command_user}:${command_group}" -q "${jabber_logs}"
- checkpath -d -m 0750 -o "${command_user}:${command_group}" -q "${jabber_pid}"
+ checkpath -d -m 0750 -o "${command_user}:${command_group}" -q "${prosody_data}"
+ checkpath -d -m 0750 -o "${command_user}:${command_group}" -q "${prosody_logs}"
+ checkpath -d -m 0750 -o "${command_user}:${command_group}" -q "${prosody_pid}"
}
diff --git a/net-im/prosody/files/prosody.service b/net-im/prosody/files/prosody.service
deleted file mode 100644
index 5c5ea87bd542..000000000000
--- a/net-im/prosody/files/prosody.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=Prosody XMPP (Jabber) server
-After=network.target
-
-[Service]
-Type=forking
-PIDFile=/var/run/jabber/prosody.pid
-ExecStart=/usr/bin/prosodyctl start
-ExecReload=/usr/bin/prosodyctl reload
-ExecStop=/usr/bin/prosodyctl stop
-
-[Install]
-WantedBy=multi-user.target
diff --git a/net-im/prosody/files/prosody.service-r2 b/net-im/prosody/files/prosody.service-r2
deleted file mode 100644
index 81408beefe53..000000000000
--- a/net-im/prosody/files/prosody.service-r2
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=Prosody XMPP server
-After=network.target
-
-[Service]
-Group=jabber
-PIDFile=/run/jabber/prosody.pid
-ExecStart=/usr/bin/prosody
-ExecReload=/bin/kill -HUP $MAINPID
-User=jabber
-
-[Install]
-WantedBy=multi-user.target
diff --git a/net-im/prosody/files/prosody.service-r3 b/net-im/prosody/files/prosody.service-r3
new file mode 100644
index 000000000000..dec39e4b0b22
--- /dev/null
+++ b/net-im/prosody/files/prosody.service-r3
@@ -0,0 +1,17 @@
+[Unit]
+Description=Prosody XMPP server
+After=network.target
+
+[Service]
+Group=prosody
+PIDFile=/run/prosody/prosody.pid
+ExecStart=/usr/bin/prosody --daemonize
+ExecReload=/bin/kill -HUP $MAINPID
+User=prosody
+ExecStartPre=!/bin/mkdir -p /var/log/prosody
+ExecStartPre=!/bin/mkdir -p /var/lib/prosody
+ExecStartPre=!/bin/chown -R prosody /var/log/prosody
+ExecStartPre=!/bin/chown -R prosody /var/lib/prosody
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-im/prosody/files/prosody.tmpfilesd b/net-im/prosody/files/prosody.tmpfilesd
deleted file mode 100644
index 924ba434659c..000000000000
--- a/net-im/prosody/files/prosody.tmpfilesd
+++ /dev/null
@@ -1 +0,0 @@
-d /var/run/jabber 710 jabber jabber
diff --git a/net-im/prosody/files/prosody.tmpfilesd-r1 b/net-im/prosody/files/prosody.tmpfilesd-r1
deleted file mode 100644
index 7fcdd539decc..000000000000
--- a/net-im/prosody/files/prosody.tmpfilesd-r1
+++ /dev/null
@@ -1 +0,0 @@
-d /run/jabber 750 jabber jabber - -
diff --git a/net-im/prosody/files/prosody.tmpfilesd-r2 b/net-im/prosody/files/prosody.tmpfilesd-r2
new file mode 100644
index 000000000000..78949f3db82c
--- /dev/null
+++ b/net-im/prosody/files/prosody.tmpfilesd-r2
@@ -0,0 +1 @@
+d /run/prosody 750 prosody prosody - -
diff --git a/net-im/prosody/metadata.xml b/net-im/prosody/metadata.xml
index d73f165dd534..0cde39ba3d07 100644
--- a/net-im/prosody/metadata.xml
+++ b/net-im/prosody/metadata.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>conikost@gentoo.org</email>
@@ -14,7 +14,6 @@
added functionality, or prototype new protocols.
</longdescription>
<use>
- <flag name="jit">Use LuaJIT instead of vanilla Lua</flag>
<flag name="libevent">Use libevent for event handling</flag>
</use>
</pkgmetadata>
diff --git a/net-im/prosody/prosody-0.11.5-r1.ebuild b/net-im/prosody/prosody-0.11.5-r1.ebuild
deleted file mode 100644
index 6ffc3bd7b489..000000000000
--- a/net-im/prosody/prosody-0.11.5-r1.ebuild
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit multilib systemd toolchain-funcs
-
-DESCRIPTION="Prosody is a flexible communications server for Jabber/XMPP written in Lua"
-HOMEPAGE="https://prosody.im/"
-SRC_URI="https://prosody.im/downloads/source/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="amd64 arm x86"
-IUSE="ipv6 jit libevent libressl mysql postgres sqlite ssl test zlib"
-RESTRICT="!test? ( test )"
-
-BASE_DEPEND="net-im/jabber-base
- dev-lua/LuaBitOp
- !jit? ( >=dev-lang/lua-5.1:0 )
- jit? ( dev-lang/luajit:2 )
- !libressl? ( dev-libs/openssl:0 )
- libressl? ( dev-libs/libressl:= )
- >=net-dns/libidn-1.1:="
-
-DEPEND="${BASE_DEPEND}
- test? ( dev-lua/busted )"
-
-RDEPEND="${BASE_DEPEND}
- ~dev-lua/luaexpat-1.3.0
- dev-lua/luafilesystem
- !ipv6? ( dev-lua/luasocket )
- ipv6? ( >=dev-lua/luasocket-3 )
- 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 )"
-
-PATCHES=( "${FILESDIR}/${PN}-0.11.2-r1-gentoo.patch" )
-
-JABBER_ETC="/etc/jabber"
-JABBER_SPOOL="/var/spool/jabber"
-
-src_configure() {
- # the configure script is handcrafted (and yells at unknown options)
- # hence do not use 'econf'
- ./configure \
- --ostype=linux \
- --prefix="${EPREFIX}/usr" \
- --libdir="${EPREFIX}/usr/$(get_libdir)" \
- --sysconfdir="${EPREFIX}${JABBER_ETC}" \
- --datadir="${EPREFIX}${JABBER_SPOOL}" \
- --with-lua-include="${EPREFIX}/usr/include" \
- --with-lua-lib="${EPREFIX}/usr/$(get_libdir)/lua" \
- --runwith=lua"$(usev jit)" \
- --cflags="${CFLAGS} -Wall -fPIC" \
- --ldflags="${LDFLAGS} -shared" \
- --c-compiler="$(tc-getCC)" \
- --linker="$(tc-getCC)" || die "configure failed"
-
- rm makefile && mv GNUmakefile Makefile || die
-}
-
-src_install() {
- emake DESTDIR="${D}" install
- systemd_dounit "${FILESDIR}/${PN}".service
- systemd_newtmpfilesd "${FILESDIR}/${PN}".tmpfilesd "${PN}".conf
- newinitd "${FILESDIR}/${PN}".initd-r2 ${PN}
- keepdir "${JABBER_SPOOL}"
-}
diff --git a/net-im/prosody/prosody-0.11.7-r2.ebuild b/net-im/prosody/prosody-0.11.7-r2.ebuild
deleted file mode 100644
index 4495eed2ee3a..000000000000
--- a/net-im/prosody/prosody-0.11.7-r2.ebuild
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit systemd tmpfiles toolchain-funcs
-
-DESCRIPTION="Prosody is a modern XMPP communication server"
-HOMEPAGE="https://prosody.im/"
-SRC_URI="https://prosody.im/downloads/source/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~amd64 ~arm ~arm64 ~x86"
-IUSE="+libevent libressl luajit mysql postgres +sqlite +ssl test +zlib"
-RESTRICT="!test? ( test )"
-
-COMMON_DEPEND="
- || (
- >=dev-lang/lua-5.2:*
- dev-lua/lua-bit32
- )
- net-dns/libidn
- net-im/jabber-base
- libressl? ( dev-libs/libressl:= )
- !libressl? ( dev-libs/openssl:0= )
- luajit? ( dev-lang/luajit:2 )
- !luajit? ( dev-lang/lua:0 )
-"
-
-DEPEND="
- ${COMMON_DEPEND}
- test? ( dev-lua/busted )
-"
-
-RDEPEND="
- ${COMMON_DEPEND}
- dev-lua/luaexpat
- dev-lua/luafilesystem
- dev-lua/luasocket
- libevent? ( dev-lua/luaevent )
- mysql? ( dev-lua/luadbi[mysql] )
- postgres? ( dev-lua/luadbi[postgres] )
- sqlite? ( dev-lua/luadbi[sqlite] )
- ssl? ( dev-lua/luasec )
- zlib? ( dev-lua/lua-zlib )
-"
-
-PATCHES=(
- "${FILESDIR}/${PN}-0.11.7-bit32.patch"
- "${FILESDIR}/${PN}-0.11.7-gentoo.patch"
-)
-
-src_prepare() {
- default
-
- # Set correct plugin path for optional net-im/prosody-modules package
- sed -e "s/GENTOO_LIBDIR/$(get_libdir)/g" -i prosody.cfg.lua.dist || die
-}
-
-src_configure() {
- local myeconfargs=(
- --c-compiler="$(tc-getCC)"
- --datadir="${EPREFIX}/var/spool/jabber"
- --libdir="${EPREFIX}/usr/$(get_libdir)"
- --linker="$(tc-getCC)"
- --ostype="linux"
- --prefix="${EPREFIX}/usr"
- --runwith="$(usex luajit luajit lua)"
- --sysconfdir="${EPREFIX}/etc/jabber"
- --with-lua-include="${EPREFIX}/usr/include"
- --with-lua-lib="${EPREFIX}/usr/$(get_libdir)/lua"
- )
-
- # Since the configure script is handcrafted,
- # and yells at unknown options, do not use 'econf'.
- ./configure ${myeconfargs[@]} --cflags="${CFLAGS} -Wall -fPIC" --ldflags="${LDFLAGS} -shared" || die
-
- rm makefile || die
- mv GNUmakefile Makefile || die
-}
-
-src_install() {
- default
-
- newinitd "${FILESDIR}"/prosody.initd-r4 prosody
- systemd_newunit "${FILESDIR}"/prosody.service-r2 prosody.service
-
- newtmpfiles "${FILESDIR}"/prosody.tmpfilesd-r1 prosody.conf
-
- keepdir /var/spool/jabber
-}
-
-pkg_postinst() {
- tmpfiles_process prosody.conf
-}
diff --git a/net-im/prosody/prosody-0.12.4.ebuild b/net-im/prosody/prosody-0.12.4.ebuild
new file mode 100644
index 000000000000..29ac71036832
--- /dev/null
+++ b/net-im/prosody/prosody-0.12.4.ebuild
@@ -0,0 +1,164 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-{1..4} luajit )
+LUA_REQ_USE="deprecated(+)"
+
+inherit lua-single systemd tmpfiles toolchain-funcs
+
+DESCRIPTION="Prosody is a modern XMPP communication server"
+HOMEPAGE="https://prosody.im/"
+SRC_URI="https://prosody.im/downloads/source/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="amd64 ~arm ~arm64 x86"
+IUSE="icu +idn +libevent ldap mysql postgres selinux +sqlite +ssl test +zlib"
+REQUIRED_USE="
+ ^^ ( icu idn )
+ ${LUA_REQUIRED_USE}
+"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+ acct-group/prosody
+ acct-user/prosody
+ $(lua_gen_cond_dep 'dev-lua/luaexpat[${LUA_USEDEP}]')
+ $(lua_gen_cond_dep 'dev-lua/luafilesystem[${LUA_USEDEP}]')
+ dev-lua/luarocks[${LUA_SINGLE_USEDEP}]
+ $(lua_gen_cond_dep 'dev-lua/luasocket[${LUA_USEDEP}]')
+ $(lua_gen_cond_dep 'dev-lua/lua-unbound[${LUA_USEDEP}]')
+ $(lua_gen_cond_dep 'dev-lua/readline[${LUA_USEDEP}]')
+ icu? ( dev-libs/icu:= )
+ idn? ( net-dns/libidn:= )
+ ldap? ( $(lua_gen_cond_dep 'dev-lua/lualdap[${LUA_USEDEP}]') )
+ libevent? ( $(lua_gen_cond_dep 'dev-lua/luaevent[${LUA_USEDEP}]') )
+ dev-libs/openssl:0=
+ lua_single_target_lua5-1? ( $(lua_gen_cond_dep 'dev-lua/lua-bit32[lua_targets_lua5-1(-)]') )
+ mysql? ( $(lua_gen_cond_dep 'dev-lua/luadbi[mysql,${LUA_USEDEP}]') )
+ postgres? ( $(lua_gen_cond_dep 'dev-lua/luadbi[postgres,${LUA_USEDEP}]') )
+ sqlite? ( $(lua_gen_cond_dep 'dev-lua/luadbi[sqlite,${LUA_USEDEP}]') )
+ ssl? ( $(lua_gen_cond_dep 'dev-lua/luasec[${LUA_USEDEP}]') )
+ zlib? ( $(lua_gen_cond_dep 'dev-lua/lua-zlib[${LUA_USEDEP}]') )
+ ${LUA_DEPS}
+"
+
+RDEPEND="
+ ${DEPEND}
+ selinux? ( sec-policy/selinux-jabber )
+"
+
+BDEPEND="
+ virtual/pkgconfig
+ test? ( $(lua_gen_cond_dep 'dev-lua/busted[${LUA_USEDEP}]') )
+"
+
+PATCHES=( "${FILESDIR}/${PN}-0.12.0-gentoo.patch" )
+
+src_prepare() {
+ default
+
+ # Set correct plugin path for optional net-im/prosody-modules package
+ sed -e "s/GENTOO_LIBDIR/$(get_libdir)/g" -i prosody.cfg.lua.dist || die
+}
+
+src_configure() {
+ local myeconfargs=(
+ --add-cflags="${CFLAGS}"
+ --add-ldflags="${LDFLAGS}"
+ --c-compiler="$(tc-getCC)"
+ --datadir="${EPREFIX}/var/lib/prosody"
+ --idn-library="$(usex idn 'idn' 'icu')"
+ --libdir="${EPREFIX}/usr/$(get_libdir)"
+ --linker="$(tc-getCC)"
+ --lua-version="$(usex lua_single_target_luajit '5.1' $(ver_cut 1-2 $(lua_get_version)))"
+ --no-example-certs
+ --ostype="linux"
+ --prefix="${EPREFIX}/usr"
+ --runwith="${ELUA}"
+ --sysconfdir="${EPREFIX}/etc/prosody"
+ --with-lua-include="${EPREFIX}/$(lua_get_include_dir)"
+ --with-lua-lib="${EPREFIX}/$(lua_get_cmod_dir)"
+ )
+
+ # Since the configure script is handcrafted,
+ # and yells at unknown options, do not use 'econf'.
+ ./configure "${myeconfargs[@]}" || die
+
+ rm makefile || die
+ mv GNUmakefile Makefile || die
+}
+
+src_install() {
+ default
+
+ keepdir /var/lib/prosody
+
+ newinitd "${FILESDIR}"/prosody.initd-r6 prosody
+ systemd_newunit "${FILESDIR}"/prosody.service-r3 prosody.service
+
+ newtmpfiles "${FILESDIR}"/prosody.tmpfilesd-r2 prosody.conf
+}
+
+pkg_postinst() {
+ local migrate_to_prosody_user="false"
+ tmpfiles_process prosody.conf
+
+ if [[ ${REPLACING_VERSIONS} ]]; then
+ for v in ${REPLACING_VERSIONS}; do
+ if ver_test "${v}" -lt 0.12.0; then
+ migrate_to_prosody_user="true"
+ break
+ fi
+ done
+ fi
+
+ # Sarting with >=0.12.0, the prosody configuration is now in
+ # /etc/prosody and no longer in /etc/jabber.
+ # See if we need to migrate the configuration. Furthermore,
+ # prosody no longer runs under the, shared via net-im/jabber-base,
+ # 'jabber' use, but under its own user.
+ # This increase isolation and hence robustness and security.
+ if ${migrate_to_prosody_user}; then
+ local -A dirs_to_migrate=(
+ [/etc/jabber]=/etc/prosody
+ [/var/log/jabber]=/var/log/prosody
+ [/var/spool/jabber]=/var/lib/prosody
+ )
+
+ for src_dir in "${!dirs_to_migrate[@]}"; do
+ local eroot_src_dir="${EROOT}/${src_dir}"
+ local eroot_dst_dir="${EROOT}/${dirs_to_migrate[${src_dir}]}"
+
+ cp -r "${eroot_src_dir}"/. "${eroot_dst_dir}" || die "Could not copy ${eroot_src_dir} to ${eroot_dst_dir}"
+
+ if [[ -f "${eroot_dst_dir}"/.keep_net-im_jabber-base-0 ]]; then
+ rm "${eroot_dst_dir}"/.keep_net-im_jabber-base-0 || die
+ fi
+
+ if ! use prefix; then
+ chown --recursive prosody:prosody "${eroot_dst_dir}" || die
+ fi
+ done
+
+ # Update configuration file to match new pathes and permissions
+ local mysedargs=(
+ -e "'s#/etc/jabber#/etc/prosody#g'"
+ -e "'s#/run/jabber#/run/prosody#g'"
+ -e "'s#/var/log/jabber#/var/log/prosody#g'"
+ -e "'s/prosody_user.*/prosody_user = \"prosody\";/g'"
+ -e "'s/prosody_group.*/prosody_group = \"prosody\";/g'"
+ -i /etc/prosody/prosody.cfg.lua
+ )
+
+ eval sed "${mysedargs[@]}" || die
+
+ ewarn "Newer versions of the prosody (Gentoo) package use ${EROOT}/etc/prosody"
+ ewarn "(just as upstream) and *not* anymore ${EROOT}/etc/jabber."
+ ewarn "The files from ${EROOT}/etc/jabber where copied to ${EROOT}/etc/prosody."
+ ewarn "Also prosody's spool directory became ${EROOT}/var/lib/prosody (was ${EROOT}/var/spool/jabbber)."
+ ewarn "Please check your configuration."
+ fi
+}