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