#!/usr/bin/make -f

#export DH_VERBOSE=1
DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^+]+).*-.*,\1,p')
%:
	dh $@

override_dh_auto_configure:
	bash build/autoconf/acregen.sh
	cp /usr/share/misc/config.sub build/autoconf
	cp /usr/share/misc/config.guess build/autoconf
	dh_auto_configure

override_dh_install:
	dh_install
	cd debian && find . -name "*.html" -exec sed -i 's\<img.*Valid XHTML 1.0 Transitional.*31px"/>\Valid XHTML 1.0 Transitional\g' {} \;
	cd debian && find . -name "*.html" -exec sed -i 's\<img.*"CSS ist valide!" />\CSS ist valide!\g' {} \;
	cd debian && find . -name "*.html" -exec sed -i '/pageTracker/d' {} \;
	cd debian && find . -name "*.html" -exec sed -i '/google\-analytics.com/d' {} \;
	cd debian && find . -name "*.html" -exec sed -i '/\s\swidth="150"/d' {} \;
	cd debian && find . -name "*.html" -exec sed -i '/\s\sheight="40"/d' {} \;
	cd debian && find . -name "*.html" -exec sed -i '/\s\sborder="0"/d' {} \;
	cd debian && find . -name "*.html" -exec sed -i '/sflogo.php/d' {} \;
	cd debian && find . -name "*.html" -exec sed -i 's\alt="Get muParser.*/>\Get muParser - A fast math parser library at SourceForge.net. Fast, secure and Free Open Source software downloads\g' {} \;
	cd debian && find . -name "*.html" -exec sed -i '/project-support.jpg/d' {} \;
	cd debian && find . -name "*.html" -exec sed -i 's\alt="Support This Project"/>\Support This Project\g' {} \;

override_dh_makeshlibs:
	#pkgkde-symbols helper is managing the symbols file.
	#Sometimes we'll FTBFS on other arch's toolchains that export or miss
	#symbols found by the local arch.
	dh_makeshlibs -- -c0 -v$(DEB_UPSTREAM_VERSION)

get-orig-source:
	uscan --repack --rename --download-current-version
