#!/usr/bin/make -f
# -*- makefile -*-

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Only build hybris support if this is an Ubuntu build with native packaging
SOURCE_FORMAT = $(shell dpkg-source --print-format . | tr -d '3.0() ')

ifeq ($(SOURCE_FORMAT), quilt)
	BUILD_HYBRIS=OFF
else ifeq ($(shell dpkg-vendor --query vendor),Ubuntu)
	BUILD_HYBRIS=ON
else
	BUILD_HYBRIS=OFF
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		-DENABLE_WERROR=$(if $(filter native,$(SOURCE_FORMAT)),ON,OFF) \
		-DREPOWERD_ENABLE_HYBRIS=$(BUILD_HYBRIS) \
		-DREPOWERD_ENABLE_BINDER=$(BUILD_HYBRIS) \
		-DREPOWERD_ENABLE_LSC=$(BUILD_HYBRIS) \
		-DREPOWERD_DISABLE_TIME_SENSITIVE_TESTS=ON

get-orig-source:
	uscan --noconf --force-download --rename --download-current-version --destdir=..
