#!/usr/bin/make -f

# DH_VERBOSE := 1

include /usr/share/dpkg/default.mk
# this provides:
# DEB_SOURCE: the source package name

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export POPCNT_CAPABILITY=0
%:
	dh $@

override_dh_auto_install:
	dh_auto_install -- prefix=/usr/lib/centrifuge
	mv debian/$(DEB_SOURCE)/usr/lib/centrifuge/bin/* debian/$(DEB_SOURCE)/usr/lib/centrifuge/
	rmdir debian/$(DEB_SOURCE)/usr/lib/centrifuge/bin
	# move documentation to correct location
	mkdir -p debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/html
	mv debian/$(DEB_SOURCE)/usr/lib/centrifuge/share/$(DEB_SOURCE)/doc/*html \
	   debian/$(DEB_SOURCE)/usr/lib/centrifuge/share/$(DEB_SOURCE)/doc/*css  \
	   debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/html
	# remove useless stuff in documentation dir
	rm -rf debian/$(DEB_SOURCE)/usr/lib/centrifuge/share/doc/
