This commit is contained in:
Gerben Jan Dijkman 2024-09-18 11:56:41 +02:00
parent ca39accd65
commit 54df2a81ce
8 changed files with 0 additions and 372 deletions

View File

@ -1,3 +0,0 @@
DIST ejabberd-24.07-fix-ejabberdctl.patch 1945 BLAKE2B 3e9e690802dd201aaba50b16435c98e64b52bfa2c77dd054c4db538f8bd9035386282e43b3c51fa444119901addeb2c3174d55d66a515847f80771e350e0a808 SHA512 0a6780915177fa4012a194d3fa755a812f0bed5d446df630c46834953aad54679450ff9fdaa1aa7fb415de5bb905a3dc2b28c65b7b32f0fd83cd99634bb5073d
DIST ejabberd-24.07-set-ejabberd-opts.patch 1508 BLAKE2B 1692fb54b3aeb9838f057d32ebebffbcca5761c820d95a377b257966094e973465740b224d17bebdae0a4f3d0b5ebe35c9c1b005217a3e9baae69fc2511c69aa SHA512 aa7f13be15ec4cb0a9c17e5c1519d5fd94ccee75b46e3a8ee1de39e23000c7faad530208c049dd4a290be18b8b9f1c866584a9abf3f288a8f2fd66c2d72e4fa5
DIST ejabberd-24.07.tar.gz 2522211 BLAKE2B 32ac7abbbb2acebfc409e93bde097104354664227cac7e1d673f224681900b1dae74aa770141e520c5d4b35a6bc7748f889ab9647cac812f407f7a0ec8da50f9 SHA512 e53c5082c92297ff956b4d811d69ba5b745a1989590e73dc890663cfcdea102e27bafa79452062883a7de8fdf5b5c481d81c68c61a3e888f5e5b668e9ac9bf3c

View File

@ -1,221 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools pam rebar systemd
DESCRIPTION="Robust, scalable and extensible XMPP server"
HOMEPAGE="https://www.ejabberd.im/ https://github.com/processone/ejabberd/"
SRC_URI="
https://github.com/processone/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
https://github.com/processone/ejabberd/commit/841d5c029905d5feabe07ab5a4db3aacfeedefb6.patch ->
${P}-fix-ejabberdctl.patch
https://github.com/processone/ejabberd/commit/4ea46c57653b3d9ea9c1386d1cc3dd07163d74d6.patch ->
${P}-set-ejabberd-opts.patch
"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~sparc ~x86 ~arm64"
REQUIRED_USE="mssql? ( odbc )"
# TODO: Add 'tools' flag.
IUSE="captcha debug full-xml ldap mssql mysql odbc pam postgres redis
roster-gw selinux sip sqlite +stun zlib"
RESTRICT="test"
# TODO: Add dependencies for 'tools' flag enabled.
# TODO: tools? (
# TODO: >=dev-erlang/luerl-0.3
# TODO: )
DEPEND="
>=dev-lang/erlang-20[odbc?,ssl]
>=dev-erlang/cache_tab-1.0.30
>=dev-erlang/eimp-1.0.22
>=dev-erlang/fast_tls-1.1.19
>=dev-erlang/fast_xml-1.1.51
>=dev-erlang/fast_yaml-1.0.36
>=dev-erlang/yconf-1.0.15
>=dev-erlang/jiffy-1.0.5
>=dev-erlang/jose-1.11.5
>=dev-erlang/lager-3.9.1
>=dev-erlang/p1_oauth2-0.6.14
>=dev-erlang/p1_utils-1.0.25
>=dev-erlang/stringprep-1.0.29
>=dev-erlang/xmpp-1.8.1
>=dev-erlang/pkix-1.0.9
>=dev-erlang/mqtree-1.0.16
>=dev-erlang/idna-6.0.0-r1
>=dev-erlang/p1_acme-1.0.22
>=dev-erlang/base64url-1.0.1
ldap? ( =net-nds/openldap-2* )
mysql? ( >=dev-erlang/p1_mysql-1.0.23 )
odbc? ( dev-db/unixODBC )
pam? ( >=dev-erlang/epam-1.0.14 )
postgres? ( >=dev-erlang/p1_pgsql-1.1.25 )
redis? ( >=dev-erlang/eredis-1.2.0 )
sip? ( >=dev-erlang/esip-1.0.52 )
sqlite? ( >=dev-erlang/sqlite3-1.1.14 )
stun? ( >=dev-erlang/stun-1.2.12 )
zlib? ( >=dev-erlang/ezlib-1.0.12 )
"
RDEPEND="
${DEPEND}
>=acct-user/ejabberd-2[pam?]
captcha? ( media-gfx/imagemagick[truetype,png] )
selinux? ( sec-policy/selinux-jabber )
"
DOCS=( CHANGELOG.md README.md )
PATCHES=(
"${FILESDIR}/ejabberd-22.10-adjust-ejabberd.service.template-to-Gentoo.patch"
)
# Get path to ejabberd lib directory.
#
# This is the path ./configure script Base for this path is path set in
# ./configure script which is /usr/lib by default. If libdir is explicitely set
# to something else than this should be adjusted here as well.
get_ejabberd_path() {
echo "/usr/$(get_libdir)/${P}"
}
src_prepare() {
default
eautoreconf
rebar_remove_deps
# Set paths to ejabberd lib directory consistently to point always to directory
# suffixed with version.
sed -e "/^EJABBERDDIR[[:space:]]*=/{s:ejabberd:${P}:}" \
-i "${S}/Makefile.in" \
|| die 'failed to set ejabberd path in Makefile.in'
# Get epam-wrapper from 'files' directory and correct path to lib directory in
# it. epam-wrapper is placed into work directory. It is assumed no epam-wrapper
# file exists there already.
local epam_wrapper_src="${FILESDIR}/epam-wrapper"
local epam_wrapper_dst="${S}/epam-wrapper"
[[ -e ${epam_wrapper_dst} ]] && die 'epam-wrapper already exists'
sed -r -e "s@^(ERL_LIBS=).*\$@\1${EPREFIX}$(get_erl_libs)@" \
"${epam_wrapper_src}" >"${epam_wrapper_dst}" \
|| die 'failed to install epam-wrapper'
rebar_fix_include_path fast_xml
rebar_fix_include_path p1_utils
rebar_fix_include_path xmpp
# Fix bug #591862. ERL_LIBS should point directly to ejabberd directory
# rather than its parent which is default. That way ejabberd directory
# takes precedence is module lookup.
local ejabberd_erl_libs="$(get_ejabberd_path):$(get_erl_libs)"
sed -e "s|\(ERL_LIBS=\)'{{libdir}}'\.*|\1${ejabberd_erl_libs}|" \
-i "${S}/ejabberdctl.template" \
|| die 'failed to set ERL_LIBS in ejabberdctl.template'
}
src_configure() {
econf \
--docdir="${EPREFIX}/usr/share/doc/${PF}/html" \
--localstatedir="${EPREFIX}/var" \
--enable-user=${PN} \
--with-rebar=rebar \
$(use_enable debug) \
$(use_enable full-xml) \
$(use_enable mssql) \
$(use_enable mysql) \
$(use_enable odbc) \
$(use_enable pam) \
$(use_enable postgres pgsql) \
$(use_enable redis) \
$(use_enable roster-gw roster-gateway-workaround) \
$(use_enable sqlite) \
$(use_enable sip) \
$(use_enable stun) \
$(use_enable zlib)
# more options to support
# --enable-elixir requires https://github.com/elixir-lang/elixir
}
src_compile() {
# Note that we also add ejabberdctl.example, which will be used by
# ejabberd's build system to create /usr/sbin/ejabberdctl, as
# target. Otherwise, ejabberdctl.example is due to be created by the
# 'install' target (as per upstream's Makefile.in). However when
# invoke the 'install' target (in src_install below), DESTDIR is
# set, which causes DESTDIR to scope into the ejabberdctl.example
# generation.
emake REBAR='rebar -v' src ejabberdctl.example ejabberd.service
}
src_install() {
default
if use pam; then
local epam_path="$(get_ejabberd_path)/priv/bin/epam"
pamd_mimic_system xmpp auth account
into "$(get_ejabberd_path)/priv"
newbin epam-wrapper epam
fi
newconfd "${FILESDIR}/${PN}.confd" "${PN}"
newinitd "${FILESDIR}/${PN}-22.05.initd" "${PN}"
systemd_dounit "${PN}.service"
insinto /etc/logrotate.d
newins "${FILESDIR}/${PN}-22.05.logrotate" "${PN}"
keepdir /var/{lib,log}/ejabberd
}
pkg_postinst() {
local migrate_to_ejabberd_user=false
if [[ ${REPLACING_VERSIONS} ]]; then
for v in ${REPLACING_VERSIONS}; do
if ver_test "${v}" -lt 21.04-r1; then
migrate_to_ejabberd_user=true
break
fi
done
fi
# Sarting with >=21.04-r1, the ejabberd configuration is now in
# /etc/ejabberd and no longer in /etc/jabber. See if we need to
# migrate the configuration. Furthermore, ejabberd 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_ejabberd_user; then
ewarn "Newer versions of the ejabberd Gentoo package use /etc/ejabberd"
ewarn "(just as upstream) and *not* /etc/jabber."
ewarn "The files from /etc/jabber will now be copied to /etc/ejabberd."
ewarn "Also ejabberd's spool directory became /var/lib/ejabberd (was /var/spool/jabber)."
ewarn "Please check your configuration, and finish the migration by stopping ejabberd"
ewarn "followed by rsync'ing /var/spool/jabber to /var/lib/ejabberd."
local -A dirs_to_migrate=(
[/etc/jabber]=/etc/ejabberd
[/var/spool/jabber]=/var/lib/ejabberd
)
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 ejabberd:ejabberd "${eroot_dst_dir}" || die
fi
done
fi
}

View File

@ -1,39 +0,0 @@
From c0af543fc3b6047f66bfe820e7ce75abd3ed2049 Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flo@geekplace.eu>
Date: Fri, 10 Dec 2021 12:36:45 +0100
Subject: [PATCH] Adjust ejabberd.service.template to Gentoo
---
Makefile.in | 2 +-
ejabberd.service.template | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index ab0e9d96702e..4d97570733aa 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -300,7 +300,7 @@ install: copy-files
chmod 755 ejabberd.init
#
# Service script
- $(SED) -e "s*@ctlscriptpath@*$(SBINDIR)*g" \
+ $(SED) -e "s*@ctlscriptpath@*/usr/sbin*g" \
-e "s*@installuser@*$(INIT_USER)*g" ejabberd.service.template \
> ejabberd.service
chmod 644 ejabberd.service
diff --git a/ejabberd.service.template b/ejabberd.service.template
index 685a104d00ae..e384e920280b 100644
--- a/ejabberd.service.template
+++ b/ejabberd.service.template
@@ -1,6 +1,7 @@
[Unit]
Description=XMPP Server
-After=network.target
+After=epmd.service network.target
+Requires=epmd.service
[Service]
Type=notify
--
2.33.1

View File

@ -1,54 +0,0 @@
#!/sbin/openrc-run
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
extra_started_commands="reload"
depend() {
use dns
need epmd net
provide jabber-server
}
start() {
if ejabberdctl status >/dev/null 2>&1; then
ewarn "ejabberd is already started (manually?)."
return 0
fi
ebegin "Starting ejabberd"
/usr/sbin/ejabberdctl ${EJABBERDCTL_OPTS} start
eend $?
}
reload() {
ebegin "Reloading ejabberd configuration"
/usr/sbin/ejabberdctl ${EJABBERDCTL_OPTS} reload_config
eend $?
}
stop() {
ejabberdctl status >/dev/null 2>&1
if test $? = 3; then
ewarn "ejabberd is already stopped (manually?)."
return 0
fi
ebegin "Stopping ejabberd"
if /usr/sbin/ejabberdctl stop >/dev/null 2>&1; then
cnt=0
sleep 1
while ejabberdctl status >/dev/null 2>&1 || test $? = 1; do
echo .
cnt=`expr $cnt + 1`
if [ $cnt -ge 60 ] ; then
eend 1
break
fi
sleep 1
done
eend 0
else
eend 1
einfo "Please, run '/usr/sbin/ejabberdctl stop' to see what's going on."
fi
eend 0
}

View File

@ -1,13 +0,0 @@
/var/log/ejabberd/*.log {
su ejabberd ejabberd
weekly
rotate 4
missingok
nocreate
sharedscripts
notifempty
compress
postrotate
/usr/sbin/ejabberdctl reopen-log > /dev/null 2>&1 || true
endscript
}

View File

@ -1,16 +0,0 @@
From c0af543fc3b6047f66bfe820e7ce75abd3ed2049 Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flo@geekplace.eu>
Date: Fri, 10 Dec 2021 12:36:45 +0100
Subject: [PATCH] Adjust ejabberd.service.template to Gentoo
--- a/ejabberd.service.template
+++ b/ejabberd.service.template
@@ -1,6 +1,7 @@
[Unit]
Description=XMPP Server
-After=network.target
+After=epmd.service network.target
+Requires=epmd.service
[Service]
Type=notify

View File

@ -1,5 +0,0 @@
# Please configure everything at /etc/jabber/ejabberdctl.cfg
# Put here only command line arguments for ejabberdctl (if any are required)
#EJABBERDCTL_OPTS=""

View File

@ -1,21 +0,0 @@
#!/bin/sh
ERL_LIBS=/usr/lib/erlang/lib
for bin in "$ERL_LIBS"/epam-*/priv/bin/epam; do
if [ -x "$bin" ]; then
if [ -z "$epam" ]; then
epam="$bin"
else
echo "Multiple epam libraries - don't know what to do" >&2
exit 1
fi
fi
done
if [ -z "$epam" ]; then
echo "Couldn't find epam package" >&2
exit 1
fi
exec "$epam"