Index | Thread | Search

From:
Brad Smith <brad@comstyle.com>
Subject:
UPDATE: QEMU - getexecpath()
To:
ports@openbsd.org
Date:
Fri, 18 Sep 2026 21:56:23 -0400

Download raw body.

Thread
  • Brad Smith:

    UPDATE: QEMU - getexecpath()

Here is a diff to add getexecpath() support for QEMU.


Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/qemu/Makefile,v
retrieving revision 1.266
diff -u -p -u -p -r1.266 Makefile
--- Makefile	3 Sep 2026 08:58:14 -0000	1.266
+++ Makefile	18 Sep 2026 05:59:29 -0000
@@ -8,6 +8,7 @@ COMMENT-ga=	QEMU guest agent
 
 VERSION=	11.1.1
 DISTNAME=	qemu-${VERSION}
+REVISION=	0
 CATEGORIES=	emulators
 SITES=		https://download.qemu.org/
 EXTRACT_SUFX=	.tar.xz
Index: patches/patch-meson_build
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-meson_build,v
retrieving revision 1.23
diff -u -p -u -p -r1.23 patch-meson_build
--- patches/patch-meson_build	3 Sep 2026 08:58:14 -0000	1.23
+++ patches/patch-meson_build	18 Sep 2026 05:59:29 -0000
@@ -1,3 +1,5 @@
+- util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir()
+
 - localstatedir does not belong under prefix
 - remove hardcoding of optimization
 
@@ -13,7 +15,22 @@ Index: meson.build
  config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir)
  config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
  
-@@ -4753,9 +4753,6 @@ if have_rust
+@@ -3030,6 +3030,14 @@ config_host_data.set('CONFIG_ELF_AUX_INFO', cc.links(o
+     return hwcap;
+   }'''))
+ 
++config_host_data.set('CONFIG_GETEXECPATH', cc.links(osdep_prefix + '''
++  #include <limits.h>
++  #include <unistd.h>
++  int main(void) {
++    char buf[PATH_MAX];
++    getexecpath(buf, sizeof(buf));
++  }'''))
++
+ config_host_data.set('CONFIG_USBFS', have_linux_user and cc.compiles('''
+   #include <linux/usbdevice_fs.h>
+ 
+@@ -4753,9 +4761,6 @@ if have_rust
    summary_info += {'bindgen version': bindgen.version()}
  endif
  option_cflags = (get_option('debug') ? ['-g'] : [])
Index: patches/patch-util_cutils_c
===================================================================
RCS file: patches/patch-util_cutils_c
diff -N patches/patch-util_cutils_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-util_cutils_c	18 Sep 2026 05:59:29 -0000
@@ -0,0 +1,18 @@
+- util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir()
+
+Index: util/cutils.c
+--- util/cutils.c.orig
++++ util/cutils.c
+@@ -1091,6 +1091,12 @@ void qemu_init_exec_dir(const char *argv0)
+             p = buf;
+         }
+     }
++#elif defined(__OpenBSD__) && defined(CONFIG_GETEXECPATH)
++    {
++        if (getexecpath(buf, sizeof(buf)) == 0) {
++            p = buf;
++        }
++    }
+ #elif defined(__APPLE__)
+     {
+         char fpath[PATH_MAX];