#Maintainer: Dimitris Tzemos <djemos~at~slackel~dot~gr>

#Mandatory
pkgname=cryptopp
pkgver=5.6.1
pkgrel=1dj
source=(http://www.cryptopp.com/$pkgname\561.zip change_gnumake_file_to_compile.patch change_gnumake_file_to_compile_x86_64.patch)
#Optional
docs=("readme.txt" "license.txt")
url=http://www.cryptopp.com

slackdesc=\
(
 #|-----handy-ruler------------------------------------------------------|
 "cryptopp (library of cryptographic schemes)"
 "Crypto++ Library is a free C++ class library of cryptographic schemes"
)

build() {
	cd $startdir/src/
	# Fix Makefile to build with correct flags and install correctly on x86_64.
	sed -i "s/-march=native -mtune=native/$CFLAGS/" GNUmakefile || return 1
	sed -i -e "s%(PREFIX)/lib%(PREFIX)/lib${LIBDIRSUFFIX}%g" GNUmakefile || return 1
	sed -i "s/\$(PREFIX)\//\$(DESTDIR)\/\$(PREFIX)\//g" GNUmakefile || return 1
        if [ "$arch" = "x86_64" ]; then
        patch -p0 < $startdir/change_gnumake_file_to_compile_x86_64.patch	
        elif [ "$arch" = "i486" ]; then
        patch -p0 < $startdir/change_gnumake_file_to_compile.patch
        fi
	make CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" -j $numjobs || return 1
	make install DESTDIR=$startdir/pkg || return 1
}