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