#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
# export DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
include /usr/share/debhelper/dh_package_notes/package-notes.mk

ifneq (linux,$(DEB_HOST_ARCH_OS))
       EXTRA_CMAKE_ARGS += -DENABLE_SELINUX:BOOL=OFF
endif
%:
	dh "${@}" --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure --builddirectory=build -- \
		-DENABLE_DOCS:BOOL=ON -DENABLE_TESTS:BOOL=ON -DWITH_ZCHUNK:BOOL=OFF $(EXTRA_CMAKE_ARGS)

override_dh_auto_build:
	dh_auto_build --builddirectory=build -- all doc

override_dh_auto_install:
	dh_auto_install --builddirectory=build

	# Use system-provides files.
	rm -fv 'build/doc/python/_static/jquery.js' \
	       'build/doc/python/_static/underscore.js' \
	       'build/doc/c/html/jquery.js' \
	       'build/doc/python/_static/doctools.js' \
	       'build/doc/python/_static/language_data.js' \
	       'build/doc/python/_static/searchtools.js'

override_dh_auto_clean:
	rm -rfv 'librepo/version.h'
	rm -rfv 'doc/c/Doxyfile.in'
	dh_auto_clean --builddirectory=build

override_dh_auto_test:
	dh_auto_test --builddirectory=build
