#!/usr/bin/make -f

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

DEB_INSTALL_CHANGELOGS_ALL := ChangeLog
DEB_DH_INSTALL_SOURCEDIR := $(DEB_DESTDIR)
DEB_INSTALL_MANPAGES_enna := debian/enna.1

DEB_CONFIGURE_EXTRA_FLAGS := --disable-rpath

# This is to fix a version mismatch with libtool
configure/enna::
	autoreconf --force --install --symlink

# Fix symlink duplicates files hook from CDBS
binary-fixup/enna-theme binary-fixup/enna-dbg::
	# symlink identical documentation to depending packages
	dep=enna; \
	echo "Searching for duplicated docs in dependency $$dep..."; \
	rootdir=`pwd`; \
	(cd debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg); find -type f ! -name copyright | while read f; do \
	  thisfile="$$rootdir/debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/$$f"; \
	  depfile="$$rootdir/debian/$$dep/usr/share/doc/$$dep/$$f"; \
	  echo "  symlinking $$f in $(cdbs_curpkg) to file in $$dep"; \
	  rm $$thisfile; ln -s /usr/share/doc/$$dep/$$f $$thisfile; \
	done );
	
	# fix absolute symlinks created above to be relative
	dh_link -p $(cdbs_curpkg)
