#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1


# Enable all hardening flags
# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Disable the following tests as they require network access
BAD_TESTS=10http1client 50reverse-proxy-added-headers 50reverse-proxy-drop-headers 50reverse-proxy-https 80invalid-h2-chars-in-headers 40server-push

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_INSTALL_SYSCONFDIR=/etc/h2o -DWITH_BUNDLED_SSL=off -DWITH_MRUBY=on -DBUILD_SHARED_LIBS=on

override_dh_auto_test:
	for test in $(BAD_TESTS); do mv $(CURDIR)/t/$$test.t $(CURDIR)/t/$$test.disabled; done
	dh_auto_test
	for test in $(BAD_TESTS); do mv $(CURDIR)/t/$$test.disabled $(CURDIR)/t/$$test.t; done

override_dh_installinit:
	# Do not do a full restart, just a graceful reload
	dh_installinit --no-restart-after-upgrade --no-stop-on-upgrade

override_dh_missing:
	dh_missing --fail-missing
