#!/usr/bin/make -f

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

%:
	dh $@ --buildsystem cargo

vendor:
	-[ -d vendor ] && rm -rf vendor
	cargo vendor
	tar Jcf ../$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig-vendor.tar.xz vendor/

override_dh_auto_configure:
	dh_auto_configure $@
	for d in vendor/* ; \
	do \
		[ -L debian/cargo_registry/$$(basename $$d) ] && rm debian/cargo_registry/$$(basename $$d) ; \
		ln -rs $$d debian/cargo_registry ; \
	done

override_dh_auto_build:
	# actually does the build
	dh_auto_test -- --release

override_dh_auto_install:
	dh_install target/$(DEB_HOST_RUST_TYPE)/release/tuigreet /usr/bin/
	install -Dm644 "debian/tuigreet.conf" debian/tuigreet/usr/lib/tmpfiles.d/tuigreet.conf
	
override_dh_installman:
	debian/install_man.sh
	dh_installman

override_dh_dwz:
