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

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

# Set temporary HOME for lazarus primary config directory
export HOME = $(CURDIR)/tmphome


%:
	dh $@


override_dh_auto_configure:
	if [ -f presets.xml ] ; then mv presets.xml presets-orig.xml; fi

override_dh_auto_build-arch:
	lazbuild --widgetset=qt5 -B winff.lpr
	mv winff winff-qt

override_dh_auto_build-indep:
	soffice --headless --convert-to pdf --outdir docs docs/WinFF.*.od?

# The language files are searched only for the first two characters of the
# language code, and we don't have a proper Spanish translation yet.
	if [ ! -f docs/WinFF.es.pdf ] ; then \
		mv docs/WinFF.es_AR.pdf docs/WinFF.es.pdf ;\
	fi

execute_before_dh_clean:
	rm -rf $(HOME)
	if [ -f presets-orig.xml ] ; then mv presets-orig.xml presets.xml; fi

# Release 1.5.3 was improperly build and all files were set executable
execute_after_dh_fixperms-indep:
	find debian/winff-data -type f -exec chmod a-x {} \;
