diff options
author | Florian Schmaus <flow@gentoo.org> | 2021-12-10 10:18:16 +0100 |
---|---|---|
committer | Florian Schmaus <flow@gentoo.org> | 2021-12-10 14:05:49 +0100 |
commit | 78a9b46fa734d8a64b17c5230ba1f2a5f76f7e76 (patch) | |
tree | ec860a3bc4272532f8e958e757807e49c049fb0a /net-im | |
parent | dev-erlang/esip: add 1.0.45 (diff) | |
download | gentoo-78a9b46fa734d8a64b17c5230ba1f2a5f76f7e76.tar.gz gentoo-78a9b46fa734d8a64b17c5230ba1f2a5f76f7e76.tar.bz2 gentoo-78a9b46fa734d8a64b17c5230ba1f2a5f76f7e76.zip |
net-im/ejabberd: add 21.12
Closes: https://bugs.gentoo.org/810886
Closes: https://github.com/gentoo/gentoo/pull/23239
Signed-off-by: Florian Schmaus <flow@gentoo.org>
Diffstat (limited to 'net-im')
-rw-r--r-- | net-im/ejabberd/Manifest | 1 | ||||
-rw-r--r-- | net-im/ejabberd/ejabberd-21.12.ebuild | 218 | ||||
-rw-r--r-- | net-im/ejabberd/files/adjust-ejabberd.service.template-to-Gentoo.patch | 39 |
3 files changed, 258 insertions, 0 deletions
diff --git a/net-im/ejabberd/Manifest b/net-im/ejabberd/Manifest index a3cfc05ea25e..e50617f20488 100644 --- a/net-im/ejabberd/Manifest +++ b/net-im/ejabberd/Manifest @@ -1,2 +1,3 @@ DIST ejabberd-20.04.tar.gz 2022319 BLAKE2B 02ce782bc58a808f38dff58715204059c51762187abff7f5c77ff08eb13330b66485234eb2204c4336770d75303417ee74077466a07e701aa512158ff641a578 SHA512 7c478bbd73577e06f21e26804f4eb57deb52a0ebdd12e45034e810314cb73bb2ec60b55c6f266271eb45d5ebc135a39c498a29706d6d1f5087fd2b509a8844ca DIST ejabberd-21.04.tar.gz 1560934 BLAKE2B 85e7a381b9fdb1274b8aff04ba98587d31aaba6e0c99b0bd5b8ad28f776a7e6dfd8c4425f57591962e69387d42e3416855fa94e914638352af1853f81e88315e SHA512 4f7f645dbca35187c412e75fe90bcb96b87fc71beb073e0b913155e78832499f57218b1c42e0adf139a24cf1e235b4d1d123214a472aabf093a65f5d136b9579 +DIST ejabberd-21.12.tar.gz 2532288 BLAKE2B 847fa90ce0140c384add489a97d566e3edf9927f71c4abf4f51869f2e0ba4a5183002cb5e4f7a9d7f4ad5ed5902a47b2dd336ab1ef854673a3a2f337326a3fc2 SHA512 4f1e56becb9970355b98c0ad177ee162130346e53aa92c274e502fe300d6f4dc7fda8fcca845821087da78379a19a2962b50794b71d139c91764539fcfeec73c diff --git a/net-im/ejabberd/ejabberd-21.12.ebuild b/net-im/ejabberd/ejabberd-21.12.ebuild new file mode 100644 index 000000000000..e4ed2bfaac5c --- /dev/null +++ b/net-im/ejabberd/ejabberd-21.12.ebuild @@ -0,0 +1,218 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit pam rebar systemd + +DESCRIPTION="Robust, scalable and extensible XMPP server" +HOMEPAGE="https://www.ejabberd.im/ https://github.com/processone/ejabberd/" +SRC_URI="https://static.process-one.net/${PN}/downloads/${PV}/${P}.tgz + -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ia64 ~sparc ~x86" +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-19.3[odbc?,ssl] + >=dev-erlang/cache_tab-1.0.29 + >=dev-erlang/eimp-1.0.21 + >=dev-erlang/fast_tls-1.1.13 + >=dev-erlang/fast_xml-1.1.48 + >=dev-erlang/fast_yaml-1.0.32 + >=dev-erlang/yconf-1.0.12 + >=dev-erlang/jiffy-1.0.5 + >=dev-erlang/jose-1.11.1 + >=dev-erlang/lager-3.9.1 + >=dev-erlang/p1_oauth2-0.6.10 + >=dev-erlang/p1_utils-1.0.23 + >=dev-erlang/stringprep-1.0.27 + >=dev-erlang/xmpp-1.5.6 + >=dev-erlang/pkix-1.0.8 + >=dev-erlang/mqtree-1.0.14 + >=dev-erlang/idna-6.0.0-r1 + >=dev-erlang/p1_acme-1.0.16 + >=dev-erlang/base64url-1.0.1 + ldap? ( =net-nds/openldap-2* ) + mysql? ( >=dev-erlang/p1_mysql-1.0.19 ) + odbc? ( dev-db/unixODBC ) + pam? ( >=dev-erlang/epam-1.0.12 ) + postgres? ( >=dev-erlang/p1_pgsql-1.1.16 ) + redis? ( >=dev-erlang/eredis-1.2.0 ) + sip? ( >=dev-erlang/esip-1.0.45 ) + sqlite? ( >=dev-erlang/sqlite3-1.1.13 ) + stun? ( >=dev-erlang/stun-1.0.47 ) + zlib? ( >=dev-erlang/ezlib-1.0.10 )" +RDEPEND="${DEPEND} + acct-user/ejabberd + captcha? ( media-gfx/imagemagick[truetype,png] ) + selinux? ( sec-policy/selinux-jabber ) +" + +DOCS=( CHANGELOG.md README.md ) +PATCHES=( + "${FILESDIR}/${PN}-19.08-ejabberdctl.patch" + "${FILESDIR}/adjust-ejabberd.service.template-to-Gentoo.patch" +) + +# Set paths to ejabberd lib directory consistently to point always to directory +# suffixed with version. +correct_ejabberd_paths() { + sed -e "/^EJABBERDDIR[[:space:]]*=/{s:ejabberd:${P}:}" \ + -i "${S}/Makefile.in" \ + || die 'failed to set ejabberd path in Makefile.in' + sed -e "/EJABBERD_BIN_PATH=/{s:ejabberd:${P}:}" \ + -i "${S}/ejabberdctl.template" \ + || die 'failed to set ejabberd path in ejabberdctl.template' +} + +# 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. +customize_epam_wrapper() { + local epam_wrapper_src="${1}" + 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' +} + +# 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 + + rebar_remove_deps + correct_ejabberd_paths + customize_epam_wrapper "${FILESDIR}/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} \ + $(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() { + emake REBAR='rebar -v' src +} + +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}.initd" "${PN}" + systemd_dounit "${PN}.service" + + insinto /etc/logrotate.d + newins "${FILESDIR}/${PN}.logrotate" "${PN}" + + keepdir /var/{lib,log}/ejabberd +} + +pkg_preinst() { + if use pam; then + einfo "Adding ejabberd user to epam group to allow ejabberd to use PAM" \ + "authentication" + # See + # <https://docs.ejabberd.im/admin/configuration/#pam-authentication>. + # epam binary is installed by dev-erlang/epam package, therefore SUID + # is set by that package. Instead of jabber group it uses epam group, + # therefore we need to add jabber user to epam group. + usermod -a -G epam ejabberd || die + fi +} + +pkg_postinst() { + local migrate_to_etc_ejabberd=false + + if [[ ! ${REPLACING_VERSIONS} ]]; then + echo + elog "For configuration instructions, please see" + elog " https://docs.ejabberd.im/" + echo + else + for v in ${REPLACING_VERSIONS}; do + if ver_test "${v}" -lt 21.04-r1; then + migrate_to_etc_ejabberd=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_etc_ejabberd; then + cp -r "${EROOT}"/etc/jabber/. "${EROOT}"/etc/ejabberd || die + if [[ -f "${EROOT}"/etc/ejabberd/.keep_net-im_jabber-base-0 ]]; then + rm "${EROOT}"/etc/ejabberd/.keep_net-im_jabber-base-0 || die + fi + if ! use prefix; then + chown --recursive ejabberd:ejabberd "${EROOT}"/etc/ejabberd || die + fi + elog "Newer versions of the ejabberd Gentoo package use /etc/ejabberd" + elog "(just as upstream) and *not* /etc/ejabber." + elog "The files from /etc/jabber where copied to /etc/ejabberd." + elog "Please check your configuration and delete the file in /etc/jabber." + fi +} diff --git a/net-im/ejabberd/files/adjust-ejabberd.service.template-to-Gentoo.patch b/net-im/ejabberd/files/adjust-ejabberd.service.template-to-Gentoo.patch new file mode 100644 index 000000000000..9bf8e10f87a9 --- /dev/null +++ b/net-im/ejabberd/files/adjust-ejabberd.service.template-to-Gentoo.patch @@ -0,0 +1,39 @@ +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 + |