Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Godot compile on FreeBSD #100047

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/camera/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
def can_build(env, platform):
import sys

if sys.platform.startswith("freebsd"):
return False
return platform == "macos" or platform == "windows" or platform == "linuxbsd"


Expand Down
6 changes: 5 additions & 1 deletion modules/openxr/SCsub
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *

import sys

Import("env")
Import("env_modules")

Expand Down Expand Up @@ -29,7 +31,9 @@ elif env["platform"] == "linuxbsd":
env_openxr.AppendUnique(CPPDEFINES=["XR_USE_PLATFORM_EGL"])

# FIXME: Review what needs to be set for Android and macOS.
env_openxr.AppendUnique(CPPDEFINES=["HAVE_SECURE_GETENV"])
# FreeBSD uses non-standard getenv functions.
if not sys.platform.startswith("freebsd"):
env_openxr.AppendUnique(CPPDEFINES=["HAVE_SECURE_GETENV"])
elif env["platform"] == "windows":
env_openxr.AppendUnique(CPPDEFINES=["XR_OS_WINDOWS", "NOMINMAX", "XR_USE_PLATFORM_WIN32"])
elif env["platform"] == "macos":
Expand Down
6 changes: 5 additions & 1 deletion platform/linuxbsd/wayland/wayland_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@

#ifdef WAYLAND_ENABLED

// FIXME: Does this cause issues with *BSDs?
#ifdef __FreeBSD__
#include <dev/evdev/input-event-codes.h>
#else
// Assume Linux.
#include <linux/input-event-codes.h>
#endif

// For the actual polling thread.
#include <poll.h>
Expand Down
4 changes: 4 additions & 0 deletions thirdparty/linuxbsd_headers/alsa/asoundlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@
#include <poll.h>
#include <errno.h>
#include <stdarg.h>
#ifdef __FreeBSD__
#include <sys/endian.h>
#else
#include <endian.h>
#endif // __FreeBSD__

#ifndef __GNUC__
#define __inline__ inline
Expand Down
16 changes: 16 additions & 0 deletions thirdparty/linuxbsd_headers/alsa/patches/freebsd_endian.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/thirdparty/linuxbsd_headers/alsa/asoundlib.h b/thirdparty/linuxbsd_headers/alsa/asoundlib.h
index a546194382..598175403c 100644
--- a/thirdparty/linuxbsd_headers/alsa/asoundlib.h
+++ b/thirdparty/linuxbsd_headers/alsa/asoundlib.h
@@ -38,7 +38,11 @@
#include <poll.h>
#include <errno.h>
#include <stdarg.h>
+#ifdef __FreeBSD__
+#include <sys/endian.h>
+#else
#include <endian.h>
+#endif // __FreeBSD__

#ifndef __GNUC__
#define __inline__ inline