#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = optimize=-lto

# Architecture handling
include /usr/share/dpkg/architecture.mk

archs_using_clang = mips64el mipsel
ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),$(archs_using_clang)))
export CC = clang
export CXX = clang++
export DEB_CFLAGS_MAINT_APPEND = -gdwarf-4
export DEB_CXXFLAGS_MAINT_APPEND = -gdwarf-4
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
endif

%:
	dh $@ --buildsystem=cmake --with kf6

override_dh_auto_configure:
	dh_auto_configure -- \
		-DBUILD_TESTING=OFF \
		-DBUILD_WITH_QT6=ON \
		-DKDE_SKIP_STRICT_BUILD_FLAGS=ON

override_dh_auto_test:
	# tests disabled
	true

execute_after_dh_auto_install:
	# remove static libraries (should not be shipped)
	find debian/tmp -name '*.a' -delete
