Weston: switch on/off display during runtime

Hello @stefan_e.tx,

I am completely new to meson, but with your help and an additional configuration parameter for meson (EXTRA_OEMESON) I got it working.

My recipe weston-kiosk-shell-dpms now looks as follow:

DESCRITPTION = "Module for Weston compositor kiosk shell providing DPMS functionality"
HOMEPAGE = "https://github.com/akhilharihar/Weston-kiosk-shell-DPMS"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=4b8ef887b5d26d4b038225869bda92d3"

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

SRCREV = "5cf171084c02b468c40777c22243925fd900dc66"
PV = "0.2+git${SRCPV}"
SRC_URI  = "git://github.com/akhilharihar/Weston-kiosk-shell-DPMS;branch=main;protocol=https"
SRC_URI += "file://weston-kiosk-shell-dpms.patch"
S = "${WORKDIR}/git"

inherit meson pkgconfig

DEPENDS = "weston wayland-native"

EXTRA_OEMESON += "--prefix=${STAGING_DIR_TARGET}/usr"

do_install() {
	install -d ${D}/${bindir_native}
	install -m 0755 dpms-client	${D}/${bindir_native}

	install -d ${D}/${libdir_native}/weston
	install -m 0755 kiosk-shell-dpms.so ${D}${libdir_native}/weston
}

FILES:${PN} += "\
	${bindir_native}/* \
	${libdir_native}/weston/* \
"

The patch for the meson.build:

index f1fb908..cae3ee9 100644
--- a/meson.build
+++ b/meson.build
@@ -10,7 +10,10 @@ libweston_version = 10
 dir_prefix = get_option('prefix')
 dir_lib = dir_prefix / get_option('libdir')
 dir_module_weston = dir_lib / 'weston'
-dir_system_include = '/usr/include'
+dir_system_include = dir_prefix / get_option('includedir')
+if dir_system_include == ''
+  dir_system_include = '/usr/include'
+endif
 
 weston = dependency('libweston-@0@'.format(libweston_version), method: 'pkg-config')
 wayland_server = dependency('wayland-server', method: 'pkg-config')

I’ve tested it on my system and it works :slight_smile: Thank you very much for your help!

I just have one more question:
To activate the weston extension when building the image I added the following to my image recipe

weston_kiosk_shell_dpms_modify_ini() {
    echo "$(awk '{print} /[core]/ && !x {print "shell=kiosk-shell.so"; x=1}' ${IMAGE_ROOTFS}${sysconfdir}/xdg/weston/weston.ini)" > ${IMAGE_ROOTFS}${sysconfdir}/xdg/weston/weston.ini
    echo "$(awk '/^modules=/ && !x {$0=$0",kiosk-shell-dpms.so"; x=1} 1' ${IMAGE_ROOTFS}${sysconfdir}/xdg/weston/weston.ini)" > ${IMAGE_ROOTFS}${sysconfdir}/xdg/weston/weston.ini
}
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_INSTALL", "weston-kiosk-shell-dpms", "weston_kiosk_shell_dpms_modify_ini; ", "", d)}'

Is there a more elegant way to modify the weston.ini? It would be best to do it directly in the recipe of the extension.

Best regards,
Markus