#!/usr/bin/make -f

#export DH_VERBOSE=1

include /usr/share/dpkg/pkg-info.mk
RELEASE := $(DEB_DISTRIBUTION)

%:
	dh $@ 

override_dh_auto_clean:

override_dh_auto_build:
	# now let's build the stuff
	ant deploy deploy-plugins
	mkdir $(CURDIR)/debian/tmp
	cp -a $(CURDIR)/deploy $(CURDIR)/debian/tmp/

override_dh_install:
	dh_install -X.js.map -X*debug.js
	# figure out package version
	echo $(DEB_VERSION) > \
		$(CURDIR)/debian/kopano-webapp-common/usr/share/kopano-webapp/version
	# remove additional license files
	rm $(CURDIR)/debian/kopano-webapp-common/usr/share/kopano-webapp/client/tinymce-plugins/powerpaste/License.txt

override_dh_fixperms:
	dh_fixperms -Xvar/lib/kopano-webapp/tmp
	chown www-data:www-data $(CURDIR)/debian/kopano-webapp-common/var/lib/kopano-webapp/tmp
