SUMMARY="A new platform layer for Node"
DESCRIPTION="
libuv is a multi-platform support library with a focus on asynchronous I/O. \
It was primarily developed for use by Node.js, but it's also used by Luvit, \
Julia, pyuv, and others."
HOMEPAGE="http://github.com/libuv/libuv"
SOURCE_URI="git://github.com/hamishm/libuv#d48e9ae4bd504aadc25e26f06e83e9c2c86921ac"
SOURCE_DIR="libuv-v1.2.0"
REVISION="1"
LICENSE="MIT"
COPYRIGHT="2009-2015 Ryan Dahl and others"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	libuv$secondaryArchSuffix = $portVersion
	lib:libuv$secondaryArchSuffix = $portVersion
"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
"

BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:autoconf
	cmd:python
	cmd:automake
	cmd:libtoolize
	cmd:gyp
"

REQUIRES_devel="
	libuv$secondaryArchSuffix == $portVersion
"

PROVIDES_devel="
	libuv${secondaryArchSuffix}_devel = $portVersion
	devel:libuv$secondaryArchSuffix = $portVersion
"

BUILD()
{
	rm -rf out
	./gyp_uv.py -f make -Dcomponent=shared_library -Duv_library=shared_library
	make -C out BUILDTYPE=Release
}

INSTALL()
{
	mkdir -p $includeDir
	cp -rf include/* $includeDir/
	
	mkdir -p $libDir
	cp -rf out/Release/lib.target/libuv.so $libDir/
	
	prepareInstalledDevelLibs libuv
	
	packageEntries devel $developDir
}

TEST()
{
	true
	#./out/Debug/run-tests
	# Test suite doesn't pass
}

