#!/usr/bin/make -f

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

export DH_VERBOSE=1

%:
	dh $@

override_dh_auto_install:
	dh_auto_install
	# Check to make sure pkg-config script version matches actual package version
	export PKG_CONFIG_SCRIPT_VERSION=$$(grep '^Version: ' $(CURDIR)/debian/libsparsehash-dev/usr/share/pkgconfig/libsparsehash.pc | cut -f2 -d' ') ; \
	[ "$(DEB_VERSION_UPSTREAM)" = "$$PKG_CONFIG_SCRIPT_VERSION" ] || \
		(echo "debian/changelog upstream version '$(DEB_VERSION_UPSTREAM)' does not match .pc script version '$$PKG_CONFIG_SCRIPT_VERSION'"; exit 1)
	# Fix upstream doc install locations
	install -d $(CURDIR)/debian/libsparsehash-dev/usr/share/doc/libsparsehash-dev/html
	mv $(CURDIR)/debian/libsparsehash-dev/usr/share/doc/libsparsehash-dev/*.html $(CURDIR)/debian/libsparsehash-dev/usr/share/doc/libsparsehash-dev/html/
	mv $(CURDIR)/debian/libsparsehash-dev/usr/share/doc/libsparsehash-dev/*.css $(CURDIR)/debian/libsparsehash-dev/usr/share/doc/libsparsehash-dev/html/
	rm -f $(CURDIR)/debian/libsparsehash-dev/usr/share/doc/libsparsehash-dev/ChangeLog
	rm -f $(CURDIR)/debian/libsparsehash-dev/usr/share/doc/libsparsehash-dev/COPYING
	rm -f $(CURDIR)/debian/libsparsehash-dev/usr/share/doc/libsparsehash-dev/INSTALL
	rm -f $(CURDIR)/debian/libsparsehash-dev/usr/share/doc/libsparsehash-dev/README_windows.txt
