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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DH_GOPKG := github.com/godbus/dbus

# _examples installs to the same path Debian's real golang-dbus-dev (the
# unrelated v5 release, github.com/godbus/dbus/v5) uses for its own examples,
# and packages needing both this v4-era fork and the real v5 in the same
# build root (e.g. vci, via golang-go-systemd-dev) hit a dpkg file conflict:
# "trying to overwrite '.../godbus/dbus/_examples/eavesdrop.go', which is
# also in package golang-dbus-dev". Examples aren't needed to build anything
# that imports this package, so drop them instead of fighting the collision.
#
# DH_GOLANG_EXCLUDES_ALL defaults to false below compat 12 (we're compat 9),
# meaning DH_GOLANG_EXCLUDES alone only trims build targets, not the files
# actually installed -- _examples kept landing in the .deb regardless. Set
# it explicitly so the exclude also applies at install time.
export DH_GOLANG_EXCLUDES := _examples
export DH_GOLANG_EXCLUDES_ALL := 1

override_dh_auto_test:
	# upstream's tests require that dbus be running (surprise, surprise)
	[ ! -S /var/run/dbus/system_bus_socket ] || \
		dh_auto_test -O--buildsystem=golang

%:
	dh $@ --buildsystem=golang --with=golang
