#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export export V=1
export DEB_CFLAGS_MAINT_APPEND = -UGDK_DISABLE_DEPRECATED
export DEB_BUILD_HARDENING=1

UPSTREAM_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p' | sed -e 's/\+.*//; s/^[0-9]://')

override_dh_auto_configure:
	dh_auto_configure -- \
		--enable-gtk-doc

override_dh_auto_install:
	dh_auto_install
	dh_girepository

override_dh_install:
	rm `find debian/tmp -name '*.la'`
	d-shlibmove --commit \
		    --multiarch \
		    --override s/libgtk-3-0-dev/libgtk-3-dev/ \
		    --override s/libsoup-2.4-1-dev/libsoup2.4-dev/ \
		    --override s/libcairo-gobject2-dev/libcairo2-dev/ \
		    --override s/libgdk-3-0-dev/libgtk-3-dev/ \
		    --movedev debian/tmp/usr/include/* usr/include \
		    --devunversioned \
		    debian/tmp/usr/lib/*/lib*.so
	dh_install --list-missing

override_dh_auto_clean:
	dh_auto_clean

override_dh_autoreconf:
	NOCONFIGURE=y ./autogen.sh
	dh_autoreconf

override_dh_makeshlibs:
	dh_makeshlibs -- -v$(UPSTREAM_VERSION)

override_dh_strip:
	dh_strip --keep-debug --dbg-package=libosmgpsmap-1.0-dbg

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