#!/usr/bin/make -f
%:
	dh $@ --buildsystem=golang --with=golang

override_dh_auto_build:
	GOPROXY=https://goproxy.cn,direct HOME=/tmp/go-home GOCACHE=/tmp/go-cache GOMODCACHE=/tmp/go-modcache go build -ldflags="-s -w" -o ag ./cmd/ag

override_dh_auto_install:
	# 只安装二进制文件，不依赖 dh_auto_install
	install -Dm755 ag $(CURDIR)/debian/atomgit-cli/usr/bin/ag
	# 安装上游 changelog（如果有）
	install -Dm644 CHANGELOG.md $(CURDIR)/debian/atomgit-cli/usr/share/doc/atomgit-cli/changelog

override_dh_auto_clean:
	dh_auto_clean
	# 删除安装目录，避免残留
	rm -rf $(CURDIR)/debian/atomgit-cli
	rm -f $(CURDIR)/ag

override_dh_auto_test:
	# 跳过测试，因为构建环境限制
	@echo "Skipping tests for build"