blob: 6b78e6722ff7118a78e91209e71410ebbfcaebd1 [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
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 Geissler6ce62a22020-11-30 19:58:47 -060047 ${D}${systemd_unitdir}/system/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
73RDEPENDS_${PN} = "weston kbd"
74
75INITSCRIPT_NAME = "weston"
76INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050077
Andrew Geissler6ce62a22020-11-30 19:58:47 -060078FILES_${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 Bishopa34c0302019-09-23 22:34:48 -040086
Andrew Geissler82c905d2020-04-13 13:39:40 -050087CONFFILES_${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston"
Brad Bishopa34c0302019-09-23 22:34:48 -040088
Andrew Geissler6ce62a22020-11-30 19:58:47 -060089SYSTEMD_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