blob: 430231088807a0de173d773a190c089a8b6e4b75 [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 Geisslerc182c622020-05-15 14:13:32 -050028 "
29
30UPSTREAM_CHECK_URI = "https://github.com/lathiat/avahi/releases/"
31SRC_URI[md5sum] = "229c6aa30674fc43c202b22c5f8c2be7"
32SRC_URI[sha256sum] = "060309d7a333d38d951bc27598c677af1796934dbd98e1024e7ad8de798fedda"
33
William A. Kennington IIIac69b482021-06-02 12:28:27 -070034# Issue only affects Debian/SUSE, not us
35CVE_CHECK_WHITELIST += "CVE-2021-26720"
36
Andrew Geisslerc182c622020-05-15 14:13:32 -050037DEPENDS = "expat libcap libdaemon glib-2.0 intltool-native"
38
39# For gtk related PACKAGECONFIGs: gtk, gtk3
William A. Kennington IIIac69b482021-06-02 12:28:27 -070040AVAHI_GTK ?= ""
Andrew Geisslerc182c622020-05-15 14:13:32 -050041
42PACKAGECONFIG ??= "dbus ${@bb.utils.contains_any('DISTRO_FEATURES','x11 wayland','${AVAHI_GTK}','',d)}"
43PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus"
44PACKAGECONFIG[gtk] = "--enable-gtk,--disable-gtk,gtk+"
45PACKAGECONFIG[gtk3] = "--enable-gtk3,--disable-gtk3,gtk+3"
46PACKAGECONFIG[libdns_sd] = "--enable-compat-libdns_sd --enable-dbus,,dbus"
47PACKAGECONFIG[libevent] = "--enable-libevent,--disable-libevent,libevent"
48PACKAGECONFIG[qt5] = "--enable-qt5,--disable-qt5,qtbase"
49
50inherit autotools pkgconfig gettext gobject-introspection
51
52EXTRA_OECONF = "--with-avahi-priv-access-group=adm \
53 --disable-stack-protector \
54 --disable-gdbm \
55 --disable-dbm \
56 --disable-mono \
57 --disable-monodoc \
58 --disable-qt3 \
59 --disable-qt4 \
60 --disable-python \
61 --disable-doxygen-doc \
62 --enable-manpages \
63 ${EXTRA_OECONF_SYSVINIT} \
64 ${EXTRA_OECONF_SYSTEMD} \
65 "
66
67# The distro choice determines what init scripts are installed
68EXTRA_OECONF_SYSVINIT = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','--with-distro=debian','--with-distro=none',d)}"
69EXTRA_OECONF_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES','systemd','--with-systemdsystemunitdir=${systemd_unitdir}/system/','--without-systemdsystemunitdir',d)}"
70
71do_configure_prepend() {
72 # This m4 file will get in the way of our introspection.m4 with special cross-compilation fixes
73 rm "${S}/common/introspection.m4" || true
74}
75
76do_compile_prepend() {
77 export GIR_EXTRA_LIBS_PATH="${B}/avahi-gobject/.libs:${B}/avahi-common/.libs:${B}/avahi-client/.libs:${B}/avahi-glib/.libs"
78}
79
80RRECOMMENDS_${PN}_append_libc-glibc = " libnss-mdns"
81
82do_install() {
83 autotools_do_install
84 rm -rf ${D}/run
85 rm -rf ${D}${datadir}/dbus-1/interfaces
86 test -d ${D}${datadir}/dbus-1 && rmdir --ignore-fail-on-non-empty ${D}${datadir}/dbus-1
87 rm -rf ${D}${libdir}/avahi
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050088
89 # Move example service files out of /etc/avahi/services so we don't
90 # advertise ssh & sftp-ssh by default
91 install -d ${D}${docdir}/avahi
92 mv ${D}${sysconfdir}/avahi/services/* ${D}${docdir}/avahi
Andrew Geisslerc182c622020-05-15 14:13:32 -050093}
94
95PACKAGES =+ "${@bb.utils.contains("PACKAGECONFIG", "libdns_sd", "libavahi-compat-libdnssd", "", d)}"
96
97FILES_libavahi-compat-libdnssd = "${libdir}/libdns_sd.so.*"
98
99RPROVIDES_libavahi-compat-libdnssd = "libdns-sd"
100
101inherit update-rc.d systemd useradd
102
103PACKAGES =+ "libavahi-gobject avahi-daemon libavahi-common libavahi-core libavahi-client avahi-dnsconfd libavahi-glib avahi-autoipd avahi-utils avahi-discover avahi-ui"
104
105FILES_avahi-ui = "${libdir}/libavahi-ui*.so.*"
106FILES_avahi-discover = "${datadir}/applications/avahi-discover.desktop \
107 ${datadir}/avahi/interfaces/avahi-discover.ui \
108 ${bindir}/avahi-discover-standalone \
109 "
110
111LICENSE_libavahi-gobject = "LGPLv2.1+"
112LICENSE_avahi-daemon = "LGPLv2.1+"
113LICENSE_libavahi-common = "LGPLv2.1+"
114LICENSE_libavahi-core = "LGPLv2.1+"
Andrew Geisslerb7d28612020-07-24 16:15:54 -0500115LICENSE_libavahi-client = "LGPLv2.1+"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500116LICENSE_avahi-dnsconfd = "LGPLv2.1+"
117LICENSE_libavahi-glib = "LGPLv2.1+"
118LICENSE_avahi-autoipd = "LGPLv2.1+"
119LICENSE_avahi-utils = "LGPLv2.1+"
120
121# As avahi doesn't put any files into PN, clear the files list to avoid problems
122# if extra libraries appear.
123FILES_${PN} = ""
124FILES_avahi-autoipd = "${sbindir}/avahi-autoipd \
125 ${sysconfdir}/avahi/avahi-autoipd.action \
126 ${sysconfdir}/dhcp/*/avahi-autoipd \
127 ${sysconfdir}/udhcpc.d/00avahi-autoipd \
128 ${sysconfdir}/udhcpc.d/99avahi-autoipd"
129FILES_libavahi-common = "${libdir}/libavahi-common.so.*"
130FILES_libavahi-core = "${libdir}/libavahi-core.so.* ${libdir}/girepository-1.0/AvahiCore*.typelib"
131FILES_avahi-daemon = "${sbindir}/avahi-daemon \
132 ${sysconfdir}/avahi/avahi-daemon.conf \
133 ${sysconfdir}/avahi/hosts \
134 ${sysconfdir}/avahi/services \
135 ${sysconfdir}/dbus-1 \
136 ${sysconfdir}/init.d/avahi-daemon \
137 ${datadir}/avahi/introspection/*.introspect \
138 ${datadir}/avahi/avahi-service.dtd \
139 ${datadir}/avahi/service-types \
140 ${datadir}/dbus-1/system-services"
141FILES_libavahi-client = "${libdir}/libavahi-client.so.*"
142FILES_avahi-dnsconfd = "${sbindir}/avahi-dnsconfd \
143 ${sysconfdir}/avahi/avahi-dnsconfd.action \
144 ${sysconfdir}/init.d/avahi-dnsconfd"
145FILES_libavahi-glib = "${libdir}/libavahi-glib.so.*"
146FILES_libavahi-gobject = "${libdir}/libavahi-gobject.so.* ${libdir}/girepository-1.0/Avahi*.typelib"
147FILES_avahi-utils = "${bindir}/avahi-* ${bindir}/b* ${datadir}/applications/b*"
148
149RDEPENDS_${PN}-dev = "avahi-daemon (= ${EXTENDPKGV}) libavahi-core (= ${EXTENDPKGV})"
150RDEPENDS_${PN}-dev += "${@["", " libavahi-client (= ${EXTENDPKGV})"][bb.utils.contains('PACKAGECONFIG', 'dbus', 1, 0, d)]}"
Andrew Geissler5a43b432020-06-13 10:46:56 -0500151RDEPENDS_${PN}-dnsconfd = "${PN}-daemon"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500152
153RRECOMMENDS_avahi-daemon_append_libc-glibc = " libnss-mdns"
154
155CONFFILES_avahi-daemon = "${sysconfdir}/avahi/avahi-daemon.conf"
156
157USERADD_PACKAGES = "avahi-daemon avahi-autoipd"
158USERADD_PARAM_avahi-daemon = "--system --home /run/avahi-daemon \
159 --no-create-home --shell /bin/false \
160 --user-group avahi"
161
162USERADD_PARAM_avahi-autoipd = "--system --home /run/avahi-autoipd \
163 --no-create-home --shell /bin/false \
164 --user-group \
165 -c \"Avahi autoip daemon\" \
166 avahi-autoipd"
167
168INITSCRIPT_PACKAGES = "avahi-daemon avahi-dnsconfd"
169INITSCRIPT_NAME_avahi-daemon = "avahi-daemon"
170INITSCRIPT_PARAMS_avahi-daemon = "defaults 21 19"
171INITSCRIPT_NAME_avahi-dnsconfd = "avahi-dnsconfd"
172INITSCRIPT_PARAMS_avahi-dnsconfd = "defaults 22 19"
173
174SYSTEMD_PACKAGES = "${PN}-daemon ${PN}-dnsconfd"
175SYSTEMD_SERVICE_${PN}-daemon = "avahi-daemon.service"
176SYSTEMD_SERVICE_${PN}-dnsconfd = "avahi-dnsconfd.service"
177
178do_install_append() {
179 install -d ${D}${sysconfdir}/udhcpc.d
180 install ${WORKDIR}/00avahi-autoipd ${D}${sysconfdir}/udhcpc.d
181 install ${WORKDIR}/99avahi-autoipd ${D}${sysconfdir}/udhcpc.d
182}
183
184# At the time the postinst runs, dbus might not be setup so only restart if running
185# Don't exit early, because update-rc.d needs to run subsequently.
186pkg_postinst_avahi-daemon () {
187if [ -z "$D" ]; then
188 killall -q -HUP dbus-daemon || true
189fi
190}
191