#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
BUILDDIR = $(CURDIR)/debian/build

# Include hardening flags for use in SWIG
include /usr/share/dpkg/buildflags.mk

%:
	dh $@ --builddirectory=$(BUILDDIR)

override_dh_auto_configure:
	dh_auto_configure -- \
		-DUSE_SYSTEM_JSONCPP=ON \
		-DUSE_QT6=ON \
		-DENABLE_OPENCV=ON \
		-DENABLE_MAGICK=ON \
		-DENABLE_WAYLAND_CAPTURE=ON \
		-DUSE_HW_ACCEL=ON \
		-DPYTHON_MODULE_PATH=lib/python3/dist-packages \
		-DCMAKE_CXX_FLAGS="$(CXXFLAGS) $(CPPFLAGS)" \
		-DCMAKE_C_FLAGS="$(CFLAGS) $(CPPFLAGS)"


override_dh_auto_build-indep:
ifeq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
	dh_auto_build -- doc
endif

# Excluded tests depend on the build machine: a VAAPI-capable GPU, and the
# stream start times the ffmpeg command-line tool produces when trimming.
override_dh_auto_test-arch:
	dh_auto_test -- ARGS+="-E 'Initial.video.gap.preserves|VAAPI_H264_422_Does_Not_Return_Black_Frames'"

override_dh_auto_test-indep:

override_dh_auto_install-indep:

override_dh_installdocs-indep:
ifeq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
	dh_installdocs --indep
	dh_doxygen --indep
endif
