#!/usr/bin/make -f

DEB_BUILD_OPTIONS := $(strip $(DEB_BUILD_OPTIONS) nocheck)
export DEB_BUILD_OPTIONS

VINPUT_RUNTIME_PREFIX := $(CURDIR)/runtime

%:
	dh $@

override_dh_auto_configure:
	export CC=clang && \
	export CXX=clang++ && \
	dh_auto_configure -- -G Ninja \
		-DCMAKE_PREFIX_PATH=$(VINPUT_RUNTIME_PREFIX) \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DVINPUT_RUNTIME_MODE=bundled \
		-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=mold \
		-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=mold \
		-DCMAKE_MODULE_LINKER_FLAGS=-fuse-ld=mold

override_dh_auto_test:
	# The project currently does not define any CTest/Ninja test target.
	# Let Launchpad finish the package build instead of invoking a missing target.
	:

override_dh_dwz:
	# Noble's dwz cannot process the DWARF sections emitted by our clang/LTO
	# release binaries, which breaks the package after a successful build.
	:

override_dh_strip:
	# Launchpad noble's debugedit/objcopy stack also fails on our clang/LTO
	# binaries and bundled upstream shared objects, so skip debug symbol
	# extraction to keep PPA builds publishable.
	:
