diff --git a/testing/ejabberd/APKBUILD b/testing/ejabberd/APKBUILD
index daa13cebae5cdb2496318344994f619f9d32b80f..14977dffe53623a55ff1575c764d3774162c8381 100644
--- a/testing/ejabberd/APKBUILD
+++ b/testing/ejabberd/APKBUILD
@@ -2,27 +2,27 @@
 # Contributor: Francesco Colista <francesco.colista@gmail.com>
 # Maintainer: John Regan <john@jrjrtech.com>
 pkgname=ejabberd
-pkgver=15.04
-pkgrel=1
+pkgver=16.02
+pkgrel=0
 pkgdesc="An erlang jabber server"
 url="http://www.ejabberd.im"
 arch="all"
 license="GPL2+"
-_erl_deps="erlang17-asn1
-           erlang17-crypto
-	   erlang17-eldap
-	   erlang17-mnesia
-	   erlang17-public-key
-	   erlang17-sasl
-	   erlang17-ssl
-	   erlang17-syntax-tools"
-_erl_make_deps="erlang17-eunit
-                erlang17-parsetools"
-depends="erlang17
+_erl_deps="erlang-asn1
+           erlang-crypto
+	   erlang-eldap
+	   erlang-mnesia
+	   erlang-public-key
+	   erlang-sasl
+	   erlang-ssl
+	   erlang-syntax-tools"
+_erl_make_deps="erlang-eunit
+                erlang-parsetools"
+depends="erlang
          util-linux
 	 yaml
 	 $_erl_deps"
-depends_dev="erlang17-dev
+depends_dev="erlang-dev
              expat-dev
 	     openssl-dev
 	     zlib-dev 
@@ -35,6 +35,8 @@ pkggroups="ejabberd"
 install="$pkgname.pre-install"
 subpackages="$pkgname-dev $pkgname-doc"
 source="http://www.process-one.net/downloads/$pkgname/$pkgver/$pkgname-$pkgver.tgz
+	makefile.patch
+	ejabberd-16.01-ejabberdctl.patch
         ejabberd.initd
 	ejabberd.logrotate
 	ejabberd.confd"
@@ -47,6 +49,7 @@ build() {
 		--localstatedir=/var \
 		--mandir=/usr/share/man \
 		--infodir=/usr/share/info
+	sed -i -e "23 i#include \<stdint.h\>"  deps/stringprep/c_src/stringprep.cpp
 	make || return 1
 }
 
@@ -65,15 +68,21 @@ package() {
 	chgrp ejabberd "$pkgdir"/etc/ejabberd/ejabberd.yml "$pkgdir"/etc/ejabberd/ejabberdctl.cfg "$pkgdir"/etc/ejabberd
 }
 
-md5sums="0a914f14ccb7f2d0a45e641efed21afd  ejabberd-15.04.tgz
-e0ef3a939e87779737ce75469e79fef1  ejabberd.initd
+md5sums="ae212bec2f233b886b9afa5510302db0  ejabberd-16.02.tgz
+4fb22399211c3a8f259de57fdbfefa0f  makefile.patch
+583d01f6b6ac7f3cd1118462eaba1c39  ejabberd-16.01-ejabberdctl.patch
+62242441aaed1025587dcc3b40d08e68  ejabberd.initd
 f97c8a96160f30e0aecc9526c12e6606  ejabberd.logrotate
 fa61d30731cb4d818187d2e5e2fd766a  ejabberd.confd"
-sha256sums="6750199b75d6b658dabffdf34e20994803b2fc0832e54fea7ab388e5122d63ec  ejabberd-15.04.tgz
-1c07fa02152b42bee44a8d1cd3f031596aeee37276ec4a36d765e3c54aa23075  ejabberd.initd
+sha256sums="98388050864d8c3717c581ece5381c473cd89729b7d0c2ee059735e9ff892a7a  ejabberd-16.02.tgz
+4c939a05bc353a90a585143a5d981069aa7767563979595cef8637f7ab782fa7  makefile.patch
+fc971f9eba50c82013f20c78d3ba7f48bb4f70945e41951808b53ef9dbf0b898  ejabberd-16.01-ejabberdctl.patch
+aed527edf2008becaa950eddffecdb1d9cb8a9a50e38cee9e51853c1189887cb  ejabberd.initd
 31780cac78736d285e46f445f8c8463a70f2aeb2683280c259129db11832ddd2  ejabberd.logrotate
 e1f690788cd1b5ecb334582af8e019602d297ef8b914a030de69bce2cc20fffd  ejabberd.confd"
-sha512sums="f19fc8560944eb928620d3f08cf5c0da63c643653551bf10e19fc9ab6fdef09aef935ecef086611cea00f56e5ac86b56d1b1ddefad42fd403319b824573c7750  ejabberd-15.04.tgz
-1142b4f1ca240f20603ca9a64819780ff4a1d9fbde2940fd1dab6cbca1d2de5108cf35aa00ff1c037dc72a778c6502521e3908c6cde5a39c4bb3c9fc1c70aceb  ejabberd.initd
+sha512sums="6a4b32100c022be91fae1119670d8e189a1d7a8100cd47c58478709d2501af2266de833664ffa986fc2c392802a026650adca9111bb833594b2ab02badadb6a4  ejabberd-16.02.tgz
+36eacec7780ed95ffc310db30e34f9d5ba8ead65f8fc44fb06c7d825f7252effad83e07c4a010e65b80a63f4a1d985290e8a489906a8c225c306f5b5b642ce36  makefile.patch
+aeb1f4fc299691751fd687a07bf35dc77f43cb1d14f9ba59e7de050e6953a0051f1827bbd0e21fc84dd4cb745b5603b915ffdf6de2151d6e34b4a4720a0a77ab  ejabberd-16.01-ejabberdctl.patch
+e2310e1b5b471e5c27ce2ec5d5fc6549656f9f49ba1d65a515ebc3af6d3237a461894c6c4c55c8c6eb1b9be0b01573057591ead51eb9014f5cf1258d387c9fc8  ejabberd.initd
 47fd2cfd9177c4e978a9799a153ba74392a9891822221af8194686a40f6bf01f38644833e1e1f5416c6357e0bfb7ca3dae96f55a4fcd7cd629ec798d85a72807  ejabberd.logrotate
 96a571c0ab2be366e931bda423a61ef920cbaba2107e61ddbc501472ce3efe2804418cc6579c99310b902a9a99aaecb9284cf2420c071dbca2f670efb4034135  ejabberd.confd"
diff --git a/testing/ejabberd/ejabberd-16.01-ejabberdctl.patch b/testing/ejabberd/ejabberd-16.01-ejabberdctl.patch
new file mode 100644
index 0000000000000000000000000000000000000000..85580179ee3803c07c931e14c8ca4c2483c8f73d
--- /dev/null
+++ b/testing/ejabberd/ejabberd-16.01-ejabberdctl.patch
@@ -0,0 +1,49 @@
+Set SHELL since the generic jabber user used on Gentoo for jabber servers
+doesn't have a valid shell set by default and fix EXEC_CMD otherwise it fails
+with "This account is currently not available" again due to jabber not having
+a valid shell.
+
+Also, workaround the assumption that jabber's $HOME is a directory when instead
+it defaults to /dev/null on Gentoo.
+
+--- a/ejabberdctl.template	2016-01-12 11:07:58.000000000 +0000
++++ b/ejabberdctl.template.new	2016-02-15 21:36:27.508297627 +0000
+@@ -16,6 +16,7 @@
+ EPMD={{bindir}}/epmd
+ INSTALLUSER={{installuser}}
+ ERL_LIBS={{libdir}}
++SHELL=/bin/sh
+ 
+ # check the proper system user is used if defined
+ if [ "$INSTALLUSER" != "" ] ; then
+@@ -23,11 +24,11 @@
+     for GID in `id -G`; do
+         if [ $GID -eq 0 ] ; then
+             INSTALLUSER_HOME=$(getent passwd "$INSTALLUSER" | cut -d: -f6)
+-            if [ -n "$INSTALLUSER_HOME" ] && [ ! -d "$INSTALLUSER_HOME" ] ; then
++            if [ -n "$INSTALLUSER_HOME" ] && [ ! -e "$INSTALLUSER_HOME" ] ; then
+                 mkdir -p "$INSTALLUSER_HOME"
+                 chown "$INSTALLUSER" "$INSTALLUSER_HOME"
+             fi
+-            EXEC_CMD="su $INSTALLUSER -c"
++            EXEC_CMD="su $INSTALLUSER -p -c"
+         fi
+     done
+     if [ `id -g` -eq `id -g $INSTALLUSER` ] ; then
+@@ -100,6 +101,7 @@
+ DATETIME=`date "+%Y%m%d-%H%M%S"`
+ ERL_CRASH_DUMP=$LOGS_DIR/erl_crash_$DATETIME.dump
+ ERL_INETRC=$ETC_DIR/inetrc
++HOME=$SPOOL_DIR
+ 
+ # define mnesia options
+ MNESIA_OPTS="-mnesia dir \"\\\"$SPOOL_DIR\\\"\" $MNESIA_OPTIONS"
+@@ -159,6 +161,8 @@
+ export CONTRIB_MODULES_PATH
+ export CONTRIB_MODULES_CONF_DIR
+ export ERL_LIBS
++export HOME
++export SHELL
+ 
+ shell_escape()
+ {
diff --git a/testing/ejabberd/ejabberd.initd b/testing/ejabberd/ejabberd.initd
index 2d6d44d3c317112ea37f563b17228fdc09c0fddc..eea73f117259b328a7c77c6163673b4494566eb7 100644
--- a/testing/ejabberd/ejabberd.initd
+++ b/testing/ejabberd/ejabberd.initd
@@ -1,4 +1,4 @@
-#!/sbin/runscript
+#!/sbin/openrc-run
 # Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/net-im/ejabberd/files/ejabberd-3.initd,v 1.3 2010/06/02 07:12:27 pva Exp $
diff --git a/testing/ejabberd/makefile.patch b/testing/ejabberd/makefile.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4d853d8f0895db073f757038166fc551c6291e75
--- /dev/null
+++ b/testing/ejabberd/makefile.patch
@@ -0,0 +1,12 @@
+diff --git a/Makefile.in b/Makefile.in
+index 0d91344..1276950 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -87,6 +87,7 @@ deps/.got:
+ 	$(REBAR) get-deps && :> deps/.got
+ 
+ deps/.built: deps/.got
++	$(SED) -i -e "23 i#include \<stdint.h\>"  deps/stringprep/c_src/stringprep.cpp
+ 	$(REBAR) compile && :> deps/.built
+ 
+ src: deps/.built