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

# Generated by zig-ebuilder 0.3.0

EAPI=8

DESCRIPTION="A Helix and Readline inspired line editor"
HOMEPAGE="https://codeberg.org/lch361/spiral"

declare -g -r -A ZBS_DEPENDENCIES=(
	[zg-0.14.1-oGqU3IAHtAJCxWhVUNS_qBzp2TacF4nUJ-v2-gDt66OQ.tar.gz]='https://codeberg.org/lch361/zg/archive/d49c679a66fbac3516798ac7db6050d42ad4280e.tar.gz'
)

ZIG_SLOT="0.14"
inherit zig

SRC_URI="
	https://codeberg.org/lch361/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
	${ZBS_DEPENDENCIES_SRC_URI}
"
S="${WORKDIR}/${PN}"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"
DOCS=("README.md" "LICENSE.txt")

IUSE="+term +editor +screen static-libs"

src_configure() {
	local my_zbs_args=(
		-Dinstall-h
	)
	for feature in term editor screen; do
		if use $feature; then
			my_zbs_args+=(-Dfeatures=$feature)
		fi
	done

	zig_src_configure
}

src_compile() {
	zig_src_compile
	if use static-libs; then
		zig_src_compile -Dlinkage=static
	fi
}

src_install() {
	zig_src_install
	if use static-libs; then
		zig_src_install -Dlinkage=static
	fi
}
