#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk

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

MANPAGES := debian/dh_girepository.1
$(MANPAGES): debian/dh_girepository
	pod2man -c "gobject-introspection" -r "$(DEB_VERSION)" $< $@

# We can drop this once we switch to building with meson
# since debhelper uses this locale by default for meson now
export LC_ALL=C.UTF-8

%:
	dh $@ --with gnome,python3

override_dh_auto_configure:
	dh_auto_configure -- \
		--enable-gtk-doc \
		--enable-doctool \
		--with-python=python3

override_dh_auto_build: $(MANPAGES)
	dh_auto_build

override_dh_shlibdeps:
	dh_shlibdeps
	perl -w debian/dh_girepository -pgir1.2-glib-2.0
	perl -w debian/dh_girepository -pgir1.2-freedesktop

override_dh_makeshlibs:
	dh_makeshlibs -- -c4

override_dh_install:
	find debian/tmp -name '*.la' -print -delete
	find debian/tmp -name '*.pyc' -print -delete
	find debian/tmp -name '*.pyo' -print -delete
	dh_install

override_dh_auto_clean:
	dh_auto_clean
	rm -rf $(MANPAGES)
