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