SUMMARY="A lightweight Javascript interpreter"
DESCRIPTION="MuJS is a lightweight Javascript interpreter designed for \
embedding in other software to extend them with scripting capabilities.
MuJS was designed with a focus on small size, correctness, and simplicity. It \
is written in portable C and implements ECMAScript as specified by ECMA-262. \
The interface for binding with native code is designed to be as simple as \
possible to use, and is very similar to Lua. There is no need to interact \
with byzantine C++ template mechanisms, or worry about marking and unmarking \
garbage collection roots, or wrestle with obscure build systems."
HOMEPAGE="https://mujs.com/"
COPYRIGHT="2013-2017 Artifex Software, Inc."
LICENSE="ISC"
REVISION="1"
SOURCE_URI="https://mujs.com/downloads/mujs-$portVersion.tar.gz"
CHECKSUM_SHA256="9ffc7b11f8e16218ee04d0c1a541c6ba79afc185221dab5bcbdbeda5a03126ee"

ARCHITECTURES="all ?x86_gcc2"

PROVIDES="
	mujs$secondaryArchSuffix = $portVersion
	cmd:mujs$secondaryArchSuffix = $portVersion
	cmd:mujs_pp$secondaryArchSuffix = $portVersion
	lib:libmujs$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libreadline$secondaryArchSuffix
	"

PROVIDES_devel="
	mujs${secondaryArchSuffix}_devel = portVersion
	devel:libmujs$secondaryArchSuffix
	"
REQUIRES_devel="
	mujs$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libreadline$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:ld
	cmd:make
	cmd:sed
	"

BUILD()
{
	make shared $jobArgs \
		prefix=$prefix \
		bindir=$binDir \
		incdir=$includeDir \
		libdir=$libDir
}

INSTALL()
{
	make install-shared \
		prefix=$prefix \
		bindir=$binDir \
		incdir=$includeDir \
		libdir=$libDir

	prepareInstalledDevelLib libmujs
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}

TEST()
{
	make test
}
