#!/usr/bin/make -f
%:
	dh $@

DEBIAN_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: *\(.*\)$$/\1/ p')

binary:
	@# Both rename the deb and put it in the right place for distaddfile.
	@# Must be renamed because name doesn't match internal control file.
	@# This also reversions it to be our version
	dpkg-deb -x *.deb debian/tmp
	dpkg-deb -e *.deb debian/tmp/DEBIAN
	sed -i "s/^Version:.*/Version: $(DEBIAN_VERSION)/" debian/tmp/DEBIAN/control
	mkdir -p debian/tmp/usr/share/icons/hicolor/48x48/apps
	mv debian/tmp/usr/share/pixmaps/skype.png debian/tmp/usr/share/icons/hicolor/48x48/apps
	sed -i "s/Icon=skype.png/Icon=skype/" debian/tmp/usr/share/applications/skype.desktop
	dpkg-deb -b debian/tmp ../skype_$(DEBIAN_VERSION)_i386.deb
	dpkg-distaddfile skype_$(DEBIAN_VERSION)_i386.deb non-free/net extra
