#!/usr/bin/make -f

# DH_VERBOSE := 1
export LC_ALL=C.UTF-8

include /usr/share/dpkg/default.mk

# for hardening you might like to uncomment this:
# export DEB_BUILD_MAINT_OPTIONS=hardening=+all

CMAKE_EXTRA_FLAGS += -DDEBIAN_BUILD=1

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_EXTRA_FLAGS) -DCMAKE_POLICY_VERSION_MINIMUM=3.5

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cp $(CURDIR)/debian/missing-sources/htslib/* test
	cp $(CURDIR)/debian/missing-sources/ctpl/*.h test
	cd test && cmake . && make || true
	cd test && \
	rm -rf external CMakeFiles Testing \
	       CMakeCache.txt CTestTestfile.cmake DartConfiguration.tcl \
	       Makefile README cmake_install.cmake ctpl_stl.h h*.h kstring.h t*.h
endif
