#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

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

# Now that we use debhelper 9, dh_auto_configure defaults to
# $libexecdir=$libdir, which might be better than this, but doesn't match
# our historical practice (so it'd break old debugging instructions).
# Leaving it as it was for now...
override_dh_auto_configure:
	dh_auto_configure -- \
		--libdir="\$${prefix}/lib" \
		--libexecdir="\$${prefix}/lib/telepathy" \
		--with-ca-certificates=/etc/ssl/certs/ca-certificates.crt \
		--disable-static \
		--enable-installed-tests
		$(NULL)

# the regression tests are too race-prone to run on Debian buildds
override_dh_auto_test:
	:

# remove the development symlinks - nothing in Debian should depend on these
# private libraries
override_dh_auto_install:
	dh_auto_install
	rm -f debian/tmp/usr/lib/telepathy/gabble-0/plugins/*.la
	rm -f debian/tmp/usr/lib/telepathy-gabble-tests/plugins/*.la
	rm -f debian/tmp/usr/lib/telepathy/gabble-0/lib/*.la
	rm -f debian/tmp/usr/lib/telepathy/gabble-0/lib/libwocky.so
	rm -f debian/tmp/usr/lib/telepathy/gabble-0/lib/libgabble-plugins.so

override_dh_install:
	dh_install --list-missing

override_dh_strip:
	dh_strip --dbgsym-migration='telepathy-gabble-dbg (<< 0.18.3-3~)'

# the libraries are considered private, nothing in Debian should depend on them
override_dh_makeshlibs:
	:

override_dh_shlibdeps:
	sed -e 's!@DEB_VERSION_UPSTREAM@!$(DEB_VERSION_UPSTREAM)!' \
		< debian/shlibs.local.in \
		> debian/shlibs.local
	dh_shlibdeps -Ltelepathy-gabble
