# $Id: Portfile 61789 2009-12-21 16:54:46Z jann@macports.org $

PortSystem          1.0

name                proftpd
version             1.3.2c
categories          net
maintainers         jinhyung.org:jenix
description         Highly configurable ftp-server. 
long_description    ProFTPD is a highly configurable ftp daemon for unix \
                    and unix-like operating systems. ProFTPD is designed \
                    to be somewhat of a "drop-in" replacement for wu-ftpd \
                    with a configuration format like Apache.    
homepage            http://www.proftpd.org
platforms           darwin freebsd
master_sites        ftp://ftp.proftpd.org/distrib/source/ \
                    ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/ftp.proftpd.net/distrib/source/ \
                    ftp://mirror.hostfuss.com/proftpd/distrib/source/ \
                    ftp://ftp.piotrkosoft.net/pub/mirrors/ftp.proftpd.org/distrib/source/ \
                    ftp://proftpd.get7.biz/proftpd/distrib/source/ \
                    ftp://ftp.ibiblio.org/pub/mirrors/proftpd/distrib/source/ \
                    ftp://ftp.solnet.ch/mirror/proftpd.org/distrib/source/
checksums           md5 559fd3fb6959d42ddd66b333a03b0c49 \
                    sha1 d81c4b988fc70109a82804852378bfd6f28602a6 \
                    rmd160 0754e3e9a6915ca497924448899238d60226ca63
                    
depends_lib         port:openssl               
use_bzip2           yes

configure.args      --sysconfdir=${prefix}/etc --localstatedir=${prefix}/var/run \
                    --mandir=${prefix}/share/man install_user=`id -u` install_group=`id -g` \
                    --with-modules=mod_tls

pre-destroot {
    reinplace "s|nogroup|nobody|g" ${worksrcpath}/sample-configurations/basic.conf 
    xinstall -m 755 -d ${destroot}${prefix}/var/run/proftpd
    system "touch ${destroot}${prefix}/var/run/proftpd/proftpd.scoreboard"
}

variant mysql4 description {Build with mysql4 support} {    
    depends_lib-append      port:mysql4
    configure.args-append   --with-modules=mod_sql:mod_sql_mysql \
                --with-includes=${prefix}/include/mysql \
                --with-libraries=${prefix}/lib/mysql 
}

variant mysql5 description {Build with mysql5 support} {
    depends_lib-append   path:bin/mysql_config5:mysql5
    configure.args-append   --with-modules=mod_sql:mod_sql_mysql \
                --with-includes=${prefix}/include/mysql5/mysql \
                --with-libraries=${prefix}/lib/mysql5/mysql 
}

startupitem.create  yes
startupitem.start   "${prefix}/sbin/proftpd"
startupitem.restart "/bin/kill -HUP \$(/bin/cat ${prefix}/var/run/proftpd.pid)"
startupitem.stop    "/bin/kill -15 \$(/bin/cat ${prefix}/var/run/proftpd.pid)"
