#!/usr/bin/make -f

export DH_VERBOSE = 1
include /usr/share/dpkg/pkg-info.mk
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE

export CARGO_HOME=$(CURDIR)/debian/cargo_home
export DEB_CARGO_CRATE=bpf-linker_$(DEB_VERSION_UPSTREAM)

export CARGO=/usr/share/cargo/bin/cargo
#export RUST_BACKTRACE=1
export RUSTC_BOOTSTRAP=1

%:
	dh $@ #--buildsystem cargo

#override_dh_auto_configure:

override_dh_auto_build:
	mkdir -p $(CARGO_HOME)
	cp $(CURDIR)/debian/config.toml $(CARGO_HOME)/config.toml
	cargo build --offline --manifest-path Cargo.toml
	cargo install --path $(CURDIR)
