#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

PPPD_PLUGIN_DIR := $(shell dh_ppp --plugin-dir)

%:
	dh $@ --with gir,ppp

autoreconf:
	gtkdocize --copy
	autopoint --force
	AUTOPOINT='intltoolize --automake --copy' autoreconf --verbose --force --install

override_dh_autoreconf:
	dh_autoreconf debian/rules -- autoreconf

override_dh_auto_configure:
	dh_auto_configure -- \
		--libexecdir=/usr/lib/NetworkManager \
		--runstatedir=/run \
		--with-pppd-plugin-dir=$(PPPD_PLUGIN_DIR) \
		--with-pppd=/usr/sbin/pppd \
		--with-resolvconf=/sbin/resolvconf \
		--with-dhclient=/sbin/dhclient \
		--with-iptables=/sbin/iptables \
		--with-dnsmasq=/usr/sbin/dnsmasq \
		--with-dnssec-trigger=/usr/lib/dnssec-trigger/dnssec-trigger-script \
		--with-systemdsystemunitdir=/lib/systemd/system \
		--with-udev-dir=/lib/udev \
		--with-dbus-sys-dir=/usr/share/dbus-1/system.d \
		--with-crypto=gnutls \
		--with-session-tracking=systemd \
		--with-suspend-resume=systemd \
		--with-modem-manager-1 \
		--with-nmtui \
		--with-nmcli \
		--with-selinux \
		--with-libaudit \
		--with-iwd \
		--without-dhcpcanon \
		--without-libnm-glib \
		--enable-polkit \
		--enable-polkit-agent \
		--enable-ppp \
		--enable-ifupdown \
		--enable-introspection \
		--enable-gtk-doc \
		--enable-concheck \
		--enable-teamdctl \
		--enable-json-validation \
		--enable-bluez5-dun \
		--enable-vala \
		--disable-config-plugin-ibft \
		--disable-more-warnings \
		--disable-modify-system \
		--disable-ovs

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

override_dh_missing:
	dh_missing --fail-missing

override_dh_makeshlibs:
	dh_makeshlibs -X/usr/lib/$(DEB_HOST_MULTIARCH)/NetworkManager/ -X/usr/lib/pppd/

override_dh_installsystemd:
	dh_installsystemd -pnetwork-manager --no-start NetworkManager-dispatcher.service NetworkManager-wait-online.service
	dh_installsystemd -pnetwork-manager --no-also NetworkManager.service

override_dh_ppp:
	dh_ppp --breaks
