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

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

%:
	dh $@

override_dh_auto_build:
	dh_auto_build --buildsystem=nodejs
	patch -p1 <debian/reproducible.patch
	help2man -N -n 'istanbul command line interface' nyc/bin/nyc.js >nyc.1
	patch -p1 -R <debian/reproducible.patch

execute_after_dh_fixperms:
	chmod +x debian/node-istanbul/usr/share/nodejs/istanbul/lib/cli.js
	chmod +x debian/node-istanbul/usr/share/nodejs/nyc/bin/nyc.js
	chmod +x debian/node-istanbul/usr/share/nodejs/babel-plugin-istanbul/lib/load-nyc-config-sync.js

override_dh_installchangelogs:
# fix mix of html and text
	dh_installchangelogs CHANGELOG.md
	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
