#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Build the `gui` feature only, so both the `moraine` CLI and the GTK 4
# `moraine-gui` binaries are built and installed. dh-cargo installs both to
# /usr/bin; the .desktop file, icon and in-app logo are added via
# debian/moraine.install.
#
# The upstream default feature set also enables `tray`, which pulls in the
# ksni crate (StatusNotifierItem over D-Bus). ksni is not in Debian, so the
# Debian build drops the tray icon; the GUI has a #[cfg(not(feature = "tray"))]
# path and runs without it.
#
# `keyring` is dropped for the same reason: keyring-core and
# zbus-secret-service-keyring-store are not in Debian at all, and librust-keyring
# / librust-secret-service are packaged at older majors than upstream uses.
# Upstream keeps `keyring` out of the `gui` feature specifically so this build is
# possible — do not "fix" this line by adding it back. Without it the app has no
# Thern account control and `password = "keyring:"` fails with an explanatory
# error; `env:` and in-config secrets are unaffected.
CARGO_FEATURES = --no-default-features --features gui

%:
	dh $@ --buildsystem cargo

override_dh_auto_build:
	dh_auto_build -- $(CARGO_FEATURES)

override_dh_auto_test:
	dh_auto_test -- $(CARGO_FEATURES)

override_dh_auto_install:
	dh_auto_install -- $(CARGO_FEATURES)
