1 require af-main_${PV}.inc
3 # NOTE: using libcap-native and setcap in install doesn't work
4 # NOTE: there is no SYSTEMD_USER_SERVICE_...
5 # NOTE: maybe setting afm_name to agl-framework is cleaner but has implications
6 # NOTE: there is a hack of security for using groups and dbus (to be checked)
7 # NOTE: using ZIP programs creates directories with mode 777 (very bad)
9 inherit cmake pkgconfig useradd systemd
10 BBCLASSEXTEND = "native"
14 DEPENDS = "openssl libxml2 xmlsec1 systemd libzip json-c systemd security-manager libcap-native af-binder"
15 DEPENDS_class-native = "openssl libxml2 xmlsec1 libzip json-c"
17 EXTRA_OECMAKE_class-native = "\
21 -Dafm_name=${afm_name} \
22 -Dafm_confdir=${afm_confdir} \
23 -Dafm_datadir=${afm_datadir} \
30 -Dafm_name=${afm_name} \
31 -Dafm_confdir=${afm_confdir} \
32 -Dafm_datadir=${afm_datadir} \
33 -Dsystemd_units_root=${systemd_units_root} \
34 -DUNITDIR_USER=${systemd_user_unitdir} \
35 -DUNITDIR_SYSTEM=${systemd_system_unitdir} \
38 USERADD_PACKAGES = "${PN}"
39 USERADD_PARAM_${PN} = "-g ${afm_name} -d ${afm_datadir} -r ${afm_name}"
40 GROUPADD_PARAM_${PN} = "-r ${afm_name}"
42 SYSTEMD_SERVICE_${PN} = "afm-system-daemon.service"
43 SYSTEMD_AUTO_ENABLE = "enable"
46 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_user_unitdir}/afm-user-daemon.service', '', d)} \
48 RDEPENDS_${PN}_append_smack = " smack-userspace"
49 DEPENDS_append_smack = " smack-userspace-native"
53 file://Hack-to-allow-the-debugging.patch \
56 # tools used to install wgt at first boot
61 do_install_append_class-target() {
62 install -d ${D}${bindir}
63 install -d -m 0775 ${D}${systemd_units_root}/system
64 install -d -m 0775 ${D}${systemd_units_root}/user
65 install -d -m 0775 ${D}${systemd_units_root}/system/default.target.wants
66 install -d -m 0775 ${D}${systemd_units_root}/user/default.target.wants
67 install -d ${D}${afm_datadir}/applications
68 install -d ${D}${afm_datadir}/icons
69 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
70 mkdir -p ${D}${sysconfdir}/systemd/system/default.target.wants
71 mkdir -p ${D}${sysconfdir}/systemd/user/default.target.wants
72 ln -sf ${systemd_user_unitdir}/afm-user-daemon.service ${D}${sysconfdir}/systemd/user/default.target.wants
74 install -m 0755 ${WORKDIR}/afm-install ${D}${bindir}
75 echo "QT_WAYLAND_SHELL_INTEGRATION=ivi-shell" > ${D}${afm_confdir}/unit.env.d/qt-for-ivi-shell
78 do_install_append_porter() {
79 echo "LD_PRELOAD=/usr/lib/libEGL.so" > ${D}${afm_confdir}/unit.env.d/preload-libEGL
82 pkg_postinst_${PN}() {
83 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
84 chgrp ${afm_name} $D${systemd_units_root}/{system,user}/{default.target.wants,.}
86 chown ${afm_name}:${afm_name} $D${afm_datadir}/{applications,icons,.}
87 setcap cap_mac_override,cap_dac_override=ep $D${bindir}/afm-system-daemon
88 setcap cap_mac_override,cap_mac_admin,cap_setgid=ep $D${bindir}/afm-user-daemon
91 pkg_postinst_${PN}_smack() {
92 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
93 chgrp ${afm_name} $D${systemd_units_root}/{system,user}/{default.target.wants,.}
94 chsmack -a 'System::Shared' -t $D${systemd_units_root}/{system,user}/{default.target.wants,.}
96 chown ${afm_name}:${afm_name} $D${afm_datadir}/{applications,icons,.}
97 chsmack -a 'System::Shared' -t $D${afm_datadir}/{applications,icons,.}
98 setcap cap_mac_override,cap_dac_override=ep $D${bindir}/afm-system-daemon
99 setcap cap_mac_override,cap_mac_admin,cap_setgid=ep $D${bindir}/afm-user-daemon
101 FILES_${PN} += " ${systemd_units_root} "
103 PACKAGES =+ "${PN}-binding ${PN}-binding-dbg"
104 FILES_${PN}-binding = " ${afb_binding_dir}/afm-main-binding.so "
105 FILES_${PN}-binding-dbg = " ${afb_binding_dir}/.debug/afm-main-binding.so "
107 PACKAGES =+ "${PN}-tools ${PN}-tools-dbg"
108 FILES_${PN}-tools = "${bindir}/wgtpkg-*"
109 FILES_${PN}-tools-dbg = "${bindir}/.debug/wgtpkg-*"