weston-init: Use the same config file from weston
[AGL/meta-agl.git] / meta-agl-profile-graphical / recipes-graphics / wayland / weston-init.bbappend
1 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3 inherit agl-graphical
4
5 WESTONSTART ??= "${@bb.utils.contains("DISTRO_FEATURES", "agl-compositor", "/usr/bin/agl-compositor", "/usr/bin/weston",d)} ${WESTONARGS}"
6 WESTONSTART_append = " ${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", " --log=${DISPLAY_XDG_RUNTIME_DIR}/weston.log", "",d)}"
7 WESTONSTART_append = " ${@bb.utils.contains("DISTRO_FEATURES", "agl-compositor", " --config ${sysconfdir}/xdg/weston/weston.ini", "",d)}"
8
9 WIFILES = " \
10     file://weston.conf.in \
11     file://tmpfiles.conf.in \
12     file://zz-dri.rules.in \
13     file://zz-input.rules.in \
14     file://zz-tty.rules.in \
15 "
16
17 WIFILES_append_imx = " \
18     file://zz-dri-imx.rules.in \
19 "
20
21 SRC_URI_append = " ${WIFILES}"
22
23 do_install_append() {
24     # Remove upstream weston.ini to avoid conflict with weston-ini-conf package
25     rm -f ${D}${sysconfdir}/xdg/weston/weston.ini
26
27     # Remove upstream weston udev rules just to be safe
28     rm -f ${D}${sysconfdir}/udev/rules.d/71-weston-drm.rules
29
30     # Process ".in" files
31     files=$(echo ${WIFILES} | sed s,file://,,g)
32     for f in ${files}; do
33         g=${f%.in}
34         if [ "${f}" != "${g}" ]; then
35             sed -e "s,@WESTONUSER@,${WESTONUSER},g" \
36                 -e "s,@WESTONGROUP@,${WESTONGROUP},g" \
37                 -e "s,@XDG_RUNTIME_DIR@,${DISPLAY_XDG_RUNTIME_DIR},g" \
38                 -e "s,@WESTONSTART@,${WESTONSTART},g" \
39                     ${WORKDIR}/${f} > ${WORKDIR}/${g}
40         fi
41     done
42
43     # Install weston drop-in
44     install -d ${D}${systemd_system_unitdir}/weston@.service.d
45     install -m644 ${WORKDIR}/weston.conf ${D}/${systemd_system_unitdir}/weston@.service.d/weston-init.conf
46
47     # Install tmpfiles drop-in
48     install -d ${D}${libdir}/tmpfiles.d
49     install -m644 ${WORKDIR}/tmpfiles.conf ${D}${libdir}/tmpfiles.d/weston-init.conf
50
51     # Install udev rules
52     install -d ${D}${sysconfdir}/udev/rules.d
53     for f in ${files}; do
54         g=${f%.in}
55         h=${g%.rules}
56         if [ "${g}" != "${h}" ]; then
57             install -m644 ${WORKDIR}/${g} ${D}${sysconfdir}/udev/rules.d
58         fi
59     done
60 }
61
62 FILES_${PN} += " \
63     ${libdir}/tmpfiles.d/ \
64     ${systemd_system_unitdir}/weston@.service.d/ \
65 "
66
67 SYSTEMD_AUTO_ENABLE = "enable"
68