#!/usr/bin/make -f

NULL =

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

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

# assure that gnupg has a writeable home
BUILDHOME = $(CURDIR)/debian/deb_build_home
export HOME=$(BUILDHOME)

pre-build::
	mkdir -p $(BUILDHOME)/.gnupg

include /usr/share/cdbs/1/class/cmake.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/utils.mk

DEB_BUILD_PARALLEL = 1

DEB_DH_INSTALL_ARGS  += --fail-missing

DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_INSTALL_PREFIX=/usr \
                         -DDOC_INSTALL_DIR=/usr/share/doc \
                         -DLIB=lib/$(shell dpkg-architecture -qDEB_BUILD_MULTIARCH) \
                         -DINCLUDE=include/$(shell dpkg-architecture -qDEB_BUILD_MULTIARCH) \
                         -DCMAKE_BUILD_TYPE=Release \
                         -DCMAKE_SKIP_RPATH=FALSE \
                         -DCMAKE_SKIP_RPATH_INSTALL=TRUE \
                         -DUSE_TRANSLATION_SET=${TRANSLATION_SET:-zypp} \
                         -DDEBIAN=1 \
                         $(NULL)

DEB_MAKE_CHECK_TARGET = ctest

DEB_DH_STRIP_ARGS_ALL = --dbgsym-migration='libzypp-dbg (<< 17.1.3~)'

common-install-indep:: remove-cruft tweak-install
common-install-arch:: remove-cruft tweak-install

remove-cruft::
	echo "Nothing to be decrufted..."

tweak-install::
	mv -f $(CURDIR)/debian/tmp/etc/logrotate.d/zypp-history.lr $(CURDIR)/debian/tmp/etc/logrotate.d/zypp-history

get-orig-source:
	uscan --noconf --force-download --rename --download-current-version --destdir=..
