summaryrefslogtreecommitdiff
path: root/net-im
diff options
context:
space:
mode:
authorAustin English <wizardedit@gentoo.org>2016-05-02 13:45:23 -0500
committerAustin English <wizardedit@gentoo.org>2016-05-02 17:21:47 -0500
commita242ed3811b5d852766dd960814e49262e12cf69 (patch)
tree333633f874f330c9dbc9cb43d3328592fa05505e /net-im
parentnet-wireless/wireless-regdb: bump (diff)
downloadgentoo-a242ed3811b5d852766dd960814e49262e12cf69.tar.gz
gentoo-a242ed3811b5d852766dd960814e49262e12cf69.tar.bz2
gentoo-a242ed3811b5d852766dd960814e49262e12cf69.zip
net-im/jabberd2: use #!/sbin/openrc-run instead of #!/sbin/runscript
Gentoo-Bug: https://bugs.gentoo.org/573846 Package-Manager: portage-2.2.26
Diffstat (limited to 'net-im')
-rw-r--r--net-im/jabberd2/files/jabberd2-2.3.1.init4
-rw-r--r--net-im/jabberd2/files/jabberd2-2.3.2.init4
-rw-r--r--net-im/jabberd2/jabberd2-2.3.1-r2.ebuild156
-rw-r--r--net-im/jabberd2/jabberd2-2.3.2-r2.ebuild157
-rw-r--r--net-im/jabberd2/jabberd2-2.3.3-r2.ebuild160
-rw-r--r--net-im/jabberd2/jabberd2-2.3.4-r1.ebuild180
6 files changed, 657 insertions, 4 deletions
diff --git a/net-im/jabberd2/files/jabberd2-2.3.1.init b/net-im/jabberd2/files/jabberd2-2.3.1.init
index 696a94489836..4f885c754369 100644
--- a/net-im/jabberd2/files/jabberd2-2.3.1.init
+++ b/net-im/jabberd2/files/jabberd2-2.3.1.init
@@ -1,5 +1,5 @@
-#!/sbin/runscript
-# Copyright 1999-2013 Gentoo Foundation
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
diff --git a/net-im/jabberd2/files/jabberd2-2.3.2.init b/net-im/jabberd2/files/jabberd2-2.3.2.init
index 108923fa71c0..cf650fdd0aed 100644
--- a/net-im/jabberd2/files/jabberd2-2.3.2.init
+++ b/net-im/jabberd2/files/jabberd2-2.3.2.init
@@ -1,5 +1,5 @@
-#!/sbin/runscript
-# Copyright 1999-2014 Gentoo Foundation
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
diff --git a/net-im/jabberd2/jabberd2-2.3.1-r2.ebuild b/net-im/jabberd2/jabberd2-2.3.1-r2.ebuild
new file mode 100644
index 000000000000..17cab1553e1b
--- /dev/null
+++ b/net-im/jabberd2/jabberd2-2.3.1-r2.ebuild
@@ -0,0 +1,156 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit db-use eutils flag-o-matic pam
+
+DESCRIPTION="Open Source Jabber Server"
+HOMEPAGE="http://jabberd2.org"
+SRC_URI="https://github.com/jabberd2/jabberd2/releases/download/jabberd-${PV}/jabberd-${PV}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc sparc x86 ~x86-fbsd"
+IUSE="berkdb debug ldap memdebug mysql pam postgres sqlite ssl test zlib"
+REQUIRED_USE="memdebug? ( debug )"
+
+# broken
+RESTRICT="test"
+
+DEPEND="dev-libs/expat
+ net-libs/udns
+ net-dns/libidn
+ virtual/gsasl
+ berkdb? ( >=sys-libs/db-4.1.25 )
+ ldap? ( net-nds/openldap )
+ mysql? ( virtual/mysql )
+ pam? ( virtual/pam )
+ postgres? ( dev-db/postgresql )
+ ssl? ( >=dev-libs/openssl-1.0.1:0 )
+ sqlite? ( dev-db/sqlite:3 )
+ zlib? ( sys-libs/zlib )"
+RDEPEND="${DEPEND}
+ >=net-im/jabber-base-0.01"
+DEPEND="${DEPEND}
+ app-arch/xz-utils
+ virtual/pkgconfig
+ test? ( dev-libs/check )"
+
+DOCS=( AUTHORS README )
+
+S=${WORKDIR}/jabberd-${PV}
+
+src_prepare() {
+ # Fix some default directory locations
+ sed -i \
+ -e 's,@localstatedir@/@package@/pid/,/var/run/@package@/,g' \
+ -e 's,@localstatedir@/@package@/run/pbx,/var/run/@package@/pbx,g' \
+ -e 's,@localstatedir@/@package@/log/,/var/log/@package@/,g' \
+ -e 's,@localstatedir@/lib/jabberd2/fs,@localstatedir@/@package@/fs,g' \
+ -e 's,@localstatedir@,/var/spool,g' \
+ -e 's,@package@,jabber,g' \
+ etc/{sm,router,c2s,s2s}.xml.dist.in || die "fixing default directory locations failed!"
+
+ # If the package wasn't merged with sqlite then default to use berkdb
+ use sqlite ||
+ sed -i \
+ -e 's,<\(module\|driver\)>sqlite<\/\1>,<\1>db</\1>,g' \
+ etc/{c2s,sm}.xml.dist.in || die "setting berkdb as default failed!"
+
+ # avoid file collision with x11-misc/screen-message wrt #453994
+ sed -i \
+ -e 's/@jabberd_router_bin@/jabberd2-router/' \
+ -e 's/@jabberd_c2s_bin@/jabberd2-c2s/' \
+ -e 's/@jabberd_s2s_bin@/jabberd2-s2s/' \
+ -e 's/@jabberd_sm_bin@/jabberd2-sm/' \
+ etc/jabberd*.in || die "fixing file collisions failed!"
+
+ # rename pid files wrt #241472
+ sed -i \
+ -e '/pidfile/s/c2s\.pid/jabberd2-c2s\.pid/' \
+ -e '/pidfile/s/router\.pid/jabberd2-router\.pid/' \
+ -e '/pidfile/s/s2s\.pid/jabberd2-s2s\.pid/' \
+ -e '/pidfile/s/sm\.pid/jabberd2-sm\.pid/' \
+ etc/*.xml.dist.in || die "renaming pid files failed!"
+}
+
+src_configure() {
+ # https://bugs.gentoo.org/show_bug.cgi?id=207655#c3
+ # https://github.com/jabberd2/jabberd2/issues/34
+ replace-flags -O[3s] -O2
+
+ # --enable-pool-debug is currently broken
+ econf \
+ --sysconfdir=/etc/jabber \
+ $(usex debug "--enable-debug" "") \
+ $(usex memdebug "--enable-nad-debug" "") \
+ $(use_enable ssl) \
+ $(use_enable mysql) \
+ $(use_enable postgres pgsql) \
+ $(use_enable sqlite) \
+ $(use_enable berkdb db) \
+ $(use_enable ldap) \
+ $(use_enable pam) \
+ --enable-pipe \
+ --enable-anon \
+ --enable-fs \
+ $(use_enable test tests) \
+ $(usex berkdb "--with-extra-include-path=$(db_includedir)" "") \
+ $(use_with zlib)
+}
+
+src_install() {
+ local i
+
+ default
+ prune_libtool_files --modules
+
+ keepdir /var/spool/jabber/{fs,db}
+ fowners jabber:jabber /usr/bin/{jabberd,router,sm,c2s,s2s} \
+ /var/spool/jabber/{fs,db}
+ fperms 770 /var/spool/jabber/{fs,db}
+ fperms 750 /usr/bin/{jabberd,router,sm,c2s,s2s}
+
+ # avoid file collision with x11-misc/screen-message wrt #453994
+ for i in router sm c2s s2s ; do
+ einfo "renaming /usr/bin/${i} to /usr/bin/jabberd2-${i}"
+ mv "${ED%/}"/usr/bin/${i} "${ED%/}"/usr/bin/jabberd2-${i} || die
+ done
+
+ newinitd "${FILESDIR}/${P}.init" jabberd
+ newpamd "${FILESDIR}/${P}.pamd" jabberd
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${P}.logrotate" jabberd
+
+ docompress -x /usr/share/doc/${PF}/tools
+ docinto tools
+ dodoc tools/db-setup{.mysql,.pgsql,.sqlite} \
+ tools/{migrate-jd14dir-2-sqlite.pl,pipe-auth.pl}
+
+ # remove useless upstart files wrt #498900
+ rm -rf "${ED%/}"/usr/etc
+}
+
+pkg_postinst() {
+ if use pam; then
+ echo
+ ewarn 'Jabberd-2 PAM authentication requires your unix usernames to'
+ ewarn 'be in the form of "contactname@jabberdomain". This behavior'
+ ewarn 'is likely to change in future versions of jabberd-2. It may'
+ ewarn 'be advisable to avoid PAM authentication for the time being.'
+ echo
+ fi
+
+ if use sqlite || use mysql || use postgres; then
+ echo
+ einfo "You will need to setup or update your database using the"
+ einfo "scripts in /usr/share/doc/${PF}/tools/"
+ echo
+ fi
+
+ ewarn 'If you are upgrading from <=jabberd2-2.2.17 then you might have'
+ ewarn 'to update /etc/jabber/jabberd.cfg via etc-update because'
+ ewarn 'the binaries have been renamed to avoid file collisions!'
+}
diff --git a/net-im/jabberd2/jabberd2-2.3.2-r2.ebuild b/net-im/jabberd2/jabberd2-2.3.2-r2.ebuild
new file mode 100644
index 000000000000..bc2e94be3939
--- /dev/null
+++ b/net-im/jabberd2/jabberd2-2.3.2-r2.ebuild
@@ -0,0 +1,157 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit db-use eutils flag-o-matic pam
+
+DESCRIPTION="Open Source Jabber Server"
+HOMEPAGE="http://jabberd2.org"
+SRC_URI="https://github.com/jabberd2/jabberd2/releases/download/jabberd-${PV}/jabberd-${PV}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc ~sparc x86 ~x86-fbsd"
+IUSE="berkdb debug experimental ldap memdebug mysql pam postgres sqlite ssl test zlib"
+REQUIRED_USE="memdebug? ( debug )"
+
+# broken
+RESTRICT="test"
+
+DEPEND="dev-libs/expat
+ net-libs/udns
+ net-dns/libidn
+ virtual/gsasl
+ berkdb? ( >=sys-libs/db-4.1.25 )
+ ldap? ( net-nds/openldap )
+ mysql? ( virtual/mysql )
+ pam? ( virtual/pam )
+ postgres? ( dev-db/postgresql )
+ ssl? ( >=dev-libs/openssl-1.0.1:0 )
+ sqlite? ( dev-db/sqlite:3 )
+ zlib? ( sys-libs/zlib )"
+RDEPEND="${DEPEND}
+ >=net-im/jabber-base-0.01"
+DEPEND="${DEPEND}
+ app-arch/xz-utils
+ virtual/pkgconfig
+ test? ( dev-libs/check )"
+
+DOCS=( AUTHORS README )
+
+S=${WORKDIR}/jabberd-${PV}
+
+src_prepare() {
+ # Fix some default directory locations
+ sed -i \
+ -e 's,@localstatedir@/@package@/pid/,/var/run/@package@/,g' \
+ -e 's,@localstatedir@/@package@/run/pbx,/var/run/@package@/pbx,g' \
+ -e 's,@localstatedir@/@package@/log/,/var/log/@package@/,g' \
+ -e 's,@localstatedir@/lib/jabberd2/fs,@localstatedir@/@package@/fs,g' \
+ -e 's,@localstatedir@,/var/spool,g' \
+ -e 's,@package@,jabber,g' \
+ etc/{sm,router,c2s,s2s}.xml.dist.in || die "fixing default directory locations failed!"
+
+ # If the package wasn't merged with sqlite then default to use berkdb
+ use sqlite ||
+ sed -i \
+ -e 's,<\(module\|driver\)>sqlite<\/\1>,<\1>db</\1>,g' \
+ etc/{c2s,sm}.xml.dist.in || die "setting berkdb as default failed!"
+
+ # avoid file collision with x11-misc/screen-message wrt #453994
+ sed -i \
+ -e 's/@jabberd_router_bin@/jabberd2-router/' \
+ -e 's/@jabberd_c2s_bin@/jabberd2-c2s/' \
+ -e 's/@jabberd_s2s_bin@/jabberd2-s2s/' \
+ -e 's/@jabberd_sm_bin@/jabberd2-sm/' \
+ etc/jabberd*.in || die "fixing file collisions failed!"
+
+ # rename pid files wrt #241472
+ sed -i \
+ -e '/pidfile/s/c2s\.pid/jabberd2-c2s\.pid/' \
+ -e '/pidfile/s/router\.pid/jabberd2-router\.pid/' \
+ -e '/pidfile/s/s2s\.pid/jabberd2-s2s\.pid/' \
+ -e '/pidfile/s/sm\.pid/jabberd2-sm\.pid/' \
+ etc/*.xml.dist.in || die "renaming pid files failed!"
+}
+
+src_configure() {
+ # https://bugs.gentoo.org/show_bug.cgi?id=207655#c3
+ # https://github.com/jabberd2/jabberd2/issues/34
+ replace-flags -O[3s] -O2
+
+ # --enable-pool-debug is currently broken
+ econf \
+ --sysconfdir=/etc/jabber \
+ $(usex debug "--enable-debug" "") \
+ $(usex memdebug "--enable-nad-debug" "") \
+ $(use_enable ssl) \
+ $(use_enable mysql) \
+ $(use_enable postgres pgsql) \
+ $(use_enable sqlite) \
+ $(use_enable berkdb db) \
+ $(use_enable ldap) \
+ $(use_enable pam) \
+ --enable-pipe \
+ --enable-anon \
+ --enable-fs \
+ $(use_enable experimental) \
+ $(use_enable test tests) \
+ $(usex berkdb "--with-extra-include-path=$(db_includedir)" "") \
+ $(use_with zlib)
+}
+
+src_install() {
+ local i
+
+ default
+ prune_libtool_files --modules
+
+ keepdir /var/spool/jabber/{fs,db}
+ fowners jabber:jabber /usr/bin/{jabberd,router,sm,c2s,s2s} \
+ /var/spool/jabber/{fs,db}
+ fperms 770 /var/spool/jabber/{fs,db}
+ fperms 750 /usr/bin/{jabberd,router,sm,c2s,s2s}
+
+ # avoid file collision with x11-misc/screen-message wrt #453994
+ for i in router sm c2s s2s ; do
+ einfo "renaming /usr/bin/${i} to /usr/bin/jabberd2-${i}"
+ mv "${ED%/}"/usr/bin/${i} "${ED%/}"/usr/bin/jabberd2-${i} || die
+ done
+
+ newinitd "${FILESDIR}/${PN}-2.3.2.init" jabberd
+ newpamd "${FILESDIR}/${PN}-2.3.1.pamd" jabberd
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}-2.3.2.logrotate" jabberd
+
+ docompress -x /usr/share/doc/${PF}/tools
+ docinto tools
+ dodoc tools/db-setup{.mysql,.pgsql,.sqlite} \
+ tools/{migrate-jd14dir-2-sqlite.pl,pipe-auth.pl}
+
+ # remove useless upstart files wrt #498900
+ rm -rf "${ED%/}"/usr/etc
+}
+
+pkg_postinst() {
+ if use pam; then
+ echo
+ ewarn 'Jabberd-2 PAM authentication requires your unix usernames to'
+ ewarn 'be in the form of "contactname@jabberdomain". This behavior'
+ ewarn 'is likely to change in future versions of jabberd-2. It may'
+ ewarn 'be advisable to avoid PAM authentication for the time being.'
+ echo
+ fi
+
+ if use sqlite || use mysql || use postgres; then
+ echo
+ einfo "You will need to setup or update your database using the"
+ einfo "scripts in /usr/share/doc/${PF}/tools/"
+ echo
+ fi
+
+ ewarn 'If you are upgrading from <=jabberd2-2.2.17 then you might have'
+ ewarn 'to update /etc/jabber/jabberd.cfg via etc-update because'
+ ewarn 'the binaries have been renamed to avoid file collisions!'
+}
diff --git a/net-im/jabberd2/jabberd2-2.3.3-r2.ebuild b/net-im/jabberd2/jabberd2-2.3.3-r2.ebuild
new file mode 100644
index 000000000000..1389115fcb12
--- /dev/null
+++ b/net-im/jabberd2/jabberd2-2.3.3-r2.ebuild
@@ -0,0 +1,160 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit db-use eutils flag-o-matic pam
+
+DESCRIPTION="Open Source Jabber Server"
+HOMEPAGE="http://jabberd2.org"
+SRC_URI="https://github.com/jabberd2/jabberd2/releases/download/jabberd-${PV}/jabberd-${PV}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86 ~x86-fbsd"
+IUSE="berkdb debug experimental ldap libressl memdebug mysql pam postgres sqlite ssl test zlib"
+REQUIRED_USE="memdebug? ( debug )"
+
+# broken
+RESTRICT="test"
+
+DEPEND="dev-libs/expat
+ net-libs/udns
+ net-dns/libidn
+ virtual/gsasl
+ berkdb? ( >=sys-libs/db-4.1.25:* )
+ ldap? ( net-nds/openldap )
+ mysql? ( virtual/mysql )
+ pam? ( virtual/pam )
+ postgres? ( dev-db/postgresql:* )
+ ssl? (
+ !libressl? ( >=dev-libs/openssl-1.0.1:0[-bindist] )
+ libressl? ( dev-libs/libressl )
+ )
+ sqlite? ( dev-db/sqlite:3 )
+ zlib? ( sys-libs/zlib )"
+RDEPEND="${DEPEND}
+ >=net-im/jabber-base-0.01"
+DEPEND="${DEPEND}
+ app-arch/xz-utils
+ virtual/pkgconfig
+ test? ( dev-libs/check )"
+
+DOCS=( AUTHORS README )
+
+S=${WORKDIR}/jabberd-${PV}
+
+src_prepare() {
+ # Fix some default directory locations
+ sed -i \
+ -e 's,@localstatedir@/@package@/pid/,/var/run/@package@/,g' \
+ -e 's,@localstatedir@/@package@/run/pbx,/var/run/@package@/pbx,g' \
+ -e 's,@localstatedir@/@package@/log/,/var/log/@package@/,g' \
+ -e 's,@localstatedir@/lib/jabberd2/fs,@localstatedir@/@package@/fs,g' \
+ -e 's,@localstatedir@,/var/spool,g' \
+ -e 's,@package@,jabber,g' \
+ etc/{sm,router,c2s,s2s}.xml.dist.in || die "fixing default directory locations failed!"
+
+ # If the package wasn't merged with sqlite then default to use berkdb
+ use sqlite ||
+ sed -i \
+ -e 's,<\(module\|driver\)>sqlite<\/\1>,<\1>db</\1>,g' \
+ etc/{c2s,sm}.xml.dist.in || die "setting berkdb as default failed!"
+
+ # avoid file collision with x11-misc/screen-message wrt #453994
+ sed -i \
+ -e 's/@jabberd_router_bin@/jabberd2-router/' \
+ -e 's/@jabberd_c2s_bin@/jabberd2-c2s/' \
+ -e 's/@jabberd_s2s_bin@/jabberd2-s2s/' \
+ -e 's/@jabberd_sm_bin@/jabberd2-sm/' \
+ etc/jabberd*.in || die "fixing file collisions failed!"
+
+ # rename pid files wrt #241472
+ sed -i \
+ -e '/pidfile/s/c2s\.pid/jabberd2-c2s\.pid/' \
+ -e '/pidfile/s/router\.pid/jabberd2-router\.pid/' \
+ -e '/pidfile/s/s2s\.pid/jabberd2-s2s\.pid/' \
+ -e '/pidfile/s/sm\.pid/jabberd2-sm\.pid/' \
+ etc/*.xml.dist.in || die "renaming pid files failed!"
+}
+
+src_configure() {
+ # https://bugs.gentoo.org/show_bug.cgi?id=207655#c3
+ # https://github.com/jabberd2/jabberd2/issues/34
+ replace-flags -O[3s] -O2
+
+ # --enable-pool-debug is currently broken
+ econf \
+ --sysconfdir=/etc/jabber \
+ $(usex debug "--enable-debug" "") \
+ $(usex memdebug "--enable-nad-debug" "") \
+ $(use_enable ssl) \
+ $(use_enable mysql) \
+ $(use_enable postgres pgsql) \
+ $(use_enable sqlite) \
+ $(use_enable berkdb db) \
+ $(use_enable ldap) \
+ $(use_enable pam) \
+ --enable-pipe \
+ --enable-anon \
+ --enable-fs \
+ $(use_enable experimental) \
+ $(use_enable test tests) \
+ $(usex berkdb "--with-extra-include-path=$(db_includedir)" "") \
+ $(use_with zlib)
+}
+
+src_install() {
+ local i
+
+ default
+ prune_libtool_files --modules
+
+ keepdir /var/spool/jabber/{fs,db}
+ fowners jabber:jabber /usr/bin/{jabberd,router,sm,c2s,s2s} \
+ /var/spool/jabber/{fs,db}
+ fperms 770 /var/spool/jabber/{fs,db}
+ fperms 750 /usr/bin/{jabberd,router,sm,c2s,s2s}
+
+ # avoid file collision with x11-misc/screen-message wrt #453994
+ for i in router sm c2s s2s ; do
+ einfo "renaming /usr/bin/${i} to /usr/bin/jabberd2-${i}"
+ mv "${ED%/}"/usr/bin/${i} "${ED%/}"/usr/bin/jabberd2-${i} || die
+ done
+
+ newinitd "${FILESDIR}/${PN}-2.3.2.init" jabberd
+ newpamd "${FILESDIR}/${PN}-2.3.1.pamd" jabberd
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}-2.3.2.logrotate" jabberd
+
+ docompress -x /usr/share/doc/${PF}/tools
+ docinto tools
+ dodoc tools/db-setup{.mysql,.pgsql,.sqlite} \
+ tools/{migrate-jd14dir-2-sqlite.pl,pipe-auth.pl}
+
+ # remove useless upstart files wrt #498900
+ rm -rf "${ED%/}"/usr/etc
+}
+
+pkg_postinst() {
+ if use pam; then
+ echo
+ ewarn 'Jabberd-2 PAM authentication requires your unix usernames to'
+ ewarn 'be in the form of "contactname@jabberdomain". This behavior'
+ ewarn 'is likely to change in future versions of jabberd-2. It may'
+ ewarn 'be advisable to avoid PAM authentication for the time being.'
+ echo
+ fi
+
+ if use sqlite || use mysql || use postgres; then
+ echo
+ einfo "You will need to setup or update your database using the"
+ einfo "scripts in /usr/share/doc/${PF}/tools/"
+ echo
+ fi
+
+ ewarn 'If you are upgrading from <=jabberd2-2.2.17 then you might have'
+ ewarn 'to update /etc/jabber/jabberd.cfg via etc-update because'
+ ewarn 'the binaries have been renamed to avoid file collisions!'
+}
diff --git a/net-im/jabberd2/jabberd2-2.3.4-r1.ebuild b/net-im/jabberd2/jabberd2-2.3.4-r1.ebuild
new file mode 100644
index 000000000000..e48dd238e103
--- /dev/null
+++ b/net-im/jabberd2/jabberd2-2.3.4-r1.ebuild
@@ -0,0 +1,180 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools db-use eutils flag-o-matic pam
+
+DESCRIPTION="Open Source Jabber Server"
+HOMEPAGE="http://jabberd2.org"
+SRC_URI="https://github.com/jabberd2/jabberd2/releases/download/jabberd-${PV}/jabberd-${PV}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86 ~x86-fbsd"
+IUSE="berkdb debug experimental ldap libressl memdebug mysql pam postgres sqlite ssl test websocket zlib"
+REQUIRED_USE="memdebug? ( debug )"
+
+# broken
+RESTRICT="test"
+
+DEPEND="dev-libs/expat
+ net-libs/udns
+ net-dns/libidn
+ virtual/gsasl
+ berkdb? ( >=sys-libs/db-4.1.25:= )
+ ldap? ( net-nds/openldap )
+ mysql? (
+ virtual/libmysqlclient:=
+ virtual/mysql:=
+ )
+ pam? ( virtual/pam )
+ postgres? ( dev-db/postgresql:= )
+ ssl? (
+ !libressl? ( >=dev-libs/openssl-1.0.1:0[-bindist] )
+ libressl? ( dev-libs/libressl:= )
+ )
+ sqlite? ( dev-db/sqlite:3 )
+ websocket? ( net-libs/http-parser:= )
+ zlib? ( sys-libs/zlib )"
+RDEPEND="${DEPEND}
+ >=net-im/jabber-base-0.01"
+DEPEND="${DEPEND}
+ app-arch/xz-utils
+ virtual/pkgconfig
+ test? ( dev-libs/check )"
+
+DOCS=( AUTHORS README )
+
+S=${WORKDIR}/jabberd-${PV}
+
+pkg_pretend() {
+ if is-flagq '-O[3s]' ; then
+ ewarn "O3/Os compiler flags have been known to cause problems"
+ ewarn "with old gcc version. Be aware that this could break"
+ ewarn "port binding. Make sure to test this."
+ ewarn "See https://github.com/jabberd2/jabberd2/issues/34"
+ fi
+}
+
+src_prepare() {
+ # Fix some default directory locations
+ sed -i \
+ -e 's,@localstatedir@/@package@/pid/,/var/run/@package@/,g' \
+ -e 's,@localstatedir@/@package@/run/pbx,/var/run/@package@/pbx,g' \
+ -e 's,@localstatedir@/@package@/log/,/var/log/@package@/,g' \
+ -e 's,@localstatedir@/lib/jabberd2/fs,@localstatedir@/@package@/fs,g' \
+ -e 's,@localstatedir@,/var/spool,g' \
+ -e 's,@package@,jabber,g' \
+ etc/{sm,router,c2s,s2s}.xml.dist.in || die "fixing default directory locations failed!"
+
+ # If the package wasn't merged with sqlite then default to use berkdb
+ use sqlite ||
+ sed -i \
+ -e 's,<\(module\|driver\)>sqlite<\/\1>,<\1>db</\1>,g' \
+ etc/{c2s,sm}.xml.dist.in || die "setting berkdb as default failed!"
+
+ # avoid file collision with x11-misc/screen-message wrt #453994
+ sed -i \
+ -e 's/@jabberd_router_bin@/jabberd2-router/' \
+ -e 's/@jabberd_c2s_bin@/jabberd2-c2s/' \
+ -e 's/@jabberd_s2s_bin@/jabberd2-s2s/' \
+ -e 's/@jabberd_sm_bin@/jabberd2-sm/' \
+ etc/jabberd*.in || die "fixing file collisions failed!"
+
+ # rename pid files wrt #241472
+ sed -i \
+ -e '/pidfile/s/${id}\.pid/jabberd2-c2s\.pid/' \
+ etc/c2s.xml.dist.in || die
+ sed -i \
+ -e '/pidfile/s/${id}\.pid/jabberd2-router\.pid/' \
+ etc/router.xml.dist.in || die
+ sed -i \
+ -e '/pidfile/s/${id}\.pid/jabberd2-s2s\.pid/' \
+ etc/s2s.xml.dist.in || die
+ sed -i \
+ -e '/pidfile/s/${id}\.pid/jabberd2-sm\.pid/' \
+ etc/sm.xml.dist.in || die
+
+ epatch "${FILESDIR}"/${P}-optimization.patch \
+ "${FILESDIR}"/${P}-websocket.patch
+ eautoreconf
+}
+
+src_configure() {
+ # --enable-pool-debug is currently broken
+ econf \
+ --sysconfdir=/etc/jabber \
+ $(usex debug "--enable-debug" "") \
+ $(usex memdebug "--enable-nad-debug" "") \
+ $(use_enable ssl) \
+ $(use_enable mysql) \
+ $(use_enable postgres pgsql) \
+ $(use_enable sqlite) \
+ $(use_enable berkdb db) \
+ $(use_enable ldap) \
+ $(use_enable pam) \
+ --enable-pipe \
+ --enable-anon \
+ --enable-fs \
+ $(use_enable websocket) \
+ $(use_enable experimental) \
+ $(use_enable test tests) \
+ $(usex berkdb "--with-extra-include-path=$(db_includedir)" "") \
+ $(use_with zlib)
+}
+
+src_install() {
+ local i
+
+ default
+ prune_libtool_files --modules
+
+ keepdir /var/spool/jabber/{fs,db}
+ fowners jabber:jabber /usr/bin/{jabberd,router,sm,c2s,s2s} \
+ /var/spool/jabber/{fs,db}
+ fperms 770 /var/spool/jabber/{fs,db}
+ fperms 750 /usr/bin/{jabberd,router,sm,c2s,s2s}
+
+ # avoid file collision with x11-misc/screen-message wrt #453994
+ for i in router sm c2s s2s ; do
+ einfo "renaming /usr/bin/${i} to /usr/bin/jabberd2-${i}"
+ mv "${ED%/}"/usr/bin/${i} "${ED%/}"/usr/bin/jabberd2-${i} || die
+ done
+
+ newinitd "${FILESDIR}/${PN}-2.3.2.init" jabberd
+ newpamd "${FILESDIR}/${PN}-2.3.1.pamd" jabberd
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}-2.3.2.logrotate" jabberd
+
+ docompress -x /usr/share/doc/${PF}/tools
+ docinto tools
+ dodoc tools/db-setup{.mysql,.pgsql,.sqlite} \
+ tools/{migrate-jd14dir-2-sqlite.pl,pipe-auth.pl}
+
+ # remove useless upstart files wrt #498900
+ rm -rf "${ED%/}"/usr/etc
+}
+
+pkg_postinst() {
+ if use pam; then
+ echo
+ ewarn 'Jabberd-2 PAM authentication requires your unix usernames to'
+ ewarn 'be in the form of "contactname@jabberdomain". This behavior'
+ ewarn 'is likely to change in future versions of jabberd-2. It may'
+ ewarn 'be advisable to avoid PAM authentication for the time being.'
+ echo
+ fi
+
+ if use sqlite || use mysql || use postgres; then
+ echo
+ einfo "You will need to setup or update your database using the"
+ einfo "scripts in /usr/share/doc/${PF}/tools/"
+ echo
+ fi
+
+ ewarn 'If you are upgrading from <=jabberd2-2.2.17 then you might have'
+ ewarn 'to update /etc/jabber/jabberd.cfg via etc-update because'
+ ewarn 'the binaries have been renamed to avoid file collisions!'
+}