#!/usr/bin/make -f

# See debhelper(7) (uncomment to enable).
# Output every command that modifies files on the build system.
#export DH_VERBOSE = 1


# See FEATURE AREAS in dpkg-buildflags(1).
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# gobject-introspection on package build fails again
# without active X-session (we had a bug before: #839397)
export WEBKIT_DISABLE_COMPOSITING_MODE=1

include /usr/share/dpkg/architecture.mk

# See ENVIRONMENT in dpkg-buildflags(1).
# Package maintainers to append CFLAGS.
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# Package maintainers to append LDFLAGS.
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


%:
	dh $@ --with gir,python3


# dh_make generated override targets.
# This is an example for Cmake (see <https://bugs.debian.org/641051>).
#override_dh_auto_configure:
#	dh_auto_configure -- \
#	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_autoreconf:
	dh_autoreconf
	intltoolize

override_dh_auto_build:
	dh_auto_build
	# The picture isn't perfect, but it'll do
	mkdir -p pixmaps/64x64
	rsvg-convert --width 64 --height 64 \
		--output pixmaps/64x64/net.sourceforge.liferea.png \
		pixmaps/scalable/net.sourceforge.liferea.svg

override_dh_installdocs:
	dh_installdocs -pliferea-data
	dh_link -pliferea     /usr/share/doc/liferea-data /usr/share/doc/liferea

override_dh_link:
	dh_link -pliferea      /usr/share/man/man1/liferea.1 /usr/share/man/man1/liferea-add-feed.1
	dh_link -pliferea-data /usr/share/liferea/doc/html /usr/share/doc/liferea-data/html

override_dh_auto_install:
	GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 \
	dh_auto_install --destdir=$(CURDIR)/debian/tmp
	# https://wiki.debian.org/ReleaseGoals/LAFileRemoval
	# Lintian: non-empty-dependency_libs-in-la-file
	rm $(CURDIR)/debian/tmp/usr/lib/*/liferea/web-extension/liblifereawebextension.*a

override_dh_girepository:
	dh_girepository -v -ldebian/tmp/usr/share/liferea/gir-1.0 \
                  /usr/lib/$(DEB_BUILD_MULTIARCH)/liferea/girepository-1.0

override_dh_python3:
	dh_python3 /usr/lib

override_dh_auto_test:
	# https://github.com/lwindolf/liferea/issues/1223
ifeq (,$(filter 32,$(DEB_BUILD_ARCH_BITS)))
	# Don't fail on missing schema; we need to move more files to
	# liferea-data, but not during the freeze
	dh_auto_test || true
else
	dh_auto_test || true
endif
	# https://github.com/lwindolf/liferea/issues/1168
	$(MAKE) -C src/tests memcheck || true
	gla11y -s debian/gla11y-suppression glade/*.ui