#!/usr/bin/make -f

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

export DH_GOLANG_EXCLUDES := \
	^github.com/yeqown/go-qrcode/cmd/wasm \
	^github.com/yeqown/go-qrcode/example

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

execute_after_dh_auto_install:
	mv -v $(CURDIR)/debian/tmp/usr/bin/qrcode \
		$(CURDIR)/debian/tmp/usr/bin/qrcode-yeqown

SKIP="Test_JPEG_Encoder|Test_PNG_Encoder|Test_rectangle_Draw|Test_circle_Draw|Test_New|Test_Issue40|Test_Attribute|Test_writer_WithBgTransparent"
override_dh_auto_test:
	-dh_auto_test $(DH_BUILD_OPTS) -- -run $(SKIP)
	dh_auto_test $(DH_BUILD_OPTS) -- -skip $(SKIP)

B = $(CURDIR)/debian/tmp/usr/bin
M = $(CURDIR)/debian/tmp/usr/share/man/man1

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
execute_before_dh_installman-arch:
	mkdir -pv $(M)
	help2man --version-string="$(DEB_VERSION)" \
		--no-info \
		--name="QR code generator" \
		--output $(M)/qrcode-yeqown.1 \
		$(B)/qrcode-yeqown
endif
