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

EAPI=8

inherit meson git-r3

DESCRIPTION="Small Wayland compositor library (maintained fork of swc)"
HOMEPAGE="https://git.sr.ht/~shrub900/neuswc"
EGIT_REPO_URI="https://git.sr.ht/~shrub900/neuswc"

LICENSE="MIT"
SLOT="0"
IUSE="+udev X"

DEPEND="
	dev-libs/libinput
	dev-libs/wayland
	dev-libs/wayland-protocols
	gui-libs/neuwld[drm]
	x11-libs/libdrm
	x11-libs/libxkbcommon
	x11-libs/pixman
	udev? ( virtual/libudev )
	X? (
		x11-base/xwayland
		x11-libs/libxcb
		x11-libs/xcb-util-wm
	)
"
RDEPEND="${DEPEND}"
BDEPEND="
	>=dev-build/meson-1.8.0
	dev-util/wayland-scanner
	virtual/pkgconfig
"

src_configure() {
	local emesonargs=(
		-Dinput=libinput
		$(meson_feature udev)
		$(meson_feature X xwayland)
		-Dextra=true
		-Dexample=false
	)
	meson_src_configure
}

pkg_postinst() {
	elog "swc-launch is installed setuid root; it handles VT and DRM device"
	elog "management so compositors built on swc can run from a plain TTY:"
	elog "    swc-launch <compositor>"
}