#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

%:
	dh $@

override_dh_auto_configure:
	for readme in $$(grep ^mod_ debian/install | sed 's,[/ ].*,/README.*,'); do \
	    if [ -f $$readme ]; then \
	        cp $$readme debian/README_$$(dirname $$readme).$$(echo $$readme | cut -d '.' -f 2); \
	    fi; \
	done

override_dh_install:
	uglifyjs -o mod_invites_page/static/platform.min.js debian/missing-sources/platform.js
	uglifyjs -o mod_invites_page/static/qrcode.min.js debian/missing-sources/qrcode.js
	dh_install
	find debian/prosody-modules/ -type f -name \*.lua -exec chmod 644 {} \;
	find debian/prosody-modules/ -type f -name README.\* -delete
	find debian/prosody-modules/ -type f -name share\*.php -delete

override_dh_auto_clean:
	rm -f debian/README_mod_*.*