On Fri, Sep 18, 2026 at 02:12:14AM -0400, Brad Smith wrote:
> Here is a diff to SDL2 to add getexecpath() support.
Here is the correct version of the diff.
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2/Makefile,v
retrieving revision 1.70
diff -u -p -u -p -r1.70 Makefile
--- Makefile 30 May 2026 13:57:36 -0000 1.70
+++ Makefile 18 Sep 2026 20:41:09 -0000
@@ -1,7 +1,7 @@
COMMENT= cross-platform multimedia library
V= 2.32.10
-REVISION= 0
+REVISION= 2
DISTNAME= SDL2-${V}
PKGNAME= sdl2-${V}
@@ -27,9 +27,13 @@ WANTLIB+= GL
LIB_DEPENDS= audio/libsamplerate \
converters/libiconv
+AUTOCONF_VERSION= 2.71
+AUTOMAKE_VERSION= 1.16
+
USE_GMAKE= Yes
SEPARATE_BUILD= Yes
-CONFIGURE_STYLE= gnu
+CONFIGURE_STYLE= autoreconf
+AUTORECONF= ./autogen.sh
MODGNU_CONFIG_GUESS_DIRS= ${WRKSRC} ${WRKSRC}/build-scripts
CONFIGURE_ARGS+= --disable-alsa \
--disable-arts \
Index: patches/patch-configure
===================================================================
RCS file: patches/patch-configure
diff -N patches/patch-configure
--- patches/patch-configure 22 Feb 2026 18:26:23 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-prevent from using linux/input.h if present
-Index: configure
---- configure.orig
-+++ configure
-@@ -26547,7 +26547,7 @@ main (void)
- _ACEOF
- if ac_fn_c_try_compile "$LINENO"
- then :
-- use_input_events=yes
-+ use_input_events=no
- fi
- rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result:
$use_input_events" >&5
Index: patches/patch-configure_ac
===================================================================
RCS file: patches/patch-configure_ac
diff -N patches/patch-configure_ac
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-configure_ac 18 Sep 2026 20:41:09 -0000
@@ -0,0 +1,25 @@
+Index: configure.ac
+--- configure.ac.orig
++++ configure.ac
+@@ -359,7 +359,7 @@ dnl Checks for library functions.
+ AC_DEFINE(HAVE_MPROTECT, 1, [ ])
+ ],[]),
+ )
+- AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv
bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat
_wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp
strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr
strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa
strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp
strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction
sigtimedwait setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll
memfd_create posix_fallocate _Exit)
++ AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv
bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat
_wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp
strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr
strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa
strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp
strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction
sigtimedwait setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll
memfd_create posix_fallocate _Exit getexecpath)
+
+ AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS
-lm"])
+ AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf
copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod
fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf
sin sinf sqrt sqrtf tan tanf)
+@@ -3828,7 +3828,11 @@ case "$host" in
+ CheckOpenGLES
+ CheckVulkan
+ CheckWayland
+- CheckInputEvents
++ case $ARCH in
++ linux)
++ CheckInputEvents
++ ;;
++ esac
+ CheckLibUDev
+ CheckDBus
+ CheckIME
Index: patches/patch-src_filesystem_unix_SDL_sysfilesystem_c
===================================================================
RCS file: patches/patch-src_filesystem_unix_SDL_sysfilesystem_c
diff -N patches/patch-src_filesystem_unix_SDL_sysfilesystem_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_filesystem_unix_SDL_sysfilesystem_c 18 Sep 2026
20:41:09 -0000
@@ -0,0 +1,39 @@
+Index: src/filesystem/unix/SDL_sysfilesystem.c
+--- src/filesystem/unix/SDL_sysfilesystem.c.orig
++++ src/filesystem/unix/SDL_sysfilesystem.c
+@@ -77,7 +77,7 @@ static char *readSymLink(const char *path)
+ #endif
+
+
+-#if defined(__OPENBSD__)
++#if defined(__OPENBSD__) && !defined(HAVE_GETEXECPATH)
+ static char *search_path_for_binary(const char *bin)
+ {
+ char *envr = SDL_getenv("PATH");
+@@ -145,7 +145,17 @@ char *SDL_GetBasePath(void)
+ }
+ #endif
+ #if defined(__OPENBSD__)
+- /* Please note that this will fail if the process was launched with a
relative path and $PWD + the cwd have changed, or argv is altered. So don't do
that. Or add a new sysctl to OpenBSD. */
++#ifdef HAVE_GETEXECPATH
++ char fullpath[PATH_MAX];
++ if (getexecpath(fullpath, sizeof(fullpath)) == 0) {
++ retval = SDL_strdup(fullpath);
++ if (!retval) {
++ SDL_OutOfMemory();
++ return NULL;
++ }
++ }
++#else
++ /* Please note that this will fail if the process was launched with a
relative path and $PWD + the cwd have changed, or argv is altered. So don't do
that. Or add a new sysctl to openBSD. */
+ char **cmdline;
+ size_t len;
+ const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV };
+@@ -202,6 +212,7 @@ char *SDL_GetBasePath(void)
+
+ SDL_free(cmdline);
+ }
++#endif
+ #endif
+
+ /* is a Linux-style /proc filesystem available? */