#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@

override_dh_auto_clean:
	rm -rf lib/assets/vendor

override_dh_auto_build:
	mkdir -p lib/assets/vendor
	test -f  /usr/share/javascript/prettify/prettify.js
	ln -s /usr/share/javascript/prettify/prettify.js  lib/assets/vendor/prettify.js
	test -f /usr/share/javascript/prettify/prettify.css
	ln -s /usr/share/javascript/prettify/prettify.css lib/assets/vendor/prettify.css

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
	# smoke test
	lib/cli.js help
else
	@echo '**********************************************************'
	@echo 'Skip test suite                                           '
	@echo '**********************************************************'
endif

override_dh_fixperms:
	dh_fixperms
	chmod +x debian/node-istanbul/usr/lib/nodejs/istanbul/lib/cli.js

override_dh_installchangelogs:
# fix mix of html and text
	dh_installchangelogs
	sed -i -e 's,</\?t[dr]>,,g' -e 's,</\?ul>,,g'  -e 's,</\?li>,,g' -e 's,</\?table>,,g' -e 's/td>//g' -e 's/[ \t]*$$//' debian/node-istanbul/usr/share/doc/node-istanbul/changelog
