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

FreeBSD support (part one: preparation) #652

Open
danfe opened this issue Dec 14, 2021 · 3 comments
Open

FreeBSD support (part one: preparation) #652

danfe opened this issue Dec 14, 2021 · 3 comments

Comments

@danfe
Copy link

danfe commented Dec 14, 2021

MangoHud works fine on FreeBSD, but currently requires some patching in order to do so. I'd like to upstream some of them, starting with more generic ones. Consider the following patch:
Rationale:

  • FreeBSD is definitely Unixy :-)
  • popen(3) is POSIX call, limiting it to GNU/Linux is wrong
  • Same applies to standard header files
--- meson.build.orig
+++ meson.build
@@ -31,7 +31,7 @@
 
 # TODO: this is very incomplete
 is_unixy = false
-if ['linux', 'cygwin', 'gnu'].contains(host_machine.system())
+if ['linux', 'cygwin', 'gnu', 'freebsd'].contains(host_machine.system())
   pre_args += '-D_GNU_SOURCE'
   pre_args += '-DHAVE_PTHREAD'
   is_unixy = true
--- src/logging.cpp.orig
+++ src/logging.cpp
@@ -16,7 +16,7 @@
 string exec(string command) {
    char buffer[128];
    string result = "";
-#ifdef __gnu_linux__
+#ifndef _WIN32
 
    // Open pipe to file
    FILE* pipe = popen(command.c_str(), "r");
--- src/vulkan.cpp.orig
+++ src/vulkan.cpp
@@ -33,7 +33,7 @@
 #include <vector>
 #include <list>
 #include <array>
-#ifdef __gnu_linux__
+#ifndef _WIN32
 #include <libgen.h>
 #include <unistd.h>
 #endif
@flightlessmango
Copy link
Owner

This might be better rather than just accepting everything that isn't windows?

#if defined(__gnu_linux__) || defined(__FreeBSD__)

@danfe
Copy link
Author

danfe commented Dec 14, 2021

Also fine, I guess. Personally I prefer to avoid enumerating systems where something is supported, because e.g. tomorrow OpenBSD or Haiku hacker comes, and then you have to extend that list again. On the contrary, chances for native popen(3) to appear on Win32 are much lower. But as I say, it's ultimately your code and your call.

@flightlessmango
Copy link
Owner

I agree, it's better to use WIN32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants