#!/usr/bin/make -f

DH_VERBOSE = 1

UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p' | sed -e 's/\+.*//; s/^[0-9]://')
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

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

# main packaging script based on dh7 syntax
%:
	dh $@ --with pkgkde_symbolshelper --parallel

override_dh_auto_configure:
	dh_auto_configure -- -DSFCGAL_BUILD_VIEWER=ON -DCMAKE_SKIP_RPATH=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH)

# in addition to the upstream stuff we also want to
# install the two manpages written for the debian package
override_dh_install:
	dh_install --list-missing
	

# As of version 1.1.0 "style test" does currently work on Debian
# GNU/Linux for unknown reasons
# the other 3 tests will work on systems with installed libraries
# only thus upstream needs to fix the tests before we would be able
# to use them here
override_dh_auto_test:
	true

override_dh_makeshlibs:
	dh_makeshlibs -- -c0 -v$(UPSTREAM_VERSION)
