#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

extra_meson_args =
ifneq ($(DEB_HOST_ARCH_OS),linux)
	extra_meson_args+="-Denable-wayland=false"
endif

# We need to point to xkb-data's files. The default should be OK but
# let's be cautious:
override_dh_auto_configure:
	dh_auto_configure -- -Dxkb-config-root=/usr/share/X11/xkb \
		-Denable-docs=true \
		$(extra_meson_args)

# Kill *.la files, and forget no-one:
override_dh_install:
	find debian/tmp -name '*.la' -delete
	find debian/tmp -name '*.md5' -delete
	dh_install

override_dh_missing:
	dh_missing --fail-missing

override_dh_makeshlibs:
	dh_makeshlibs -- -c4

%:
	dh $@


# For maintainer use only, generate a tarball
gentarball: SOURCE=$(shell dpkg-parsechangelog|awk '/^Source:/ {print $$2}')
gentarball: UV=$(shell dpkg-parsechangelog|awk '/^Version:/ {print $$2}'|sed 's/-.*$$//')
gentarball:
	git archive --format=tar upstream-unstable --prefix=$(SOURCE)-$(UV)/ | gzip -9 > ../$(SOURCE)_$(UV).orig.tar.gz
