SUMMARY="The fastest WebAssembly interpreter, and the most universal runtime"
DESCRIPTION="Wasm3 started as a research project and remains \
so by many means. Evaluating the engine in different \
environments is part of the research."
HOMEPAGE="http://github.com/wasm3/wasm3"
COPYRIGHT="2019 Steven Massey, Volodymyr Shymanskyy"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/wasm3/wasm3/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="b778dd72ee2251f4fe9e2666ee3fe1c26f06f517c3ffce572416db067546536c"
PATCHES="wasm3-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="?x86"

PROVIDES="
	wasm3$secondaryArchSuffix = $portVersion
	cmd:wasm3$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"

BUILD_PREREQUIRES="
	cmd:cmake
	cmd:make
	cmd:gcc
	"

BUILD()
{
	mkdir -p build 
	cd build 
	cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_WASI=simple
	make
}

INSTALL()
{

	# install runtime
	mkdir -p $binDir

	cd build
	cp -p wasm3 $binDir/
}
