#!/usr/bin/make -f

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

export CARGO_VENDOR_DIR = rust-vendor
export RUST_LIBC_UNSTABLE_GNU_TIME_BITS=64
VENDOR_TARBALL = $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig-$(CARGO_VENDOR_DIR).tar.xz

%:
	dh $@ --buildsystem cargo

override_dh_auto_build:
	dh_auto_build
	asciidoctor -b manpage man/3cpio.1.adoc

override_dh_auto_test:
	dh_auto_test -- test --all

$(CARGO_VENDOR_DIR): debian/control
	cargo vendor $@

../$(VENDOR_TARBALL): $(CARGO_VENDOR_DIR)
	tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime -caf $@ $<

vendor-tarball: ../$(VENDOR_TARBALL)

.PHONY: vendor-tarball
