# $Id: Portfile 120114 2014-05-15 22:04:22Z ciserlohn@macports.org $

PortSystem          1.0

name                ejabberd
version             14.05
categories          net
platforms           darwin
license             GPL-2
maintainers         ciserlohn
description         ejabberd is an XMPP application server.
long_description    ${description} ejabberd stands for "Erlang Jabber Daemon"

homepage            http://www.process-one.net/en/ejabberd/
master_sites        http://www.process-one.net/downloads/ejabberd/${version}/

checksums           rmd160  b302e99842ca3ee9a44b839932508455cc74fa05 \
                    sha256  1f97b1625bab99c7328010ad576810e70ae5d5c89c701b92cbc8d1999e4014cd

extract.suffix      .tgz

build.env-append    CC=${configure.cc} \
                    CXX=${configure.cxx} \
                    CPP=${configure.cpp} \
                    CFLAGS=${configure.cflags} \
                    CXXFLAGS=${configure.cxxflags} \
                    LDFLAGS=${configure.ldflags} \

depends_build       port:git-core

depends_lib         port:erlang \
                    port:expat \
                    port:libyaml \
                    port:openssl \
                    port:libiconv \
                    port:zlib

# erlang is not universal
universal_variant   no

configure.args      --with-expat=${prefix} \
                    --with-zlib=${prefix} \
                    --with-openssl=${prefix}

# All ejabberd configuration files.
set conf_files      {ejabberd.yml ejabberdctl.cfg inetrc}

destroot.keepdirs   ${destroot}${prefix}/var/log/ejabberd/

set etc ${prefix}/etc/ejabberd
post-destroot {
    # Create sample configuration files so they don't get overwritten by an
    # update.
    foreach file ${conf_files} {
        file rename ${destroot}${etc}/${file} ${destroot}${etc}/${file}.sample
    }

}

notes "
Before running ${name} for the first time, you must copy the sample\
configuration files:

cd ${etc}/
"
foreach file ${conf_files} {
    notes-append "cp ${file}.sample ${file}"
}

livecheck.type      regex
livecheck.url       ${homepage}release_notes
livecheck.regex     "${name} (\\d+(?:\\.\\d+)*)"
