#!/usr/bin/make -f
# -*- makefile -*-

SHAREDIR=debian/unity-mail/usr/share
LOCALEDIR=$(SHAREDIR)/locale
ICONSDIR=$(SHAREDIR)/icons/hicolor

%:
	dh $@

override_dh_auto_install:
	ls po --hide *.pot | sed 's/\.po//g' | xargs -I {} -t sh -c \
	"mkdir -p $(LOCALEDIR)/{}/LC_MESSAGES/ && msgfmt po/{}.po -o $(LOCALEDIR)/{}/LC_MESSAGES/unity-mail.mo"
	set -ex && for size in 16 22 24 32 48 128; do \
        	mkdir -p $(ICONSDIR)/$$size\x$$size/apps/; \
		convert -resize $$size icons/unity-mail.png $(ICONSDIR)/$$size\x$$size/apps/unity-mail.png; \
    	done
	dh_auto_install
