ivi-homescreen: improve AGL integration
[AGL/meta-agl-devel.git] / meta-agl-flutter / recipes-graphics / toyota / ivi-homescreen_aglflutter.inc
1 FILESEXTRAPATHS:append := "${THISDIR}/files:"
2
3 SRC_URI += " \
4     file://0001-Allow-the-embedder-to-run-as-a-regular-normal-applic.patch \
5     file://0002-shell-configuration-Obey-json-configuration-file.patch \
6     file://0003-shell-configuration-Fixes-to-general-options.patch \
7     file://0004-Add-app-id-command-line-argument.patch \
8     file://config.json \
9 "
10
11 # Upstream is now pinning ivi-homescreen, but if it did need to be pinned
12 # it can be done here.
13 #SRCREV = ""
14
15 # For now disable gstreamer to avoid needing to enable "commercial"
16 # licenses for the stated ffmpeg dependency.
17 PACKAGECONFIG:remove = "gstreamer"
18
19 #
20 # AGL specifics
21 #
22
23 IVI_HOMESCREEN_APP_OVERRIDE = "--b=/usr/share/flutter/gallery --j=/usr/share/flutter/config.json"
24
25 SERVICE_UNIT        = "Requires=agl-compositor.service\nAfter=agl-compositor.service"
26 SERVICE_INSTALL     = "WantedBy=agl-session.target"
27
28 # The "homescreen" naming of the embedder binary conflicts with the
29 # Qt homescreen in meta-agl-demo.  At least for now, rename it to
30 # allow running Flutter apps in an image that uses the Qt homescreen
31 # and launcher for testing.
32 SERVICE_EXEC_START  = "ExecStart=/usr/bin/flutter --f ${IVI_HOMESCREEN_APP_OVERRIDE} ${SERVICE_EXEC_START_PARAMS}"
33
34 # we have a regular/agl-driver user, so avoid setting one
35 SERVICE_ENVIRONMENT = ""
36 SERVICE_USER_GROUP  = ""
37 SERVICE_RESTART     = "Restart=on-failure"
38
39 # we need to install as user session, not root.
40 do_install:append() {
41     # The system level systemd unit is not required in AGL
42     rm -f ${D}{systemd_system_unitdir}/homescreen.service
43
44     install -d ${D}${systemd_user_unitdir}/agl-session.target.wants
45     install -D -m 0644 ${WORKDIR}/config.json ${D}${datadir}/flutter/config.json
46     install -m 0644 ${WORKDIR}/homescreen.service ${D}${systemd_user_unitdir}/homescreen.service
47     ln -s ../homescreen.service ${D}${systemd_user_unitdir}/agl-session.target.wants/homescreen.service
48
49     # Rename embedder binary, see explanation above
50     mv ${D}${bindir}/homescreen ${D}${bindir}/flutter
51 }
52
53 # Split the embedder binary into a separate package to allow reusing it
54 # without the generated upstream systemd unit that ATM is still useful
55 # for testing with the agl-image-flutter image.  AGL will use either
56 # the applaunchd systemd template or custom units in meta-agl-demo.
57 PACKAGE_BEFORE_PN = "flutter-embedder-${FLUTTER_RUNTIME}"
58
59 FILES:flutter-embedder-${FLUTTER_RUNTIME} = "${bindir}"
60
61 FILES:${PN} += "${systemd_user_unitdir} ${datadir}/flutter/config.json"
62
63 RDEPENDS:${PN} += "flutter-embedder-${FLUTTER_RUNTIME}"
64
65 RDEPENDS:flutter-embedder-${FLUTTER_RUNTIME} += "flutter-engine-${FLUTTER_RUNTIME}"