#!/usr/bin/make -f
# -*- makefile -*-
export DH_VERBOSE=1
export DH_OPTIONS=-v


CLIENT_ROOT = $(CURDIR)/debian/libreoffice-canzeley-client
CLIENT_TOP = $(CLIENT_ROOT)/usr/lib/libreoffice/share/extensions/canzeley-client

CLIENT_FILE = $(CURDIR)/Extension/description.xml

build: build-indep

build-indep: build-indep-stamp

build-indep-stamp:
	dh_testdir
	TZ=UTC unzip -o $(CURDIR)/Extension/canzeley_*.oxt -d $(CURDIR)/Extension ; \
		patch -p0 < debian/patches/remove-registration.patch

	touch $@

build-arch:
clean:
	dh_testdir
	dh_testroot
	rm -f build-indep-stamp
	-cd Extension && \
		find . ! -name "*.oxt" -exec rm -rf {} \;
	dh_clean


install: build-indep
	dh_prep
	dh_installdirs -A
	dh_install

	rm $(CLIENT_TOP)/*.oxt
	rm -rf $(CLIENT_TOP)/registration
	mv $(CLIENT_TOP)/icons \
		$(CLIENT_ROOT)/usr/share/libreoffice-canzeley-client

#Note that the following form is recommended however:
binary-indep: build-indep install
	dh_installchangelogs -k Changelog.Source
	dh_installdocs
	mv $(CURDIR)/debian/libreoffice-canzeley-client/usr/share/doc/libreoffice-canzeley-client/Changelog.Source $(CURDIR)/debian/libreoffice-canzeley-client/usr/share/doc/libreoffice-canzeley-client/Changelog
	dh_link
	dh_compress -X.odt -X.sql -X.zip -X.ott -X.ots
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch: build-arch
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

