#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
BASEDIR=debian/gnome-shell-extension-*/usr/share/gnome-shell/extensions/*
%:
	dh $@

override_dh_auto_build:
	for POFILE in po/*/system-monitor.po; do \
		MOLANG=$$(echo $$POFILE | sed -e "s/po\///g" | sed -e "s/\/system-monitor.po//g"); \
		MOFILE="system-monitor@paradoxxx.zero.gmail.com/locale/$$MOLANG/LC_MESSAGES/system-monitor.mo"; \
		msgfmt -cv -o $$MOFILE $$POFILE; \
	done

override_dh_auto_install:
	# Compile gschemas so that we don't ship upstream compiled version
	glib-compile-schemas --strict --targetdir=system-monitor@paradoxxx.zero.gmail.com/schemas/ system-monitor@paradoxxx.zero.gmail.com/schemas
	make extension translate

override_dh_install:
	dh_install
	rm -f $(BASEDIR)/README
	sed -i 's/"version": -1/"version": "$(DEB_VERSION)"/' $(BASEDIR)/metadata.json;

override_dh_auto_clean:
	rm -f system-monitor@paradoxxx.zero.gmail.com/schemas/gschemas.compiled
