a5eeab6c6ae01b01eb07f5f59a5ff34b854a487e
[AGL/meta-agl-demo.git] / recipes-graphics / wayland / weston-init_agldemo.inc
1 FILESEXTRAPATHS_prepend := "${THISDIR}/weston-init:"
2
3 inherit agl-graphical
4
5 AGL_DEFAULT_WESTONSTART ??= "/usr/bin/agl-compositor --config ${sysconfdir}/xdg/weston/weston.ini"
6
7 WESTONSTART ??= "${AGL_DEFAULT_WESTONSTART} ${WESTONARGS}"
8 WESTONSTART_append = " ${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", " --log=${DISPLAY_XDG_RUNTIME_DIR}/compositor.log", "",d)}"
9 WESTONSTART_append = " ${@bb.utils.contains("DISTRO_FEATURES", "agl-devel", " --debug", "",d)}"
10
11 # Systemd name of DRM device to have weston/agl-compositor startup depend
12 # upon, if required.  Currently only x86-64 seems to need a dependency to
13 # avoid failures due to racing with i915 driver init on e.g. UpSquared.
14 # It seems safer for now to only apply it there rather than doing a blanket
15 # default everywhere that might then need to be over-ridden for vendor BSPs.
16 WESTON_DRM_DEVICE ?= ""
17
18 WIFILES = " \
19     file://weston.conf.in \
20     file://weston-dep.conf.in \
21     file://tmpfiles.conf.in \
22     file://zz-dri.rules.in \
23     file://zz-input.rules.in \
24     file://zz-tty.rules.in \
25 "
26
27 WIFILES_append_imx = " \
28     file://zz-dri-imx.rules.in \
29 "
30
31 SRC_URI_append = " ${WIFILES}"
32
33 do_install_append() {
34     # Remove upstream weston udev rules just to be safe
35     rm -f ${D}${sysconfdir}/udev/rules.d/71-weston-drm.rules
36
37     # Process ".in" files
38     files=$(echo ${WIFILES} | sed s,file://,,g)
39     for f in ${files}; do
40         g=${f%.in}
41         if [ "${f}" != "${g}" ]; then
42             sed -e "s,@WESTONUSER@,${WESTONUSER},g" \
43                 -e "s,@WESTONGROUP@,${WESTONGROUP},g" \
44                 -e "s,@XDG_RUNTIME_DIR@,${DISPLAY_XDG_RUNTIME_DIR},g" \
45                 -e "s,@WESTONSTART@,${WESTONSTART},g" \
46                 -e "s,@WESTON_DRM_DEVICE@,${WESTON_DRM_DEVICE},g" \
47                     ${WORKDIR}/${f} > ${WORKDIR}/${g}
48         fi
49     done
50
51     # Install weston drop-in
52     install -d ${D}${systemd_system_unitdir}/weston@.service.d
53     install -m644 ${WORKDIR}/weston.conf ${D}/${systemd_system_unitdir}/weston@.service.d/weston-init.conf
54
55     # Install weston DRM device dependency drop-in if required
56     if [ -n "${WESTON_DRM_DEVICE}" ]; then
57         install -m 0644 ${WORKDIR}/weston-dep.conf ${D}/${systemd_system_unitdir}/weston@.service.d/
58     fi
59
60     # Install tmpfiles drop-in
61     install -d ${D}${libdir}/tmpfiles.d
62     install -m644 ${WORKDIR}/tmpfiles.conf ${D}${libdir}/tmpfiles.d/weston-init.conf
63
64     # Install udev rules
65     install -d ${D}${sysconfdir}/udev/rules.d
66     for f in ${files}; do
67         g=${f%.in}
68         h=${g%.rules}
69         if [ "${g}" != "${h}" ]; then
70             install -m644 ${WORKDIR}/${g} ${D}${sysconfdir}/udev/rules.d
71         fi
72     done
73 }
74
75 FILES_${PN} += " \
76     ${libdir}/tmpfiles.d/ \
77     ${systemd_system_unitdir}/weston@.service.d/ \
78 "