#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

# Directory for tmp installation of the package. Files must be installed/copied there
# before being packaged
TMPDIR=debian/tmp

UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | sed 's/-[^-]*$$//')
REVISION := $(shell echo $(UPSTREAM_VERSION) | sed -e 's/.*svn//')

%:
	dh $@ --buildsystem=autoconf

override_dh_auto_configure:
	./autogen.sh
	dh_auto_configure
	sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' \
                debian/libfaifa-dev.links.in > debian/libfaifa-dev.links
	sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' \
                debian/libfaifa-dev.install.in > debian/libfaifa-dev.install

override_dh_auto_build:
	SVN_REV=$(REVISION) STRIP=strip $(MAKE)

override_dh_shlibdeps:
	dh_shlibdeps -Llibfaifa -l$(CURDIR)/$(TMPDIR)/usr/lib/faifa -a

get-orig-source:
	sh debian/orig-tar.sh $(UPSTREAM_VERSION)