#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-

%:
	dh $@ --with python2

# Remove the dh_auto_clean, dh_auto_build and dh_auto_install step
override_dh_auto_clean:
override_dh_auto_build:
override_dh_auto_install:

override_dh_installdirs:
	dh_installdirs
	# Generate .mo files instead of using the pre-generated ones, useful if
	# we add patches later.
	# Note that the following code handles pt_BR as an special case, if more
	# country locales are needed we will need to review the way we handle
	# that.
	for po in `ls po/childsplay_*_*.po`; do \
		lang=`echo $$po | sed -e 's%^po/childsplay_%%;s%_...po$$%%'`; \
		[ "$$po" = "po/childsplay_pt_BR.po" ] && lang="pt_BR"; \
		mkdir -p debian/childsplay/usr/share/locale/$$lang/LC_MESSAGES/; \
		msgfmt $$po -o debian/childsplay/usr/share/locale/$$lang/LC_MESSAGES/childsplay.mo; \
	done

override_dh_install:
	dh_install
	# Remove wrong executable files
	find debian/childsplay/usr/share/childsplay/CPData/Quiz_historyData/ \
	     -type f -exec chmod -x {} \;
	mkdir -p debian/childsplay/usr/share/childsplay/CPData/Quizcontent/speakers


override_dh_link:
	# Remove DejaVu files (the font is replaced by a link)
	rm -f debian/childsplay/usr/share/childsplay/SPData/DejaVu*
	rm -f debian/childsplay/usr/share/childsplay/SPData/base/DejaVu*
	dh_link
