#!/usr/bin/make -f

#export DH_VERBOSE=1
export DEB_BUILD_HARDENING=1

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_UPSTREAM_VERSION := $(shell dpkg-parsechangelog|grep "^Version:"|cut -d" " -f2|rev|cut -d- -f2-|rev|cut -d':' -f2)

%:
	dh $@ --with autoreconf

override_dh_auto_install:
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	# Build the build script.
	g++ debian/src/geoip-csv-to-dat.cpp -o debian/tmp/geoip-generator -lGeoIP \
		-I $(CURDIR)/debian/tmp/usr/include/ -L $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/
	chrpath -d -k debian/tmp/usr/bin/geoip*
	chrpath -d -k debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libGeoIPUpdate.so.0.0.0

override_dh_strip:
	dh_strip --dbg-package=geoip-dbg

override_dh_builddeb:
	dh_builddeb -- -Zxz
