SUMMARY="Remote terminal that supports intermittent connectivity"
DESCRIPTION="Remote terminal application that allows roaming, supports \
intermittent connectivity, and provides intelligent local echo and line \
editing of user keystrokes.

Mosh is a replacement for SSH. It's more robust and responsive, especially \
over Wi-Fi, cellular, and long-distance links.

Mosh is free software, available for GNU/Linux, FreeBSD, Solaris, Mac OS X, \
and Android.
"
HOMEPAGE="https://mosh.mit.edu/"
REVISION="1"
LICENSE="GNU GPL v3"
COPYRIGHT="2012-2013 Keith Winstein"
ARCHITECTURES="x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

SOURCE_URI="https://mosh.mit.edu/mosh-$portVersion.tar.gz"
CHECKSUM_SHA256="e74d0d323226046e402dd469a176075fc2013b69b0e67cea49762c957175df46"
PATCHES="mosh-1.2.4.patchset"

PROVIDES="
	mosh$secondaryArchSuffix = $portVersion
	cmd:mosh_client
	cmd:mosh_server
	cmd:mosh
"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	lib:libncursesw$secondaryArchSuffix
	lib:libprotobuf$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
"

BUILD_REQUIRES="
	devel:libncurses$secondaryArchSuffix
	devel:libprotoc$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
"

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:autoconf
	cmd:automake
	cmd:awk
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
"

BUILD()
{
	export LDFLAGS=-lnetwork
	./autogen.sh
	runConfigure ./configure --bindir=$prefix/bin
	make $jobArgs
}

INSTALL()
{
	make install
}
