#!/usr/bin/make -f

#export DH_VERBOSE = 1

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/rustc/architecture.mk

export PYBUILD_NAME=aardwolf
export CARGO_HOME=$(CURDIR)/debian/cargo_home
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
export DEB_CARGO_CRATE=rlers_0.0.1

CARGO=/usr/share/cargo/bin/cargo

%:
	dh $@ #--buildsystem=pybuild

execute_after_dh_auto_configure:
	mkdir $(CURDIR)/debian/vendor
	# link-from-system must be the 3rd arg (see
	# /usr/share/cargo/bin/cargo)
#	$(CARGO) prepare-debian $(CURDIR)/debian/vendor --link-from-system --manifest-path aardwolf/utils/rlers/Cargo.toml
	cargo build  --manifest-path aardwolf/utils/rlers/Cargo.toml

override_dh_auto_build:

override_dh_install:
	dh_install -Xtarget/ -Xgitignore -Xdevelstuff -XCargo.lock -Xdtest
	cp aardwolf/utils/rlers/target/debug/librlers.so debian/python3-aardwolf/usr/lib/python3/dist-packages/

execute_after_dh_clean:
	rm -rf $(CURDIR)/debian/vendor
