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

EAPI=8

inherit cmake toolchain-funcs

DESCRIPTION="A dynamic Linux tiling window manager for Xorg"
HOMEPAGE="https://github.com/hyprwm/Hypr"

if [[ "${PV}" = *9999 ]]; then
	EGIT_REPO_URI="https://github.com/hyprwm/Hypr.git"
	inherit git-r3
else
	SRC_URI="https://github.com/hyprwm/Hypr/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"

	KEYWORDS="~amd64"
	S="${WORKDIR}/Hypr-${PV}"

	PATCHES=(
		"${FILESDIR}/fix-build.patch"
	)
fi


LICENSE="BSD"
SLOT="0"

DEPEND="
	x11-libs/cairo
	dev-util/ninja
	x11-libs/libxcb
	x11-base/xcb-proto
	x11-libs/xcb-util
	x11-libs/xcb-util-cursor
	x11-libs/xcb-util-keysyms
	x11-libs/xcb-util-wm
	dev-cpp/gtkmm:3.0
	gui-libs/gtk
	x11-apps/xmodmap
"

pkg_pretend() {
	if ! tc-is-gcc; then
		ewarn "Only GCC is officially supported as compiler"
		ewarn "Proceed with your own caution"
	fi
	}

src_install() {
	dobin "${BUILD_DIR}/Hypr"
	dodoc "${S}/example/hypr.conf"
}
