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

EAPI=8

inherit cmake

if [[ ${PV} == 9999 ]]; then
    KEYWORDS=""
    EGIT_REPO_URI="https://gitlab.com/ubports/development/core/lib-cpp/${PN}.git"
    inherit git-r3
else
    KEYWORDS="~amd64"
    SRC_URI="https://gitlab.com/ubports/development/core/lib-cpp/${PN}/-/archive/${PV}/${P}.tar.gz"
fi

DESCRIPTION="Cache of key-value pairs with persistent storage for C++ 11"
HOMEPAGE="https://gitlab.com/ubports/development/core/${PN}"

LICENSE="LGPL-3"
SLOT="0"
RESTRICT="test"

DEPEND="
    dev-libs/boost
    dev-libs/leveldb
"

RDEPEND="${DEPEND}"

BDEPEND="
    dev-build/cmake
    dev-build/cmake-extras
    dev-build/samurai
"

PATCHES=(
    "${FILESDIR}"/001-disable-tests.patch
    "${FILESDIR}"/002-fix-install-path.patch
    "${FILESDIR}"/003-fix-maybe-uninitialized-warning.patch
)