#!/usr/bin/make -f

# optimize linking
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1

# TODO: disallow undefined symbols
#export DEB_LDFLAGS_MAINT_APPEND += -Wl,-z,defs

# link only when needed
export DEB_LDFLAGS_MAINT_APPEND += -Wl,--as-needed

%:
	dh "$@" --builddir=build

override_dh_auto_test:

execute_after_dh_install:
# Let d-shlibs calculate development package dependencies
#  and handle shared library install
	d-shlibmove --commit \
		--multiarch \
		--exclude-la --exclude-a \
		--devunversioned --ignorelibdep \
		--movedev debian/tmp/usr/share/gir-1.0 usr/share/ \
		--extralib debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libsugar-eventcontroller.so \
		debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libsugarext.so

override_dh_installdocs:
	dh_installdocs --all -- AUTHORS

override_dh_strip:
	dh_strip --dbgsym-migration='libsugarext-dbg (<< 0.116-5~)'
