blob: 65d7b81dc54d986e4ac4188ae26ad1b73c4aa2d0 [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001SUMMARY = "Startup script and systemd unit file for the Weston Wayland compositor"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002LICENSE = "MIT"
Brad Bishop6e60e8b2018-02-01 10:27:11 -05003LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004
Brad Bishopa34c0302019-09-23 22:34:48 -04005PACKAGE_ARCH = "${MACHINE_ARCH}"
6
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05007SRC_URI = "file://init \
Andrew Geissler82c905d2020-04-13 13:39:40 -05008 file://weston.env \
Brad Bishopa34c0302019-09-23 22:34:48 -04009 file://weston.ini \
Andrew Geissler6ce62a22020-11-30 19:58:47 -060010 file://weston.service \
11 file://weston.socket \
Andrew Geisslerc9f78652020-09-18 14:11:35 -050012 file://weston-autologin \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060013 file://weston-start"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014
15S = "${WORKDIR}"
16
Andrew Geissler4c19ea12020-10-27 13:52:24 -050017PACKAGECONFIG ??= ""
18
19PACKAGECONFIG[no-idle-timeout] = ",,"
20
Andrew Geisslerc9f78652020-09-18 14:11:35 -050021DEFAULTBACKEND ??= ""
22DEFAULTBACKEND_qemuall ?= "fbdev"
23DEFAULTBACKEND_qemuarm64 = "drm"
24DEFAULTBACKEND_qemux86 = "drm"
25DEFAULTBACKEND_qemux86-64 = "drm"
Andrew Geissler6ce62a22020-11-30 19:58:47 -060026# gallium swrast was found to crash weston on startup in x32 qemu
27DEFAULTBACKEND_qemux86-64_x86-x32 = "fbdev"
28DEFAULTBACKEND_x86-x32 = "fbdev"
Andrew Geisslerc9f78652020-09-18 14:11:35 -050029
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030do_install() {
Andrew Geissler6ce62a22020-11-30 19:58:47 -060031 if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then
32 install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
33 fi
Brad Bishopa34c0302019-09-23 22:34:48 -040034 install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini
Andrew Geissler82c905d2020-04-13 13:39:40 -050035 install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050036
Brad Bishopa34c0302019-09-23 22:34:48 -040037 # Install Weston systemd service and accompanying udev rule
Andrew Geissler6ce62a22020-11-30 19:58:47 -060038 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 Geisslerc9f78652020-09-18 14:11:35 -050040 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 Bishopa34c0302019-09-23 22:34:48 -040043 sed -i -e s:/etc:${sysconfdir}:g \
44 -e s:/usr/bin:${bindir}:g \
45 -e s:/var:${localstatedir}:g \
Andrew Geissler6ce62a22020-11-30 19:58:47 -060046 ${D}${systemd_unitdir}/system/weston.service
Patrick Williamsc0f7c042017-02-23 20:41:17 -060047 # 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 Geisslerc9f78652020-09-18 14:11:35 -050051 if [ -n "${DEFAULTBACKEND}" ]; then
52 sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini
53 fi
Andrew Geissler4c19ea12020-10-27 13:52:24 -050054
55 if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then
Andrew Geissler6ce62a22020-11-30 19:58:47 -060056 sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini
Andrew Geissler4c19ea12020-10-27 13:52:24 -050057 fi
Andrew Geissler6ce62a22020-11-30 19:58:47 -060058
59 install -dm 755 -o weston -g weston ${D}/home/weston
Andrew Geissler82c905d2020-04-13 13:39:40 -050060}
61
Andrew Geissler6ce62a22020-11-30 19:58:47 -060062INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}"
63
64inherit update-rc.d features_check systemd useradd
65
66USERADD_PACKAGES = "${PN}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050067
68# rdepends on weston which depends on virtual/egl
Andrew Geissler6ce62a22020-11-30 19:58:47 -060069# requires pam enabled if started via systemd
70REQUIRED_DISTRO_FEATURES = "opengl ${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', 'pam', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071
72RDEPENDS_${PN} = "weston kbd"
73
74INITSCRIPT_NAME = "weston"
75INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050076
Andrew Geissler6ce62a22020-11-30 19:58:47 -060077FILES_${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 Bishopa34c0302019-09-23 22:34:48 -040085
Andrew Geissler82c905d2020-04-13 13:39:40 -050086CONFFILES_${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston"
Brad Bishopa34c0302019-09-23 22:34:48 -040087
Andrew Geissler6ce62a22020-11-30 19:58:47 -060088SYSTEMD_SERVICE_${PN} = "weston.service weston.socket"
89USERADD_PARAM_${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input weston"
90GROUPADD_PARAM_${PN} = "-r wayland"
Brad Bishopa34c0302019-09-23 22:34:48 -040091