#!/usr/bin/make -f

export DH_VERBOSE = 1

PKGDIR = $(CURDIR)/debian/appindicator-gnome-shell-extension

# Build inside debian/ so no upstream-owned path gains build artifacts and
# debian/.gitignore alone is enough to keep the tree clean for rebasing.
%:
	dh $@ --buildsystem=meson --builddirectory=debian/build

override_dh_auto_configure:
	dh_auto_configure -- -Dlocal_install=disabled

# Upstream's only test is an eslint run needing the JS toolchain.
override_dh_auto_test:

override_dh_auto_install:
	dh_auto_install
	# Upstream's schemas/meson.build runs glib-compile-schemas at install
	# time -- that is why libglib2.0-bin is a build dependency (the binary
	# lives there, NOT in libglib2.0-dev-bin). We keep the validation but
	# drop its output: shipping gschemas.compiled would conflict with every
	# other schema-providing package. The maintainer scripts regenerate it.
	rm -f $(PKGDIR)/usr/share/glib-2.0/schemas/gschemas.compiled

	# GSettings override with our defaults
	install -d $(PKGDIR)/usr/share/glib-2.0/schemas
	install -m 644 debian/10_appindicator.gschema.override \
		$(PKGDIR)/usr/share/glib-2.0/schemas/

	# Per-user update script
	install -d $(PKGDIR)/usr/lib/appindicator-extension
	install -m 755 debian/appindicator-update-user.sh \
		$(PKGDIR)/usr/lib/appindicator-extension/

	# Autostart desktop file, seeded into /etc/skel for new users
	install -d $(PKGDIR)/etc/skel/.config/autostart
	install -m 644 debian/appindicator-extension-update.desktop \
		$(PKGDIR)/etc/skel/.config/autostart/
