#!/usr/bin/make -f

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh ${@} --with autoreconf,autotools_dev

override_dh_auto_configure:
	dh_auto_configure -- --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/lxc --libexecdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --with-distro=debian --with-rootfs-path=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/lxc --enable-doc --enable-configpath-log

override_dh_auto_install:
	dh_auto_install

	# currently hardcoding lxc directory
	mkdir -p debian/lxc/etc/lxc
	echo "lxcpath=/var/lib/lxc" >> debian/lxc/etc/lxc/lxc.conf

	# removing useless files
	rm -f debian/tmp/usr/bin/lxc-ls # superseeded by local version until python-lxc is ready
	rm -f debian/tmp/usr/share/lxc/templates/lxc-ubuntu # currently broken

override_dh_builddeb:
	dh_builddeb -- -Zxz

override_dh_compress:
	dh_compress -X.cfg

override_dh_install:
	dh_install --fail-missing

override_dh_installinit:
	dh_installinit -plxc-stuff --onlyscripts --no-restart-on-upgrade --name lxc

override_dh_strip:
	dh_strip --dbg-package=lxc-dbg
