#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

#export DH_VERBOSE=1

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

CPPFLAGS ?= $(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS   ?= $(shell dpkg-buildflags --get CFLAGS)
CXXFLAGS ?= $(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS  ?= $(shell dpkg-buildflags --get 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 \
	    CPPFLAGS="$(CPPFLAGS)" \
	    CFLAGS="$(CFLAGS)" \
	    CXXFLAGS="$(CXXFLAGS)" \
	    LDFLAGS="$(LDFLAGS)"

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 --dbg-package=libgcu-dbg

override_dh_makeshlibs:
	dh_makeshlibs -a -V'libgcu0v5 (>= 0.14), libgcu0v5 (<< 0.15)'

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
