#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk
include /usr/share/rustc/architecture.mk

export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
export PATH := /usr/share/cargo/bin:$(PATH)
export CARGO_HOME := $(CURDIR)/debian/cargo_home
export DEB_CARGO_CRATE := vtracer_$(DEB_VERSION_UPSTREAM)
export PYBUILD_NAME=vtracer
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --buildsystem=pybuild

execute_before_dh_auto_configure:
	cargo prepare-debian debian/cargo_registry --link-from-system

execute_before_dh_auto_clean:
	rm -rf debian/cargo_home debian/cargo_registry

execute_after_dh_python3:
	find debian/python3-vtracer/usr/lib/python3/dist-packages \
		\( -path '*/LICENSE' -o -path '*/vtracer/README.md' \) \
		-type f -delete
