# $Id$

PortSystem          1.0

name                ejabberd
version             15.03
revision            1
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  22dde290f1d9fb2a41b2eb02f89eb9a1ea0a895c \
                    sha256  b685cd615ecd9a4f42701541e84c2a28ae534bc608d292b78145d9c59ea17233

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

depends_lib         port:erlang \
                    port:expat \
                    port:libyaml \
                    path:lib/libssl.dylib: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+)*)"