#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
#export DH_VERBOSE=1
#export DH_OPTIONS=-v

#include /usr/share/cdbs/1/rules/debhelper.mk
#include /usr/share/cdbs/1/class/autotools.mk
#include /usr/share/cdbs/1/class/python-module.mk

%:
	dh $@

override_dh_auto_configure:
	mv configure configure.dist && ./autogen.sh
	dh_auto_configure -- --prefix=/opt/oneclient --exec-prefix=/opt/oneclient

override_dh_install:
	strip --remove-section=.comment --remove-section=.note --strip-unneeded \
		debian/tmp/opt/oneclient/lib/*/glusterfs/*/xlator/debug/trace.so
	strip --remove-section=.comment --remove-section=.note --strip-unneeded \
		debian/tmp/opt/oneclient/lib/*/glusterfs/*/xlator/debug/error-gen.so
	strip --remove-section=.comment --remove-section=.note --strip-unneeded \
		debian/tmp/opt/oneclient/lib/*/glusterfs/*/xlator/debug/io-stats.so
	find debian/tmp/opt/oneclient/lib -type f -name \*.la -exec sed 's/^dependency_libs/#dependency_libs/g' -i {} \;
	install -D -p -m 0644 extras/glusterfs-logrotate \
		debian/tmp/etc/logrotate.d/glusterfs
	install -D -p -m 0644 extras/glusterfs-georep-logrotate \
		debian/tmp/etc/logrotate.d/glusterfs-georep

	dh_install --exclude=usr/share

override_dh_installdocs:
	

override_dh_installman:
	

override_dh_installchangelogs:
	

override_dh_builddeb:
	dh_builddeb -- -Zxz

override_dh_strip:
	dh_strip --dbg-package=glusterfs-dbg-opt
