From af5bc30e15e223acf4642af83bdebd517023a020 Mon Sep 17 00:00:00 2001
From: turret <turret@duck.com>
Date: Sun, 3 Sep 2023 14:34:08 -0500
Subject: games-util/grapejuice: add live ebuild

Signed-off-by: turret <turret@duck.com>
---
 games-util/grapejuice/grapejuice-7.14.4.ebuild | 17 +++++-
 games-util/grapejuice/grapejuice-9999.ebuild   | 83 ++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 3 deletions(-)
 create mode 100644 games-util/grapejuice/grapejuice-9999.ebuild

diff --git a/games-util/grapejuice/grapejuice-7.14.4.ebuild b/games-util/grapejuice/grapejuice-7.14.4.ebuild
index 2a61870..d0253bb 100644
--- a/games-util/grapejuice/grapejuice-7.14.4.ebuild
+++ b/games-util/grapejuice/grapejuice-7.14.4.ebuild
@@ -7,11 +7,18 @@ inherit xdg optfeature
 
 DESCRIPTION="A Wine+Roblox management application"
 HOMEPAGE="https://gitlab.com/brinkervii/grapejuice.git"
-SRC_URI="https://gitlab.com/brinkervii/grapejuice/-/archive/v${PV}/grapejuice-v${PV}.tar.bz2"
+
+if [[ ${PV} == *9999* ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://gitlab.com/brinkervii/grapejuice.git"
+	EGIT_BRANCH="staging"
+else
+	SRC_URI="https://gitlab.com/brinkervii/grapejuice/-/archive/v${PV}/grapejuice-v${PV}.tar.bz2"
+	KEYWORDS="-* ~amd64"
+fi
 
 LICENSE="GPL-3"
 SLOT="0"
-KEYWORDS="-* ~amd64"
 RESTRICT="mirror"
 
 DEPEND="dev-libs/gobject-introspection
@@ -43,7 +50,11 @@ RDEPEND="
 
 src_unpack() {
 	default
-	mv "${WORKDIR}/grapejuice-v${PV}" "${S}" || die
+	if [[ ${PV} == *9999* ]]; then
+		git-r3_src_unpack
+	else
+		mv "${WORKDIR}/grapejuice-v${PV}" "${S}" || die
+	fi
 }
 
 src_prepare() {
diff --git a/games-util/grapejuice/grapejuice-9999.ebuild b/games-util/grapejuice/grapejuice-9999.ebuild
new file mode 100644
index 0000000..d0253bb
--- /dev/null
+++ b/games-util/grapejuice/grapejuice-9999.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit xdg optfeature
+
+DESCRIPTION="A Wine+Roblox management application"
+HOMEPAGE="https://gitlab.com/brinkervii/grapejuice.git"
+
+if [[ ${PV} == *9999* ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://gitlab.com/brinkervii/grapejuice.git"
+	EGIT_BRANCH="staging"
+else
+	SRC_URI="https://gitlab.com/brinkervii/grapejuice/-/archive/v${PV}/grapejuice-v${PV}.tar.bz2"
+	KEYWORDS="-* ~amd64"
+fi
+
+LICENSE="GPL-3"
+SLOT="0"
+RESTRICT="mirror"
+
+DEPEND="dev-libs/gobject-introspection
+		dev-python/pip
+		dev-util/desktop-file-utils
+		dev-util/gtk-update-icon-cache
+		dev-vcs/git
+		sys-devel/gettext
+		x11-apps/mesa-progs
+		x11-libs/cairo
+		x11-libs/gtk+
+		x11-misc/shared-mime-info
+		x11-misc/xdg-user-dirs
+		x11-misc/xdg-utils
+
+		dev-python/click
+		dev-python/packaging
+		dev-python/psutil
+		dev-python/pydantic
+		dev-python/pygobject
+		dev-python/requests
+		dev-python/setuptools
+		dev-python/unidecode
+		dev-python/wheel"
+
+RDEPEND="
+		${DEPEND}
+		virtual/wine"
+
+src_unpack() {
+	default
+	if [[ ${PV} == *9999* ]]; then
+		git-r3_src_unpack
+	else
+		mv "${WORKDIR}/grapejuice-v${PV}" "${S}" || die
+	fi
+}
+
+src_prepare() {
+	default
+	sed -i \
+		-e 's/"--target"/"--no-build-isolation",\n\t\t"--target"/' \
+		src/grapejuice_packaging/builders/linux_package_builder.py || die
+}
+
+src_compile() {
+	cd "${S}"
+	export PYTHONPATH="${S}/src"
+	python3 -m grapejuice_packaging linux_package || die
+}
+
+src_install() {
+	export PYTHON_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
+	tar -xf "${S}/dist/linux_package"/*.tar.gz -C "${D}" || die
+	mv "${D}/usr/lib/python3/dist-packages" "${D}/usr/lib/python${PYTHON_VERSION}" || die
+	rm -r "${D}/usr/lib/python3" || die
+	default
+}
+
+pkg_postinst() {
+	optfeature "Required for PRIME systems running XOrg, where XRandR based profiling is desired" x11-apps/xrandr
+}
-- 
cgit v1.2.3