#!/usr/bin/make -f

# resolve DEB_VERSION_UPSTREAM
include /usr/share/dpkg/pkg-info.mk

# use local fork of debcargo and dh-cargo
PATH := $(CURDIR)/debian/dh-cargo/bin:$(PATH)
PERL5LIB = $(CURDIR)/debian/dh-cargo/lib
export PATH PERL5LIB

DEB_VERSION_UPSTREAM_ORIG = $(firstword $(subst ~,$() ,$(DEB_VERSION_UPSTREAM)))

CRATE = $(patsubst rust-%,%,$(DEB_SOURCE))
TARGET = debian/librust-$(CRATE)-dev/usr/share/cargo/registry/$(CRATE)-$(DEB_VERSION_UPSTREAM_ORIG)

%:
	dh $@ --buildsystem cargo

execute_after_dh_auto_install:
	rm -rf $(addprefix $(TARGET)/,.github benchmark_tools compare smhasher)
	rm -f $(addprefix $(TARGET)/,.gitignore LICENSE-*)
