#!/usr/bin/make -f
# libgadu package rules file
# Copyright 2002-2011 Marcin Owsiany <porridge@debian.org>

# As recommended by "current Debian best practice" prescribed by autotools-dev, we:

# * set configure flags appropriately to help cross-compiling:
# These are set automatically by dpkg-buildpackage, but we cannot depend on
# them being available, because caller might not be using dpkg-buildpackage
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

confflags = $(shell dpkg-buildflags --export=configure)
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  confflags += --build $(DEB_HOST_GNU_TYPE)
else
  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

# * specify an explicit automake version
export AUTOMAKE=automake-1.14

%:
	dh $@ --with autoreconf --parallel

# Remember to update README.Debian as well...
override_dh_auto_configure:
	dh_auto_configure -- \
		$(confflags) \
		--disable-silent-rules \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--with-pthread \
		--without-bind \
		--without-openssl \
		--with-gnutls
# Reasons for disabling features are in README.Debian
# Remember to update README.Debian as well...

override_dh_auto_build:
	dh_auto_build
	# work-around #591387
	rm -f docs/html/installdox

override_dh_auto_test:
	: tests disabled temporarily, as they can hang the build

override_dh_installdocs:
	dh_installdocs
ifneq (,$(findstring libgadu-doc, $(shell dh_listpackages)))
	# nicer name for api docs directory
	mv debian/libgadu-doc/usr/share/doc/libgadu-doc/html \
	   debian/libgadu-doc/usr/share/doc/libgadu-doc/api
endif

override_dh_compress:
	dh_compress -X.js

override_dh_strip:
	dh_strip --dbg-package=libgadu3-dbg

override_dh_makeshlibs:
	dh_makeshlibs -V
