weston-init.bb 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. SUMMARY = "Startup script and systemd unit file for the Weston Wayland compositor"
  2. LICENSE = "MIT"
  3. LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
  4. PACKAGE_ARCH = "${MACHINE_ARCH}"
  5. SRC_URI = "file://init \
  6. file://weston.env \
  7. file://weston.ini \
  8. file://weston.service \
  9. file://weston.socket \
  10. file://weston-socket.sh \
  11. file://weston-autologin \
  12. file://weston-start"
  13. S = "${UNPACKDIR}"
  14. PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xwayland', '', d)}"
  15. PACKAGECONFIG:append:qemuriscv64 = " use-pixman"
  16. PACKAGECONFIG:append:qemuppc64 = " use-pixman"
  17. PACKAGECONFIG[xwayland] = ",,"
  18. PACKAGECONFIG[no-idle-timeout] = ",,"
  19. PACKAGECONFIG[use-pixman] = ",,"
  20. DEFAULTBACKEND ??= ""
  21. DEFAULTBACKEND:qemuall ?= "drm"
  22. WESTON_USER ??= "weston"
  23. WESTON_USER_HOME ??= "/home/${WESTON_USER}"
  24. do_install() {
  25. # Install weston-start script
  26. if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then
  27. install -Dm755 ${S}/weston-start ${D}${bindir}/weston-start
  28. sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start
  29. sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start
  30. install -Dm755 ${S}/init ${D}/${sysconfdir}/init.d/weston
  31. sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston
  32. fi
  33. # Install Weston systemd service
  34. if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
  35. install -D -p -m0644 ${S}/weston.service ${D}${systemd_system_unitdir}/weston.service
  36. install -D -p -m0644 ${S}/weston.socket ${D}${systemd_system_unitdir}/weston.socket
  37. install -D -p -m0644 ${S}/weston-socket.sh ${D}${sysconfdir}/profile.d/weston-socket.sh
  38. sed -i -e s:@sysconfdir@:${sysconfdir}:g \
  39. -e s:@bindir@:${bindir}:g \
  40. -e s:@localstatedir@:${localstatedir}:g \
  41. -e s:@runtimedir@:${runtimedir}:g \
  42. -e s:@WESTON_USER@:${WESTON_USER}:g \
  43. -e s:@WESTON_USER_HOME@:${WESTON_USER_HOME}:g \
  44. ${D}${systemd_system_unitdir}/weston.service \
  45. ${D}${systemd_system_unitdir}/weston.socket \
  46. ${D}${sysconfdir}/profile.d/weston-socket.sh
  47. fi
  48. if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
  49. install -D -p -m0644 ${S}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin
  50. fi
  51. install -D -p -m0644 ${S}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini
  52. install -Dm644 ${S}/weston.env ${D}${sysconfdir}/default/weston
  53. if [ -n "${DEFAULTBACKEND}" ]; then
  54. sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini
  55. fi
  56. if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then
  57. sed -i -e "/^\[core\]/a xwayland=true" ${D}${sysconfdir}/xdg/weston/weston.ini
  58. fi
  59. if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then
  60. sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini
  61. fi
  62. if [ "${@bb.utils.contains('PACKAGECONFIG', 'use-pixman', 'yes', 'no', d)}" = "yes" ]; then
  63. sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini
  64. fi
  65. install -dm 755 -o ${WESTON_USER} -g ${WESTON_USER} ${D}/${WESTON_USER_HOME}
  66. }
  67. INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}"
  68. inherit update-rc.d systemd useradd
  69. USERADD_PACKAGES = "${PN}"
  70. # rdepends on weston which depends on virtual/egl
  71. #
  72. require ${THISDIR}/required-distro-features.inc
  73. RDEPENDS:${PN} = "weston kbd ${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'weston-xwayland', '', d)}"
  74. INITSCRIPT_NAME = "weston"
  75. INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
  76. FILES:${PN} += "\
  77. ${sysconfdir}/xdg/weston/weston.ini \
  78. ${sysconfdir}/profile.d/weston-socket.sh \
  79. ${systemd_system_unitdir}/weston.service \
  80. ${systemd_system_unitdir}/weston.socket \
  81. ${sysconfdir}/default/weston \
  82. ${sysconfdir}/pam.d/ \
  83. ${WESTON_USER_HOME} \
  84. "
  85. CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston"
  86. SYSTEMD_SERVICE:${PN} = "weston.service weston.socket"
  87. USERADD_PARAM:${PN} = "--home ${WESTON_USER_HOME} --shell /bin/sh --user-group -G video,input,render,seat,wayland ${WESTON_USER}"
  88. GROUPADD_PARAM:${PN} = "-r wayland; -r render; -r seat"