? Does its libc++ have other deps? ++ if env["use_llvm"] and platform.system() in ["FreeBSD", "OpenBSD", "NetBSD"]: ++ env.Append(LINKFLAGS=["-nostdlib++"]) ++ env["LINKCOM"] += " -l:libc++.a" ++ if platform.system() == "OpenBSD": ++ env["LINKCOM"] += " -l:libc++abi.a" ++ else: ++ env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"]) ++ ++ if env["use_llvm"] and platform.system() not in ["FreeBSD", "OpenBSD", "NetBSD"]: ++ env["LINKCOM"] += " -l:libatomic.a" + else: +- if env["use_llvm"] and platform.system() != "FreeBSD": ++ if env["use_llvm"] and platform.system() not in ["FreeBSD", "OpenBSD", "NetBSD"]: + env.Append(LIBS=["atomic"]) diff --git a/devel/godot/files/patch-platform_linuxbsd_libudev-so__wrap.c b/devel/godot/files/patch-platform_linuxbsd_libudev-so__wrap.c deleted file mode 100644 index 6f50b34142d9..000000000000 --- a/devel/godot/files/patch-platform_linuxbsd_libudev-so__wrap.c +++ /dev/null @@ -1,11 +0,0 @@ ---- platform/linuxbsd/libudev-so_wrap.c.orig 2025-02-19 15:17:47 UTC -+++ platform/linuxbsd/libudev-so_wrap.c -@@ -281,7 +281,7 @@ - int initialize_libudev(int verbose) { - void *handle; - char *error; -- handle = dlopen("libudev.so.1", RTLD_LAZY); -+ handle = dlopen("libudev.so.0", RTLD_LAZY); - if (!handle) { - if (verbose) { - fprintf(stderr, "%s\n", dlerror()); diff --git a/devel/godot/files/patch-platform_linuxbsd_platform__config.h b/devel/godot/files/patch-platform_linuxbsd_platform__config.h new file mode 100644 index 000000000000..09278d411fb0 --- /dev/null +++ b/devel/godot/files/patch-platform_linuxbsd_platform__config.h @@ -0,0 +1,31 @@ +--- platform/linuxbsd/platform_config.h.orig 2025-10-13 19:05:40 UTC ++++ platform/linuxbsd/platform_config.h +@@ -30,18 +30,22 @@ + + #pragma once + ++// alloca + #ifdef __linux__ + #include ++#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) ++#ifdef __cplusplus ++#include ++#else ++#include + #endif ++#endif + +-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +-#include // alloca ++#if defined(__FreeBSD__) || defined(__OpenBSD__) + // FreeBSD and OpenBSD use pthread_set_name_np, while other platforms, + // include NetBSD, use pthread_setname_np. NetBSD's version however requires + // a different format, we handle this directly in thread_posix. +-#ifdef __NetBSD__ +-#define PTHREAD_NETBSD_SET_NAME +-#else + #define PTHREAD_BSD_SET_NAME +-#endif ++#elif defined(__NetBSD__) ++#define PTHREAD_NETBSD_SET_NAME + #endif diff --git a/devel/godot/files/patch-platform_linuxbsd_wayland_wayland__embedder.cpp b/devel/godot/files/patch-platform_linuxbsd_wayland_wayland__embedder.cpp new file mode 100644 index 000000000000..77628d425520 --- /dev/null +++ b/devel/godot/files/patch-platform_linuxbsd_wayland_wayland__embedder.cpp @@ -0,0 +1,65 @@ +--- platform/linuxbsd/wayland/wayland_embedder.cpp.orig 2026-01-25 12:41:41 UTC ++++ platform/linuxbsd/wayland/wayland_embedder.cpp +@@ -38,6 +38,22 @@ + + #ifdef __FreeBSD__ + #include ++#include ++#include ++#include ++#include ++ ++/** if CMSG_ALIGN is not defined on this platform, a workaround */ ++#ifndef CMSG_ALIGN ++# ifdef __CMSG_ALIGN ++# define CMSG_ALIGN(n) __CMSG_ALIGN(n) ++# elif defined(CMSG_DATA_ALIGN) ++# define CMSG_ALIGN _CMSG_DATA_ALIGN ++# else ++# define CMSG_ALIGN(len) (((len)+sizeof(long)-1) & ~(sizeof(long)-1)) ++# endif ++#endif ++ + #else + // Assume Linux. + #include +@@ -2869,15 +2885,27 @@ void WaylandEmbedder::handle_fd(int p_fd, int p_revent + int new_fd = accept(proxy_socket, nullptr, nullptr); + ERR_FAIL_COND_MSG(new_fd == -1, "Failed to accept client."); + ++#if defined(__FreeBSD__) ++ struct xucred cred = {}; ++#else + struct ucred cred = {}; ++#endif + socklen_t cred_size = sizeof cred; ++#if defined(__FreeBSD__) ++ getsockopt(new_fd, SOL_LOCAL, LOCAL_PEERCRED, &cred, &cred_size); ++#else + getsockopt(new_fd, SOL_SOCKET, SO_PEERCRED, &cred, &cred_size); ++#endif + + Client &client = clients.insert_new(new_fd, {})->value; + + client.embedder = this; + client.socket = new_fd; ++#if defined(__FreeBSD__) ++ client.pid = cred.cr_pid; ++#else + client.pid = cred.pid; ++#endif + + client.global_ids[DISPLAY_ID] = Client::GlobalIdInfo(DISPLAY_ID, nullptr); + client.local_ids[DISPLAY_ID] = DISPLAY_ID; +@@ -2900,7 +2928,11 @@ void WaylandEmbedder::handle_fd(int p_fd, int p_revent + main_client->new_fake_object(new_local_id, &godot_embedded_client_interface, 1, eclient_data); + + // godot_embedding_compositor::client(nu) ++#if defined(__FreeBSD__) ++ send_wayland_message(main_client->socket, local_id, 0, { new_local_id, (uint32_t)cred.cr_pid }); ++#else + send_wayland_message(main_client->socket, local_id, 0, { new_local_id, (uint32_t)cred.pid }); ++#endif + } + } + diff --git a/devel/godot/files/patch-platform_linuxbsd_wayland_wayland__thread.cpp b/devel/godot/files/patch-platform_linuxbsd_wayland_wayland__thread.cpp new file mode 100644 index 000000000000..9222403d3c82 --- /dev/null +++ b/devel/godot/files/patch-platform_linuxbsd_wayland_wayland__thread.cpp @@ -0,0 +1,65 @@ +--- platform/linuxbsd/wayland/wayland_thread.cpp.orig 2025-10-13 19:05:40 UTC ++++ platform/linuxbsd/wayland/wayland_thread.cpp +@@ -95,7 +95,7 @@ Vector WaylandThread::_read_fd(int fd) { + break; + } + +- DEBUG_LOG_WAYLAND_THREAD(vformat("Read chunk of %d bytes.", last_bytes_read)); ++ DEBUG_LOG_WAYLAND_THREAD(vformat("Read chunk of %d bytes.", (uint64_t)last_bytes_read)); + + bytes_read += last_bytes_read; + +@@ -1197,7 +1197,7 @@ void WaylandThread::_wl_surface_on_enter(void *data, s + WindowState *ws = (WindowState *)data; + ERR_FAIL_NULL(ws); + +- DEBUG_LOG_WAYLAND_THREAD(vformat("Window entered output %x.", (size_t)wl_output)); ++ DEBUG_LOG_WAYLAND_THREAD(vformat("Window entered output %x.", (uint64_t)wl_output)); + + ws->wl_outputs.insert(wl_output); + +@@ -1248,7 +1248,7 @@ void WaylandThread::_wl_surface_on_leave(void *data, s + + ws->wl_outputs.erase(wl_output); + +- DEBUG_LOG_WAYLAND_THREAD(vformat("Window left output %x.\n", (size_t)wl_output)); ++ DEBUG_LOG_WAYLAND_THREAD(vformat("Window left output %x.\n", (uint64_t)wl_output)); + } + + // TODO: Add support to this event. +@@ -1310,7 +1310,7 @@ void WaylandThread::_wl_output_on_done(void *data, str + + ss->wayland_thread->_update_scale(ss->data.scale); + +- DEBUG_LOG_WAYLAND_THREAD(vformat("Output %x done.", (size_t)wl_output)); ++ DEBUG_LOG_WAYLAND_THREAD(vformat("Output %x done.", (uint64_t)wl_output)); + } + + void WaylandThread::_wl_output_on_scale(void *data, struct wl_output *wl_output, int32_t factor) { +@@ -1319,7 +1319,7 @@ void WaylandThread::_wl_output_on_scale(void *data, st + + ss->pending_data.scale = factor; + +- DEBUG_LOG_WAYLAND_THREAD(vformat("Output %x scale %d", (size_t)wl_output, factor)); ++ DEBUG_LOG_WAYLAND_THREAD(vformat("Output %x scale %d", (uint64_t)wl_output, factor)); + } + + void WaylandThread::_wl_output_on_name(void *data, struct wl_output *wl_output, const char *name) { +@@ -2509,7 +2509,7 @@ void WaylandThread::_wl_data_source_on_send(void *data + } + + if (written_bytes > 0) { +- DEBUG_LOG_WAYLAND_THREAD(vformat("Clipboard: sent %d bytes.", written_bytes)); ++ DEBUG_LOG_WAYLAND_THREAD(vformat("Clipboard: sent %d bytes.", (uint64_t)written_bytes)); + } else if (written_bytes == 0) { + DEBUG_LOG_WAYLAND_THREAD("Clipboard: no bytes sent."); + } else { +@@ -2697,7 +2697,7 @@ void WaylandThread::_wp_primary_selection_source_on_se + } + + if (written_bytes > 0) { +- DEBUG_LOG_WAYLAND_THREAD(vformat("Clipboard: sent %d bytes.", written_bytes)); ++ DEBUG_LOG_WAYLAND_THREAD(vformat("Clipboard: sent %d bytes.", (uint64_t)written_bytes)); + } else if (written_bytes == 0) { + DEBUG_LOG_WAYLAND_THREAD("Clipboard: no bytes sent."); + } else { diff --git a/devel/godot/files/patch-thirdparty_jolt__physics_Jolt_Core_Core.h b/devel/godot/files/patch-thirdparty_jolt__physics_Jolt_Core_Core.h index 41a7d11c20b0..cc435c7b4c70 100644 --- a/devel/godot/files/patch-thirdparty_jolt__physics_Jolt_Core_Core.h +++ b/devel/godot/files/patch-thirdparty_jolt__physics_Jolt_Core_Core.h @@ -1,6 +1,6 @@ ---- thirdparty/jolt_physics/Jolt/Core/Core.h.orig 2025-08-13 15:24:56 UTC +--- thirdparty/jolt_physics/Jolt/Core/Core.h.orig 2025-10-13 19:05:40 UTC +++ thirdparty/jolt_physics/Jolt/Core/Core.h -@@ -215,7 +215,7 @@ +@@ -219,7 +219,7 @@ #define JPH_CPU_BIG_ENDIAN #endif #define JPH_VECTOR_ALIGNMENT 16 diff --git a/devel/godot/files/patch-thirdparty_linuxbsd__headers_udev_libudev.h b/devel/godot/files/patch-thirdparty_linuxbsd__headers_udev_libudev.h index 5720c06187c2..25f688956637 100644 --- a/devel/godot/files/patch-thirdparty_linuxbsd__headers_udev_libudev.h +++ b/devel/godot/files/patch-thirdparty_linuxbsd__headers_udev_libudev.h @@ -1,4 +1,4 @@ ---- thirdparty/linuxbsd_headers/udev/libudev.h.orig 2025-02-15 07:16:26 UTC +--- thirdparty/linuxbsd_headers/udev/libudev.h.orig 2025-10-13 19:05:40 UTC +++ thirdparty/linuxbsd_headers/udev/libudev.h @@ -22,7 +22,7 @@ #define _LIBUDEV_H_ diff --git a/devel/godot/files/patch-thirdparty_sdl_joystick_bsd_SDL__bsdjoystick.c b/devel/godot/files/patch-thirdparty_sdl_joystick_bsd_SDL__bsdjoystick.c new file mode 100644 index 000000000000..6c24d1c685f4 --- /dev/null +++ b/devel/godot/files/patch-thirdparty_sdl_joystick_bsd_SDL__bsdjoystick.c @@ -0,0 +1,872 @@ +--- thirdparty/sdl/joystick/bsd/SDL_bsdjoystick.c.orig 2026-01-03 09:26:31 UTC ++++ thirdparty/sdl/joystick/bsd/SDL_bsdjoystick.c +@@ -0,0 +1,869 @@ ++/* ++ Simple DirectMedia Layer ++ Copyright (C) 1997-2025 Sam Lantinga ++ ++ This software is provided 'as-is', without any express or implied ++ warranty. In no event will the authors be held liable for any damages ++ arising from the use of this software. ++ ++ Permission is granted to anyone to use this software for any purpose, ++ including commercial applications, and to alter it and redistribute it ++ freely, subject to the following restrictions: ++ ++ 1. The origin of this software must not be misrepresented; you must not ++ claim that you wrote the original software. If you use this software ++ in a product, an acknowledgment in the product documentation would be ++ appreciated but is not required. ++ 2. Altered source versions must be plainly marked as such, and must not be ++ misrepresented as being the original software. ++ 3. This notice may not be removed or altered from any source distribution. ++*/ ++#include "SDL_internal.h" ++ ++#ifdef SDL_JOYSTICK_USBHID ++ ++/* ++ * Joystick driver for the uhid(4) / ujoy(4) interface found in OpenBSD, ++ * NetBSD and FreeBSD. ++ * ++ * Maintainer: ++ */ ++ ++#include ++#include ++ ++#include ++#include ++#include ++ ++#ifndef __FreeBSD_kernel_version ++#define __FreeBSD_kernel_version __FreeBSD_version ++#endif ++ ++#ifdef HAVE_USB_H ++#include ++#endif ++#ifdef __DragonFly__ ++#include ++#include ++#else ++#include ++#include ++#endif ++ ++#ifdef HAVE_USBHID_H ++#include ++#elif defined(HAVE_LIBUSB_H) ++#include ++#elif defined(HAVE_LIBUSBHID_H) ++#include ++#endif ++ ++#if defined(SDL_PLATFORM_FREEBSD) ++#include ++#if __FreeBSD_kernel_version > 800063 ++#include ++#elif defined(__DragonFly__) ++#include ++#endif ++#include ++#include ++#endif ++ ++#ifdef SDL_HAVE_MACHINE_JOYSTICK_H ++#include ++#endif ++ ++#include "../SDL_sysjoystick.h" ++#include "../SDL_joystick_c.h" ++#include "../hidapi/SDL_hidapijoystick_c.h" ++ ++#if defined(SDL_PLATFORM_FREEBSD) || defined(SDL_HAVE_MACHINE_JOYSTICK_H) || defined(__FreeBSD_kernel__) || defined(__DragonFly_) ++#define SUPPORT_JOY_GAMEPORT ++#endif ++ ++#define MAX_UHID_JOYS 64 ++#define MAX_JOY_JOYS 2 ++#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS) ++ ++#ifdef SDL_PLATFORM_OPENBSD ++ ++#define HUG_DPAD_UP 0x90 ++#define HUG_DPAD_DOWN 0x91 ++#define HUG_DPAD_RIGHT 0x92 ++#define HUG_DPAD_LEFT 0x93 ++ ++#define HAT_UP 0x01 ++#define HAT_RIGHT 0x02 ++#define HAT_DOWN 0x04 ++#define HAT_LEFT 0x08 ++ ++#endif ++ ++struct report ++{ ++#if defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 900000) || \ ++ defined(__DragonFly__) ++ void *buf; // Buffer ++#elif defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 800063) ++ struct usb_gen_descriptor *buf; // Buffer ++#else ++ struct usb_ctl_report *buf; // Buffer ++#endif ++ size_t size; // Buffer size ++ int rid; // Report ID ++ enum ++ { ++ SREPORT_UNINIT, ++ SREPORT_CLEAN, ++ SREPORT_DIRTY ++ } status; ++}; ++ ++static struct ++{ ++ int uhid_report; ++ hid_kind_t kind; ++ const char *name; ++} const repinfo[] = { ++ { UHID_INPUT_REPORT, hid_input, "input" }, ++ { UHID_OUTPUT_REPORT, hid_output, "output" }, ++ { UHID_FEATURE_REPORT, hid_feature, "feature" } ++}; ++ ++enum ++{ ++ REPORT_INPUT = 0, ++ REPORT_OUTPUT = 1, ++ REPORT_FEATURE = 2 ++}; ++ ++enum ++{ ++ JOYAXE_X, ++ JOYAXE_Y, ++ JOYAXE_Z, ++ JOYAXE_SLIDER, ++ JOYAXE_WHEEL, ++ JOYAXE_RX, ++ JOYAXE_RY, ++ JOYAXE_RZ, ++ JOYAXE_count ++}; ++ ++struct joystick_hwdata ++{ ++ int fd; ++ enum ++ { ++ BSDJOY_UHID, // uhid(4) ++ BSDJOY_JOY // joy(4) ++ } type; ++ ++ int naxes; ++ int nbuttons; ++ int nhats; ++ struct report_desc *repdesc; ++ struct report inreport; ++ int axis_map[JOYAXE_count]; /* map present JOYAXE_* to 0,1,.. */ ++}; ++ ++// A linked list of available joysticks ++typedef struct SDL_joylist_item ++{ ++ SDL_JoystickID device_instance; ++ char *path; // "/dev/uhid0" or whatever ++ char *name; // "SideWinder 3D Pro" or whatever ++ SDL_GUID guid; ++ dev_t devnum; ++ struct SDL_joylist_item *next; ++} SDL_joylist_item; ++ ++static SDL_joylist_item *SDL_joylist = NULL; ++static SDL_joylist_item *SDL_joylist_tail = NULL; ++static int numjoysticks = 0; ++ ++static bool report_alloc(struct report *, struct report_desc *, int); ++static void report_free(struct report *); ++ ++#if defined(USBHID_UCR_DATA) || (defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version <= 800063) ++#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data) ++#elif (defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 900000)) || \ ++ defined(__DragonFly__) ++#define REP_BUF_DATA(rep) ((rep)->buf) ++#elif (defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 800063)) ++#define REP_BUF_DATA(rep) ((rep)->buf->ugd_data) ++#else ++#define REP_BUF_DATA(rep) ((rep)->buf->data) ++#endif ++ ++static int usage_to_joyaxe(int usage) ++{ ++ int joyaxe; ++ switch (usage) { ++ case HUG_X: ++ joyaxe = JOYAXE_X; ++ break; ++ case HUG_Y: ++ joyaxe = JOYAXE_Y; ++ break; ++ case HUG_Z: ++ joyaxe = JOYAXE_Z; ++ break; ++ case HUG_SLIDER: ++ joyaxe = JOYAXE_SLIDER; ++ break; ++ case HUG_WHEEL: ++ joyaxe = JOYAXE_WHEEL; ++ break; ++ case HUG_RX: ++ joyaxe = JOYAXE_RX; ++ break; ++ case HUG_RY: ++ joyaxe = JOYAXE_RY; ++ break; ++ case HUG_RZ: ++ joyaxe = JOYAXE_RZ; ++ break; ++ default: ++ joyaxe = -1; ++ } ++ return joyaxe; ++} ++ ++static void FreeJoylistItem(SDL_joylist_item *item) ++{ ++ SDL_free(item->path); ++ SDL_free(item->name); ++ SDL_free(item); ++} ++ ++static void FreeHwData(struct joystick_hwdata *hw) ++{ ++ if (hw->type == BSDJOY_UHID) { ++ report_free(&hw->inreport); ++ ++ if (hw->repdesc) { ++ hid_dispose_report_desc(hw->repdesc); ++ } ++ } ++ close(hw->fd); ++ SDL_free(hw); ++} ++ ++static struct joystick_hwdata *CreateHwData(const char *path) ++{ ++ struct joystick_hwdata *hw; ++ struct hid_item hitem; ++ struct hid_data *hdata; ++ struct report *rep = NULL; ++ int fd; ++ int i; ++ ++ fd = open(path, O_RDONLY | O_CLOEXEC); ++ if (fd == -1) { ++ SDL_SetError("%s: %s", path, strerror(errno)); ++ return NULL; ++ } ++ ++ hw = (struct joystick_hwdata *) ++ SDL_calloc(1, sizeof(struct joystick_hwdata)); ++ if (!hw) { ++ close(fd); ++ return NULL; ++ } ++ hw->fd = fd; ++ ++#ifdef SUPPORT_JOY_GAMEPORT ++ if (SDL_strncmp(path, "/dev/joy", 8) == 0) { ++ hw->type = BSDJOY_JOY; ++ hw->naxes = 2; ++ hw->nbuttons = 2; ++ } else ++#endif ++ { ++ hw->type = BSDJOY_UHID; ++ { ++ int ax; ++ for (ax = 0; ax < JOYAXE_count; ax++) { ++ hw->axis_map[ax] = -1; ++ } ++ } ++ hw->repdesc = hid_get_report_desc(fd); ++ if (!hw->repdesc) { ++ SDL_SetError("%s: USB_GET_REPORT_DESC: %s", path, ++ strerror(errno)); ++ goto usberr; ++ } ++ rep = &hw->inreport; ++#if defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) ++ rep->rid = hid_get_report_id(fd); ++ if (rep->rid < 0) { ++#else ++ if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) { ++#endif ++ rep->rid = -1; // XXX ++ } ++ if (!report_alloc(rep, hw->repdesc, REPORT_INPUT)) { ++ goto usberr; ++ } ++ if (rep->size <= 0) { ++ SDL_SetError("%s: Input report descriptor has invalid length", ++ path); ++ goto usberr; ++ } ++#if defined(USBHID_NEW) || (defined(SDL_PLATFORM_FREEBSD) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) ++ hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid); ++#else *** 552 LINES SKIPPED ***