#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

%:
	dh $@ --builddirectory=debian/_build --buildsystem=golang

override_dh_auto_test:
	# Force Go's new asynchronous timer channel behaviour. dh-golang builds in
	# GOPATH mode so the "go 1.25.0" directive from go.mod does not affect the
	# default GODEBUG settings. Without this asynctimerchan keeps its legacy
	# value of 1 which is rejected by testing/synctest in Go 1.26.
	#
	# Skip TestMountIndex - requires a working FUSE mount via fusermount
	# which is not available in Debian build chroots.
	GODEBUG=asynctimerchan=0 \
		dh_auto_test -- -test.skip="^TestMountIndex$$"

override_dh_auto_install:
	help2man -N \
		-n "desync" \
		--version-string='$(DEB_VERSION_UPSTREAM)' \
		-o debian/desync.1 \
		debian/_build/bin/desync
	dh_auto_install -- --no-source

override_dh_installman:
	dh_installman debian/desync.1
