#!/usr/bin/make -f
# Debian build of upstream matugen (Rust, fully vendored offline build,
# same policy as the RPM spec: cargo --offline --frozen --release against
# the vendored crates + source-replacement config update.sh generates).
# No network at build time: the orig tarball IS the combined Debian orig
# update.sh assembles (upstream source + vendor/ + cargo_config under one
# top dir, which dpkg-source strips on unpack, so all three land at the
# build root). dpkg-source -b runs right after debian/rules clean on
# pristine sources, so no debian/source/options workaround is needed.
%:
	dh $@

override_dh_auto_configure:
	:

override_dh_auto_build:
	mkdir -p .cargo && cp cargo_config .cargo/config
	cargo build --offline --frozen --release

override_dh_auto_test:
	:

override_dh_auto_install:
	install -Dm0755 target/release/matugen debian/matugen/usr/bin/matugen

override_dh_auto_clean:
	rm -rf target .cargo

override_dh_clean:
	dh_clean -X.orig
# NOTE (2026-10-09): dh_clean deletes every *.orig as "detritus", but
# cargo verifies the sha256 of each vendor/*/Cargo.toml.orig recorded in
# .cargo-checksum.json -- deleting them breaks the offline build
# ("failed to calculate checksum of .../vendor/ariadne/Cargo.toml.orig",
# Debian_Testing 15:50 UTC build). -X.orig keeps them; nothing else in
# this tree relies on *.orig cleanup.
