#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE = 1

# This has to be exported to make some magic below work.
export DH_OPTIONS

# Build system
export CARGO_HOME = $(CURDIR)/debian/cargo
export CARGO_TARGET_DIR = $(CURDIR)/debian/cargo/target

override_dh_auto_build:
	# Build apt-ostree with cargo - ensure rustup environment is available
	export PATH=$(HOME)/.cargo/bin:$$PATH
	cargo build --release
	dh_auto_build

override_dh_auto_install:
	# Install the apt-ostree binary to the correct location
	install -D -m 755 debian/cargo/target/release/apt-ostree debian/apt-ostree/usr/bin/apt-ostree
	# Create any additional directories or files needed
	mkdir -p debian/apt-ostree/usr/share/doc/apt-ostree
	# Skip dh_auto_install since we've handled installation manually

override_dh_auto_clean:
	# Clean cargo build artifacts
	rm -rf debian/cargo
	dh_auto_clean

%:
	dh $@ 