# $Id: Portfile 65526 2010-03-27 02:46:16Z ryandesign@macports.org $

PortSystem	1.0

name			flow-tools
version			0.68
categories		net
maintainers		nomaintainer
platforms		darwin

description		Suite of tools and library to work with netflow data
long_description	${description}

homepage		http://www.splintered.net/sw/flow-tools/
master_sites	        ftp://ftp.eng.oar.net/pub/flow-tools/
checksums		md5 c9e0a8b53c79611b6bffcb9d510a5a38

patchfiles		patch-configs_Makefile \
			patch-flow-header.c \
			patch-ftpaths.h \
			patch-lib_ftchash.c \
			patch-lib_ftio.c \
			patch-lib_ftsym.c \
			patch-lib_fttlv.c \
			patch-lib_Makefile.in \
			patch-lib_support.c \
			patch-lib-ftfile.c \
			patch-src_flow-fanout.c \
			patch-src_Makefile.in

depends_lib		port:openssl \
			port:zlib

post-patch {
	reinplace "s|__PREFIX__|${prefix}|g" \
		${filespath}/patch-ftpaths.h

	reinplace "s|\$WHERE_MYSQL/lib/mysql|\$WHERE_MYSQL/lib/mysql5|g" \
		${worksrcpath}/configure
	reinplace "s|\$WHERE_MYSQL/include/mysql|\$WHERE_MYSQL/include/mysql5|g" \
		${worksrcpath}/configure

	eval reinplace "s|@localstatedir@/sym/|${prefix}/share/flow-tools/|g" \
		[glob ${worksrcpath}/docs/flow-*.1.in] \
		[glob ${worksrcpath}/docs/flow-*.html.in]

	eval reinplace "s|@localstatedir@/cfg/|${prefix}/etc/flow-tools/|g" \
		[glob ${worksrcpath}/docs/flow-*.1.in] \
		[glob ${worksrcpath}/docs/flow-*.html.in]
}

configure.args		--with-openssl=${prefix} \
			--localstatedir=${prefix} \
			--mandir=${prefix}/share/man

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
	xinstall -m 644 -W ${worksrcpath} INSTALL README ChangeLog TODO \
		${destroot}${prefix}/share/doc/${name}
}

variant mysql5 {
	configure.args-append	--with-mysql=${prefix}
	depends_lib-append	path:bin/mysql_config5:mysql5
}

livecheck.type		regex
livecheck.regex		${name}-(\[0-9.\]+)\\.tar
