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

EAPI=8

inherit cmake

DESCRIPTION="C++17 HTTP framework for creating REST services"
HOMEPAGE="https://stiffstream.com/en/products/restinio.html
	https://github.com/Stiffstream/restinio"
SRC_URI="https://github.com/Stiffstream/restinio/releases/download/v${PV}/restinio-${PV}.tar.bz2"

S="${WORKDIR}/${P}/dev"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	dev-cpp/asio
	dev-cpp/expected-lite
	dev-cpp/sobjectizer
	dev-libs/libfmt
	net-libs/llhttp:=
"
DEPEND="${RDEPEND}"

# Force the use of system dependencies instead of the bundled ones
# (the non-full release tarball does not ship them anyway).
src_configure() {
	local mycmakeargs=(
		-DRESTINIO_INSTALL=ON
		-DRESTINIO_TEST=OFF
		-DRESTINIO_SAMPLE=OFF
		-DRESTINIO_BENCHMARK=OFF
		-DRESTINIO_WITH_SOBJECTIZER=ON
		-DRESTINIO_ASIO_SOURCE=standalone
		-DRESTINIO_DEP_STANDALONE_ASIO=system
		-DRESTINIO_DEP_LLHTTP=system
		-DRESTINIO_DEP_FMT=find
		-DRESTINIO_DEP_EXPECTED_LITE=find
		-DRESTINIO_DEP_SOBJECTIZER=find
	)
	cmake_src_configure
}