#!/usr/bin/make -f
#-*- makefile -*-

export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 -Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk
include /usr/share/gnome-pkg-tools/1/rules/gnome-version.mk

%:
	dh $@ --with gnome,gir

override_dh_autoreconf:
	dh_autoreconf --as-needed

override_dh_auto_configure:
	dh_auto_configure -- \
		--enable-gtk-doc \
		--enable-vala=yes \
		--disable-run-in-source-tree \
		PYTHON=/usr/bin/python3

override_dh_strip:
	dh_strip --dbgsym-migration='totem-dbg (<< 3.20.1-1~)'

override_dh_makeshlibs:
	dh_makeshlibs -p totem -X/usr/lib/$(DEB_HOST_MULTIARCH)/nautilus/
	dh_makeshlibs -p libtotem0 -V'libtotem0 (>= $(DEB_VERSION)), libtotem0 (<< $(DEB_GNOME_NEXTVERSION))'
	dh_makeshlibs --remaining-packages -Xplugins/

override_dh_girepository:
	dh_girepository -lsrc

override_dh_python3:
	dh_python3 --no-ext-rename -ptotem-plugins /usr/lib/*/totem/plugins
	dh_python3 --remaining-packages

override_dh_install:
	find debian \( -name '*.a' -o -name '*.la' \) -delete
	rm -rf debian/tmp/usr/lib/*/totem/plugins/*/__pycache__
	dh_install --fail-missing
