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

DEBIAN_DIR = $(dir $(firstword $(MAKEFILE_LIST)))
CURVER ?= $(shell dpkg-parsechangelog -l$(DEBIAN_DIR)/changelog | \
			sed -n 's/-.*$$//; s/^Version: //p')
USCAN = uscan \
			--package=tangerine \
			--watchfile=$(DEBIAN_DIR)/watch \
			--upstream-version=$(CURVER)

get-orig-source:
	$(USCAN) \
		--force-download \
		--download \
		--destdir=. \
		--rename

override_dh_auto_configure:
	autoreconf -f -i -I m4/shamrock
	dh_auto_configure -- \
		MCS=/usr/bin/mono-csc \
		--enable-debug \
		--disable-banshee \
		--disable-beagle \
		--enable-file

override_dh_strip:
	dh_strip --dbg-package=tangerine-dbg

override_dh_clistrip:
	dh_clistrip --dbg-package=tangerine-dbg

# disable dh_makeshlibs (problems with /usr/lib/tangerine/*.so*)
override_dh_makeshlibs:

ifneq ($(shell dpkg-architecture -ilinux-any && echo linux),linux)
override_dh_clideps:
	dh_clideps --exclude-moduleref=tangglue
endif

# delete sample.conf (handled by dh_installexamples)
override_dh_auto_install:
	dh_auto_install -- DESTDIR="$(CURDIR)/debian/tangerine"
	rm debian/tangerine/usr/share/doc/tangerine/sample.conf
	find debian/tangerine -name '*.la' -delete

%:
	dh $@ --with autoreconf,cli
