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

EAPI=8
LUA_COMPAT=( lua5-4 lua5-5 )

inherit lua-single hyprpm cmake

REQUIRED_USE="${LUA_REQUIRED_USE}"

DESCRIPTION="i3/sway-like layout for hyprland"
HOMEPAGE="https://github.com/outfoxxed/hy3"
LICENSE="GPL-3"
SLOT="0"

HYPRLAND_DEP=""

HYPRPM_REPO_URI="https://github.com/outfoxxed/hy3.git"

KEYWORDS="~amd64"

PATCHES=("${FILESDIR}/include-lua.patch")

# hy3 releases are directly tied to the matching Hyprland release, up to the minor
# version.
RDEPEND="
	${HYPRLAND_DEP}
	!gui-libs/hy3
"
DEPEND="
	${HYPRLAND_DEP}
	${RDEPEND}
	x11-libs/pixman
	x11-libs/libdrm
	x11-libs/pango
	x11-libs/libxkbcommon
	dev-libs/libinput
	dev-libs/wayland
	${LUA_DEPS}
"
BDEPEND="
	virtual/pkgconfig
	>=dev-build/cmake-3.19
"

src_configure() {
	local mycmakeargs=(
		-DLUA_INCLUDE_DIR="$(lua_get_include_dir)"
	)

	cmake_src_configure
}


src_install() {
	hyprpm_doplugin "${BUILD_DIR}/libhy3.so"
}