SUMMARY="Full-strength general purpose cryptography library (with SSL/TLS)"
DESCRIPTION="
The OpenSSL Project is a collaborative effort to develop a robust, \
commercial-grade, full-featured, and Open Source toolkit implementing the \
Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) \
protocols as well as a full-strength general purpose cryptography library. The \
project is managed by a worldwide community of volunteers that use the \
Internet to communicate, plan, and develop the OpenSSL toolkit and its related \
documentation.
OpenSSL is based on the excellent SSLeay library developed by Eric A. Young \
and Tim J. Hudson. The OpenSSL toolkit is licensed under an Apache-style \
licence, which basically means that you are free to get and use it for \
commercial and non-commercial purposes subject to some simple license \
conditions.
"
HOMEPAGE="http://www.openssl.org/"
SRC_URI="http://www.openssl.org/source/openssl-1.0.0d.tar.gz"
CHECKSUM_MD5="40b6ea380cc8a5bf9734c2f8bf7e701e"
LICENSE="OpenSSL"
COPYRIGHT="
	1995-1998 Eric Young
	1998-2011 The OpenSSL Project.
	"
REVISION="5"
ARCHITECTURES="x86_gcc2 ?x86"

PATCHES="openssl-1.0.0d.patch"

PROVIDES="
	openssl = $portVersion compat >= 1.0.0
	cmd:c_rehash = $portVersion compat >= 1
	cmd:openssl = $portVersion compat >= 1
	lib:libcrypto = $portVersion compat >= 1.0.0
	lib:libssl = $portVersion compat >= 1.0.0
	"
REQUIRES="
	haiku >= $haikuVersion
	zlib >= 1.2.3
	"
BUILD_REQUIRES="
	zlib_devel >= 1.2.3
	"
BUILD_PREREQUIRES="
	haiku_devel >= $haikuVersion
	cmd:gcc
	cmd:ld
	cmd:make
	cmd:perl >= 5
	cmd:sed
	"


BUILD()
{
	# Fix hardcoded directory for manpages
	sed -i "s@MANDIR=.*\$@MANDIR=$manDir@g" Make*
	
	./config --prefix=$prefix zlib shared --openssldir=$dataRootDir/ssl
	make
}

INSTALL()
{
	make install

	# move include dir to correct location
	mkdir -p $(dirname $includeDir)
	mv $prefix/include $includeDir

	# prepare develop/lib
	prepareInstalledDevelLibs libcrypto libssl
	fixPkgconfig
}

TEST()
{
	make test
}
