Added own hacky mangohud ebuilds

I cloned the upstream repo myself to pull the meson subprojects, and
tarballed them. They are then extracted in src_prepare() to the right
right directory to build mangohud successfully.

This was to fix new vulkan headers breaking mangohud, so the subprojects
are used instead.
This commit is contained in:
Sheldon Lee 2023-05-27 01:56:24 +01:00
parent fd1f02c17e
commit 2eae738bcb
5 changed files with 121 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST mangohud-0.6.9.1.tar.gz 14853039 BLAKE2B e34674dc6877249bdfa8929fec1b337876f6d69c42e5c35c37813adca67232084178247d8bef1bf9c0471f9966474df27b25564644dea55e90b3b3c6b9fbf4d1 SHA512 540fb4d1c5494e1305553600f76c57ba75c465df4b76ddbe1f15c418fa9a7e26c66be7ce64a13bfd7c5073bcb985cd28b2876252cdff7c43793d22a40eb78a87

View File

@ -0,0 +1,14 @@
# We provide media-libs/imgui in guru
--- a/meson.build
+++ b/meson.build
@@ -251,8 +251,7 @@ elif sizeof_ptr == 4
pre_args += '-DMANGOHUD_ARCH="32bit"'
endif
-dearimgui_sp = subproject('imgui', default_options: imgui_options)
-dearimgui_dep = dearimgui_sp.get_variable('imgui_dep')
+dearimgui_dep = dependency('imgui')
spdlog_dep = cpp.find_library('spdlog', required: get_option('use_system_spdlog'))
if not spdlog_dep.found()

View File

@ -0,0 +1,106 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..11} )
inherit python-any-r1 meson
MY_PV=$(ver_cut 1-3)
[[ -n "$(ver_cut 4)" ]] && MY_PV_REV="-$(ver_cut 4)"
DESCRIPTION="Vulkan and OpenGL overlay for monitoring FPS, sensors, system load and more"
HOMEPAGE="https://github.com/flightlessmango/MangoHud"
if [[ ${PV} == 9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/flightlessmango/MangoHud.git"
else
SRC_URI="https://github.com/flightlessmango/MangoHud/archive/v${MY_PV}${MY_PV_REV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64"
fi
LICENSE="MIT"
SLOT="0"
IUSE="+dbus debug +X xnvctrl wayland video_cards_nvidia"
REQUIRED_USE="
|| ( X wayland )
xnvctrl? ( video_cards_nvidia )"
BDEPEND="
app-arch/unzip
$(python_gen_any_dep 'dev-python/mako[${PYTHON_USEDEP}]')
"
python_check_deps() {
python_has_version "dev-python/mako[${PYTHON_USEDEP}]"
}
DEPEND="
~media-libs/imgui-1.81[opengl,vulkan]
dev-libs/spdlog
dev-util/glslang
>=dev-util/vulkan-headers-1.2
media-libs/vulkan-loader
media-libs/libglvnd
x11-libs/libdrm
dbus? ( sys-apps/dbus )
X? ( x11-libs/libX11 )
video_cards_nvidia? (
x11-drivers/nvidia-drivers
xnvctrl? ( x11-drivers/nvidia-drivers[static-libs] )
)
wayland? ( dev-libs/wayland )
"
RDEPEND="${DEPEND}"
[[ "$PV" != "9999" ]] && S="${WORKDIR}/MangoHud-${PV}"
PATCHES=(
"${FILESDIR}/mangohud-0.6.6-meson-fix-imgui-dep.patch"
)
src_unpack() {
default
[[ $PV == 9999 ]] && git-r3_src_unpack
[[ $PV != 9999 && -n "${MY_PV_REV}" ]] && ( mv "${WORKDIR}/MangoHud-${MY_PV}${MY_PV_REV}" "${WORKDIR}/MangoHud-${PV}" || die )
}
src_prepare() {
default
# replace all occurences of "#include <imgui.h>" to "#include <imgui/imgui.h>"
find . -type f -exec sed -i 's/#include <imgui.h>/#include <imgui\/imgui.h>/g' {} \;
find . -type f -exec sed -i 's/#include "imgui.h"/#include <imgui\/imgui.h>/g' {} \;
# extract meson pre-generated subproject as a hacky way to bypass not being
# able to download meson subprojects at runtime
tar -xf "${FILESDIR}/meson-subproject_Vulkan-Headers-1.2.158.tar.gz" -C "${WORKDIR}/MangoHud-${PV}/subprojects"
tar -xf "${FILESDIR}/meson-subproject_nlohmann_json-3.10.5.tar.gz" -C "${WORKDIR}/MangoHud-${PV}/subprojects"
}
src_configure() {
local emesonargs=(
-Dappend_libdir_mangohud=false
-Duse_system_spdlog=enabled
-Dinclude_doc=false
$(meson_feature video_cards_nvidia with_nvml)
$(meson_feature xnvctrl with_xnvctrl)
$(meson_feature X with_x11)
$(meson_feature wayland with_wayland)
$(meson_feature dbus with_dbus)
)
meson_src_configure
}
pkg_postinst() {
if ! use xnvctrl; then
einfo ""
einfo "If mangohud can't get GPU load, or other GPU information,"
einfo "and you have an older Nvidia device."
einfo ""
einfo "Try enabling the 'xnvctrl' useflag."
einfo ""
fi
}