#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# Strip Debian-style upstream suffixes (+dfsg, ~rc, +really, ...) so that
# only the numeric dotted version reaches CMake/VULKAN_PROFILE_VERSION.
UPSTREAM_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed 's/[+~].*//')


%:
	dh $@


override_dh_auto_configure:
	dh_auto_configure -- \
		-DVULKAN_HEADERS_INSTALL_DIR="/usr" \
		-DVULKAN_LOADER_INSTALL_DIR="/usr" \
		-DVULKAN_VALIDATIONLAYERS_INSTALL_DIR="/usr" \
		-DVULKAN_UTILITY_LIBRARIES_INSTALL_DIR="/usr" \
		-DCMAKE_INSTALL_SYSCONFDIR="/usr/share" \
		-DBUILD_TESTS="ON" \
		-DFATAL_WARNINGS="OFF" \
		-DVALIJSON_INSTALL_DIR="/usr" \
		-DVULKAN_PROFILE_VERSION=$(UPSTREAM_VERSION) \
		-DENABLE_SO_VERSIONING=ON

override_dh_auto_test:
	VK_DRIVER_FILES=/usr/share/vulkan/icd.d/lvp_icd.json \
	VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json \
	dh_auto_test

override_dh_makeshlibs:
	dh_makeshlibs -V -plibvklayer-khronos-profiles1 -- -c4
