From: Johan Oudinet <johan.oudinet@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2] ejabberd: new package
Date: Wed, 16 Jul 2014 17:57:07 +0200 [thread overview]
Message-ID: <1405526227-4277-1-git-send-email-johan.oudinet@gmail.com> (raw)
Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
---
Changes v1 -> v2:
- Run ejabberd as ejabberd user instead of root.
---
package/Config.in | 1 +
package/ejabberd/Config.in | 13 +++++++
package/ejabberd/check-erlang-lib | 48 +++++++++++++++++++++++
package/ejabberd/ejabberd.mk | 81 +++++++++++++++++++++++++++++++++++++++
4 files changed, 143 insertions(+)
create mode 100644 package/ejabberd/Config.in
create mode 100755 package/ejabberd/check-erlang-lib
create mode 100644 package/ejabberd/ejabberd.mk
diff --git a/package/Config.in b/package/Config.in
index b363a7c..a50416e 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -937,6 +937,7 @@ endif
source "package/dnsmasq/Config.in"
source "package/dropbear/Config.in"
source "package/ebtables/Config.in"
+ source "package/ejabberd/Config.in"
source "package/ethtool/Config.in"
source "package/faifa/Config.in"
source "package/fmc/Config.in"
diff --git a/package/ejabberd/Config.in b/package/ejabberd/Config.in
new file mode 100644
index 0000000..3a2336d
--- /dev/null
+++ b/package/ejabberd/Config.in
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_EJABBERD
+ bool "ejabberd"
+ select BR2_PACKAGE_OPENSSL
+ select BR2_PACKAGE_ERLANG
+ select BR2_PACKAGE_LIBYAML
+ select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
+ select BR2_PACKAGE_EXPAT
+ help
+ Ejabberd is a Jabber/XMPP instant messaging server, written
+ in Erlang/OTP. Among other features, ejabberd is
+ cross-platform, fault-tolerant, clusterable and modular.
+
+ http://www.ejabberd.im
diff --git a/package/ejabberd/check-erlang-lib b/package/ejabberd/check-erlang-lib
new file mode 100755
index 0000000..1a942bb
--- /dev/null
+++ b/package/ejabberd/check-erlang-lib
@@ -0,0 +1,48 @@
+#!/bin/sh -e
+# Helper to bypass AC_ERLANG_CHECK_LIB
+
+usage() {
+ cat <<EOF
+Usage:
+ $0 library
+Look for Erlang's library in TARGET_DIR/usr/lib/erlang/lib.
+
+If the library is found, it returns the path to the latest version,
+relative to TARGET_DIR. Otherwise, it returns "not found".
+
+If there are several versions, it returns an error because it does not
+know which one Erlang uses.
+
+EOF
+}
+
+die () {
+ echo "$@" >&2
+ exit 1
+}
+
+if [ $# -ne 1 ]; then
+ usage
+ exit 0
+else
+ library="$1"
+fi
+
+target_dir="${TARGET_DIR:-../../output/target}"
+
+[ -d "$target_dir" ] || die "TARGET_DIR is not a directory. Please \
+specify the TARGET_DIR environment variable."
+
+case "$(ls -1d -- "$target_dir/usr/lib/erlang/lib/$library-"* | wc -l)" in
+ 0)
+ echo "not found"
+ ;;
+ 1)
+ echo "$target_dir/usr/lib/erlang/lib/$library-"* \
+ | sed -e "s,^$target_dir,,"
+ ;;
+ *)
+ die "Several versions of $library have been found. Please \
+ remove the unused ones."
+ ;;
+esac
diff --git a/package/ejabberd/ejabberd.mk b/package/ejabberd/ejabberd.mk
new file mode 100644
index 0000000..ca54e4e
--- /dev/null
+++ b/package/ejabberd/ejabberd.mk
@@ -0,0 +1,81 @@
+################################################################################
+#
+# ejabberd
+#
+################################################################################
+
+EJABBERD_VERSION = 14.05
+EJABBERD_SITE = $(call github,processone,ejabberd,$(EJABBERD_VERSION))
+EJABBERD_LICENSE = GPLv2+
+EJABBERD_LICENSE_FILES = COPYING
+EJABBERD_DEPENDENCIES = libyaml expat openssl erlang
+
+ifeq ($(BR2_PACKAGE_LIBICONV),y)
+ EJABBERD_DEPENDENCIES += libiconv
+endif
+
+EJABBERD_ERLANG_LIBS := sasl crypto public_key ssl mnesia inets compiler
+
+# Do AC_ERLANG_CHECK_LIB job without erlang.
+define EJABBERD_SET_LIBS_DIR
+ for lib in $(EJABBERD_ERLANG_LIBS); do \
+ export \
+ erlang_lib_dir_$$lib="`package/ejabberd/check-erlang-lib $$lib`"; \
+ done
+endef
+
+# Set cross-compilation options to the configure called by rebar.
+define EJABBERD_FIX_REBAR_CONFIG_SCRIPT
+ sed -e "s,./configure,./configure \\ \
+ --target=$(GNU_TARGET_NAME) \\ \
+ --host=$(GNU_TARGET_NAME) \\ \
+ --build=$(GNU_HOST_NAME)," \
+ -i "$(@D)"/rebar.config.script
+endef
+
+EJABBERD_PRE_CONFIGURE_HOOKS += \
+ EJABBERD_SET_LIBS_DIR \
+ EJABBERD_FIX_REBAR_CONFIG_SCRIPT
+
+# Guess answers for these tests, configure will bail out otherwise
+# saying error: cannot run test program while cross compiling.
+EJABBERD_CONF_ENV = \
+ ac_cv_erlang_root_dir='$(HOST_DIR)/usr/lib/erlang' \
+ $(foreach lib, $(EJABBERD_ERLANG_LIBS), \
+ ac_cv_erlang_lib_dir_$(lib)="$$erlang_lib_dir_$(lib)")
+
+# Set environment variables so the rebar compile command does
+# cross-compile ejabberd dependencies.
+EJABBERD_MAKE_ENV = \
+ $(TARGET_CONFIGURE_OPTS) \
+ $(TARGET_CONFIGURE_ARGS) \
+ LDFLAGS="-L$(HOST_DIR)/usr/$(GNU_TARGET_NAME)/sysroot/usr/lib/erlang/usr/lib"
+
+# Delete HOST_DIR prefix from ERL path in ejabberctl script.
+define EJABBERD_FIX_EJABBERDCTL
+ sed -e "s,ERL=$(HOST_DIR),ERL=," \
+ -e "s,INSTALLUSER=,INSTALLUSER=ejabberd," \
+ -i "$(TARGET_DIR)"/usr/sbin/ejabberdctl
+endef
+
+EJABBERD_POST_INSTALL_TARGET_HOOKS += EJABBERD_FIX_EJABBERDCTL
+
+define EJABBERD_PERMISSIONS
+/etc/ejabberd d 750 0 128 - - - - -
+/etc/ejabberd/ejabberd.yml-new f 640 0 128 - - - - -
+/etc/ejabberd/ejabberd.yml f 640 0 128 - - - - -
+/etc/ejabberd/ejabberdctl.cfg-new f 640 0 128 - - - - -
+/etc/ejabberd/ejabberdctl.cfg f 640 0 128 - - - - -
+/etc/ejabberd/inetrc f 644 0 128 - - - - -
+/usr/sbin/ejabberdctl f 550 0 128 - - - - -
+/usr/lib/ejabberd/priv/bin/captcha.sh f 750 119 0 - - - - -
+/usr/var/lib/ejabberd d 750 119 0 - - - - -
+/usr/var/lock/ejabberdctl d 750 119 0 - - - - -
+/usr/var/log/ejabberd d 750 119 0 - - - - -
+endef
+
+define EJABBERD_USERS
+ejabberd 119 ejabberd 128 * /var/run/ejabberd - - ejabberd daemon
+endef
+
+$(eval $(autotools-package))
--
1.9.1
next reply other threads:[~2014-07-16 15:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-16 15:57 Johan Oudinet [this message]
2014-07-16 22:05 ` [Buildroot] [PATCH v2] ejabberd: new package Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1405526227-4277-1-git-send-email-johan.oudinet@gmail.com \
--to=johan.oudinet@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.