#!/usr/bin/make -f

PACKAGE = $(shell dh_listpackages)
TMP     = $(CURDIR)/debian/$(PACKAGE)

%:
	JS_INC=/usr/include/nspr/:/usr/include/mozjs/ \
	JS_THREADSAFE=1 JS_ENABLE_E4X=1 JS_UTF8=1 JS_FORCE=1 \
	dh $@

override_dh_clean:
	$(RM) JavaScript_Env.h
	# this is cruft from Inline::C in t/24-c-level-interrupt-handler.t
	$(RM) -r _Inline/
	dh_clean

override_dh_auto_build:
	JS_INC=/usr/include/nspr/:/usr/include/mozjs/ \
	dh_auto_build -- OPTIMIZE="$(CFLAGS) -DMOZILLA_1_8_BRANCH=1" \
			 LD_RUN_PATH=""

override_dh_fixperms:
	dh_fixperms
	chmod 644 $(TMP)/usr/lib/perl5/auto/JavaScript/typemap
