# Description: 	The Tripwire package contains programs used to verify the integrity of the files on a given system. 
# URL:         	http://downloads.sourceforge.net/tripwire
# Packager:		berlius at nutyx dot com
# Depends on:  	

name=tripwire
version=2.4.2.2
release=1
source=(http://downloads.sourceforge.net/tripwire/$name-$version-src.tar.bz2)

build () {

    cd $name-$version-src
    
	sed -i -e 's@TWBIN="${prefix}@TWBIN="$PKG/usr@' install/install.cfg            
	sed -i -e 's@TWPOLICY="${sysconfdir}@TWPOLICY="$PKG/etc@' install/install.cfg            
	sed -i -e 's@TWDB="${prefix}@TWDB="$PKG/var@' install/install.cfg            
	sed -i -e 's/!Equal/!this->Equal/' src/cryptlib/algebra.h                
	sed -i -e '/stdtwadmin.h/i#include <unistd.h>' src/twadmin/twadmincl.cpp 
	sed -i -e '/TWMAN/ s|${prefix}|$PKG/usr/share|' \
       -e '/TWDOCS/s|${prefix}/doc/tripwire|$PKG/usr/share/doc/tripwire-2.4.2.2|' \
       install/install.cfg                                               
	sed -i -e 's/eArchiveOpen e\([^)]*)\)/throw ( eArchiveOpen\1 )/' \
       -e '/throw e;/d' src/core/archive.cpp                             

	./configure --prefix=/usr --sysconfdir=/etc/tripwire 
                    
	make
	
	install -v -m750 -d $PKG/usr/share/doc/tripwire-2.4.2.2
	cp -v policy/*.txt $PKG/usr/share/doc/tripwire-2.4.2.2
	
    make DESTDIR=$PKG install

}
