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 |
| 33 | fi |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 34 | 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] | 35 | install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 36 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 37 | # Install Weston systemd service and accompanying udev rule |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 38 | install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service |
| 39 | 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] | 40 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then |
| 41 | install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin |
| 42 | fi |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 43 | sed -i -e s:/etc:${sysconfdir}:g \ |
| 44 | -e s:/usr/bin:${bindir}:g \ |
| 45 | -e s:/var:${localstatedir}:g \ |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 46 | ${D}${systemd_unitdir}/system/weston.service |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 47 | # Install weston-start script |
| 48 | install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start |
| 49 | sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start |
| 50 | sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 51 | if [ -n "${DEFAULTBACKEND}" ]; then |
| 52 | sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini |
| 53 | fi |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 54 | |
| 55 | 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] | 56 | 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] | 57 | fi |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 58 | |
| 59 | install -dm 755 -o weston -g weston ${D}/home/weston |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 60 | } |
| 61 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 62 | INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}" |
| 63 | |
| 64 | inherit update-rc.d features_check systemd useradd |
| 65 | |
| 66 | USERADD_PACKAGES = "${PN}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 67 | |
| 68 | # rdepends on weston which depends on virtual/egl |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 69 | # requires pam enabled if started via systemd |
| 70 | 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] | 71 | |
| 72 | RDEPENDS_${PN} = "weston kbd" |
| 73 | |
| 74 | INITSCRIPT_NAME = "weston" |
| 75 | INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ." |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 76 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 77 | FILES_${PN} += "\ |
| 78 | ${sysconfdir}/xdg/weston/weston.ini \ |
| 79 | ${systemd_system_unitdir}/weston.service \ |
| 80 | ${systemd_system_unitdir}/weston.socket \ |
| 81 | ${sysconfdir}/default/weston \ |
| 82 | ${sysconfdir}/pam.d/ \ |
| 83 | /home/weston \ |
| 84 | " |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 85 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 86 | CONFFILES_${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston" |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 87 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 88 | SYSTEMD_SERVICE_${PN} = "weston.service weston.socket" |
| 89 | USERADD_PARAM_${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input weston" |
| 90 | GROUPADD_PARAM_${PN} = "-r wayland" |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 91 | |