SUMMARY="Secure Shell Client and Server (Remote Login Program)"
HOMEPAGE="http://www.openssh.com/" 
LICENSE="OpenSSH"
COPYRIGHT="2005-2011 Tatu Ylonen et al."
SRC_URI="
	http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-5.8p2.tar.gz
	http://obsd.cec.mtu.edu/pub/OpenBSD/OpenSSH/portable/openssh-5.8p2.tar.gz
	"
CHECKSUM_SHA256="5c35ec7c966ce05cc4497ac59c0b54a556e55ae7368165cc8c4129694654f314"
REVISION="4"
ARCHITECTURES="x86_gcc2 ?x86"

PATCHES="openssh-5.8p2.patch"

ADDITIONAL_FILES="sshd_keymaker.sh"

PROVIDES="
	openssh = $portVersion compat >= 5
	cmd:scp = $portVersion compat >= 5
	cmd:sftp = $portVersion compat >= 5
	cmd:sftp_server = $portVersion compat >= 5
	cmd:slogin = $portVersion compat >= 5
	cmd:ssh = $portVersion compat >= 5
	cmd:ssh_add = $portVersion compat >= 5
	cmd:ssh_agent = $portVersion compat >= 5
	cmd:ssh_keygen = $portVersion compat >= 5
	cmd:ssh_keyscan = $portVersion compat >= 5
	cmd:ssh_keysign = $portVersion compat >= 5
	cmd:ssh_pkcs11_helper = $portVersion compat >= 5
	cmd:sshd = $portVersion compat >= 5
	"
REQUIRES="
	haiku >= $haikuVersion
	lib:libcrypto
	lib:libedit
	lib:libssl
	lib:libz
	"
BUILD_REQUIRES="
	openssl
	"
BUILD_PREREQUIRES="
	haiku_devel >= $haikuVersion
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc
	cmd:ld
	cmd:libtoolize
	cmd:make
	"


PATCH()
{
	echo 'AC_CONFIG_MACRO_DIR([m4])' >> configure.ac
}

BUILD()
{
	mkdir -p m4
	aclocal --install -I m4
	libtoolize --force --copy
	aclocal -I m4
	autoconf
	defaultPath=".:/boot/home/config/non-packaged/bin:/boot/home/config/bin"
	defaultPath+=":/boot/common/non-packaged/bin:/boot/common/bin:/bin"
	defaultPath+=":/boot/common/apps:/boot/common/preferences:/boot/system/apps"
	defaultPath+=":/boot/system/preferences"
	runConfigure ./configure \
		--with-privsep-path=$dataDir/openssh/empty \
		--with-default-path="$defaultPath" \
		--with-md5-passwords \
		--disable-utmpx \
		--with-libedit
	make $jobArgs
}

INSTALL()
{
	make install-nokeys
	postInstallDir=$prefix/boot/post_install
	mkdir -p $postInstallDir
	cp -f $portDir/additional-files/sshd_keymaker.sh $postInstallDir
}

TEST()
{
	make tests
}

DESCRIPTION="
OpenSSH is a FREE version of the SSH connectivity tools that technical users \
of the Internet rely on. Users of telnet, rlogin, and ftp may not realize that \
their password is transmitted across the Internet unencrypted, but it is. \
OpenSSH encrypts all traffic (including passwords) to effectively eliminate \
eavesdropping, connection hijacking, and other attacks. Additionally, OpenSSH \
provides secure tunneling capabilities and several authentication methods, and \
supports all SSH protocol versions.
The OpenSSH suite replaces rlogin and telnet with the ssh program, rcp with \
scp, and ftp with sftp. Also included is sshd (the server side of the \
package), and the other utilities like ssh-add, ssh-agent, ssh-keysign, \
ssh-keyscan, ssh-keygen and sftp-server.
"
