#!/usr/bin/make -f

-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

# don't strip translated pages
export NO_PKG_MANGLE=1

%:
	dh $@ --with gnome

# Files which should not be installed. Modified versions are
# installed by the ubuntu-docs package for most of those files.
DO_NOT_INSTALL = \
	about-this-guide.page \
	get-involved.page \
	help-irc.page \
	help-mailing-list.page \
	index.page \
	more-help.page \
	net-install-flash.page \
	translate.page

# Note: Make sure that LANGUAGES is in sync with the HELP_LINGUAS
# variable in gnome-help/Makefile.am.
LANGUAGES = as ca cs da de el fi fr es gl gu he hi hr hu id it ja kn lv mr nl pa pl pt pt_BR ro ru sl sr sr@latin sv te vi ta zh_CN

override_dh_install:
	for d in $(CURDIR)/debian/tmp/usr/share/help/*/gnome-help; do \
		cd $$d; \
		rm $(DO_NOT_INSTALL); \
		sed -i 's/action="install:/href="apt:/' *.page; \
	done
	for lang in $(LANGUAGES); do \
		if [ "$$lang" = 'pt_BR' -o "$$lang" = 'sr@latin' -o "$$lang" = 'zh_CN' ]; then \
			continue; \
		fi; \
		dh_movefiles -p gnome-user-docs-$$lang usr/share/help/$$lang; \
	done
	dh_movefiles -p gnome-user-docs		usr/share/help/C
	dh_movefiles -p gnome-user-docs-pt	usr/share/help/pt_BR
	dh_movefiles -p gnome-user-docs-sr	usr/share/help/sr@latin
	dh_movefiles -p gnome-user-docs-zh-hans	usr/share/help/zh_CN
	# Korean translation is present only for system-admin-guide.
	dh_movefiles -p gnome-user-docs-ko	usr/share/help/ko

override_dh_missing:
	dh_missing --fail-missing
