# $Id: Portfile,v 1.7 2006/01/09 20:07:37 matt Exp $

PortSystem 1.0
name			vsftpd
version			2.0.4
categories		net
platforms		darwin
maintainers		darwinports@opendarwin.org
homepage		http://vsftpd.beasts.org/
description		Simple FTP server for UNIX systems

long_description	vsftpd is an FTP server, or daemon. The 'vs' stands for Very Secure. \
			Obviously this is not a guarantee, but a reflection that I have written \
			the entire codebase with security in mind, and carefully designed the \
			program to be resilient to attack.

master_sites		ftp://${name}.beasts.org/users/cevans/
checksums		md5 c0bf8c7b8e15ab15827172786fc56115

patchfiles		patch-sysdeputil.c.diff \
			patch-vsf_findlibs.sh.diff \
			patch-vsftpd.conf.diff

use_configure		no

build.target		{}

pre-build {		reinplace "s|/etc/|${prefix}/etc/|g" \
				${worksrcpath}/defs.h \
				${worksrcpath}/tunables.c \
				${worksrcpath}/vsftpd.8 \
				${worksrcpath}/vsftpd.conf
			reinplace "s|/var/|${prefix}/var/|g" \
				${worksrcpath}/tunables.c \
				${worksrcpath}/vsftpd.conf.5 \
				${worksrcpath}/vsftpd.conf
			reinplace "s|/usr/share/empty|${prefix}/var/empty|g" \
				${worksrcpath}/tunables.c
			reinplace "s|/usr/share/ssl/|${prefix}/share/ssl/|g" \
				${worksrcpath}/tunables.c
			reinplace "s|/etc/vsftpd|${prefix}/etc/vsftpd|g" \
				${worksrcpath}/vsftpd.conf.5
			reinplace "s|#local_enable|local_enable|" \
				${worksrcpath}/vsftpd.conf
			reinplace "s|anonymous_enable=YES|anonymous_enable=NO|" \
				${worksrcpath}/vsftpd.conf
			}

build.env		CFLAGS="-fno-common"

destroot {		xinstall -d -W ${destroot}${prefix} \
                                sbin etc var/empty var/log share/man/man5 \
				share/man/man8 share/doc/${name}
			file copy ${worksrcpath}/vsftpd ${destroot}${prefix}/sbin
			file copy ${worksrcpath}/vsftpd.8 ${destroot}${prefix}/share/man/man8
			file copy ${worksrcpath}/vsftpd.conf.5 ${destroot}${prefix}/share/man/man5
			file copy ${worksrcpath}/vsftpd.conf ${destroot}${prefix}/etc
			xinstall -v -m 644 -W ${worksrcpath} \
				AUDIT BENCHMARKS BUGS FAQ README README.security TUNING \
				${destroot}${prefix}/share/doc/${name}
			file copy ${worksrcpath}/EXAMPLE ${destroot}${prefix}/share/doc/${name}
			file copy ${worksrcpath}/xinetd.d ${destroot}${prefix}/share/doc/${name}
			}

destroot.keepdirs	"${destroot}${prefix}/var/empty/" \
			"${destroot}${prefix}/var/log/"
			

# Notify the user how to launch the ftpd
post-install {		ui_msg "\nYou can now start ${name} in 3 ways,"
			ui_msg "either via a super-server like xinetd or inetd,"
			ui_msg "in standalone mode or if you're using Darwin 8.x"
			ui_msg "and above, launchd(8).\n"
			ui_msg "By default, ${name} will runs in standalone"
			ui_msg "mode.\n"
			}

