#!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_DESTDIR ?= .. .PHONY: override_dh_auto_test ifneq (,$(filter upstream-cargo,$(DEB_BUILD_PROFILES))) export CARGO_HOME ?= $(CURDIR)/debian/cargo_home export CARGO_TARGET_DIR ?= $(CURDIR)/target export CARGO_PROFILE_LTO_DEBUG = 2 %: dh $@ override_dh_auto_build: cargo build --locked --profile lto rm -rf debian/cargo_out_dir mkdir -p debian/cargo_out_dir find $(CARGO_TARGET_DIR)/lto/build -path '*/out/*.8' -exec cp {} debian/cargo_out_dir/ \; override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) cargo test --locked --profile lto -- --test-threads 1 ifeq ($(NALA_CI_LOCALE_CHECK),1) LC_ALL=de_DE.UTF-8 APT_CONFIG="$(CURDIR)/tests/empty-apt.conf" cargo test --locked --profile lto -- --test-threads 1 endif endif override_dh_auto_install: install -Dm755 $(CARGO_TARGET_DIR)/lto/nala debian/nala/usr/bin/nala # dh-cargo populates these fields for strict Debian builds. Crates.io # dependencies have no Debian source packages to record in the online build. override_dh_gencontrol: dh_gencontrol -- \ -Vcargo:Built-Using= \ -Vcargo:Static-Built-Using= \ -Vcargo:X-Cargo-Built-Using= override_dh_auto_clean: ifeq ($(NO_CLEAN),1) @echo "Skipping Cargo build cache cleanup because NO_CLEAN=1" else rm -rf debian/cargo_home debian/cargo_out_dir target endif else # Branch CI shares dependency compilation between tests and the binary. ifeq ($(NALA_CI_TEST_PROFILE),release) ci_test_profile = --release endif %: dh $@ --buildsystem cargo override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) dh_auto_test --buildsystem cargo -- test $(ci_test_profile) -- --test-threads 1 ifeq ($(NALA_CI_LOCALE_CHECK),1) LC_ALL=de_DE.UTF-8 APT_CONFIG="$(CURDIR)/tests/empty-apt.conf" dh_auto_test --buildsystem cargo -- test $(ci_test_profile) -- --test-threads 1 endif endif override_dh_auto_clean: ifeq ($(NO_CLEAN),1) @echo "Skipping Cargo build cache cleanup because NO_CLEAN=1" rm -rf debian/cargo_home debian/cargo_registry debian/cargo_out_dir rm -f .cargo-checksum.json else dh_auto_clean --buildsystem cargo endif endif override_dh_builddeb: mkdir -p $(DEB_DESTDIR) dh_builddeb --destdir=$(DEB_DESTDIR)