# SliTaz package receipt.

PACKAGE="spidermonkey"
VERSION="1.8.0-rc1"
CATEGORY="multimedia"
SHORT_DESC="Mozilla C implementation of Javascript"
MAINTAINER="jozee@slitaz.org"
SOURCE="js"
TARBALL="$SOURCE-$VERSION.tar.gz"
WEB_SITE="http://www.mozilla.org/js/spidermonkey/" 
WGET_URL="http://ftp.mozilla.org/pub/mozilla.org/js/$TARBALL"
TAGS="javascript"

DEPENDS="nspr"
BUILD_DEPENDS="nspr-dev"

# Rules to configure and make the package.
compile_rules()
{
	cd $src/src

	# Fix from Archlinux
	# http://projects.archlinux.org/svntogit/community.git/tree/spidermonkey/trunk/PKGBUILD
	#patch -p0 < $stuff/spidermonkey-Makefile.patch || return 1
	sed -i 's|include|include/js|' rules.mk || return 1
	# patch Makefile for threadsafe support with native nspr
	patch -p2 -i $stuff/spidermonkey-1.7-threadsafe.patch || return 1
	# FS#16673
	export CFLAGS="${CFLAGS} -DJS_C_STRINGS_ARE_UTF8"
	# build - threadsafe
	make -j1 -f Makefile.ref BUILD_OPT=1 JS_THREADSAFE=1 \
		DIST=$DESTDIR/usr all export
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/lib
	
	cp -a $_pkg/usr/bin $fs/usr	
	cp -a $_pkg/usr/lib/*so* $fs/usr/lib
}