#!/usr/bin/make -f

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 $@ \
		--buildsystem=cmake \
		--parallel \
		--dbg-package=colobot-dbg

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

override_dh_auto_build-arch:
	dh_auto_build -a
	# obj-* is the default builddirectory in debhelper
	convert obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)/desktop/32/colobot.png debian/colobot.xpm

override_dh_auto_build-indep:
	dh_auto_build -i -- doc

override_dh_auto_clean:
	dh_auto_clean
	rm -f debian/colobot.xpm
