#!/usr/bin/make -f

SHARED_PKG := $(shell sed -rn 's/^Package:[[:space:]]*(libgoocanvasmm-[0-9\.]+-[0-9][0-9a-z]*)[[:space:]]*$$/\1/p' debian/control)
SHVER = 1.90.11

ifneq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	ENABLE_DOCS = --enable-documentation
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 -Wl,-z,defs -Wl,--as-needed

%:
	dh $@ --with gnome

override_dh_auto_configure:
	dh_auto_configure -- --enable-maintainer-mode $(ENABLE_DOCS)

override_dh_install-arch:
	find debian/tmp -name '*.la' -delete
	dh_install

override_dh_install-indep:
	find debian/tmp -name jquery.js -delete
	ln -sf /usr/share/javascript/jquery/jquery.js \
		debian/tmp/usr/share/doc/goocanvasmm-2.0/reference/html/jquery.js
	dh_install

override_dh_missing:
	dh_missing --list-missing

override_dh_compress:
	dh_compress -X examples -X reference

override_dh_makeshlibs:
	dh_makeshlibs -V"$(SHARED_PKG) (>= $(SHVER))" -- -c4
