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 -m 0775 ${D}${systemd_units_root}/system/sockets.target.wants
68 install -d -m 0775 ${D}${systemd_units_root}/user/sockets.target.wants
69 install -d ${D}${afm_datadir}/applications
70 install -d ${D}${afm_datadir}/icons
71 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
72 mkdir -p ${D}${sysconfdir}/systemd/system/default.target.wants
73 mkdir -p ${D}${sysconfdir}/systemd/user/default.target.wants
74 ln -sf ${systemd_user_unitdir}/afm-user-daemon.service ${D}${sysconfdir}/systemd/user/default.target.wants
76 install -m 0755 ${WORKDIR}/afm-install ${D}${bindir}
77 echo "QT_WAYLAND_SHELL_INTEGRATION=ivi-shell" > ${D}${afm_confdir}/unit.env.d/qt-for-ivi-shell
80 do_install_append_porter() {
81 echo "LD_PRELOAD=/usr/lib/libEGL.so" > ${D}${afm_confdir}/unit.env.d/preload-libEGL
84 pkg_postinst_${PN}() {
85 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
86 for SYS in "system" "user";do
87 for DEST in "default.target.wants" ".";do
88 chgrp ${afm_name} $D${systemd_units_root}/${SYS}/${DEST};
92 for DEST in "applications" "icons" ".";do
93 chown ${afm_name}:${afm_name} $D${afm_datadir}/${DEST};
95 setcap cap_mac_override,cap_dac_override=ep $D${bindir}/afm-system-daemon
98 pkg_postinst_${PN}_smack() {
99 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
100 for SYS in "system" "user";do
101 for DEST in "default.target.wants" ".";do
102 chgrp ${afm_name} $D${systemd_units_root}/${SYS}/${DEST};
103 chsmack -a 'System::Shared' -t $D${systemd_units_root}/${SYS}/${DEST};
107 for DEST in "applications" "icons" ".";do
108 chown ${afm_name}:${afm_name} $D${afm_datadir}/${DEST};
109 chsmack -a 'System::Shared' -t $D${afm_datadir}/${DEST};
111 setcap cap_mac_override,cap_dac_override=ep $D${bindir}/afm-system-daemon
113 FILES_${PN} += " ${systemd_units_root} "
115 PACKAGES =+ "${PN}-binding ${PN}-binding-dbg"
116 FILES_${PN}-binding = " ${afb_binding_dir}/afm-main-binding.so "
117 FILES_${PN}-binding-dbg = " ${afb_binding_dir}/.debug/afm-main-binding.so "
119 PACKAGES =+ "${PN}-tools ${PN}-tools-dbg"
120 FILES_${PN}-tools = "${bindir}/wgtpkg-*"
121 FILES_${PN}-tools-dbg = "${bindir}/.debug/wgtpkg-*"