#!/usr/bin/make -f

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

CONFFILE=/etc/GeoIP.conf
DATADIR=/var/lib/GeoIP
VERSION=$(DEB_VERSION_UPSTREAM)

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

override_dh_auto_build:
	# build the Go program, passing the right paths (see upstream Makefile)
	dh_auto_build --builddirectory=build --buildsystem=golang -- \
		-buildmode=pie\
		-ldflags '-X main.defaultConfigFile=$(CONFFILE) -X main.defaultDatabaseDirectory=$(DATADIR) -X "main.version=$(VERSION)"'
	# build the manpages
	CONFFILE=$(CONFFILE) DATADIR=$(DATADIR) make data

override_dh_auto_install:
	dh_auto_install -- --no-source
