-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Rename x11 platform to 'linuxbsd' #27266
Conversation
Sorry about the noise while I sorted out Travis issues. This should be ready for review. |
Why is the new platform not called POSIX? Isn't that what it is programmed against? Unix is after all trademarked :-) (edit) Also: What's the plan for Linux specific code? |
Well, POSIX doesn't specify a display server like x11 or Wayland. Other code here, like power stuff, crash handler, etc, aren't specified by POSIX.
|
It's actually worse - this is a glibc-specific way of getting the stack trace. See this ticket: I imagine that in the long run we should use feature detection at build-time to enable or disable specific implementations of this sort of thing. Or we could use runtime guesswork like we do in PowerUnix - which could easily be adapted for e.g. BSD in the future. I think that needn't be solved in this particular patch, though. |
Yeah the crash handler aspect has always been tough to figure out. I'd have to check out a recent version of Google's breakpad to look at what they're doing now. Maybe they have a better abstraction? edit: While I haven't looked into it in a while, I thought breakpad also used SCons, so we might just take inspiration from them in case they already have feature detection code for this kinda stuff. |
imo the crash handler is nice-to-have at best - loading up a core dump is going to give you more useful information and tools to work with anyway. I used to have crash handlers in my programs but eventually removed them. Do you think solving this problem is a blocker for this patch? |
Oh I am in no position to actually decide any of that heh. I was just wondering whether you had a concept for handling sub-platform specific code in generic_unix, such as this crash handler. |
As the need for that grows, we can start writing some |
I much prefer the name Neither Linux nor BSD are certified Unix, but Mac, Solaris, AIX, FTX, UnixWare, HP-UX, z/OS, K-UX are. It is very misleading to make the name containing "unix" when it doesn't actually run on any of those. |
Calling it linuxbsd would be misleading as well, and doesn't describe it for what it is either. I don't see any reason why any of the code here wouldn't run on Minix, OpenSolaris, macOS, Cygwin, or any of several more niche systems. No one takes Unix certification seriously, and none of the code here depends on the niche Unix features which are unique to certified Unicies. "Generic Unix" is used all over the internet to refer to generic Unix-like systems, for which Linux and BSD certainly qualify. That being said, we don't need to bikeshed this to death. If you insist on a particular name I'll update the patch to use it. |
The final decision is not mine, it will probably be @akien-mga 's. |
I'll just add here that I've seen users on forums be confused about what build to download for linux before because of the x11 naming. Not sure how much better calling it generic unix is going to be but I expect it to be at least an improvement. |
I checked the code real quick and it looks good. Didn't check every singe function tough, but the general idea of separating the DisplayDriver implementations by using inheritance is good Imo. |
I don't think it is misleading because it is meant to run on Linux and *BSD. While it could run on other systems, it's not meant to, so you expect to experience incompatibilities. In any case, I think that opening a PR (worse: many PRs) just to decide a naming convention is a waste of time. We should discuss on an issue until we reach a conclusion and then change the code for good. No use making the same changes for each name suggestion, just to later discard all the rejected ones. |
What part of this is only meant to run on Linux or *BSD? Only some of the code is Linux-specific and is optional. The code will compile and run on any POSIX system with an X11 server.
That's not what this PR is for. This PR also includes a considerable amount of cleanup from the previous WIP PR, which was not in a mergable state. |
Compiled with both llvm and gnu and didn't find any regression in my game. About the name, does posix_freedesktop describe the abstractions that were made? |
No. POSIX would be more appropriate for I'd sooner have linuxbsd than freedesktop, but both are wrong. |
You can build and run X11 version of Godot on macOS (with exception of webm/webp modules, but these two fail on any "non-standard" configuration) by setting pkg-config search path to XQuartz location, and applying following minimal patch. Patchdiff --git a/platform/x11/detect.py b/platform/x11/detect.py
index b5ad59e60..1439adddb 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -14,7 +14,7 @@ def get_name():
def can_build():
- if (os.name != "posix" or sys.platform == "darwin"):
+ if (os.name != "posix"):
return False
# Check the minimal dependencies
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index 9e6011ddf..21a2a6b6a 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/platform_config.h
@@ -28,9 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef __linux__
+#if defined (__linux__) || defined(__APPLE__)
#include <alloca.h>
#endif
+#if defined(__APPLE__)
+#define PTHREAD_RENAME_SELF
+#endif
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#include <stdlib.h>
#define PTHREAD_BSD_SET_NAME |
IMO, "LinuxBSD" ( "LinuxBSD" is clear for end users and contributors that this is the platform code for Linux and *BSD. It can of course be made to support other Unixes, and those will have to do with being labelled wrongly, but that's not a big deal IMO. We already have a I'm fine with using "Freedesktop" if we really want to have an accurate-ish common denominator for all the platforms supported by this port, since the code in this port is mainly limited to Freedesktop (and XDG) related code. The Unix specific code lives in another place ( AFAICT "Freedesktop" and "LinuxBSD" are the only two names that core developers are somewhat OK with, so I'll just make a mini poll in the next comments. Add a 👍 to the name you prefer. Note: Whatever name we settle on, keep it mind that it will only be relevant in the port's code and the name of the
|
If you favor the "LinuxBSD" ( |
If you favor the "Freedesktop" ( |
Nice work! This now simply improves the platform name with limited risk and no architectural changes. I hope it can move forward so we can start looking at #27747, which builds on top of it. Edit: By the way, as the commit message indicates |
@@ -1,5 +1,5 @@ | |||
/*************************************************************************/ | |||
/* power_x11.cpp */ | |||
/* power_linuxbsd.cpp */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this code even works on BSDs. FreeBSD only has /proc for Linux compatibility iirc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weather it works or not, it is used on all X11 platforms (as the old name suggests). Therefor, I think this is an appropriate name. The more accurate name, PowerLinuxAndAlsoBSDAlthoughItsProbablyBrokenThere
Just doesn't have the same ring to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It:
- Works on non-X11 displays, like Wayland
- Doesn't break on BSD
- Is already somewhat generic and adding BSD support would be easy
So I agree with @wmww that the name here is right.
It should be noted in the changelog that this is a compatibility-breaking change, as the feature tag will no longer be |
Changelog updated, though the OS name change was rolled back per @hpvb's suggestion. |
@ddevault I didn't mean you should add it to |
Rebased against the latest master and addressed merge conflicts. |
Also renames OS_X11 to OS_LinuxBSD, and a few other similar changes.
@ddevault You will need to rebase this very often, as this code changes often. The milestone has also been changed to 4.0 so it won't be merged until after 3.2. Still, I suggest rebasing often to avoid bigger monolithic rebases later and to continually test this. |
I kept up with it for a while but without any feedback or estimate of when it'll be reviewed, it's not worth my time to keep it up-to-date. I'd be happy to rebase it once it starts receiving feedback. |
platform->set_debug_32("linuxbsd_32_debug"); | ||
platform->set_release_64("linuxbsd_64_release"); | ||
platform->set_debug_64("linuxbsd_64_debug"); | ||
platform->set_os_name("Unix"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just confirming. OS name is gonna be "Unix" and not "Linux/BSD"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. linuxbsd
on account of there already being a unix
OS (that includes MacOS)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So line 54 will be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
|
||
# Alias "linux" and "bsd" to "linuxbsd" | ||
if selected_platform == 'linux' or selected_platform == 'bsd': | ||
selected_platform = 'linuxbsd' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also alias "x11" to "linuxbsd" so that exiting build scripts continue to work.
Superseded by #37317, but thanks for the contribution nevertheless! |
Also renames OS_X11 to OS_LinuxBSD, and a few other similar changes.