summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmarks/mangohud/Makefile23
-rw-r--r--benchmarks/mangohud/distinfo12
-rw-r--r--benchmarks/mangohud/files/patch-meson.build6
-rw-r--r--benchmarks/mangohud/files/patch-src_file__utils.cpp28
-rw-r--r--benchmarks/mangohud/files/patch-src_meson.build6
-rw-r--r--benchmarks/mangohud/files/patch-src_vulkan.cpp77
6 files changed, 130 insertions, 22 deletions
diff --git a/benchmarks/mangohud/Makefile b/benchmarks/mangohud/Makefile
index d2e96215ead9..2be3c8377b8f 100644
--- a/benchmarks/mangohud/Makefile
+++ b/benchmarks/mangohud/Makefile
@@ -1,12 +1,11 @@
# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
PORTNAME= mangohud
-PORTVERSION= 0.5.1
+PORTVERSION= 0.6.5
DISTVERSIONPREFIX= v
CATEGORIES= benchmarks graphics
-
-PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
-PATCHFILES= cec98369ae34d910476b78f98adece96016ab603.diff:-p1
+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
@@ -21,11 +20,15 @@ LIB_DEPENDS= libinotify.so:devel/libinotify
USES= compiler:c++14-lang meson pkgconfig python:build xorg
USE_GITHUB= yes
-GH_ACCOUNT= flightlessmango
-GH_PROJECT= MangoHud
+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 man/man1/mangohud.1.gz \
share/vulkan/implicit_layer.d/MangoHud.json
@@ -38,15 +41,13 @@ DBUS_LIB_DEPENDS= libdbus-1.so:devel/dbus
DBUS_MESON_OFF= -Dwith_dbus=disabled
post-patch:
- @${REINPLACE_CMD} -e '/version : /s,0\.4\.0,${PORTVERSION}, ; \
+ @${REINPLACE_CMD} -e 's,cygwin,${OPSYS:tl}, ; \
/^prog_python = /s,3,${PYTHON_VER},' ${WRKSRC}/meson.build
- @${REINPLACE_CMD} -e '1s,usr/bin/env ba,bin/,' \
- ${WRKSRC}/bin/mangohud.in
@${REINPLACE_CMD} -e 's,/usr/share/doc,${PREFIX}/share/examples,' \
${WRKSRC}/data/mangohud.1
- @${REINPLACE_CMD} -e '/#include <sys\/sysinfo\.h>/d' \
- ${WRKSRC}/src/overlay_params.cpp
@${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>
diff --git a/benchmarks/mangohud/distinfo b/benchmarks/mangohud/distinfo
index efa987906dde..e5afe5bc6482 100644
--- a/benchmarks/mangohud/distinfo
+++ b/benchmarks/mangohud/distinfo
@@ -1,5 +1,7 @@
-TIMESTAMP = 1597596860
-SHA256 (flightlessmango-MangoHud-v0.5.1_GH0.tar.gz) = 3e91d4fc7369d46763894c13f3315133871dd02705072981770c3cf58e8081c6
-SIZE (flightlessmango-MangoHud-v0.5.1_GH0.tar.gz) = 15042595
-SHA256 (cec98369ae34d910476b78f98adece96016ab603.diff) = 5af8817cc62bbf441c7a7b735f391bb648e7d90668e7a3746c1b91199698b1d6
-SIZE (cec98369ae34d910476b78f98adece96016ab603.diff) = 551
+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
diff --git a/benchmarks/mangohud/files/patch-meson.build b/benchmarks/mangohud/files/patch-meson.build
index eb9ffcf29134..5068faad2643 100644
--- a/benchmarks/mangohud/files/patch-meson.build
+++ b/benchmarks/mangohud/files/patch-meson.build
@@ -15,6 +15,6 @@
-if dep_vulkan.found()
+if true
- datadir = get_option('datadir')
- if not datadir.startswith('/')
- datadir = get_option('prefix') / datadir
+ datadir = get_option('vulkan_datadir')
+ if datadir == ''
+ datadir = get_option('datadir')
diff --git a/benchmarks/mangohud/files/patch-src_file__utils.cpp b/benchmarks/mangohud/files/patch-src_file__utils.cpp
new file mode 100644
index 000000000000..4ae32c1fc2b2
--- /dev/null
+++ b/benchmarks/mangohud/files/patch-src_file__utils.cpp
@@ -0,0 +1,28 @@
+--- src/file_utils.cpp.orig 2021-07-08 06:23:59 UTC
++++ src/file_utils.cpp
+@@ -109,7 +109,7 @@ std::string read_symlink(const char * link)
+
+ 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 +119,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;
diff --git a/benchmarks/mangohud/files/patch-src_meson.build b/benchmarks/mangohud/files/patch-src_meson.build
index 2a87d1c1eef4..9f796c446235 100644
--- a/benchmarks/mangohud/files/patch-src_meson.build
+++ b/benchmarks/mangohud/files/patch-src_meson.build
@@ -13,11 +13,11 @@
dep_dl,
dep_rt,
dep_pthread,
-- dep_vulkan],
-+ dep_inotify],
+- dep_vulkan,
++ dep_inotify,
+ windows_deps],
include_directories : [inc_common],
link_args : link_args,
- install_dir : libdir_mangohud,
@@ -187,7 +187,7 @@ configure_file(input : '../bin/mangohud.in',
if get_option('include_doc')
install_data(
diff --git a/benchmarks/mangohud/files/patch-src_vulkan.cpp b/benchmarks/mangohud/files/patch-src_vulkan.cpp
new file mode 100644
index 000000000000..7c8876346f01
--- /dev/null
+++ b/benchmarks/mangohud/files/patch-src_vulkan.cpp
@@ -0,0 +1,77 @@
+--- 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,24 @@ 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}'");
++ ram = exec("grep MemTotal " PROCDIR "/meminfo | awk '{print $2}'");
+ trim(ram);
+- cpu = exec("cat /proc/cpuinfo | grep 'model name' | tail -n1 | sed 's/^.*: //' | sed 's/([^)]*)/()/g' | tr -d '(/)'");
++ cpu = exec("grep 'model name' " PROCDIR "/cpuinfo | 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");
++ 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 = exec("sysctl -b kern.sched.name");
+
+ const char* mangohud_recursion = getenv("MANGOHUD_RECURSION");
+ if (!mangohud_recursion) {
+@@ -669,6 +672,8 @@ void init_system_info(){
+ else {
+ wineVersion = "";
+ }
++
++#ifdef __gnu_linux__
+ // check for gamemode and vkbasalt
+ stringstream ss;
+ string line;
+@@ -686,6 +691,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 +703,6 @@ void init_system_info(){
+ << "Gpu:" << gpu << "\n"
+ << "Driver:" << driver << "\n"
+ << "CPU Scheduler:" << cpusched << std::endl;
+-#endif
+ #endif
+ }
+