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 af-binder"
15 DEPENDS_class-native = "openssl libxml2 xmlsec1 libzip json-c"
17 PACKAGE_WRITE_DEPS_append_smack = " smack-userspace-native libcap-native"
19 EXTRA_OECMAKE_class-native = "\
23 -Dafm_name=${afm_name} \
24 -Dafm_confdir=${afm_confdir} \
25 -Dafm_datadir=${afm_datadir} \
32 -Dafm_name=${afm_name} \
33 -Dafm_confdir=${afm_confdir} \
34 -Dafm_datadir=${afm_datadir} \
35 -Dsystemd_units_root=${systemd_units_root} \
36 -DUNITDIR_USER=${systemd_user_unitdir} \
37 -DUNITDIR_SYSTEM=${systemd_system_unitdir} \
40 EXTRA_OECMAKE_append_agl-devel = " -DAGL_DEVEL=1"
42 USERADD_PACKAGES = "${PN}"
43 USERADD_PARAM_${PN} = "-g ${afm_name} -d ${afm_datadir} -r ${afm_name}"
44 GROUPADD_PARAM_${PN} = "-r ${afm_name}"
46 SYSTEMD_SERVICE_${PN} = "afm-system-daemon.service"
47 SYSTEMD_AUTO_ENABLE = "enable"
50 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_user_unitdir}/afm-user-daemon.service', '', d)} \
52 RDEPENDS_${PN}_append_smack = " smack-userspace bash"
53 DEPENDS_append_smack = " smack-userspace-native"
57 file://Hack-to-allow-the-debugging.patch \
60 # tools used to install wgt at first boot
65 do_install_append_class-target() {
66 install -d ${D}${bindir}
67 install -d -m 0775 ${D}${systemd_units_root}/system
68 install -d -m 0775 ${D}${systemd_units_root}/user
69 install -d -m 0775 ${D}${systemd_units_root}/system/default.target.wants
70 install -d -m 0775 ${D}${systemd_units_root}/user/default.target.wants
71 install -d -m 0775 ${D}${systemd_units_root}/system/sockets.target.wants
72 install -d -m 0775 ${D}${systemd_units_root}/user/sockets.target.wants
73 install -d ${D}${afm_datadir}/applications
74 install -d ${D}${afm_datadir}/icons
75 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
76 mkdir -p ${D}${sysconfdir}/systemd/system/default.target.wants
77 mkdir -p ${D}${sysconfdir}/systemd/user/default.target.wants
78 ln -sf ${systemd_user_unitdir}/afm-user-daemon.service ${D}${sysconfdir}/systemd/user/default.target.wants
80 install -m 0755 ${WORKDIR}/afm-install ${D}${bindir}
81 echo "QT_WAYLAND_SHELL_INTEGRATION=ivi-shell" > ${D}${afm_confdir}/unit.env.d/qt-for-ivi-shell
84 do_install_append_porter() {
85 echo "LD_PRELOAD=/usr/lib/libEGL.so" > ${D}${afm_confdir}/unit.env.d/preload-libEGL
88 pkg_postinst_${PN}() {
89 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
90 for SYS in "system" "user";do
91 for DEST in "sockets.target.wants" "default.target.wants" ".";do
92 chgrp ${afm_name} $D${systemd_units_root}/${SYS}/${DEST};
96 for DEST in "applications" "icons" ".";do
97 chown ${afm_name}:${afm_name} $D${afm_datadir}/${DEST};
99 setcap cap_mac_override,cap_dac_override=ep $D${bindir}/afm-system-daemon
102 pkg_postinst_${PN}_smack() {
103 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
104 for SYS in "system" "user";do
105 for DEST in "sockets.target.wants" "default.target.wants" ".";do
106 chgrp ${afm_name} $D${systemd_units_root}/${SYS}/${DEST};
107 chsmack -a 'System::Shared' -t $D${systemd_units_root}/${SYS}/${DEST};
111 for DEST in "applications" "icons" ".";do
112 chown ${afm_name}:${afm_name} $D${afm_datadir}/${DEST};
113 chsmack -a 'System::Shared' -t $D${afm_datadir}/${DEST};
115 setcap cap_mac_override,cap_dac_override=ep $D${bindir}/afm-system-daemon
117 FILES_${PN} += " ${systemd_units_root} "
119 PACKAGES =+ "${PN}-binding ${PN}-binding-dbg"
120 FILES_${PN}-binding = " ${afb_binding_dir}/afm-main-binding.so "
121 FILES_${PN}-binding-dbg = " ${afb_binding_dir}/.debug/afm-main-binding.so "
123 PACKAGES =+ "${PN}-tools ${PN}-tools-dbg"
124 FILES_${PN}-tools = "${bindir}/wgtpkg-*"
125 FILES_${PN}-tools-dbg = "${bindir}/.debug/wgtpkg-*"