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