#!/usr/bin/make -f

%:
	dh $@

override_dh_autoreconf:
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
	patch -p1 < debian/patches/02_ubuntu_default_server.patch ; \
	touch debian/applied
endif
	dh_autoreconf ./autogen.sh
	[ -f xchat.xpm ] || convert -resize 32x32 xchat.png xchat.xpm

override_dh_auto_configure:
	dh_auto_configure -- --enable-ipv6 --enable-spell=gtkspell

override_dh_auto_clean:
	dh_auto_clean
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
	@if [ -e ./debian/applied ]; then \
		patch -R -p1 < debian/patches/02_ubuntu_default_server.patch ; \
		rm ./debian/applied ; \
	fi
endif
	rm -f po/*.gmo
	rm -f depcomp missing compile ltmain.sh
	rm -f po/stamp-po
	rm -f src/common/dbus/org.xchat.service.service
	rm -f xchat.xpm

override_dh_compress:
	dh_compress -X.pl -pxchat-common -pxchat
