#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/autoreconf.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/class/gnome.mk
include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk
include /usr/share/hardening-includes/hardening.make

GNOME_MODULE := gtkhtml

CURRENT   := $(shell sed -n 's/^GTKHTML_CURRENT=//p' configure.ac)
AGE       := $(shell sed -n 's/^GTKHTML_AGE=//p' configure.ac)
REVISION  := $(shell sed -n 's/^GTKHTML_REVISION=//p' configure.ac)
SOVERSION := $(shell expr $(CURRENT) - $(AGE))
API_VER   := 3.14

LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
LDFLAGS+=$(HARDENING_LDFLAGS) -Wl,-z,defs -Wl,--as-needed -Wl,-O1 -lm
CFLAGS+=$(HARDENING_CFLAGS)

export CFLAGS LDFLAGS

DEB_CONFIGURE_EXTRA_FLAGS += --enable-static --disable-deprecated_warning_flags
DEB_SHLIBDEPS_INCLUDE_gtkhtml$(API_VER) += $(CURDIR)/debian/libgtkhtml$(API_VER)-$(SOVERSION)/usr/lib
DEB_DH_MAKESHLIBS_ARGS_gtkhtml$(API_VER) += --noscripts
DEB_SHLIBDEPS_INCLUDE_libgtkhtml$(API_VER)-dev += $(CURDIR)/debian/libgtkhtml$(API_VER)-$(SOVERSION)/usr/lib
DEB_DH_MAKESHLIBS_ARGS_libgtkhtml$(API_VER)-$(SOVERSION) += -V 'libgtkhtml$(API_VER)-$(SOVERSION) (>= $(DEB_UPSTREAM_VERSION))'

binary-post-install/libgtkhtml$(API_VER)-$(SOVERSION)::
	chrpath -d -k \
	$(CURDIR)/debian/libgtkhtml$(API_VER)-$(SOVERSION)/usr/lib/libgtkhtml-$(API_VER).so.$(SOVERSION).$(AGE).$(REVISION)

binary-post-install/libgtkhtml-editor0::
	chrpath -d -k $(CURDIR)/debian/libgtkhtml-editor0/usr/lib/libgtkhtml-editor-$(API_VER).so.0.0.0 

common-binary-post-install-indep::
	dh_bugfiles -A
