#!/usr/bin/make -f

%:
	dh $@ --with xul-ext --buildsystem=xul_ext


override_dh_auto_build:
	./tools/make-firefox.sh
	xpi-pack dist/build/uBlock0.firefox xul-ext-ublock-origin.xpi


override_dh_auto_install:
	install-xpi xul-ext-ublock-origin.xpi -x LICENSE.txt


override_dh_auto_clean:
	./tools/make-clean.sh
	rm -f *.xpi


# We bypass dh_link so that the symlink to fontawesome-webfont.ttf is
# absolute.  Although this violates a 'should' directive of Debian
# Policy, it is necessary for ublock-origin to work correctly with
# firefox-esr 45, which is likely to be the version of Firefox
# included in stretch.  See #827517 & #819900 for details.

# Once all versions of Firefox in testing and unstable are at least
# version 48, this override should be removed, and the symlink
# installed with debian/xul-ext-ublock-origin.links (revert 020a17e
# and then revert c14b5b3)
override_dh_link:
	dh_link -Xfontawesome-webfont.ttf
	ln -sf /usr/share/fonts/truetype/font-awesome/fontawesome-webfont.ttf \
		debian/xul-ext-ublock-origin/usr/share/xul-ext/ublock-origin/css/fonts/fontawesome-webfont.ttf


override_dh_installchangelogs:
	dh_installchangelogs debian/upstream/changelog.html debian/upstream/changelog

.PHONY: get-orig-changelog
get-orig-changelog:
	amo-changelog -p rst ublock-origin
