70130f74a5c837dda3b33e1048c07805edc7c271
[AGL/meta-agl.git] / meta-agl-core / recipes-graphics / wayland / weston-ini-conf.bb
1 SUMMARY = "Configuration file for the Weston and AGL Wayland compositors"
2 LICENSE = "MIT"
3 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
4
5 SRC_URI = " \
6         file://core.cfg \
7         file://shell.cfg \
8         file://hdmi-a-1-90.cfg \
9         file://hdmi-a-1-180.cfg \
10         file://hdmi-a-1-270.cfg \
11         file://remote-output.cfg \
12         file://virtual-270.cfg \
13         file://virtual-0.cfg \
14 "
15
16 S = "${WORKDIR}"
17
18 inherit update-alternatives
19
20 # Default primary display/orientation fragment
21 WESTON_DISPLAYS ?= "hdmi-a-1-270"
22
23 # Configuration fragments to use in weston.ini.*
24 # Note that some may be replaced/removed when building the landscape
25 # configuration.
26 WESTON_FRAGMENTS = "core shell ${WESTON_DISPLAYS}"
27
28 # On-target weston.ini directory
29 weston_ini_dir = "${sysconfdir}/xdg/weston"
30
31 do_compile() {
32     # Put all of our cfg files together for a default portrait
33     # orientation configuration
34     rm -f ${WORKDIR}/weston.ini.default
35     for F in ${WESTON_FRAGMENTS}; do
36         cat ${WORKDIR}/${F}.cfg >> ${WORKDIR}/weston.ini.default
37         echo >> ${WORKDIR}/weston.ini.default
38     done
39     sed -i -e '$ d' ${WORKDIR}/weston.ini.default
40
41     # Do it again, but filter fragments to configure for landscape
42     rm -f ${WORKDIR}/weston.ini.landscape
43     for F in ${WESTON_FRAGMENTS}; do
44         if echo $F | grep '^hdmi-a-1-\(90\|270\)$'; then
45             F="hdmi-a-1-180"
46         elif echo $F | grep '^virtual-270$'; then
47             F="virtual-0"
48         fi
49         cat ${WORKDIR}/${F}.cfg >> ${WORKDIR}/weston.ini.landscape
50         echo >> ${WORKDIR}/weston.ini.landscape
51     done
52     sed -i -e '$ d' ${WORKDIR}/weston.ini.landscape
53 }
54
55 do_install_append() {
56     install -d ${D}${weston_ini_dir}
57     install -m 0644 ${WORKDIR}/weston.ini.default ${D}${weston_ini_dir}/
58     install -m 0644 ${WORKDIR}/weston.ini.landscape ${D}${weston_ini_dir}/
59 }
60
61 PACKAGE_ARCH = "${MACHINE_ARCH}"
62
63 # Use the alternative mechanism to handle multiple packages providing
64 # weston.ini.  This seems simpler than other possible approaches.
65 # Note that for now the generated packages are being marked as
66 # incompatible with each other for simplicity, that can be changed if
67 # a usecase where switching between alternatives at runtime is desirable
68 # appears.
69
70 ALTERNATIVE_LINK_NAME[weston.ini] = "${weston_ini_dir}/weston.ini"
71
72 RDEPENDS_${PN} = "weston-init"
73 RPROVIDES_${PN} = "weston-ini"
74 RCONFLICTS_${PN} = "${PN}-landscape"
75 ALTERNATIVE_${PN} = "weston.ini"
76 ALTERNATIVE_TARGET_${PN} = "${weston_ini_dir}/weston.ini.default"
77
78 PACKAGE_BEFORE_PN += "${PN}-landscape"
79
80 FILES_${PN}-landscape = "${weston_ini_dir}/weston.ini.landscape"
81
82 RDEPENDS_${PN}-landscape = "weston-init"
83 RPROVIDES_${PN}-landscape = "weston-ini"
84 RCONFLICTS_${PN}-landscape = "${PN}"
85 ALTERNATIVE_${PN}-landscape = "weston.ini"
86 ALTERNATIVE_TARGET_${PN}-landscape = "${weston_ini_dir}/weston.ini.landscape"