#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Ubuntu builds with symbolic-functions by default which causes plugin issues
# https://gitlab.gnome.org/GNOME/calls/-/issues/334
export DEB_LDFLAGS_MAINT_STRIP = -Wl,-Bsymbolic-functions

#ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
#  CONFIGURE_OPTS+=-Dgtk_doc=true
#else
  CONFIGURE_OPTS+=-Dgtk_doc=false
#endif

CONFIGURE_OPTS+=-Dtests=false

%:
	dh $@ -- -B_build

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIGURE_OPTS)

override_dh_auto_build:
	dh_auto_build
#ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
#	# https://github.com/mesonbuild/meson/pull/2862
#	dh_auto_build -- calls-doc
#endif

override_dh_auto_install:
	#
	dh_auto_install  --destdir=debian/tmp
	ls -lR debian
	#
#	dh_install -p gnome-calls /etc/*
#	dh_install -p gnome-calls /usr/bin/*
#	dh_install -p gnome-calls /usr/lib/*
#	dh_install -p gnome-calls /usr/share/applications/*
#	dh_install -p gnome-calls /usr/share/icons/*
#	dh_install -p gnome-calls /usr/share/locale/*
#	dh_install -p gnome-calls /usr/share/metainfo/*
#	dh_install -p gnome-calls /usr/share/glib-2.0/schemas/org.gnome.Calls.gschema.xml
	#

override_dh_auto_test:
#	xvfb-run dh_auto_test

# generate the manpages from the scripts using help2man
execute_before_dh_installman:
	help2man --version-option='-h' --no-info --name="A GTK+ user interface for PSTN phone calls" \
		debian/tmp/usr/bin/gnome-calls > debian/gnome-calls.1
