SUMMARY="Websocket++ header-only library"
DESCRIPTION="WebSocket++ is a header only C++ library that implements RFC6455 \
The WebSocket Protocol. It allows integrating WebSocket client and server \
functionality into C++ programs. It uses interchangeable network transport \
modules including one based on raw char buffers, one based on C++ iostreams, \
and one based on Asio (either via Boost or standalone). End users can write \
additional transport policies to support other networking or event libraries \
as needed."
HOMEPAGE="https://github.com/zaphoyd/websocketpp"
COPYRIGHT="2018, Peter Thorson"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://github.com/zaphoyd/websocketpp/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="6ce889d85ecdc2d8fa07408d6787e7352510750daa66b5ad44aacb47bea76755"
PATCHES="websocketpp-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	websocketpp$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
	BUILD_REQUIRES="$BUILD_REQUIRES
	devel:libboost_system$secondaryArchSuffix
	devel:libboost_thread$secondaryArchSuffix
	devel:libboost_unit_test_framework$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
fi
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
		TESTS=ON
	else
		TESTS=OFF
	fi
	mkdir -p build && cd build
	cmake .. -DCMAKE_BUILD_TYPE=Release \
		-DENABLE_CPP11=ON \
		-DBUILD_TESTS=$TESTS \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DINSTALL_INCLUDE_DIR:PATH=$includeDir \
		-DINSTALL_CMAKE_DIR:PATH=$libDir/cmake
	make $jobArgs
}


INSTALL()
{
	cd build
	make install
	# we don't want the test binaries installed
	rm -rf $prefix/bin
}

TEST()
{
	cd build
	make test
}
