#!/usr/bin/make -f

export PYBUILD_NAME=cotengrust
export CARGO_HOME=$(shell pwd)/debian/cargo_home

override_dh_auto_clean:
	if test -f Cargo.lock.saved; then mv Cargo.lock.saved Cargo.lock; fi
	rm -rf target
	dh_auto_clean

override_dh_auto_build:
	mv Cargo.lock Cargo.lock.saved
	maturin build --release -v
	dh_auto_build

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_shlibdeps:
	dh_shlibdeps --dpkg-shlibdeps-params=--warnings=9

override_dh_auto_install:
	dh_auto_install
	# Strip unneeded symbols from shared libraries
	find debian/python3-cotengrust -name "*.so*" -exec strip --strip-unneeded --remove-section=.comment --remove-section=.note {} +
