#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export QT_SELECT=qt5
# cf. https://github.com/MaartenBaert/ssr/issues/498
export DEB_CXXFLAGS_MAINT_APPEND := -fPIC

%:
	dh $@

# * glinjectlib is disabled on non-x86 systems as it requires the
#   x86-only elfhacks code (see README.source)

override_dh_auto_configure:
ifneq ($(filter $(DEB_HOST_ARCH_CPU), amd64 i386),)
	dh_auto_configure -- \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/simplescreenrecorder \
		-DENABLE_FFMPEG_VERSIONS=TRUE \
		-DWITH_QT5=TRUE
else
	dh_auto_configure -- \
		-DENABLE_X86_ASM=FALSE \
		-DWITH_GLINJECT=FALSE \
		-DWITH_QT5=TRUE
endif

execute_after_dh_auto_install:
	appstreamcli validate-tree --no-net debian/tmp
