# $Id: Portfile 86303 2011-10-24 12:26:54Z ryandesign@macports.org $

PortSystem        1.0

name		aide
version		0.15.1
categories	security
maintainers	nomaintainer
description	Advanced Intrusion Detection Environment
long_description	AIDE (Advanced Intrusion Detection Environment) \
	is a free replacement for Tripwire. It does the same things as \
	the semi-free Tripwire and more. \
	It creates a database from the regular expression rules that it \
	finds from the config file. Once this database is initialized it \
	can be used to verify the integrity of the files. It has several \
	message digest algorithms (md5,sha1,rmd160,tiger,haval,etc.) that \
	are used to check the integrity of the file. More algorithms can \
	be added with relative ease. All of the usual file attributes can \
	also be checked for inconsistencies. It can read databases from \
	older or newer versions. See the manual pages within the distribution \
	for further info. There is also a beginning of a manual.
homepage          http://aide.sourceforge.net/
master_sites      sourceforge:project/aide/aide/${version}
platforms         darwin
checksums         md5 d0b72535ff68b93a648e4d08b0ed7f07 \
                  sha1 c5998c04a223416142323fa1bd18db0936099827 \
                  rmd160 80ea88b1c1496bcca57d2d1cdeecdcdfca0fa5cf
configure.args  --mandir=${prefix}/share/man \
		--with-mhash --with-zlib \
		--with-locale --disable-static

depends_build     port:bison
depends_lib       port:mhash \
                  port:gettext

patchfiles        patch-Makefile.in.diff patch-src-Makefile.in.diff \
			patch-doc-aide.conf.diff patch-doc-aide-check.cron.diff
post-patch {
	reinplace "s|@@LOCALEDIR@@|${prefix}/share/locale|g" \
		${worksrcpath}/Makefile.in ${worksrcpath}/src/Makefile.in
	reinplace "s|%%PREFIX%%|${prefix}|g" \
		${worksrcpath}/doc/aide-check.cron ${worksrcpath}/doc/aide.conf
}

post-destroot {
	file mkdir ${destroot}${prefix}/share/doc/${name}-${version}
	file mkdir ${destroot}${prefix}/etc/${name}
	file mkdir ${destroot}${prefix}/libexec/${name}

	system "install -bC ${worksrcpath}/doc/aide.conf \
		${destroot}${prefix}/share/doc/${name}-${version}/"
	system "install -bC ${worksrcpath}/doc/manual.html \
		${destroot}${prefix}/share/doc/${name}-${version}/"
	system "install -bC ${worksrcpath}/doc/aide.conf \
		${destroot}${prefix}/etc/${name}/"
	system "install -bC ${worksrcpath}/doc/aide-check.cron \
		${destroot}${prefix}/libexec/${name}/"
}

platform darwin {
    # darwin doesn't have or need off64_t and friends
    configure.args-append --disable-lfs
}
