Skip to content

Commit

Permalink
Enable PipeWire
Browse files Browse the repository at this point in the history
  • Loading branch information
jwillikers committed Mar 12, 2024
1 parent 41c25f8 commit 9ada229
Showing 1 changed file with 95 additions and 46 deletions.
141 changes: 95 additions & 46 deletions recipes/weston/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ def configure(self):
):
self.options.renderer_gl = True

if self.options.backend_drm and self.options.backend_drm_screencast_vaapi:
self.options["libva"].with_drm = True

if self._requires_mesa_gbm:
self.options["mesa"].gbm = True

Expand All @@ -140,30 +143,25 @@ def configure(self):
self.options["libglvnd"].gles2 = True
self.options["libinput"].with_libudev = self.options.with_libudev
self.options["pango"].with_cairo = True
self.options["xkbcommon"].with_wayland = True

def layout(self):
basic_layout(self, src_folder="src")

def requirements(self):
self.requires("cairo/1.18.0")
self.requires("fontconfig/2.15.0", force=True)
self.requires("fontconfig/2.15.0")
self.requires("libevdev/1.13.1")
self.requires("libdrm/2.4.120", force=True)
self.requires("libdrm/2.4.119")
self.requires("libglvnd/1.7.0")
self.requires("libinput/1.25.0")
self.requires("libpng/1.6.43", force=True)
self.requires("pixman/0.43.0", transitive_headers=True, force=True)
# todo requires pangocairo from pango
self.requires("libpng/[>=1.6 <2]")
self.requires("pixman/0.42.2", transitive_headers=True)
self.requires("pango/1.51.0")
self.requires("wayland/1.22.0", transitive_headers=True)
self.requires("xkbcommon/1.6.0", transitive_headers=True)

# Not a direct dep, but need to override:
self.requires("expat/2.6.0", override=True)

if self.options.with_glib:
self.requires("glib/2.78.3", force=True)
self.requires("glib/2.78.1")

if self.options.backend_x11:
self.requires("xorg/system")
Expand Down Expand Up @@ -193,19 +191,15 @@ def requirements(self):
if self._requires_pam and self.options.get_safe("with_pam") == "openpam":
self.requires("openpam/20190224")

# todo libudev
if self.options.with_libudev == "systemd":
# todo Use libudev from the libsystemd package.
# self.requires("libsystemd/255.2")
self.requires("libudev/system")
pass
elif self.options.with_libudev == "eudev":
self.requires("eudev/3.2.12")
self.requires("eudev/3.2.14")

if self.options.backend_drm:
self.requires("libdisplay-info/0.1.1")
self.requires("libseat/0.8.0")
# Requires libgbm
# Requires mesa for libgbm
if self.options.renderer_gl:
self.requires("mesa/24.0.2")
if self.options.backend_drm_screencast_vaapi:
Expand All @@ -214,18 +208,17 @@ def requirements(self):
if self.options.with_lcms:
self.requires("lcms/2.16")
if self.options.with_systemd:
self.requires("libsystemd/255.2", force=True)

self.requires("linux-headers-generic/6.5.9", override=True)
self.requires("libselinux/3.5", override=True)
self.requires("libxml2/2.11.6", override=True)
self.requires("libmount/2.39.2", override=True)
self.requires("xz_utils/5.4.5", override=True)
self.requires("libsystemd/255.2")

def validate(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration(f"{self.ref} only supports Linux")

if not self.dependencies["pango"].options.with_cairo:
raise ConanInvalidConfiguration(
f"{self.name} requires the with_cairo option of the pango package to be enabled"
)

if self.options.simple_client_im and not self.options.with_glib:
raise ConanInvalidConfiguration(
"The simple_client_im option requires the with_glib option to be enabled"
Expand Down Expand Up @@ -264,21 +257,21 @@ def validate(self):
"The remoting and pipewire options require the renderer_gl option to be enabled"
)

if not self.dependencies["xkbcommon"].options.with_wayland:
if self.options.backend_drm and self.options.backend_drm_screencast_vaapi and not self.dependencies["libva"].options.with_drm:
raise ConanInvalidConfiguration(
"The with_wayland option of the xkbcommon package must be enabled"
f"{self.name} requires the with_drm option of the libva package to be enabled when the backend_drm and backend_drm_screencast_vaapi options are enabled"
)

# Unsupported due to missing Conan dependencies:
if self.options.remoting:
raise ConanInvalidConfiguration("The remoting option is not yet supported")
if self.options.backend_rdp:
raise ConanInvalidConfiguration(
"The backend_rdp option is not yet supported"
"The backend_rdp option is not yet supported. Contributions welcome."
)
if self.options.backend_vnc:
raise ConanInvalidConfiguration(
"The backend_vnc option is not yet supported"
"The backend_vnc option is not yet supported. Contributions welcome."
)

def build_requirements(self):
Expand Down Expand Up @@ -384,24 +377,6 @@ def _patch_sources(self):
"subdir('man')",
"#subdir('man')",
)
replace_in_file(
self,
os.path.join(self.source_folder, "clients", "meson.build"),
"dependency('libudev', version: '>= 136')",
"dependency('libudev')",
)
replace_in_file(
self,
os.path.join(self.source_folder, "libweston", "meson.build"),
"dependency('libudev', version: '>= 136')",
"dependency('libudev')",
)
replace_in_file(
self,
os.path.join(self.source_folder, "libweston", "backend-drm", "meson.build"),
"dependency('libudev', version: '>= 136')",
"dependency('libudev')",
)
if self._has_build_profile:
# Patch the build system to use the pkg-config files generated for the build context.
replace_in_file(
Expand Down Expand Up @@ -518,7 +493,9 @@ def package_info(self):
]
)
if self.options.backend_drm_screencast_vaapi:
self.cpp_info.components["libweston"].requires.append("libva::libva")
self.cpp_info.components["libweston"].requires.extend(["libva::libva_", "libva::libva-drm"])
if self.options.backend_pipewire or self.options.pipewire:
self.cpp_info.components["libweston"].requires.append("pipewire::libpipewire")
if self.options.renderer_gl:
self.cpp_info.components["libweston"].requires.extend(
["libglvnd::egl", "libglvnd::gles2"]
Expand All @@ -534,3 +511,75 @@ def package_info(self):
if self._requires_mesa_gbm:
self.cpp_info.components["libweston"].requires.append("mesa::gbm")
self.cpp_info.components["libweston"].system_libs = ["dl", "m"]

self.runenv_info.prepend_path("WESTON_DATA_DIR", os.path.join(self.package_folder, "res", "weston"))

module_map = {}
bin_dir = os.path.join(self.package_folder, "bin")
weston_module_dir = os.path.join(self.package_folder, "lib", "weston")
libweston_module_dir = os.path.join(self.package_folder, "lib", f"libweston-{major_version}")
plugin_dir = os.path.join(self.package_folder, "bin", "plugin")

if self.options.backend_drm:
module_map["drm-backend.so"] = libweston_module_dir

if self.options.backend_headless:
module_map["headless-backend.so"] = libweston_module_dir

if self.options.backend_pipewire:
module_map["pipewire-backend.so"] = libweston_module_dir

if self.options.backend_rdp:
module_map["rdp-backend.so"] = libweston_module_dir

if self.options.backend_vnc:
module_map["vnc-backend.so"] = libweston_module_dir

if self.options.backend_wayland:
module_map["wayland-backend.so"] = libweston_module_dir

if self.options.backend_x11:
module_map["x11-backend.so"] = libweston_module_dir

if self.options.with_lcms:
module_map["color-lcms.so"] = libweston_module_dir

if self.options.renderer_gl:
module_map["gl-renderer.so"] = libweston_module_dir

if self.options.pipewire:
module_map["pipewire-plugin.so"] = libweston_module_dir

if self.options.remoting:
module_map["remoting-plugin.so"] = libweston_module_dir

if self.options.shell_desktop:
module_map["desktop-shell.so"] = weston_module_dir
module_map["weston-desktop-shell"] = plugin_dir
module_map["weston-keyboard"] = plugin_dir

if self.options.shell_desktop or self.options.shell_fullscreen or self.options.shell_kiosk or self.options.shell_ivi:
module_map["weston-screenshooter"] = bin_dir

if self.options.shell_ivi:
module_map["ivi-shell.so"] = weston_module_dir
module_map["hmi-controller.so"] = weston_module_dir
module_map["weston-ivi-shell-user-interface"] = plugin_dir

if self.options.shell_kiosk:
module_map["kiosk-shell.so"] = weston_module_dir

if self.options.screenshare:
module_map["screen-share.so"] = weston_module_dir

if self.options.with_systemd:
module_map["systemd-notify.so"] = weston_module_dir

# if self.options.xwayland:
# module_map["xwayland.so"] = libweston_module_dir

modules = str()
for module, directory in module_map.items():
modules += module + "=" + os.path.join(directory, module) + ";"

self.runenv_info.prepend("WESTON_MODULE_MAP", modules)

0 comments on commit 9ada229

Please sign in to comment.