#!/usr/bin/make -f
export DH_VERBOSE=1

LSB_VENDOR = $(shell lsb_release -is)
LSB_CODENAME = $(shell lsb_release -cs)
DEB_VERSION = $(shell dpkg-parsechangelog -ldebian/changelog | grep ^Vers | cut -d\  -f2)

override_dh_auto_configure:
	dh_auto_configure -- \
		--with-vendor-package-version="Debian $(DEB_VERSION)" \
		--enable-engine-campfire \
		--enable-engine-irc \
		--enable-engine-jabbr \
		--enable-engine-xmpp \
		--enable-frontend-gnome \
		--disable-frontend-stfl \
		--with-db4o=included \
		GMCS=/usr/bin/mono-csc MCS=/usr/bin/mono-csc

override_dh_auto_build:
	# upstream's build system is not parallel safe
	$(MAKE)

# disable "make check"
override_dh_auto_test:

# disable stripping debugging symbols
override_dh_clistrip:

# disable generating clilibs
override_dh_makeclilibs:

override_dh_clideps:
	dh_clideps \
		--exclude-moduleref=i:secur32 \
		--exclude-moduleref=i:secur32.dll \
		--exclude-moduleref=libigemacintegration.dylib \
		--exclude-moduleref=/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon \
		--exclude-moduleref=/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation \
		--exclude-moduleref=/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices

override_dh_install:
	dh_install
	# optional included libs
	-dh_install -p smuxi-frontend-gnome "usr/lib/smuxi/messagingmenu-sharp.dll*"
	-dh_install -p smuxi-frontend-gnome "usr/lib/smuxi/gio-sharp.dll*"
	# optional system libs
	-install /usr/lib/gio-sharp/gio-sharp.dll* debian/smuxi-frontend-gnome/usr/lib/smuxi/

override_dh_autoreconf:
	ln -sf debian/autogen.sh
	NOCONFIGURE=1 NOGIT=1 dh_autoreconf ./autogen.sh

%:
	dh $@ --with autoreconf,cli
