#!/usr/bin/make -f
# -*- makefile -*-

SRC_PACKAGE = accessodf
SRC_VERSION = 0.1
TARBALL = $(SRC_PACKAGE)_$(SRC_VERSION).orig.tar.gz
.PHONY: get-orig-source

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@ 

override_dh_auto_clean:
	-rm -rf dist
	-rm -rf build

override_dh_auto_build:
	ant -Don-debian=True uno-package

override_dh_auto_install:
	mkdir -p debian/tmp/usr/lib/libreoffice/share/extensions/accessodf
	unzip -d debian/tmp/usr/lib/libreoffice/share/extensions/accessodf/ dist/AccessODF.oxt 
	-rm -rf debian/tmp/usr/lib/libreoffice/share/extensions/accessodf/lib
	-rm -rf debian/tmp/usr/lib/libreoffice/share/extensions/accessodf/accessodf-addon.jar


get-orig-source:
	git clone git://git.code.sf.net/p/accessodf/code \
		$(SRC_PACKAGE)-$(SRC_VERSION).orig
	cd $(SRC_PACKAGE)-$(SRC_VERSION).orig; \
		git checkout release-0.1.0
	# Remove $SRC/lib and $SRC/ant-build/resources, because it's not necessary in Debian, dependencies are in Debian itself available, furthermore some scm-files
	rm -rf $(SRC_PACKAGE)-$(SRC_VERSION).orig/lib
	rm -rf $(SRC_PACKAGE)-$(SRC_VERSION).orig/.git
	rm -rf $(SRC_PACKAGE)-$(SRC_VERSION).orig/.gitignore
	rm -rf $(SRC_PACKAGE)-$(SRC_VERSION).orig/.hgignore
	tar czf ../$(TARBALL) $(SRC_PACKAGE)-$(SRC_VERSION).orig
	rm -rf $(SRC_PACKAGE)-$(SRC_VERSION).orig
