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

%:
	dh $@ --with python2

override_dh_auto_configure: # No ORC on arm
ifeq ($(DEB_BUILD_ARCH_OS),armel)
	dh_auto_configure -- -DENABLE_ORC=Off -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DPYTHON_EXECUTABLE:STRING="/usr/bin/python"
else
ifeq ($(DEB_BUILD_ARCH_OS),armhf)
	dh_auto_configure -- -DENABLE_ORC=Off -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DPYTHON_EXECUTABLE:STRING="/usr/bin/python"
else
	dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DPYTHON_EXECUTABLE:STRING="/usr/bin/python"
endif
endif

override_dh_python2:
	dh_python2 --no-guessing-versions

override_dh_auto_test:
	- dh_auto_test -- CTEST_TEST_TIMEOUT=60

override_dh_auto_install:
	dh_auto_install
	# 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

override_dh_install:
	dh_install
	# remove duplicate files that are in new libvolk-* packages
	rm debian/gnuradio/usr/bin/volk*
	rm debian/gnuradio-dev/usr/lib/*/libvolk.so
	rm debian/gnuradio-dev/usr/lib/*/pkgconfig/volk.pc
