#!/usr/bin/make -f

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh $@ --with pkgkde_symbolshelper --buildsystem cmake

override_dh_auto_configure:
	dh_auto_configure -- \
	    -DEXIV2_ENABLE_NLS=ON \
	    -DEXIV2_ENABLE_VIDEO=ON \
	    -DEXIV2_ENABLE_WEBREADY=ON

override_dh_strip:
	dh_strip --dbgsym-migration='libexiv2-dbg (<= 0.26-1~~)'

override_dh_install:
	# no need for libtool .la files
	rm -f $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.la
	dh_install
	dh_missing --list-missing
	find $(CURDIR)/debian -type f -name exiv2 | xargs /usr/bin/chrpath -d

override_dh_auto_build-indep: build-arch
	dh_auto_configure --builddirectory build-doc -- -DEXIV2_BUILD_DOC_ONLY=ON
	dh_auto_build --builddirectory build-doc

override_dh_installdocs:
	dh_installdocs -A -Xcmd.txt -XMakefile -Xtemplates -XChangeLog
	find $(CURDIR)/debian -name jquery.js -exec ln -sfv /usr/share/javascript/jquery/jquery.js {} \;
	find $(CURDIR)/debian \( -name '*.map' -o -name '*.md5' \) -delete

override_dh_installchangelogs:
	dh_installchangelogs -A doc/ChangeLog

override_dh_compress:
	dh_compress -X.xls -X.js -X.idx -X.xml -X.php -X.cpp
