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

EAPI=8

inherit cmake

DESCRIPTION="Microframework for HTTP and WebSocket services"
HOMEPAGE="https://crowcpp.org/master/ https://github.com/CrowCpp/Crow"
SRC_URI="
	https://github.com/CrowCpp/Crow/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz
"

S="${WORKDIR}/Crow-${PV}"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64"
IUSE="boost ssl zlib"

RDEPEND="
	boost? ( dev-libs/boost:= )
	!boost? ( dev-cpp/asio )
	ssl? ( dev-libs/openssl:= )
	zlib? ( virtual/zlib:= )
"
DEPEND="${RDEPEND}"

src_configure() {
	local mycmakeargs=(
		"-DCROW_BUILD_EXAMPLES=false"
		# tests require downloading files within the sandbox
		"-DCROW_BUILD_TESTS=false"
		"-DCROW_BUILD_FUZZER=false"
		"-DCROW_ENABLE_SANITIZERS=false"
		"-DCROW_AMALGAMATE=true"
		"-DCROW_INSTALL=true"
		"-DCROW_USE_BOOST=$(usex boost)"
		"-DCROW_GENERATE_SBOM=false"
		"-DCROW_ENABLE_SSL=$(usex ssl)"
		"-DCROW_ENABLE_COMPRESSION=$(usex zlib)"
		"-DCROW_ENABLE_TSAN=false"
	)
	cmake_src_configure
}