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

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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
#export LIBODSSTREAM_VERSION="0.7.6"


export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

%:
	dh $@ --buildsystem=cmake


override_dh_clean:
	dh_clean
	-$(RM) libodsstream0.links libodsstream-dev.links

override_dh_auto_configure:
	dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Release \
		-DMAKE_TEST=1 \
		-DCMAKE_SKIP_RPATH=1

	sed -e "s/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g" \
		-e "s/@LIBODSSTREAM_VERSION@/$(DEB_VERSION_UPSTREAM)/g" \
		< debian/libodsstream0.links.in \
		> debian/libodsstream0.links

	sed -e "s/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g" \
		-e "s/@LIBODSSTREAM_VERSION@/$(DEB_VERSION_UPSTREAM)/g" \
		< debian/libodsstream-dev.links.in \
		> debian/libodsstream-dev.links

override_dh_auto_build:
	dh_auto_build --no-parallel
	dh_auto_build -- doc
