blob: e02da0c3589b02006b85b46592ff92b1e3fdaf9a [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 ??= ""
Patrick Williams213cb262021-08-07 19:21:33 -050022DEFAULTBACKEND: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
Patrick Williams213cb262021-08-07 19:21:33 -050027DEFAULTBACKEND: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
Andrew Geissler95ac1b82021-03-31 14:34:31 -050033 sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston
Andrew Geissler6ce62a22020-11-30 19:58:47 -060034 fi
Brad Bishopa34c0302019-09-23 22:34:48 -040035 install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini
Andrew Geissler82c905d2020-04-13 13:39:40 -050036 install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050037
Brad Bishopa34c0302019-09-23 22:34:48 -040038 # Install Weston systemd service and accompanying udev rule
Andrew Geissler6ce62a22020-11-30 19:58:47 -060039 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 Geisslerc9f78652020-09-18 14:11:35 -050041 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 Bishopa34c0302019-09-23 22:34:48 -040044 sed -i -e s:/etc:${sysconfdir}:g \
45 -e s:/usr/bin:${bindir}:g \
46 -e s:/var:${localstatedir}:g \
Andrew Geissler5199d832021-09-24 16:47:35 -050047 ${D}${systemd_system_unitdir}/weston.service
Patrick Williamsc0f7c042017-02-23 20:41:17 -060048 # 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 Geisslerc9f78652020-09-18 14:11:35 -050052 if [ -n "${DEFAULTBACKEND}" ]; then
53 sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini
54 fi
Andrew Geissler4c19ea12020-10-27 13:52:24 -050055
56 if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then
Andrew Geissler6ce62a22020-11-30 19:58:47 -060057 sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini
Andrew Geissler4c19ea12020-10-27 13:52:24 -050058 fi
Andrew Geissler6ce62a22020-11-30 19:58:47 -060059
60 install -dm 755 -o weston -g weston ${D}/home/weston
Andrew Geissler82c905d2020-04-13 13:39:40 -050061}
62
Andrew Geissler6ce62a22020-11-30 19:58:47 -060063INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}"
64
65inherit update-rc.d features_check systemd useradd
66
67USERADD_PACKAGES = "${PN}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050068
69# rdepends on weston which depends on virtual/egl
Andrew Geissler6ce62a22020-11-30 19:58:47 -060070# requires pam enabled if started via systemd
71REQUIRED_DISTRO_FEATURES = "opengl ${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', 'pam', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050072
Patrick Williams213cb262021-08-07 19:21:33 -050073RDEPENDS:${PN} = "weston kbd"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050074
75INITSCRIPT_NAME = "weston"
76INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050077
Patrick Williams213cb262021-08-07 19:21:33 -050078FILES:${PN} += "\
Andrew Geissler6ce62a22020-11-30 19:58:47 -060079 ${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 Bishopa34c0302019-09-23 22:34:48 -040086
Patrick Williams213cb262021-08-07 19:21:33 -050087CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston"
Brad Bishopa34c0302019-09-23 22:34:48 -040088
Patrick Williams213cb262021-08-07 19:21:33 -050089SYSTEMD_SERVICE:${PN} = "weston.service weston.socket"
90USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input weston"
91GROUPADD_PARAM:${PN} = "-r wayland"
Brad Bishopa34c0302019-09-23 22:34:48 -040092