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

#export DH_VERBOSE=1

DEB_VENDOR := $(shell dpkg-vendor --query vendor)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

LDFLAGS += -Wl,--as-needed

%:
	dh $@ --parallel

override_dh_auto_configure: configure
	dh_auto_configure -- \
	    --libexecdir=\$${libdir}/gchemutils \
	    --with-mozilla-libdir=\$${libdir}/mozilla \
	    --without-kde-mime-dir \
	    --disable-update-databases \
	    --disable-scrollkeeper \
	    CPPFLAGS="$(CPPFLAGS)" \
	    CFLAGS="$(CFLAGS)" \
	    CXXFLAGS="$(CXXFLAGS)" \
	    LDFLAGS="$(LDFLAGS)"

override_dh_auto_install:
	dh_auto_install
	mv $(CURDIR)/debian/tmp/usr/share/appdata \
	   $(CURDIR)/debian/tmp/usr/share/metainfo

override_dh_auto_test:
	dh_auto_test || true

override_dh_clean:
	dh_clean po/*.gmo po/.intltool-merge-cache build-stamp

override_dh_install:
	dh_install --list-missing -X.la

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_strip:
	dh_strip --dbgsym-migration='libgcu-dbg (<< 0.14.14~)'

override_dh_gencontrol:
	dh_gencontrol -Ngcu-plugin
ifneq (,$(filter Ubuntu,$(DEB_VENDOR)))
	dh_gencontrol -pgcu-plugin -- -Vvendor:Browser='firefox | seamonkey'
else
	dh_gencontrol -pgcu-plugin -- -Vvendor:Browser='iceweasel | iceape'
endif
