summaryrefslogtreecommitdiffstats
path: root/meta-agl-demo-control-panel/recipes-demo/agl-demo-control-panel/agl-demo-control-panel_git.bb
blob: 03c0679ab8f9bbb031a5166e79e82851b7b3c1bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
SUMMARY     = "AGL demo control panel"
LICENSE     = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=685e0faaaec2c2334cf8159ca6bd2975"

PV = "1.0+git${SRCPV}"

SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/agl-demo-control-panel;protocol=https;branch=${AGL_BRANCH} \
           file://agl-demo-control-panel.service \
"
SRCREV = "6fdddee7d45206dc64eacd08700f79566ad9b4a6"
S = "${WORKDIR}/git"

inherit systemd allarch update-alternatives

DEPENDS += "qtbase-native"

SYSTEMD_SERVICE:${PN} = "${BPN}.service"

do_configure[noexec] = "1"
do_compile[noexec] = "1"

do_install() {
    # compile qrc
    # RECIPE_SYSROOT_NATIVE
    ${RECIPE_SYSROOT_NATIVE}/usr/libexec/rcc -g python ${S}/assets/res.qrc | sed '0,/PySide6/s//PyQt6/' > ${S}/res_rc.py

    # There's no provision for a Pythonic install into /usr/lib, so dump
    # into a directory /usr/libexec.
    install -d ${D}${libexecdir}/${BPN}
    cp -drv ${S}/* ${D}${libexecdir}/${BPN}

    # Remove stray shell script from Docker container build support to
    # avoid QA complaints
    rm -rf ${D}${libexecdir}/${BPN}/docker

    install -D -m 0644 ${WORKDIR}/${BPN}.service ${D}${systemd_system_unitdir}/${BPN}.service
    
    # Install conf file
    install -d ${D}${sysconfdir}/agl-demo-control-panel
    install -m 0644 ${S}/extras/config.ini ${D}${sysconfdir}/agl-demo-control-panel/config.ini.default
    sed 's/ip = localhost/ip = 192.168.10.2/' ${S}/extras/config.ini > \
        ${D}${sysconfdir}/agl-demo-control-panel/config.ini.demo
    sed -e 's/hvac-enabled = true/hvac-enabled = false/' \
        -e 's/steering-wheel-enabled = true/steering-wheel-enabled = false/' \
        ${S}/extras/config.ini > \
        ${D}${sysconfdir}/agl-demo-control-panel/config.ini.gateway-demo
}


ALTERNATIVE_LINK_NAME[agl-demo-control-panel.ini] = "${sysconfdir}/agl-demo-control-panel/config.ini"

RDEPENDS:${PN} += " \
    ${PN}-conf \
    python3 \
    python3-modules \
    python3-packaging \
    python3-can \
    python3-cantools \
    python3-rich \
    python3-pyqt6 \
    agl-users \
    weston \
    bash \
"

PACKAGE_BEFORE_PN += "${PN}-conf"
FILES:${PN}-conf += "${sysconfdir}/agl-demo-control-panel/config.ini.default"
RDEPENDS:${PN}-conf = "${PN}"
RPROVIDES:${PN}-conf = "agl-demo-control-panel.ini"
ALTERNATIVE:${PN}-conf = "agl-demo-control-panel.ini"
ALTERNATIVE_TARGET_${PN}-conf = "${sysconfdir}/agl-demo-control-panel/config.ini.default"

PACKAGE_BEFORE_PN += "${PN}-conf-demo"
FILES:${PN}-conf-demo += "${sysconfdir}/agl-demo-control-panel/config.ini.demo"
RDEPENDS:${PN}-conf-demo = "${PN}"
RPROVIDES:${PN}-conf-demo = "agl-demo-control-panel.ini"
ALTERNATIVE:${PN}-conf-demo = "agl-demo-control-panel.ini"
ALTERNATIVE_TARGET_${PN}-conf-demo = "${sysconfdir}/agl-demo-control-panel/config.ini.demo"
ALTERNATIVE_PRIORITY_${PN}-conf-demo = "20"

PACKAGE_BEFORE_PN += "${PN}-conf-gateway-demo"
FILES:${PN}-conf-gateway-demo += "${sysconfdir}/agl-demo-control-panel/config.ini.gateway-demo"
RDEPENDS:${PN}-conf-gateway-demo = "${PN}"
RPROVIDES:${PN}-conf-gateway-demo = "agl-demo-control-panel.ini"
ALTERNATIVE:${PN}-conf-gateway-demo = "agl-demo-control-panel.ini"
ALTERNATIVE_TARGET_${PN}-conf-gateway-demo = "${sysconfdir}/agl-demo-control-panel/config.ini.gateway-demo"
ALTERNATIVE_PRIORITY_${PN}-conf-gateway-demo = "30"