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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export PYBUILD_NAME=zorin_appearance

PKD   = $(abspath $(dir $(MAKEFILE_LIST)))
PKG   = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))


%:
	dh $@ --buildsystem=pybuild --with=python3

override_dh_auto_build:
	for po_file in po/*.po; do \
		msgfmt -cv "$$po_file" -o "$${po_file%.po}.mo"; \
	done
	dh_auto_build

override_dh_install:
	for mo_file in po/*.mo; do \
		lang_code="$$(basename "$$mo_file" .mo)"; \
		mkdir -p debian/$(PKG)/usr/share/locale/$$lang_code/LC_MESSAGES; \
		cp "$$mo_file" debian/$(PKG)/usr/share/locale/$$lang_code/LC_MESSAGES/zorin-appearance.mo; \
	done
	dh_install
