#!/usr/bin/make -f

%:
	dh $@ --with autoreconf

override_dh_auto_configure:
# set GSTREAMER and GLIB2 _LIBS to smaller list
# to avoid linking with useless libraries
	GSTREAMER_1_0_LIBS="-lgstapp-1.0 -lgstreamer-1.0" \
	GLIB2_LIBS="-lgio-2.0 -lgobject-2.0 -lglib-2.0" \
	dh_auto_configure -- --disable-silent-rules \
	 --enable-smartcard \
	 --with-gstreamer=1.0 \
	 --with-sasl \
	 --enable-lz4 \

# remove Requires.private and Libs.private defs from .pc file -- we're not building static libs
	sed -E -i '/^(Libs|Requires)\.private:/D' spice-server.pc

# at least one of the tests (listen) initializes dconf which,
# for some reason, initializes its cache in ~/.cache/dconf.
# On a buildd, writing to $HOME is forbidden. Work around this
# by temporarily overriding $XDG_RUNTIME_DIR
override_dh_auto_test:
	mkdir -p .home
	XDG_RUNTIME_DIR=${CURDIR}/.home dh_auto_test --no-parallel
	rm -rf .home
override_dh_auto_clean:
	dh_auto_clean
	rm -rf .home
