# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
UBUNTU_EAUTORECONF="yes"

UVER=
UREV=1ubuntu7

inherit ubuntu-versionator

DESCRIPTION="Client library to interact with zeitgeist"
HOMEPAGE="https://launchpad.net/libzeitgeist/"
SRC_URI="${SRC_URI} ${UURL}-${UREV}.debian.tar.xz"

LICENSE="GPL-3 LGPL-2.1"
SLOT="0"
KEYWORDS="amd64"
IUSE="doc"
# Tests require a running zeitgeist daemon on the session bus #
RESTRICT="test"

COMMON_DEPEND=">=dev-libs/glib-2.37.3:2"
RDEPEND="${COMMON_DEPEND}
	gnome-extra/zeitgeist
"
DEPEND="${COMMON_DEPEND}"
BDEPEND="
	dev-build/gtk-doc-am
	virtual/pkgconfig

	doc? ( dev-util/gtk-doc )
"

src_prepare() {
	# Fix doc dir #
	sed -i "s:/doc/libzeitgeist:/doc/${PF}:" Makefile.am || die

	# Make gtk-doc-html really optional #
	if ! use doc; then
		sed -i "/doc /d" Makefile.am || die
	fi

	ubuntu-versionator_src_prepare
}

src_configure() {
	local myeconfargs=(
		$(use_enable doc gtk-doc)
	)
	econf "${myeconfargs[@]}"
}

src_install() {
	default
	find "${ED}" -name '*.la' -delete || die
}