#!/usr/bin/make -f
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_HOST_MULTIARCH

%:
	dh $@ --parallel --builddirectory=build --with-buildsystem=cmake --with python2

override_dh_python2:
	dh_python2 --no-guessing-versions

override_dh_auto_configure:
	dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)"

override_dh_auto_test:
	- dh_auto_test

override_dh_auto_install:
	dh_auto_install
	find debian/tmp -name *.pyc -delete
	find debian/tmp -name *.pyo -delete
	# include plot modules in gnuradio python package
	cp debian/tmp/usr/bin/gr_plot_fft.py debian/tmp/usr/lib/python2.7/dist-packages/gnuradio/
	cp debian/tmp/usr/bin/gr_plot_psd.py debian/tmp/usr/lib/python2.7/dist-packages/gnuradio/
	# fixup to remove .py extension on files in /usr/bin
	for i in debian/tmp/usr/bin/*.py ; do mv $$i debian/gnuradio/usr/bin/`basename $$i .py` ; done
	# jquery.js is provided in another debian package, do not ship one here too
	rm debian/tmp/usr/share/doc/gnuradio*/html/jquery.js
	chmod +x debian/tmp/usr/lib/python2.7/dist-packages/gnuradio/grc/python/flow_graph.tmpl
