DESCRIPTION="V8 is Google's open source JavaScript engine." 
HOMEPAGE="https://code.google.com/p/v8/" 
SOURCE_URI="svn+http://v8.googlecode.com/svn/trunk/#13067"
REVISION="1"
STATUS_HAIKU="unstable"
DEPEND=""
#CHECKSUM_MD5=""
MESSAGE="This port only builds with gcc4. Use 'setgcc gcc4' before building."
BUILD()
{
	gyp_patch_path=$(dirname ${PWD})/patches/gyp-r1501.patch
	cd v8-r13067
	cd build
	svn co http://gyp.googlecode.com/svn/trunk/@1501 gyp
	cd gyp
	patch -p1  -i $gyp_patch_path
	cd ../..
	make library=shared ia32.debug
}

TEST()
{
	cd v8-r13067
	make ia32.debug.check
}

INSTALL()
{
	cd v8-r13067
	includedir=${DESTDIR}/`finddir B_COMMON_HEADERS_DIRECTORY`/v8
	mkdir -p ${includedir}
	cp -R ./include/*  ${includedir}
	libdir=${DESTDIR}/`finddir B_COMMON_LIB_DIRECTORY`
	mkdir -p ${libdir}
	cp -R ./out/ia32.debug/obj.target/tools/gyp/*.a ${libdir}
	cp -R ./out/ia32.debug/obj.target/tools/gyp/*.so ${libdir}
	bindir=${DESTDIR}/`finddir B_COMMON_BIN_DIRECTORY`/v8
	mkdir -p ${bindir}
	cp ./out/ia32.debug/cctest ${bindir}
	cp ./out/ia32.debug/d8 ${bindir}
	cp ./out/ia32.debug/lineprocessor ${bindir}
	cp ./out/ia32.debug/mksnapshot ${bindir}
	cp ./out/ia32.debug/preparser ${bindir}
	cp ./out/ia32.debug/process ${bindir}
	cp ./out/ia32.debug/shell ${bindir}
}

LICENSE="BSD (3-clause)"
COPYRIGHT="2006-2012 The V8 Project Authors"
