#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/utils.mk

common-binary-post-install-arch:: list-missing

export DPKG_GENSYMBOLS_CHECK_LEVEL = 4

DEB_CONFIGURE_EXTRA_FLAGS = --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
                            --enable-gtk-doc \
                            --disable-python

ifneq (,$(findstring coverage,$(DEB_BUILD_OPTIONS)))
       DEB_CONFIGURE_EXTRA_FLAGS += --enable-coverage
endif

DEV_PKG_ROOT := debian/libtelepathy-farstream-0.4-dev
DEV_PKG_LIB := $(DEV_PKG_ROOT)/usr/lib/$(DEB_HOST_MULTIARCH)
DEV_PKG_INCLUDE := $(DEV_PKG_ROOT)/usr/include

binary-post-install/libtelepathy-farstream-0.4-dev::
	mv $(DEV_PKG_INCLUDE)/telepathy-1.0 \
	   $(DEV_PKG_INCLUDE)/telepathy-1.0-compat
	mv $(DEV_PKG_LIB)/libtelepathy-farstream.so \
	   $(DEV_PKG_LIB)/libtelepathy-farstream-0.4.so
	mv $(DEV_PKG_LIB)/libtelepathy-farstream.a \
	   $(DEV_PKG_LIB)/libtelepathy-farstream-0.4.a
	mv $(DEV_PKG_LIB)/pkgconfig/telepathy-farstream.pc \
	   $(DEV_PKG_LIB)/pkgconfig/telepathy-farstream-0.4.pc
	sed -i -e 's/-ltelepathy-farstream/-ltelepathy-farstream-0.4/' \
	       -e 's!-I\$${includedir}/telepathy-1.0!-I\$${includedir}/telepathy-1.0-compat!' \
		  $(DEV_PKG_LIB)/pkgconfig/telepathy-farstream-0.4.pc

DOC_PKG_GTKDOC := debian/libtelepathy-farstream-0.4-doc/usr/share/gtk-doc/html

binary-post-install/libtelepathy-farstream-0.4-doc::
	mv $(DOC_PKG_GTKDOC)/telepathy-farstream \
	   $(DOC_PKG_GTKDOC)/telepathy-farstream-0.4

include $(CURDIR)/debian/update-patches.mk
