#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export debversion = $(shell dpkg-parsechangelog -SVersion)
ifeq ($(debversion:4.%=4.),4.)
export DEB_CFLAGS_MAINT_APPEND = "-Wno-error=incompatible-pointer-types" # drop this when upgrading to 5.x
endif

# On some arches (mips64el, s390x, alpha) antlr3 is extremely slow
# and throws a heap space OutOfMemory exception. Workaround by increasing
# heap space
export _JAVA_OPTIONS = -Xms512m -Xmx1024m

%:
	dh $@ --buildsystem=cmake --no-parallel --without autoreconf

# Upstream unconditionally sets CMAKE_INSTALL_RPATH. Make it ineffective by
# setting CMAKE_SKIP_RPATH
# Disable tests as this would require bctoolbox to be built with tests
# enabled as well, which has additional dependencies not yet in Debian
override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_SKIP_RPATH=ON -DENABLE_TESTS=no

override_dh_strip:
	dh_strip --dbgsym-migration='libbellesip-dbg (<< 1.6.3-1~)'
