#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow

%:
	dh $@ --buildsystem=cmake+ninja

# avoid downloading external libraries with git
O += -D ES_USE_VCPKG=0

# release build includes installation of the endless-sky binary
O += -D CMAKE_BUILD_TYPE=Release

override_dh_auto_configure:
	dh_auto_configure --buildsystem=cmake+ninja -- $O

execute_after_dh_auto_install:
	rm -f debian/tmp/usr/share/doc/endless-sky/license.txt

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd obj-$(shell dpkg-architecture -q DEB_BUILD_GNU_TYPE) && ctest --label-exclude "(benchmark|integration-debug|unit)" --timeout 9000
endif

override_dh_strip:
	dh_strip -a --no-automatic-dbgsym
