#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/makefile.mk
include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk
include /usr/share/gnome-pkg-tools/1/rules/ubuntu-get-source.mk

DEB_MAKE_INSTALL_TARGET=install DESTDIR=$(DEB_DESTDIR)

DISTRO := $(shell lsb_release -si)

# Anyway, defaults to Debian
ifeq ($(DISTRO),)
DISTRO := Debian
endif

ICON_DIR := debian/tangerine-icon-theme/usr/share/icons/Tangerine

binary-post-install/tangerine-icon-theme::
	# replace the Ubuntu logos with the distribution overrides
	@echo "=== Installing distribution specific overrides ==="
	if [ -d debian/$(DISTRO) ]; then \
	    cp -rvf debian/$(DISTRO)/* $(ICON_DIR)/; \
	    find $(ICON_DIR) -name '*.uue' | while read encoded; do \
	        decoded="`echo $$encoded | sed 's/\.uue$$//'`"; \
	        echo "Converting $$encoded to $$decoded"; \
	        uudecode -o "$$decoded" "$$encoded"; \
	        rm -vf "$$encoded"; \
	    done; \
	fi
	dh_icons
