#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

CMAKE_OPTS=-DCONTRIBUTORS=$(CURDIR)/doc/CONTRIBUTORS \
					 -DFORCE_VERSION=internal \
					 -DWANT_QT5=1 \
					 -DWANT_CARLA=0
ifneq ($(DEB_HOST_ARCH_OS),linux)
CMAKE_OPTS+=-DWANT_ALSA=0
endif

CMAKE_OPTS+= -DWANT_VST_NOWINE=1 \
	-DREMOTE_VST_PLUGIN_FILEPATH=../../i386-linux-gnu/lmms/RemoteVstPlugin
# CMake 4 dropped compatibility with cmake_minimum_required < 3.5
CMAKE_OPTS+= -DCMAKE_POLICY_VERSION_MINIMUM=3.5


# Define NDEBUG. This helps with reproducible builds.
export DEB_CPPFLAGS_MAINT_APPEND=-DNDEBUG
# Add -Wno-error=format-truncation because truncation is expected in snprintf.
DEB_CXXFLAGS_MAINT_APPEND=-Wno-error=format-truncation
ifeq ($(DEB_HOST_ARCH),ppc64el)
# -Wno-maybe-uninitialized needed on Ubuntu ppc64el to avoid FTBFS (LP: 1816459)
DEB_CXXFLAGS_MAINT_APPEND+=-Wno-maybe-uninitialized
endif
export DEB_CXXFLAGS_MAINT_APPEND
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_OPTS)
