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