#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

%:
	dh $@

override_dh_install:
	# The full upstream archive must contain identical copies of the production files.
	cd production && find common -type f -exec sh -ec \
		'for path do cmp -- "$$path" "../$$path"; done' sh {} +
	install -d debian/unicode-cldr-exemplars/usr/share/unicode/cldr
	find common -type f -exec sh -ec \
		'for path do \
			if [ ! -f "production/$$path" ]; then \
				cp --parents --preserve=mode -- "$$path" \
					debian/unicode-cldr-exemplars/usr/share/unicode/cldr; \
			fi; \
		done' sh {} +
	dh_install

execute_after_dh_fixperms-indep:
	find debian/unicode-cldr-*/usr/share/unicode/cldr -type f \
		-perm /111 -exec chmod a-x {} +

execute_after_dh_strip_nondeterminism-indep:
	# Use the same data mtimes for Git exports and unpacked orig tarballs.
	find debian/unicode-cldr-*/usr/share/unicode/cldr \
		-exec touch --no-dereference --date="@$(SOURCE_DATE_EPOCH)" -- {} +
