SUMMARY="A Javascript engine written in C/C++"
DESCRIPTION="Spidermonkey is a Javascript engine written in C/C++ used in \
various products from Mozilla." 
HOMEPAGE="http://www.mozilla.org/js/spidermonkey"
COPYRIGHT="1998-1999 Netscape Communications Corporation"
LICENSE="NPL v1.1"
REVISION="1"
SOURCE_URI="https://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz"
CHECKSUM_SHA256="5d12f7e1f5b4a99436685d97b9b7b75f094d33580227aa998c406bbae6f2a687"
SOURCE_DIR="js-$portVersion/"
PATCHES="spidermonkey-${portVersion}.patchset"

ARCHITECTURES="?x86_gcc2 x86 ?x86_64"

PROVIDES="
	spidermonkey$secondaryArchSuffix = $portVersion compat >= 1.8
	lib:libmozjs185$secondaryArchSuffix = 1.0.0 compat >= 1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	spidermonkey${secondaryArchSuffix}_devel = $portVersion
	devel:libmozjs185$secondaryArchSuffix = 1.0.0 compat >= 1
	"
REQUIRES_devel="
	spidermonkey$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:perl
	cmd:awk
	cmd:python
	cmd:xargs
	cmd:pkg_config$secondaryArchSuffix
	cmd:sed
	"

BUILD()
{
	cd js/src
	runConfigure --omit-dirs "libDir docDir dataRootDir" ./configure \
		--disable-tracejit
	make $jobArgs
}

INSTALL()
{
	cd js/src
	make install
	
	mv $libDir/libmozjs185-1.0.a $libDir/libmozjs185.a
	
	prepareInstalledDevelLibs libmozjs185
	fixPkgconfig
	
	# devel package
	packageEntries devel \
		$developDir

}
