benchmarks/mangohud: Remove port

Desktop application; personal use cases not relevant to server focus
This commit is contained in:
2025-03-27 17:13:52 +01:00
parent 21c653782c
commit 120ceefbe2
14 changed files with 1 additions and 406 deletions
+1
View File
@@ -17,6 +17,7 @@ benchmarks/linux-unigine-heaven
benchmarks/linux-unigine-superposition
benchmarks/linux-unigine-valley
benchmarks/linux-vdbench
benchmarks/mangohud
biology/haplohseq
biology/mca-calling
biology/phrap
-1
View File
@@ -46,7 +46,6 @@
SUBDIR += linux-unigine-tropics
SUBDIR += lmbench
SUBDIR += lzbench
SUBDIR += mangohud
SUBDIR += mdtest
SUBDIR += mst-bench
SUBDIR += nbench
-55
View File
@@ -1,55 +0,0 @@
PORTNAME= mangohud
PORTVERSION= 0.6.5
PORTREVISION= 2
DISTVERSIONPREFIX= v
CATEGORIES= benchmarks graphics
MASTER_SITES= https://wrapdb.mesonbuild.com/v1/projects/imgui/1.81/1/get_zip?dummy=/:igw
DISTFILES= imgui-1.81-1-wrap.zip:igw
MAINTAINER= danfe@FreeBSD.org
COMMENT= Vulkan/OpenGL overlay for CPU/GPU monitoring
WWW= https://github.com/flightlessmango/MangoHud
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
BROKEN= https://github.com/flightlessmango/MangoHud/issues/927
BUILD_DEPENDS= glslangValidator:graphics/glslang \
${LOCALBASE}/share/vulkan/registry/vk.xml:graphics/vulkan-headers \
${PYTHON_PKGNAMEPREFIX}mako>=0:textproc/py-mako@${PY_FLAVOR}
LIB_DEPENDS= libinotify.so:devel/libinotify
USES= compiler:c++14-lang meson pkgconfig python:build xorg
USE_GITHUB= yes
GH_ACCOUNT= flightlessmango ocornut:ig
GH_PROJECT= MangoHud imgui:ig
GH_TAGNAME= v1.81:ig
GH_SUBDIR= subprojects/imgui-1.81:ig
USE_XORG= x11
MESON_ARGS= -Duse_system_vulkan=enabled -Dwith_xnvctrl=disabled
CPPFLAGS+= -DPROCDIR=\\\"${LINUXBASE}/proc\\\"
PLIST_FILES= bin/mangohud lib/mangohud/libMangoHud.so \
lib/mangohud/libMangoHud_dlsym.so share/man/man1/mangohud.1.gz \
share/vulkan/implicit_layer.d/MangoHud.json
PORTEXAMPLES= MangoHud.conf.example
OPTIONS_DEFINE= DBUS EXAMPLES
OPTIONS_DEFAULT= DBUS
DBUS_LIB_DEPENDS= libdbus-1.so:devel/dbus
DBUS_MESON_OFF= -Dwith_dbus=disabled
post-patch:
@${REINPLACE_CMD} -e 's,cygwin,${OPSYS:tl}, ; \
/^prog_python = /s,3,${PYTHON_VER},' ${WRKSRC}/meson.build
@${REINPLACE_CMD} -e 's,/usr/share/doc,${PREFIX}/share/examples,' \
${WRKSRC}/data/mangohud.1
@${REINPLACE_CMD} -e 's,libdl\.so,ld-elf.so,' \
${WRKSRC}/src/real_dlsym.cpp
@${REINPLACE_CMD} -e 's,def __gnu_linux__,ndef _WIN32,' \
${WRKSRC}/src/logging.cpp
.include <bsd.port.mk>
-7
View File
@@ -1,7 +0,0 @@
TIMESTAMP = 1625725439
SHA256 (imgui-1.81-1-wrap.zip) = 6d00b442690b6a5c5d8f898311daafbce16d370cf64f53294c3b8c5c661e435f
SIZE (imgui-1.81-1-wrap.zip) = 1850
SHA256 (flightlessmango-MangoHud-v0.6.5_GH0.tar.gz) = 5e5490407a64275e04dae7b3068cbfcbb522f02c632c872a212b95025a316f72
SIZE (flightlessmango-MangoHud-v0.6.5_GH0.tar.gz) = 14828281
SHA256 (ocornut-imgui-v1.81_GH0.tar.gz) = f7c619e03a06c0f25e8f47262dbc32d61fd033d2c91796812bf0f8c94fca78fb
SIZE (ocornut-imgui-v1.81_GH0.tar.gz) = 1413443
@@ -1,19 +0,0 @@
--- include/elfhacks.h.orig 2020-08-16 16:54:20 UTC
+++ include/elfhacks.h
@@ -58,6 +58,16 @@ extern "C" {
# endif
#endif
+#ifndef __ELF_NATIVE_CLASS
+#define __ELF_NATIVE_CLASS __WORDSIZE
+#endif
+
+/* We use this macro to refer to ELF types independent of the native wordsize.
+ `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */
+#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type)
+#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t)
+#define _ElfW_1(e,w,t) e##w##t
+
/**
* \defgroup elfhacks elfhacks
* Elfhacks is a collection of functions that aim for retvieving
@@ -1,20 +0,0 @@
--- meson.build.orig 2020-08-16 16:54:20 UTC
+++ meson.build
@@ -98,7 +98,7 @@ inc_common = [
include_directories('include'),
]
-dep_vulkan = dependency('vulkan', required: get_option('use_system_vulkan'))
+dep_inotify = dependency('libinotify')
dep_pthread = dependency('threads')
dbus_dep = dependency('dbus-1', required: get_option('with_dbus')).partial_dependency(compile_args : true, includes : true)
@@ -170,7 +170,7 @@ else
dep_rt = cc.find_library('rt')
endif
-if dep_vulkan.found()
+if true
datadir = get_option('vulkan_datadir')
if datadir == ''
datadir = get_option('datadir')
@@ -1,72 +0,0 @@
--- src/cpu.cpp.orig 2021-07-08 06:23:59 UTC
+++ src/cpu.cpp
@@ -227,6 +227,7 @@ bool CPUStats::UpdateCPUData()
bool CPUStats::UpdateCoreMhz() {
m_coreMhz.clear();
+#if defined(__linux__)
std::ifstream cpuInfo(PROCCPUINFOFILE);
std::string row;
size_t i = 0;
@@ -238,6 +239,13 @@ bool CPUStats::UpdateCoreMhz() {
i++;
}
}
+#elif defined(__FreeBSD__)
+ char sysctl_name[32];
+ for (int i = 0; i < m_cpuData.size(); i++) {
+ snprintf(sysctl_name, sizeof(sysctl_name), "dev.cpu.%d.freq", i);
+ m_cpuData[i].mhz = read_sysctl<int>(sysctl_name);
+ }
+#endif
m_cpuDataTotal.cpu_mhz = 0;
for (auto data : m_cpuData)
m_cpuDataTotal.cpu_mhz += data.mhz;
@@ -246,6 +254,7 @@ bool CPUStats::UpdateCoreMhz() {
}
bool CPUStats::UpdateCpuTemp() {
+#if defined(__linux__)
if (!m_cpuTempFile)
return false;
@@ -256,6 +265,23 @@ bool CPUStats::UpdateCpuTemp() {
m_cpuDataTotal.temp = temp / 1000;
return ret;
+#elif defined(__FreeBSD__)
+ char sysctl_name[32];
+ int dK, i, temp;
+ for (temp = i = 0; i < m_cpuData.size(); i++) {
+ snprintf(sysctl_name, sizeof(sysctl_name), "dev.cpu.%d.temperature", i);
+ dK = read_sysctl<int>(sysctl_name);
+ if (dK < 0) {
+ // If we could not read some core's temperature, store
+ // the last read (bogus) value and return false early.
+ m_cpuDataTotal.temp = dK;
+ return false;
+ }
+ temp += dK - 2731;
+ }
+ m_cpuDataTotal.temp = temp / (10 * m_cpuData.size());
+ return m_cpuDataTotal.temp > 0;
+#endif
}
static bool get_cpu_power_k10temp(CPUPowerData* cpuPowerData, int& power) {
@@ -407,6 +433,7 @@ static bool find_fallback_temp_input(const std::string
return false;
}
+#ifdef __linux__
bool CPUStats::GetCpuFile() {
if (m_cpuTempFile)
return true;
@@ -447,6 +474,7 @@ bool CPUStats::GetCpuFile() {
}
return true;
}
+#endif
static bool find_input(const std::string& path, const char* input_prefix, std::string& input, const std::string& name)
{
@@ -1,29 +0,0 @@
--- src/elfhacks.cpp.orig 2020-08-16 16:54:20 UTC
+++ src/elfhacks.cpp
@@ -195,22 +195,22 @@ int eh_init_obj(eh_obj_t *obj)
if (obj->strtab)
return ENOTSUP;
- obj->strtab = (const char *) obj->dynamic[p].d_un.d_ptr;
+ obj->strtab = (const char *) (obj->dynamic[p].d_un.d_ptr + obj->addr);
} else if (obj->dynamic[p].d_tag == DT_HASH) {
if (obj->hash)
return ENOTSUP;
- obj->hash = (ElfW(Word) *) obj->dynamic[p].d_un.d_ptr;
+ obj->hash = (ElfW(Word) *) (obj->dynamic[p].d_un.d_ptr + obj->addr);
} else if (obj->dynamic[p].d_tag == DT_GNU_HASH) {
if (obj->gnu_hash)
return ENOTSUP;
- obj->gnu_hash = (Elf32_Word *) obj->dynamic[p].d_un.d_ptr;
+ obj->gnu_hash = (Elf32_Word *) (obj->dynamic[p].d_un.d_ptr + obj->addr);
} else if (obj->dynamic[p].d_tag == DT_SYMTAB) {
if (obj->symtab)
return ENOTSUP;
- obj->symtab = (ElfW(Sym) *) obj->dynamic[p].d_un.d_ptr;
+ obj->symtab = (ElfW(Sym) *) (obj->dynamic[p].d_un.d_ptr + obj->addr);
}
p++;
}
@@ -1,65 +0,0 @@
--- src/file_utils.cpp.orig 2021-07-08 06:23:59 UTC
+++ src/file_utils.cpp
@@ -2,6 +2,7 @@
#include "string_utils.h"
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/sysctl.h>
#include <unistd.h>
#include <dirent.h>
#include <limits.h>
@@ -107,9 +108,36 @@ std::string read_symlink(const char * link)
return std::string(result, (count > 0) ? count : 0);
}
+template <>
+int read_sysctl(const char* name)
+{
+ int value;
+ size_t len = sizeof(value);
+
+ if (sysctlbyname(name, &value, &len, NULL, 0) == 0)
+ return value;
+ else return -1;
+}
+
+template <>
+std::string read_sysctl(const char* name)
+{
+ size_t len;
+
+ // How large buffer do we need?
+ if (sysctlbyname(name, NULL, &len, NULL, 0) != 0)
+ return "";
+
+ char value[len];
+ // Now read the actual value into it.
+ if (sysctlbyname(name, value, &len, NULL, 0) == 0)
+ return value;
+ else return "";
+}
+
std::string get_exe_path()
{
- return read_symlink("/proc/self/exe");
+ return read_symlink(PROCDIR "/self/exe");
}
std::string get_wine_exe_name(bool keep_ext)
@@ -119,14 +147,14 @@ std::string get_wine_exe_name(bool keep_ext)
return std::string();
}
- std::string line = read_line("/proc/self/comm"); // max 16 characters though
+ std::string line = read_line(PROCDIR "/self/comm"); // max 16 characters though
if (ends_with(line, ".exe", true))
{
auto dot = keep_ext ? std::string::npos : line.find_last_of('.');
return line.substr(0, dot);
}
- std::ifstream cmdline("/proc/self/cmdline");
+ std::ifstream cmdline(PROCDIR "/self/cmdline");
// Iterate over arguments (separated by NUL byte).
while (std::getline(cmdline, line, '\0')) {
auto n = std::string::npos;
@@ -1,10 +0,0 @@
--- src/file_utils.h.orig 2021-07-08 06:23:59 UTC
+++ src/file_utils.h
@@ -19,6 +19,7 @@ std::vector<std::string> ls(const char* root, const ch
bool file_exists(const std::string& path);
bool dir_exists(const std::string& path);
std::string read_symlink(const char * link);
+template <typename T> T read_sysctl(const char*);
std::string get_exe_path();
std::string get_wine_exe_name(bool keep_ext = false);
std::string get_home_dir();
@@ -1,29 +0,0 @@
--- src/meson.build.orig 2020-08-16 16:54:20 UTC
+++ src/meson.build
@@ -3,7 +3,7 @@ glslang = find_program('glslangValidator')
# Needs prefix for configure_file()
if get_option('append_libdir_mangohud')
libdir_mangohud = join_paths(get_option('libdir'), 'mangohud')
- ld_libdir_mangohud = get_option('prefix') + '/\$LIB/mangohud/'
+ ld_libdir_mangohud = get_option('prefix') + '/lib/mangohud/'
else
libdir_mangohud = get_option('libdir')
ld_libdir_mangohud = get_option('prefix') + '/\$LIB/'
@@ -141,7 +141,7 @@ vklayer_mesa_overlay = shared_library(
dep_dl,
dep_rt,
dep_pthread,
- dep_vulkan,
+ dep_inotify,
windows_deps],
include_directories : [inc_common],
link_args : link_args,
@@ -187,7 +187,7 @@ configure_file(input : '../bin/mangohud.in',
if get_option('include_doc')
install_data(
files('../bin/MangoHud.conf'),
- install_dir : join_paths(get_option('datadir'), 'doc', 'mangohud'),
+ install_dir : join_paths(get_option('datadir'), 'examples', 'mangohud'),
rename : ['MangoHud.conf.example']
)
endif
@@ -1,16 +0,0 @@
--- src/overlay.cpp.orig 2021-07-08 06:23:59 UTC
+++ src/overlay.cpp
@@ -28,12 +28,11 @@ void update_hw_info(struct swapchain_stats& sw_stats,
}
if (params.enabled[OVERLAY_PARAM_ENABLED_cpu_stats] || logger->is_active()) {
cpuStats.UpdateCPUData();
-#ifdef __gnu_linux__
-
if (params.enabled[OVERLAY_PARAM_ENABLED_core_load] || params.enabled[OVERLAY_PARAM_ENABLED_cpu_mhz])
cpuStats.UpdateCoreMhz();
if (params.enabled[OVERLAY_PARAM_ENABLED_cpu_temp] || logger->is_active() || params.enabled[OVERLAY_PARAM_ENABLED_graphs])
cpuStats.UpdateCpuTemp();
+#ifdef __gnu_linux__
if (params.enabled[OVERLAY_PARAM_ENABLED_cpu_power])
cpuStats.UpdateCpuPower();
#endif
@@ -1,81 +0,0 @@
--- src/vulkan.cpp.orig 2021-07-08 06:23:59 UTC
+++ src/vulkan.cpp
@@ -33,7 +33,7 @@
#include <vector>
#include <list>
#include <array>
-#ifdef __gnu_linux__
+#ifndef _WIN32
#include <libgen.h>
#include <unistd.h>
#endif
@@ -464,10 +464,10 @@ struct overlay_draw *get_overlay_draw(struct swapchain
void init_cpu_stats(overlay_params& params)
{
-#ifdef __gnu_linux__
auto& enabled = params.enabled;
enabled[OVERLAY_PARAM_ENABLED_cpu_stats] = cpuStats.Init()
&& enabled[OVERLAY_PARAM_ENABLED_cpu_stats];
+#ifdef __gnu_linux__
enabled[OVERLAY_PARAM_ENABLED_cpu_temp] = cpuStats.GetCpuFile()
&& enabled[OVERLAY_PARAM_ENABLED_cpu_temp];
enabled[OVERLAY_PARAM_ENABLED_cpu_power] = cpuStats.InitCpuPowerData()
@@ -600,21 +600,21 @@ void init_gpu_stats(uint32_t& vendorID, overlay_params
}
void init_system_info(){
- #ifdef __gnu_linux__
const char* ld_preload = getenv("LD_PRELOAD");
if (ld_preload)
unsetenv("LD_PRELOAD");
- ram = exec("cat /proc/meminfo | grep 'MemTotal' | awk '{print $2}'");
- trim(ram);
- cpu = exec("cat /proc/cpuinfo | grep 'model name' | tail -n1 | sed 's/^.*: //' | sed 's/([^)]*)/()/g' | tr -d '(/)'");
- trim(cpu);
- kernel = exec("uname -r");
- trim(kernel);
- os = exec("cat /etc/*-release | grep 'PRETTY_NAME' | cut -d '=' -f 2-");
- os.erase(remove(os.begin(), os.end(), '\"' ), os.end());
- trim(os);
- cpusched = read_line("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor");
+ ram = to_string(sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE)
+ / 1024 / 1024) + " MB";
+ cpu = read_sysctl<string>("hw.model");
+ kernel = to_string(read_sysctl<int>("kern.osreldate"));
+ os = read_sysctl<string>("kern.ostype") + " " +
+ read_sysctl<string>("kern.osrelease");
+ gpu = exec("pciconf -lv | grep -A2 ^vgapci0 | tail -1 | cut -d\\' -f2");
+ trim(gpu);
+ driver = exec("glxinfo -B | grep 'OpenGL version' | sed 's/^.*: //'");
+ trim(driver);
+ cpusched = read_sysctl<string>("kern.sched.name");
const char* mangohud_recursion = getenv("MANGOHUD_RECURSION");
if (!mangohud_recursion) {
@@ -669,6 +669,8 @@ void init_system_info(){
else {
wineVersion = "";
}
+
+#ifdef __gnu_linux__
// check for gamemode and vkbasalt
stringstream ss;
string line;
@@ -686,6 +688,7 @@ void init_system_info(){
if (HUDElements.gamemode_bol && HUDElements.vkbasalt_bol)
break;
}
+#endif
if (ld_preload)
setenv("LD_PRELOAD", ld_preload, 1);
@@ -697,7 +700,6 @@ void init_system_info(){
<< "Gpu:" << gpu << "\n"
<< "Driver:" << driver << "\n"
<< "CPU Scheduler:" << cpusched << std::endl;
-#endif
#endif
}
-2
View File
@@ -1,2 +0,0 @@
MangoHud is a Vulkan/OpenGL overlay for monitoring FPS, temperatures,
CPU/GPU load, and more.