#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/gnome.mk
include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
include /usr/share/gnome-pkg-tools/1/rules/gnome-version.mk
-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

GNOME_MODULE := epiphany

LDFLAGS += -Wl,-O1 -Wl,--as-needed

DEB_CONFIGURE_EXTRA_FLAGS += \
		--enable-dbus \
		--disable-scrollkeeper \
		--enable-zeroconf \
		--libexecdir=\$${prefix}/lib/epiphany-browser \
		--enable-gtk-doc \
		--enable-introspection \
		--enable-spell-checker \
		--with-ca-file=/etc/ssl/certs/ca-certificates.crt

ifneq ($(DEB_HOST_ARCH),ia64)
DEB_CONFIGURE_EXTRA_FLAGS += \
		--enable-seed
endif

ifeq ($(DEB_HOST_ARCH_OS),linux)
DEB_CONFIGURE_EXTRA_FLAGS += \
		--enable-network-manager
endif

DEB_DH_INSTALLCHANGELOGS_ARGS_ALL := --no-act
DEB_INSTALL_DOCS_ALL := --no-act

binary-post-install/%::
	dh_installchangelogs -p$(cdbs_curpkg)
	dh_installdocs -p$(cdbs_curpkg)

binary-post-install/epiphany-browser::
	cd debian/epiphany-browser/usr/bin \
		&& mv epiphany epiphany-browser \
		&& mv epiphany.sh epiphany

binary-post-install/epiphany-browser-data::
	dh_installchangelogs -p$(cdbs_curpkg) ./ChangeLog
	cd debian/epiphany-browser-data/usr/share/man/man1 \
		&& mv epiphany.1 epiphany-browser.1
	sed 's/@PACKAGEVERSION@/$(DEB_VERSION)/' debian/branding.conf.in \
		> debian/epiphany-browser-data/usr/share/epiphany-browser/branding.conf
