#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# We don't need - or can't, rather, enforce (cf. Policy 10.2)
# because libtool does some chrpath's and re-linking through out 
# the build process, and these options fail the build before 
# lib tool gets it's chance to do anything.
# export DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,defs

# main packaging script based on dh7 syntax
%:
	dh $@ --with autoreconf,python2,systemd --fail-missing --link-doc=cluster-glue

override_dh_autoreconf:
	dh_autoreconf ./autogen.sh

override_dh_auto_configure:
	./configure  --sysconfdir=/etc --localstatedir=/var \
		--enable-upstart --enable-dependency-tracking --disable-fatal-warnings

override_dh_auto_install:
	dh_auto_install
# clear .la files, dependency_libs fields
	for file in `find $(CURDIR)/debian/tmp -name '*.la'`; do \
		sed -i "/dependency_libs/ s/'.*'/''/" $$file ; \
	done

override_dh_installinit:
	dh_installinit --name=logd -pcluster-glue -u 'defaults 20 32'

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog

override_dh_python2:
	dh_python2
	dh_python2 /usr/lib/stonith/plugins/stonith2

override_dh_strip:
	dh_strip --dbg-package=cluster-glue-dbg

