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 EXTRA_OECMAKE_append_agl-devel = " -DAGL_DEVEL=1"
40 USERADD_PACKAGES = "${PN}"
41 USERADD_PARAM_${PN} = "-g ${afm_name} -d ${afm_datadir} -r ${afm_name}"
42 GROUPADD_PARAM_${PN} = "-r ${afm_name}"
44 SYSTEMD_SERVICE_${PN} = "afm-system-daemon.service"
45 SYSTEMD_AUTO_ENABLE = "enable"
48 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_user_unitdir}/afm-user-daemon.service', '', d)} \
50 RDEPENDS_${PN}_append_smack = " smack-userspace bash"
51 DEPENDS_append_smack = " smack-userspace-native"
55 file://Hack-to-allow-the-debugging.patch \
58 # tools used to install wgt at first boot
63 do_install_append_class-target() {
64 install -d ${D}${bindir}
65 install -d -m 0775 ${D}${systemd_units_root}/system
66 install -d -m 0775 ${D}${systemd_units_root}/user
67 install -d -m 0775 ${D}${systemd_units_root}/system/default.target.wants
68 install -d -m 0775 ${D}${systemd_units_root}/user/default.target.wants
69 install -d -m 0775 ${D}${systemd_units_root}/system/sockets.target.wants
70 install -d -m 0775 ${D}${systemd_units_root}/user/sockets.target.wants
71 install -d ${D}${afm_datadir}/applications
72 install -d ${D}${afm_datadir}/icons
73 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
74 mkdir -p ${D}${sysconfdir}/systemd/system/default.target.wants
75 mkdir -p ${D}${sysconfdir}/systemd/user/default.target.wants
76 ln -sf ${systemd_user_unitdir}/afm-user-daemon.service ${D}${sysconfdir}/systemd/user/default.target.wants
78 install -m 0755 ${WORKDIR}/afm-install ${D}${bindir}
79 echo "QT_WAYLAND_SHELL_INTEGRATION=ivi-shell" > ${D}${afm_confdir}/unit.env.d/qt-for-ivi-shell
82 do_install_append_porter() {
83 echo "LD_PRELOAD=/usr/lib/libEGL.so" > ${D}${afm_confdir}/unit.env.d/preload-libEGL
86 pkg_postinst_${PN}() {
87 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
88 for SYS in "system" "user";do
89 for DEST in "sockets.target.wants" "default.target.wants" ".";do
90 chgrp ${afm_name} $D${systemd_units_root}/${SYS}/${DEST};
94 for DEST in "applications" "icons" ".";do
95 chown ${afm_name}:${afm_name} $D${afm_datadir}/${DEST};
97 setcap cap_mac_override,cap_dac_override=ep $D${bindir}/afm-system-daemon
100 pkg_postinst_${PN}_smack() {
101 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
102 for SYS in "system" "user";do
103 for DEST in "sockets.target.wants" "default.target.wants" ".";do
104 chgrp ${afm_name} $D${systemd_units_root}/${SYS}/${DEST};
105 chsmack -a 'System::Shared' -t $D${systemd_units_root}/${SYS}/${DEST};
109 for DEST in "applications" "icons" ".";do
110 chown ${afm_name}:${afm_name} $D${afm_datadir}/${DEST};
111 chsmack -a 'System::Shared' -t $D${afm_datadir}/${DEST};
113 setcap cap_mac_override,cap_dac_override=ep $D${bindir}/afm-system-daemon
115 FILES_${PN} += " ${systemd_units_root} "
117 PACKAGES =+ "${PN}-binding ${PN}-binding-dbg"
118 FILES_${PN}-binding = " ${afb_binding_dir}/afm-main-binding.so "
119 FILES_${PN}-binding-dbg = " ${afb_binding_dir}/.debug/afm-main-binding.so "
121 PACKAGES =+ "${PN}-tools ${PN}-tools-dbg"
122 FILES_${PN}-tools = "${bindir}/wgtpkg-*"
123 FILES_${PN}-tools-dbg = "${bindir}/.debug/wgtpkg-*"