#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk

DEB_PYTHON_SYSTEM=pycentral

install/glusterfs-server::
	mv debian/tmp/etc/glusterfs/glusterfs.vol.sample \
	   debian/tmp/etc/glusterfs/glusterfs.vol
	mv debian/tmp/etc/glusterfs/glusterfsd.vol.sample \
	   debian/tmp/etc/glusterfs/glusterfsd.vol
	ln -s glusterfs.8 debian/tmp/usr/share/man/man8/glusterfsd.8
	mv debian/tmp/usr/sbin/glusterfsd \
	   debian/tmp/usr/sbin/glusterfs

install/libglusterfs0::
	for f in debian/tmp/usr/lib/glusterfs/*/xlator/debug/trace.so; do \
		debug_path=`echo "$$f" | sed -e 's|debian/tmp|debian/glusterfs-dbg/usr/lib/debug|'`; \
		install -d "`dirname $$debug_path`"; \
		objcopy --only-keep-debug "$$f" "$$debug_path"; \
	done
	install -D -m 644 extras/glusterfs.vim debian/tmp/usr/share/vim/vim72/glusterfs.vim
	install -D -m 644 extras/glusterfs-mode.el debian/tmp/usr/share/emacs/site-lisp/glusterfs-mode.el
	strip --remove-section=.comment --remove-section=.note --strip-unneeded \
		debian/tmp/usr/lib/glusterfs/*/xlator/debug/trace.so
	strip --remove-section=.comment --remove-section=.note --strip-unneeded \
		debian/tmp/usr/lib/glusterfs/*/xlator/debug/error-gen.so.0.0.0
	strip --remove-section=.comment debian/tmp/usr/lib/glusterfs/*/xlator/debug/io-stats.so.0.0.0

clean::
	dh $@
	rm -rf glusterfs*.8

get-orig-source::
	uscan --force-download --verbose
