dynamically load wayland and its dependencies, fix warnings

This commit is contained in:
IoI_xD 2026-03-24 17:38:21 -07:00
commit 47746ff30e
5 changed files with 522 additions and 74 deletions

View file

@ -29,13 +29,12 @@ if (grep(/^gdi$/, @backends)) {
if (grep(/^wayland$/, @backends)) {
add_cflags("-DUSE_WAYLAND");
new_object("src/backend/wayland.c");
add_cflags(`pkg-config --cflags cairo wayland-client xkbcommon`);
add_libs(`pkg-config --libs cairo wayland-client xkbcommon`);
if (param_get("opengl")) {
add_libs(`pkg-config --libs egl wayland-egl`);
add_cflags("-DWAYLAND_LOAD_OPENGL");
}
scan_wayland_protocol_core();
scan_wayland_protocol("stable", "xdg-shell", "");
scan_wayland_protocol("stable", "viewporter", "");
scan_wayland_protocol("stable", "tablet", "-v2");

View file

@ -58,6 +58,35 @@ sub use_backend {
}
}
sub scan_wayland_protocol_core {
my $proto_c = "src/backend/wayland-core-protocol.c";
if (
system(
"wayland-scanner private-code /usr/share/wayland/wayland.xml ${proto_c}"
) != 0
)
{
print(
"^ Error on getting private code for /usr/share/wayland/wayland.xml\n"
);
}
else {
new_object($proto_c);
}
if (
system(
"wayland-scanner client-header /usr/share/wayland/wayland.xml include/Mw/LowLevel/Wayland/wayland-core-protocol.h"
)
)
{
print(
"^ Error on getting client header for /usr/share/wayland/wayland.xml\n"
);
}
}
sub scan_wayland_protocol {
my $tier = $_[0];
my $proto = $_[1];