#!/usr/bin/make -f

%:
	dh $@

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# tests depending on a TZ with a small offset
export TZ='/usr/share/zoneinfo/Etc/GMT'

# Extended precision on i386 results in weird bugs, so we build
# with -ffloat-store.
ifneq (,$(filter $(DEB_BUILD_ARCH),i386))
CFLAGS += -ffloat-store
endif

FLAGS := -DGPSBABEL_WITH_LIBUSB=pkgconfig -DGPSBABEL_WITH_SHAPELIB=pkgconfig -DGPSBABEL_WITH_ZLIB=pkgconfig
$(shell dpkg -s qt6-webengine-dev > /dev/null)
ifneq ($(.SHELLSTATUS),0)
FLAGS += -DGPSBABEL_MAPPREVIEW=OFF
endif

override_dh_auto_configure:
	dh_auto_configure -- ${FLAGS}
	convert -resize 32x32 gui/images/appicon.png debian/gpsbabel.xpm
	xsltproc --output debian/gpsbabel.1 /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl xmldoc/gpsbabel_man.xml

override_dh_auto_build-indep:
	dh_auto_build -- gpsbabel.org
