blob: 4b15d11b616e91009008a8416d8a8093bdd946bd [file] [log] [blame]
Andrew Geisslerc182c622020-05-15 14:13:32 -05001SUMMARY = "Avahi IPv4LL network address configuration daemon"
2DESCRIPTION = 'Avahi is a fully LGPL framework for Multicast DNS Service Discovery. It \
3allows programs to publish and discover services and hosts running on a local network \
4with no specific configuration. This tool implements IPv4LL, "Dynamic Configuration of \
5IPv4 Link-Local Addresses" (IETF RFC3927), a protocol for automatic IP address \
6configuration from the link-local 169.254.0.0/16 range without the need for a central \
7server.'
8AUTHOR = "Lennart Poettering <lennart@poettering.net>"
9HOMEPAGE = "http://avahi.org"
10BUGTRACKER = "https://github.com/lathiat/avahi/issues"
11SECTION = "network"
12
13# major part is under LGPLv2.1+, but several .dtd, .xsl, initscripts and
14# python scripts are under GPLv2+
15LICENSE = "GPLv2+ & LGPLv2.1+"
16LIC_FILES_CHKSUM = "file://LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1 \
17 file://avahi-common/address.h;endline=25;md5=b1d1d2cda1c07eb848ea7d6215712d9d \
18 file://avahi-core/dns.h;endline=23;md5=6fe82590b81aa0ddea5095b548e2fdcb \
19 file://avahi-daemon/main.c;endline=21;md5=9ee77368c5407af77caaef1b07285969 \
20 file://avahi-client/client.h;endline=23;md5=f4ac741a25c4f434039ba3e18c8674cf"
21
22SRC_URI = "https://github.com/lathiat/avahi/releases/download/v${PV}/avahi-${PV}.tar.gz \
23 file://00avahi-autoipd \
24 file://99avahi-autoipd \
25 file://initscript.patch \
26 file://0001-Fix-opening-etc-resolv.conf-error.patch \
Andrew Geissler09036742021-06-25 14:25:14 -050027 file://handle-hup.patch \
Andrew Geissler5f350902021-07-23 13:09:54 -040028 file://local-ping.patch \
Andrew Geisslerc182c622020-05-15 14:13:32 -050029 "
30
31UPSTREAM_CHECK_URI = "https://github.com/lathiat/avahi/releases/"
32SRC_URI[md5sum] = "229c6aa30674fc43c202b22c5f8c2be7"
33SRC_URI[sha256sum] = "060309d7a333d38d951bc27598c677af1796934dbd98e1024e7ad8de798fedda"
34
William A. Kennington IIIac69b482021-06-02 12:28:27 -070035# Issue only affects Debian/SUSE, not us
36CVE_CHECK_WHITELIST += "CVE-2021-26720"
37
Andrew Geissler5199d832021-09-24 16:47:35 -050038DEPENDS = "expat libcap libdaemon glib-2.0"
Andrew Geisslerc182c622020-05-15 14:13:32 -050039
40# For gtk related PACKAGECONFIGs: gtk, gtk3
William A. Kennington IIIac69b482021-06-02 12:28:27 -070041AVAHI_GTK ?= ""
Andrew Geisslerc182c622020-05-15 14:13:32 -050042
43PACKAGECONFIG ??= "dbus ${@bb.utils.contains_any('DISTRO_FEATURES','x11 wayland','${AVAHI_GTK}','',d)}"
44PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus"
45PACKAGECONFIG[gtk] = "--enable-gtk,--disable-gtk,gtk+"
46PACKAGECONFIG[gtk3] = "--enable-gtk3,--disable-gtk3,gtk+3"
47PACKAGECONFIG[libdns_sd] = "--enable-compat-libdns_sd --enable-dbus,,dbus"
48PACKAGECONFIG[libevent] = "--enable-libevent,--disable-libevent,libevent"
49PACKAGECONFIG[qt5] = "--enable-qt5,--disable-qt5,qtbase"
50
51inherit autotools pkgconfig gettext gobject-introspection
52
53EXTRA_OECONF = "--with-avahi-priv-access-group=adm \
54 --disable-stack-protector \
55 --disable-gdbm \
56 --disable-dbm \
57 --disable-mono \
58 --disable-monodoc \
59 --disable-qt3 \
60 --disable-qt4 \
61 --disable-python \
62 --disable-doxygen-doc \
63 --enable-manpages \
64 ${EXTRA_OECONF_SYSVINIT} \
65 ${EXTRA_OECONF_SYSTEMD} \
66 "
67
68# The distro choice determines what init scripts are installed
69EXTRA_OECONF_SYSVINIT = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','--with-distro=debian','--with-distro=none',d)}"
Andrew Geissler5199d832021-09-24 16:47:35 -050070EXTRA_OECONF_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES','systemd','--with-systemdsystemunitdir=${systemd_system_unitdir}/','--without-systemdsystemunitdir',d)}"
Andrew Geisslerc182c622020-05-15 14:13:32 -050071
Patrick Williams213cb262021-08-07 19:21:33 -050072do_configure:prepend() {
Andrew Geisslerc182c622020-05-15 14:13:32 -050073 # This m4 file will get in the way of our introspection.m4 with special cross-compilation fixes
74 rm "${S}/common/introspection.m4" || true
75}
76
Patrick Williams213cb262021-08-07 19:21:33 -050077do_compile:prepend() {
Andrew Geisslerc182c622020-05-15 14:13:32 -050078 export GIR_EXTRA_LIBS_PATH="${B}/avahi-gobject/.libs:${B}/avahi-common/.libs:${B}/avahi-client/.libs:${B}/avahi-glib/.libs"
79}
80
Patrick Williams213cb262021-08-07 19:21:33 -050081RRECOMMENDS:${PN}:append:libc-glibc = " libnss-mdns"
Andrew Geisslerc182c622020-05-15 14:13:32 -050082
83do_install() {
84 autotools_do_install
85 rm -rf ${D}/run
86 rm -rf ${D}${datadir}/dbus-1/interfaces
87 test -d ${D}${datadir}/dbus-1 && rmdir --ignore-fail-on-non-empty ${D}${datadir}/dbus-1
88 rm -rf ${D}${libdir}/avahi
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050089
90 # Move example service files out of /etc/avahi/services so we don't
91 # advertise ssh & sftp-ssh by default
92 install -d ${D}${docdir}/avahi
93 mv ${D}${sysconfdir}/avahi/services/* ${D}${docdir}/avahi
Andrew Geisslerc182c622020-05-15 14:13:32 -050094}
95
96PACKAGES =+ "${@bb.utils.contains("PACKAGECONFIG", "libdns_sd", "libavahi-compat-libdnssd", "", d)}"
97
Patrick Williams213cb262021-08-07 19:21:33 -050098FILES:libavahi-compat-libdnssd = "${libdir}/libdns_sd.so.*"
Andrew Geisslerc182c622020-05-15 14:13:32 -050099
Patrick Williams213cb262021-08-07 19:21:33 -0500100RPROVIDES:libavahi-compat-libdnssd = "libdns-sd"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500101
102inherit update-rc.d systemd useradd
103
104PACKAGES =+ "libavahi-gobject avahi-daemon libavahi-common libavahi-core libavahi-client avahi-dnsconfd libavahi-glib avahi-autoipd avahi-utils avahi-discover avahi-ui"
105
Patrick Williams213cb262021-08-07 19:21:33 -0500106FILES:avahi-ui = "${libdir}/libavahi-ui*.so.*"
107FILES:avahi-discover = "${datadir}/applications/avahi-discover.desktop \
Andrew Geisslerc182c622020-05-15 14:13:32 -0500108 ${datadir}/avahi/interfaces/avahi-discover.ui \
109 ${bindir}/avahi-discover-standalone \
110 "
111
Patrick Williams213cb262021-08-07 19:21:33 -0500112LICENSE:libavahi-gobject = "LGPLv2.1+"
113LICENSE:avahi-daemon = "LGPLv2.1+"
114LICENSE:libavahi-common = "LGPLv2.1+"
115LICENSE:libavahi-core = "LGPLv2.1+"
116LICENSE:libavahi-client = "LGPLv2.1+"
117LICENSE:avahi-dnsconfd = "LGPLv2.1+"
118LICENSE:libavahi-glib = "LGPLv2.1+"
119LICENSE:avahi-autoipd = "LGPLv2.1+"
120LICENSE:avahi-utils = "LGPLv2.1+"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500121
122# As avahi doesn't put any files into PN, clear the files list to avoid problems
123# if extra libraries appear.
Patrick Williams213cb262021-08-07 19:21:33 -0500124FILES:${PN} = ""
125FILES:avahi-autoipd = "${sbindir}/avahi-autoipd \
Andrew Geisslerc182c622020-05-15 14:13:32 -0500126 ${sysconfdir}/avahi/avahi-autoipd.action \
127 ${sysconfdir}/dhcp/*/avahi-autoipd \
128 ${sysconfdir}/udhcpc.d/00avahi-autoipd \
129 ${sysconfdir}/udhcpc.d/99avahi-autoipd"
Patrick Williams213cb262021-08-07 19:21:33 -0500130FILES:libavahi-common = "${libdir}/libavahi-common.so.*"
131FILES:libavahi-core = "${libdir}/libavahi-core.so.* ${libdir}/girepository-1.0/AvahiCore*.typelib"
132FILES:avahi-daemon = "${sbindir}/avahi-daemon \
Andrew Geisslerc182c622020-05-15 14:13:32 -0500133 ${sysconfdir}/avahi/avahi-daemon.conf \
134 ${sysconfdir}/avahi/hosts \
135 ${sysconfdir}/avahi/services \
136 ${sysconfdir}/dbus-1 \
137 ${sysconfdir}/init.d/avahi-daemon \
138 ${datadir}/avahi/introspection/*.introspect \
139 ${datadir}/avahi/avahi-service.dtd \
140 ${datadir}/avahi/service-types \
141 ${datadir}/dbus-1/system-services"
Patrick Williams213cb262021-08-07 19:21:33 -0500142FILES:libavahi-client = "${libdir}/libavahi-client.so.*"
143FILES:avahi-dnsconfd = "${sbindir}/avahi-dnsconfd \
Andrew Geisslerc182c622020-05-15 14:13:32 -0500144 ${sysconfdir}/avahi/avahi-dnsconfd.action \
145 ${sysconfdir}/init.d/avahi-dnsconfd"
Patrick Williams213cb262021-08-07 19:21:33 -0500146FILES:libavahi-glib = "${libdir}/libavahi-glib.so.*"
147FILES:libavahi-gobject = "${libdir}/libavahi-gobject.so.* ${libdir}/girepository-1.0/Avahi*.typelib"
148FILES:avahi-utils = "${bindir}/avahi-* ${bindir}/b* ${datadir}/applications/b*"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500149
Patrick Williams213cb262021-08-07 19:21:33 -0500150RDEPENDS:${PN}-dev = "avahi-daemon (= ${EXTENDPKGV}) libavahi-core (= ${EXTENDPKGV})"
151RDEPENDS:${PN}-dev += "${@["", " libavahi-client (= ${EXTENDPKGV})"][bb.utils.contains('PACKAGECONFIG', 'dbus', 1, 0, d)]}"
152RDEPENDS:${PN}-dnsconfd = "${PN}-daemon"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500153
Patrick Williams213cb262021-08-07 19:21:33 -0500154RRECOMMENDS:avahi-daemon:append:libc-glibc = " libnss-mdns"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500155
Patrick Williams213cb262021-08-07 19:21:33 -0500156CONFFILES:avahi-daemon = "${sysconfdir}/avahi/avahi-daemon.conf"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500157
158USERADD_PACKAGES = "avahi-daemon avahi-autoipd"
Patrick Williams213cb262021-08-07 19:21:33 -0500159USERADD_PARAM:avahi-daemon = "--system --home /run/avahi-daemon \
Andrew Geisslerc182c622020-05-15 14:13:32 -0500160 --no-create-home --shell /bin/false \
161 --user-group avahi"
162
Patrick Williams213cb262021-08-07 19:21:33 -0500163USERADD_PARAM:avahi-autoipd = "--system --home /run/avahi-autoipd \
Andrew Geisslerc182c622020-05-15 14:13:32 -0500164 --no-create-home --shell /bin/false \
165 --user-group \
166 -c \"Avahi autoip daemon\" \
167 avahi-autoipd"
168
169INITSCRIPT_PACKAGES = "avahi-daemon avahi-dnsconfd"
Patrick Williams213cb262021-08-07 19:21:33 -0500170INITSCRIPT_NAME:avahi-daemon = "avahi-daemon"
171INITSCRIPT_PARAMS:avahi-daemon = "defaults 21 19"
172INITSCRIPT_NAME:avahi-dnsconfd = "avahi-dnsconfd"
173INITSCRIPT_PARAMS:avahi-dnsconfd = "defaults 22 19"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500174
175SYSTEMD_PACKAGES = "${PN}-daemon ${PN}-dnsconfd"
Patrick Williams213cb262021-08-07 19:21:33 -0500176SYSTEMD_SERVICE:${PN}-daemon = "avahi-daemon.service"
177SYSTEMD_SERVICE:${PN}-dnsconfd = "avahi-dnsconfd.service"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500178
Patrick Williams213cb262021-08-07 19:21:33 -0500179do_install:append() {
Andrew Geisslerc182c622020-05-15 14:13:32 -0500180 install -d ${D}${sysconfdir}/udhcpc.d
181 install ${WORKDIR}/00avahi-autoipd ${D}${sysconfdir}/udhcpc.d
182 install ${WORKDIR}/99avahi-autoipd ${D}${sysconfdir}/udhcpc.d
183}
184
185# At the time the postinst runs, dbus might not be setup so only restart if running
186# Don't exit early, because update-rc.d needs to run subsequently.
Patrick Williams213cb262021-08-07 19:21:33 -0500187pkg_postinst:avahi-daemon () {
Andrew Geisslerc182c622020-05-15 14:13:32 -0500188if [ -z "$D" ]; then
189 killall -q -HUP dbus-daemon || true
190fi
191}
192