From patchwork Wed Jul 16 15:57:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Oudinet X-Patchwork-Id: 370785 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id B5D5614009E for ; Thu, 17 Jul 2014 01:57:15 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 3E48593344; Wed, 16 Jul 2014 15:57:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YupxGD8F7aF0; Wed, 16 Jul 2014 15:57:12 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id CFA1793216; Wed, 16 Jul 2014 15:57:12 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 1C9571CE525 for ; Wed, 16 Jul 2014 15:57:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 1905393224 for ; Wed, 16 Jul 2014 15:57:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4rjpwXr682k2 for ; Wed, 16 Jul 2014 15:57:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by hemlock.osuosl.org (Postfix) with ESMTPS id 186FA93216 for ; Wed, 16 Jul 2014 15:57:10 +0000 (UTC) Received: by mail-wi0-f174.google.com with SMTP id d1so6503150wiv.1 for ; Wed, 16 Jul 2014 08:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=s6y+N/Ms6mBHdLySpn0xEVXpQl2X/o0fFIMjNg8Tbac=; b=naFivbwLyLmX6+56jQBbsBwk35KacuNwdrIa1As8rWOvH0bTNotyp1BIqVgAj0j5lR Dpgf97bSyG00C+nQAZrwjS4d74Pmmv/HVmV4iU2g/uRGa2PKglQSd6pBnujvkVtNdSg0 e9MkVv96GkgnATv4sL6BjO8LduS0IGBCnXs3ZV/mhydvF7ASjxXUi3YXWX885m5hqXCV YCYbI1zPScGeq97tudDGanYFAS7DxucxEEOluW1SHAu+q3R+gPr406W2znvEHcS+3ljQ oEduVP3ib6T0drINQUYzlbKJ31Ag7RL6bEZ/aYjyST6gPXnbquHnAqiU/NZwoagQ+Ebd FoLA== X-Received: by 10.180.211.71 with SMTP id na7mr12837189wic.55.1405526229523; Wed, 16 Jul 2014 08:57:09 -0700 (PDT) Received: from localhost.localdomain ([193.51.194.208]) by mx.google.com with ESMTPSA id ed14sm19412950wic.10.2014.07.16.08.57.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Jul 2014 08:57:08 -0700 (PDT) From: Johan Oudinet To: buildroot@buildroot.org Date: Wed, 16 Jul 2014 17:57:07 +0200 Message-Id: <1405526227-4277-1-git-send-email-johan.oudinet@gmail.com> X-Mailer: git-send-email 1.9.1 Subject: [Buildroot] [PATCH v2] ejabberd: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Signed-off-by: Johan Oudinet --- 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 <&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))