#!/usr/bin/make -f

HIPPOMOCKS_BROKEN_ARCHS=arm64 mips mips64el mipsel
DEB_HOST_ARCH?=$(shell dpkg-architecture -qDEB_HOST_ARCH)

CBOT_CONFIGURE_SOUNDS=-DMUSIC:BOOL=False
ifneq (,$(findstring colobot-common-sounds, $(shell dh_listpackages)))
CBOT_CONFIGURE_SOUNDS=-DMUSIC:BOOL=True -DMUSIC_FLAC:BOOL=True
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" \
	                     -DOFFICIAL_BUILD:BOOL=True \
	                     -DTESTS:BOOL=True \
	                     -DINSTALL_DOCS:BOOL=True \
	                     ${CBOT_CONFIGURE_SOUNDS} \
	                     -DOPENAL_SOUND:BOOL=True -DCMAKE_VERBOSE_MAKEFILE=True

override_dh_auto_build-arch:
	dh_auto_build -a

override_dh_auto_build-indep:
	dh_auto_build -i -- doc

ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(HIPPOMOCKS_BROKEN_ARCHS)))
override_dh_auto_test-arch:
	# Allow the tests to fail on that architecture, see #843690
	- dh_auto_test -a
endif

override_dh_auto_test-indep:

# can be removed after stretch have been released
override_dh_strip:
	dh_strip --ddeb-migration='colobot-dbg (<< 0.1.6-3~)'
