core: remove linux support

The `mach.Core` API needs major design changes, and every backend that it supports
today must be updated to account for those API design changes. Unless someone is
actively maintaining and improving the state of a given backend, it slows down our
ability to make those critical changes.

Unfortunately, the backends for X11 and Wayland today are half-baked, nobody is
actively maintaining on or contributing to them, and the Linux CI tests have been
broken for over a month as a result which harms overall stability of Mach.

As a result, this PR removes Linux support from `mach.Core`

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-08-24 23:27:15 -07:00 committed by Stephen Gutekanst
parent 51e996db72
commit 17450fde65
5 changed files with 4 additions and 2237 deletions

View file

@ -102,40 +102,6 @@ pub fn build(b: *std.Build) !void {
if (want_examples) try buildExamples(b, optimize, target, module);
}
if (want_core) {
if (target.result.cpu.arch != .wasm32) {
// TODO: for some reason this is not functional, a Zig bug (only when using this Zig package
// externally):
//
// module.addCSourceFile(.{ .file = b.path("src/core/platform/wayland/wayland.c" });
//
// error: unable to check cache: stat file '/Volumes/data/hexops/mach-core-starter-project/zig-cache//Volumes/data/hexops/mach-core-starter-project/src/core/platform/wayland/wayland.c' failed: FileNotFound
//
// So instead we do this:
const lib = b.addStaticLibrary(.{
.name = "core-wayland",
.target = target,
.optimize = optimize,
});
lib.addCSourceFile(.{
.file = b.path("src/core/wayland/wayland.c"),
});
lib.linkLibC();
module.linkLibrary(lib);
if (b.lazyDependency("x11_headers", .{
.target = target,
.optimize = optimize,
})) |dep| {
module.linkLibrary(dep.artifact("x11-headers"));
lib.linkLibrary(dep.artifact("x11-headers"));
}
if (b.lazyDependency("wayland_headers", .{
.target = target,
.optimize = optimize,
})) |dep| {
module.linkLibrary(dep.artifact("wayland-headers"));
lib.linkLibrary(dep.artifact("wayland-headers"));
}
if (target.result.isDarwin()) {
if (b.lazyDependency("mach_objc", .{
.target = target,
@ -143,7 +109,6 @@ pub fn build(b: *std.Build) !void {
})) |dep| module.addImport("objc", dep.module("mach-objc"));
}
}
}
if (want_sysaudio) {
// Can build sysaudio examples if desired, then.
if (target.result.cpu.arch != .wasm32) {
@ -284,8 +249,6 @@ pub fn build(b: *std.Build) !void {
}
pub const Platform = enum {
x11,
wayland,
wasm,
win32,
darwin,
@ -295,7 +258,7 @@ pub const Platform = enum {
if (target.cpu.arch == .wasm32) return .wasm;
if (target.os.tag.isDarwin()) return .darwin;
if (target.os.tag == .windows) return .win32;
return .x11;
return .null;
}
};

View file

@ -13,8 +13,6 @@ pub const Timer = @import("core/Timer.zig");
const Frequency = @import("core/Frequency.zig");
pub const Platform = switch (build_options.core_platform) {
.x11 => @import("core/X11.zig"),
.wayland => @import("core/Wayland.zig"),
.wasm => @panic("TODO: support mach.Core WASM platform"),
.win32 => @import("core/win32.zig"),
.darwin => @import("core/Darwin.zig"),
@ -25,8 +23,6 @@ pub const Platform = switch (build_options.core_platform) {
// platform must take control and drive the main loop itself.
pub const supports_non_blocking = switch (build_options.core_platform) {
.win32 => true,
.x11 => true,
.wayland => true,
.wasm => false,
.darwin => false,
.null => false,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,7 +0,0 @@
#include "wayland-client-protocol-code.h"
#include "wayland-xdg-shell-client-protocol-code.h"
#include "wayland-xdg-decoration-client-protocol-code.h"
#include "wayland-viewporter-client-protocol-code.h"
#include "wayland-relative-pointer-unstable-v1-client-protocol-code.h"
#include "wayland-pointer-constraints-unstable-v1-client-protocol-code.h"
#include "wayland-idle-inhibit-unstable-v1-client-protocol-code.h"