#!/usr/bin/make -f

# Build the single static Go binary directly rather than via dh-golang or the
# repository Makefile: the source package ships the vendored dependencies, so
# the build is offline and reproducible — no module download, no GOPATH source
# layout, no clean-chroot requirement.

export CGO_ENABLED = 0
# Use whatever Go the build-dependency provides (Debian's golang-go); never
# fetch a toolchain. The vendored modules satisfy the build without a proxy.
export GOTOOLCHAIN = local
export GOFLAGS = -mod=vendor

%:
	dh $@

override_dh_auto_build:
	go build -trimpath -ldflags '-w' -o bin/fleeting-plugin-proxmox ./cmd/fleeting-plugin-proxmox

# Unit tests run in their own CI job; don't repeat them during packaging.
override_dh_auto_test:

override_dh_auto_clean:
	rm -rf bin

override_dh_auto_install:
	install -D -m 0755 bin/fleeting-plugin-proxmox \
		debian/fleeting-plugin-proxmox/usr/bin/fleeting-plugin-proxmox
