#!/usr/bin/make -f
#DH_VERBOSE = 1

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

%:
	dh $@  --parallel --with autoreconf

# needs OpenGL working, we shouldn't and can't rely on $DISPLAY, though
# and xfvb-run doesn't work...
ifneq (nocheck,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
ENABLE_TESTS := --enable-tests
endif

override_dh_auto_configure:
	dh_auto_configure -- --disable-silent-rules --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
		--enable-static --disable-werror $(ENABLE_TESTS)

override_dh_auto_test:
	-LIBGL_DRIVERS_PATH=/usr/lib/$(DEB_HOST_MULTIARCH)/dri LIBGL_DEBUG=verbose \
		xvfb-run dh_auto_test \
	    || cat qa/test/test-suite.log

