git: 4d21e541ff28 - main - graphics/xournalpp: Replace /proc/self/exe with the FreeBSD equivalent

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 21 Jul 2026 03:45:58 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4d21e541ff28fe532363a9261fd16a6fa090efff

commit 4d21e541ff28fe532363a9261fd16a6fa090efff
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-07-21 03:42:40 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-07-21 03:42:40 +0000

    graphics/xournalpp: Replace /proc/self/exe with the FreeBSD equivalent
    
    Some people reported that xournalpp fails to start, but I couldn't
    reproduce this for some reason before this fix. It worked fine for me
    every time I used it.
    
    PR:             295834
    Reported by:    Julian Ospald <hasufell@posteo.de>
---
 graphics/xournalpp/Makefile                          |  1 +
 graphics/xournalpp/files/patch-src_util_PathUtil.cpp | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/graphics/xournalpp/Makefile b/graphics/xournalpp/Makefile
index 682def1fd7d4..3bc74b109cca 100644
--- a/graphics/xournalpp/Makefile
+++ b/graphics/xournalpp/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	xournalpp
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.3.6
+PORTREVISION=	1
 CATEGORIES=	graphics
 
 MAINTAINER=	yuri@FreeBSD.org
diff --git a/graphics/xournalpp/files/patch-src_util_PathUtil.cpp b/graphics/xournalpp/files/patch-src_util_PathUtil.cpp
new file mode 100644
index 000000000000..45a940838217
--- /dev/null
+++ b/graphics/xournalpp/files/patch-src_util_PathUtil.cpp
@@ -0,0 +1,14 @@
+--- src/util/PathUtil.cpp.orig	2026-07-21 03:37:42 UTC
++++ src/util/PathUtil.cpp
+@@ -100,7 +100,11 @@ auto Util::getExePath() -> fs::path {
+ #define PATH_MAX 4096
+ #endif
+     std::array<char, PATH_MAX> result{};
++#if !defined(__FreeBSD__)
+     ssize_t count = readlink("/proc/self/exe", result.data(), PATH_MAX);
++#else
++    ssize_t count = readlink("/proc/curproc/file", result.data(), PATH_MAX);
++#endif
+     return fs::path{std::string(result.data(), as_unsigned(std::max(ssize_t{0}, count)))}.parent_path();
+ }
+ #endif