#!/usr/bin/make -f

include /usr/share/dpkg/default.mk
EXTRA_CMAKE_VARIABLES += \
	LOTTIE_MODULE_PATH=/usr/lib/$(DEB_HOST_MULTIARCH)/rlottie/image-loader.so \
	LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH)

ifeq ($(filter nocheck, $(DEB_BUILD_OPTIONS)),)
 EXTRA_CMAKE_VARIABLES += LOTTIE_TEST=ON
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

# Silence assert failures in LottieParser that may be raised due to unexpected
# input data. See Telegram build scripts: https://github.com/desktop-app/cmake_helpers/blob/ac193a597d6b953f9869a240e21e275ce6e388cb/external/rlottie/CMakeLists.txt#L116
export DEB_CPPFLAGS_MAINT_APPEND = -DRAPIDJSON_ASSERT=\(void\)

# Work around a compilation error in -O2 (#1075448)
export DEB_CXXFLAGS_MAINT_APPEND = -Os

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(EXTRA_CMAKE_VARIABLES:%=-D%)

# Do not collect exported symbols from the private plugin.
override_dh_makeshlibs:
	dh_makeshlibs -X image-loader.so
