#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/utils.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-get-source.mk
include /usr/share/cdbs/1/rules/autoreconf.mk

GNOME_MODULE := libgtop

SHARED_PKG := libgtop-2.0-10

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

ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
CPPFLAGS += $(shell pkg-config --cflags libbsd-overlay)
endif

DEB_DH_AUTORECONF_ARGS = --as-needed

DEB_DH_MAKESHLIBS_ARGS_ALL += -V '$(SHARED_PKG) (>= 2.32.0)'

DEB_CONFIGURE_EXTRA_FLAGS += --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
                             --libexecdir=\$${libdir}/$(SHARED_PKG)

DEB_FIXPERMS_EXCLUDE += libgtop_server2

ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
install/$(SHARED_PKG)::
	# The server is only necessary on kFreeBSD
	dh_install --autodest -p$(SHARED_PKG) \
		--ignore=debian/$(SHARED_PKG).install \
		debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/$(SHARED_PKG)/libgtop_server2
endif
