#!/usr/bin/make -f
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_HOST_MULTIARCH
DEB_DEBIAN_DIR=$(dir $(firstword $(MAKEFILE_LIST)))
VER=$(shell dpkg-parsechangelog -l$(DEB_DEBIAN_DIR)/changelog \
              | sed -rne 's,^Version: ([^-]+).*,\1,p')
GITREV=$(shell echo $(VER) | sed -rne 's,[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.([0-9]+),\1,p')

%:
	dh $@ --with python3 --with numpy3

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

override_dh_install:
	rm -f debian/tmp/usr/lib/python3/dist-packages/funcube/*.pyc
	rm -f debian/tmp/usr/lib/python3/dist-packages/funcube/*.pyo
	dh_install

get-orig-source:
	git clone https://github.com/dl1ksv/gr-funcube
	cd gr-funcube && git archive --format=tar --prefix=gr-funcube-$(VER)/  $(GITREV) | xz > ../gr-funcube_$(VER).orig.tar.xz
	rm -rf gr-funcube
