#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_build:
	cd src; make -f Makefile.debian

override_dh_auto_install:
	mkdir -p debian/chmsee/usr/share/chmsee debian/chmsee/usr/lib/chmsee debian/chmsee/usr/bin
	cp -r application.ini chrome.manifest chrome/ data/ defaults/ components/ debian/chmsee/usr/share/chmsee
	chrpath -d debian/chmsee/usr/share/chmsee/components/libxpcomchm.so
	mv debian/chmsee/usr/share/chmsee/components/libxpcomchm.so debian/chmsee/usr/lib/chmsee/
	install -m755 debian/chmsee.sh debian/chmsee/usr/bin/chmsee

override_dh_auto_clean:
	cd src; make -f Makefile.debian clean || true

# to re-generate debian/control, invoke
# fakeroot debian/rules debian/control DEB_AUTO_UPDATE_DEBIAN_CONTROL:=yes

#include /usr/share/cdbs/1/rules/debhelper.mk
#include /usr/share/cdbs/1/class/cmake.mk
#
#INSTROOT = $(CURDIR)/debian/chmsee
#DEB_CONFIGURE_SCRIPT_ENV += LDFLAGS=" -Wl,--as-needed"
#DEB_CONFIGURE_EXTRA_FLAGS += --with-gecko=libxul
#DEB_INSTALL_CHANGELOGS_ALL += ChangeLog
#
## copy from /usr/share/cdbs/1/class/gnome.mk
#clean::
#	cd $(DEB_BUILDDIR) && \
#	  rm -f intltool-extract intltool-merge intltool-update po/.intltool-merge-cache; \
#	  if test -d doc; then find doc -name '*.omf.out' -exec rm -f \{\} \; ; fi; \
#	  if test -d help; then find help -name '*.omf.out' -exec rm -f \{\} \; ; fi
#
#binary-predeb/chmsee::
#	dh_xulrunner -pchmsee
