#!/usr/bin/make -f

DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
ifneq ($(DEB_HOST_ARCH_OS),linux)
  CONFIGURE_ARGS += -DENABLE_VIDEO=NO
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --buildsystem=cmake

# Upstream unconditionally sets CMAKE_INSTALL_RPATH. Make it ineffective by
# setting CMAKE_SKIP_RPATH
override_dh_auto_configure:
	dh_auto_configure -- \
		-DCMAKE_SKIP_RPATH=ON \
		-DENABLE_LDAP=YES \
		-DENABLE_ROOTCA_DOWNLOAD=NO \
		-DENABLE_GTK_UI=YES \
		-DENABLE_STRICT=NO \
		$(CONFIGURE_ARGS)

	# FIXME not sure how this is supposed to work when building from tarball
	echo "" > coreapi/liblinphone_gitversion.h

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_strip:
	dh_strip --dbgsym-migration='linphone-dbg (<< 3.12.0-1~)'
