SUMMARY="Scalable distributed programming environment"
DESCRIPTION="SockHop is a system that facilitates the development of applications \
that run on many machines at once. It is implemented in a single \
file (libsockhop.so) that serves as both shared library for client code, \
and as a server program for remote program invocation and control. SockHop's \
primary design goals are ease of use, flexibility, and scalability \
Using SockHop, writing and debugging a program that runs on many machines \
at once is not much harder than writing a \"regular\" multithreaded program."
HOMEPAGE="http://haikuarchives.github.io/SockHop/"
COPYRIGHT="1999 Jeremy Friesner"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/HaikuArchives/SockHop/archive/edb241e6f58b462a04f2c61308d5b37a42cbaa6b.tar.gz"
CHECKSUM_SHA256="50377a2b8e20a36b10bb2baa1143ea3b5ddf21ce69cc0928a9ccb8f9b4505fba"
SOURCE_DIR="SockHop-edb241e6f58b462a04f2c61308d5b37a42cbaa6b"

ARCHITECTURES="?all x86_gcc2"

PROVIDES="
	sockhop = $portVersion
	cmd:sockhop = $portVersion
	lib:libsockhop = $portVersion
	"
REQUIRES="
	haiku
	lib:libz
	"

PROVIDES_devel="
	sockhop_devel = $portVersion
	devel:libsockhop = $portVersion
	"
REQUIRES_devel="
	haiku_devel
	sockhop == $portVersion base
	"

BUILD_REQUIRES="
	haiku_devel
	devel:libz
	"
BUILD_PREREQUIRES="
	makefile_engine
	cmd:gcc
	cmd:make
	cmd:mkdepend
	"

BUILD()
{
	cd source
	cd libsockhop
	make $jobArgs OBJ_DIR=objects
	cd ../sockhop
	make $jobArgs OBJ_DIR=objects
}

INSTALL()
{
	mkdir -p $binDir
	mkdir -p $libDir
	mkdir -p $includeDir

	cp -a source/sockhop/objects/sockhop $binDir
	cp -a source/libsockhop/objects/libsockhop.so $libDir
	cp -R include/. $includeDir

	prepareInstalledDevelLibs \
		libsockhop
	packageEntries devel \
		$developDir
}

TEST()
{
	cd source/tests
	# Yes, I know. ;)
	for i in {1..12}; do
		pushd $i
		make $jobArgs OBJ_DIR=objects
		popd
	done
}
