#!/usr/bin/make -f

# install.sh derives its per-user paths from HOME; keep them inside the build.
export HOME = $(CURDIR)/debian/.home
# Its progress spinner calls setterm, which fails outright on an unset TERM.
export TERM = dumb

%:
	dh $@

# install.sh refuses a --dest inside its own source tree, so it renders into a
# temporary directory that is then copied into the package.
override_dh_auto_install:
	mkdir -p debian/.home debian/whitesur-gtk-theme/usr/share/themes
	tmp=$$(mktemp -d) && ./install.sh --dest "$$tmp" \
		--color light --color dark --opacity normal --alt normal \
		--theme default --scheme standard \
		&& cp -a "$$tmp"/. debian/whitesur-gtk-theme/usr/share/themes/ \
		&& rm -rf "$$tmp"

override_dh_auto_clean:
	dh_auto_clean
	rm -rf debian/.home
