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

export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
# Use all hardening flags for zathura
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# do not strip
export SFLAGS=
# build with verbose output
export VERBOSE=1
# disable check's timeout functionality
export CK_DEFAULT_TIMEOUT=0
# disable colors
export COLOR=0

%:
	dh $@

override_dh_auto_build:
	dh_auto_build
	# append gtk3 to ABI version for the GTK+2 -> GTK+3 switch
	# (can be dropped once zathura bumps its ABI the next time)
	$(MAKE) zathura.pc
	sed -i 's/^abiversion=.*$$/&gtk3/' zathura.pc

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	xvfb-run -a env $(shell $(dpkg_buildflags) --export=configure) $(MAKE) test
endif

override_dh_gencontrol:
	PKG_CONFIG_PATH=$(CURDIR) ./debian/dh_zathura \
		-pzathura --substvar=zathura:Provides
	dh_gencontrol
