Skip to content

Commit

Permalink
Incorporate FreeBSD port patches (libretro#16221)
Browse files Browse the repository at this point in the history
This commit imports a series of patches from the FreeBSD port of RetroArch to
improve build compatibility and address specific issues encountered in the
FreeBSD environment. These patches, sourced from the FreeBSD Ports collection
(https://cgit.freebsd.org/ports/tree/games/retroarch/files), have been adapted
and tested to ensure they integrate seamlessly with the current build process.
  • Loading branch information
ehaupt authored Sep 11, 2024
1 parent e61b3ae commit 7a0d568
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions gfx/common/wayland_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,13 @@ bool gfx_ctx_wl_get_metrics_common(void *data,
static int create_shm_file(off_t size)
{
int fd, ret;
#ifndef __FreeBSD__
if ((fd = syscall(SYS_memfd_create, SPLASH_SHM_NAME,
MFD_CLOEXEC | MFD_ALLOW_SEALING)) >= 0)
#else
if ((fd = memfd_create(SPLASH_SHM_NAME,
MFD_CLOEXEC | MFD_ALLOW_SEALING)) >= 0)
#endif
{
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK);

Expand Down
4 changes: 2 additions & 2 deletions input/input_keymaps.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#include "SDL.h"
#endif

#if defined(__linux__) || defined(HAVE_WAYLAND)
#if defined(__linux__) || defined(HAVE_WAYLAND) || defined(__FreeBSD__) && !defined(__PS4__)
#if defined(__linux__)
#include <linux/input.h>
#include <linux/kd.h>
Expand Down Expand Up @@ -1213,7 +1213,7 @@ const struct rarch_key_map rarch_key_map_x11[] = {
};
#endif

#if defined(__linux__) || defined(HAVE_WAYLAND)
#if defined(__linux__) || defined(HAVE_WAYLAND) || defined(__FreeBSD__) && !defined(__PS4__)
/* Note: Only one input can be mapped to each
* RETROK_* key. If several physical inputs
* correspond to the same key, these inputs
Expand Down
4 changes: 2 additions & 2 deletions libretro-common/features/features_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

#if defined(_XBOX360)
#include <PPCIntrinsics.h>
#elif !defined(__MACH__) && (defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__) || defined(__PPC64__) || defined(__powerpc64__))
#elif !defined(__MACH__) && !defined(__FreeBSD__) && (defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__) || defined(__PPC64__) || defined(__powerpc64__))
#ifndef _PPU_INTRINSICS_H
#include <ppu_intrinsics.h>
#endif
Expand Down Expand Up @@ -174,7 +174,7 @@ retro_perf_tick_t cpu_features_get_perf_counter(void)
time_ticks = (1000000 * tv_sec + tv_usec);
#elif defined(GEKKO)
time_ticks = gettime();
#elif !defined(__MACH__) && (defined(_XBOX360) || defined(__powerpc__) || defined(__ppc__) || defined(__POWERPC__) || defined(__PSL1GHT__) || defined(__PPC64__) || defined(__powerpc64__))
#elif !defined(__MACH__) && !defined(__FreeBSD__) && (defined(_XBOX360) || defined(__powerpc__) || defined(__ppc__) || defined(__POWERPC__) || defined(__PSL1GHT__) || defined(__PPC64__) || defined(__powerpc64__))
time_ticks = __mftb();
#elif (defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK > 0) || defined(__QNX__) || defined(ANDROID)
struct timespec tv;
Expand Down

0 comments on commit 7a0d568

Please sign in to comment.