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

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

include /usr/share/dpkg/pkg-info.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

features += -DBUILD_SHARED_LIBS=ON

# Upstream unconditionally sets CMAKE_INSTALL_RPATH. Make it ineffective by
# setting CMAKE_SKIP_RPATH
options += -DCMAKE_SKIP_RPATH=ON
options += -DDEB_VERSION_UPSTREAM=$(DEB_VERSION_UPSTREAM)
options += -DDEB_SOVERSION=$(shell echo $(DEB_VERSION_UPSTREAM) | cut -d. -f1)
# To avoid a conflict with libebml-dev and libmatroska-dev we have to
# place the headers into its own subdirectory.  Doing it here obviates
# the need for patching any cmake and source files.
options += -DCMAKE_INSTALL_INCLUDEDIR=/usr/include/bcmatroska2

%:
	dh $@ --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure -O--buildsystem=cmake -- \
	${features} \
	${options}
