Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | SUMMARY = "Startup script and systemd unit file for the Weston Wayland compositor" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 2 | LICENSE = "MIT" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 4 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 5 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 6 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 7 | SRC_URI = "file://init \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 8 | file://weston.env \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 9 | file://weston.ini \ |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 10 | file://weston.service \ |
| 11 | file://weston.socket \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 12 | file://weston-autologin \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 13 | file://weston-start" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | |
| 15 | S = "${WORKDIR}" |
| 16 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 17 | PACKAGECONFIG ??= "" |
| 18 | |
| 19 | PACKAGECONFIG[no-idle-timeout] = ",," |
| 20 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 21 | DEFAULTBACKEND ??= "" |
| 22 | DEFAULTBACKEND_qemuall ?= "fbdev" |
| 23 | DEFAULTBACKEND_qemuarm64 = "drm" |
| 24 | DEFAULTBACKEND_qemux86 = "drm" |
| 25 | DEFAULTBACKEND_qemux86-64 = "drm" |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 26 | # gallium swrast was found to crash weston on startup in x32 qemu |
| 27 | DEFAULTBACKEND_qemux86-64_x86-x32 = "fbdev" |
| 28 | DEFAULTBACKEND_x86-x32 = "fbdev" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 29 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | do_install() { |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 31 | if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then |
| 32 | install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame^] | 33 | sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 34 | fi |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 35 | install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 36 | install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 37 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 38 | # Install Weston systemd service and accompanying udev rule |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 39 | install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service |
| 40 | install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 41 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then |
| 42 | install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin |
| 43 | fi |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 44 | sed -i -e s:/etc:${sysconfdir}:g \ |
| 45 | -e s:/usr/bin:${bindir}:g \ |
| 46 | -e s:/var:${localstatedir}:g \ |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 47 | ${D}${systemd_unitdir}/system/weston.service |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 48 | # Install weston-start script |
| 49 | install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start |
| 50 | sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start |
| 51 | sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 52 | if [ -n "${DEFAULTBACKEND}" ]; then |
| 53 | sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini |
| 54 | fi |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 55 | |
| 56 | if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 57 | sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 58 | fi |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 59 | |
| 60 | install -dm 755 -o weston -g weston ${D}/home/weston |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 61 | } |
| 62 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 63 | INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}" |
| 64 | |
| 65 | inherit update-rc.d features_check systemd useradd |
| 66 | |
| 67 | USERADD_PACKAGES = "${PN}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 68 | |
| 69 | # rdepends on weston which depends on virtual/egl |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 70 | # requires pam enabled if started via systemd |
| 71 | REQUIRED_DISTRO_FEATURES = "opengl ${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', 'pam', '', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 72 | |
| 73 | RDEPENDS_${PN} = "weston kbd" |
| 74 | |
| 75 | INITSCRIPT_NAME = "weston" |
| 76 | INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ." |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 77 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 78 | FILES_${PN} += "\ |
| 79 | ${sysconfdir}/xdg/weston/weston.ini \ |
| 80 | ${systemd_system_unitdir}/weston.service \ |
| 81 | ${systemd_system_unitdir}/weston.socket \ |
| 82 | ${sysconfdir}/default/weston \ |
| 83 | ${sysconfdir}/pam.d/ \ |
| 84 | /home/weston \ |
| 85 | " |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 86 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 87 | CONFFILES_${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston" |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 88 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 89 | SYSTEMD_SERVICE_${PN} = "weston.service weston.socket" |
| 90 | USERADD_PARAM_${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input weston" |
| 91 | GROUPADD_PARAM_${PN} = "-r wayland" |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 92 | |