xref: /OK3568_Linux_fs/buildroot/package/avahi/avahi.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# avahi
4#
5################################################################################
6
7AVAHI_VERSION = 0.8
8AVAHI_SITE = https://github.com/lathiat/avahi/releases/download/v$(AVAHI_VERSION)
9AVAHI_LICENSE = LGPL-2.1+
10AVAHI_LICENSE_FILES = LICENSE
11AVAHI_CPE_ID_VENDOR = avahi
12AVAHI_SELINUX_MODULES = avahi
13AVAHI_INSTALL_STAGING = YES
14
15# CVE-2021-26720 is an issue in avahi-daemon-check-dns.sh, which is
16# part of the Debian packaging and not part of upstream avahi
17AVAHI_IGNORE_CVES += CVE-2021-26720
18
19# 0001-Fix-NULL-pointer-crashes-from-175.patch
20AVAHI_IGNORE_CVES += CVE-2021-36217
21
22AVAHI_CONF_ENV = \
23	avahi_cv_sys_cxx_works=yes \
24	DATADIRNAME=share
25
26# Note: even if we have Gtk2 and Gtk3 support in Buildroot, we
27# explicitly disable support for them, in order to avoid the following
28# circular dependencies:
29#
30#  avahi -> libglade -> libgtk2 -> cups -> avahi
31#  avahi -> libgtk3 -> cups -> avahi
32#
33# Since Gtk2 and Gtk3 in Avahi are only used for some example/demo
34# programs, we decided to disable their support to solve the circular
35# dependency.
36AVAHI_CONF_OPTS = \
37	--disable-qt3 \
38	--disable-qt4 \
39	--disable-qt5 \
40	--disable-gtk \
41	--disable-gtk3 \
42	--disable-gdbm \
43	--disable-pygobject \
44	--disable-mono \
45	--disable-monodoc \
46	--disable-stack-protector \
47	--disable-introspection \
48	--with-distro=none \
49	--disable-manpages \
50	$(if $(BR2_PACKAGE_AVAHI_AUTOIPD),--enable,--disable)-autoipd \
51	--with-avahi-user=avahi \
52	--with-avahi-group=avahi \
53	--with-autoipd-user=avahi \
54	--with-autoipd-group=avahi
55
56AVAHI_DEPENDENCIES = host-pkgconf $(TARGET_NLS_DEPENDENCIES)
57
58AVAHI_CFLAGS = $(TARGET_CFLAGS)
59
60ifeq ($(BR2_PACKAGE_SYSTEMD),y)
61AVAHI_CONF_OPTS += --with-systemdsystemunitdir=/usr/lib/systemd/system
62else
63AVAHI_CONF_OPTS += --with-systemdsystemunitdir=no
64AVAHI_CFLAGS += -DDISABLE_SYSTEMD
65endif
66
67ifneq ($(BR2_PACKAGE_AVAHI_DAEMON)$(BR2_PACKAGE_AVAHI_AUTOIPD),)
68AVAHI_DEPENDENCIES += libdaemon
69else
70AVAHI_CONF_OPTS += --disable-libdaemon
71endif
72
73ifeq ($(BR2_PACKAGE_LIBCAP),y)
74AVAHI_DEPENDENCIES += libcap
75endif
76
77ifeq ($(BR2_PACKAGE_AVAHI_DAEMON),y)
78AVAHI_DEPENDENCIES += expat
79AVAHI_CONF_OPTS += --with-xml=expat
80else
81AVAHI_CONF_OPTS += --with-xml=none
82endif
83
84ifeq ($(BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY),y)
85AVAHI_CONF_OPTS += --enable-compat-libdns_sd
86endif
87
88ifeq ($(BR2_PACKAGE_DBUS),y)
89AVAHI_DEPENDENCIES += dbus
90AVAHI_CONF_OPTS += --with-dbus-sys=/usr/share/dbus-1/system.d
91else
92AVAHI_CONF_OPTS += --disable-dbus
93endif
94
95ifeq ($(BR2_PACKAGE_LIBEVENT),y)
96AVAHI_DEPENDENCIES += libevent
97else
98AVAHI_CONF_OPTS += --disable-libevent
99endif
100
101ifeq ($(BR2_PACKAGE_LIBGLIB2),y)
102AVAHI_DEPENDENCIES += libglib2
103else
104AVAHI_CONF_OPTS += --disable-glib --disable-gobject
105endif
106
107ifeq ($(BR2_PACKAGE_PYTHON),y)
108AVAHI_CONF_ENV += \
109	am_cv_pathless_PYTHON=python \
110	am_cv_path_PYTHON=$(PYTHON_TARGET_BINARY) \
111	am_cv_python_version=$(PYTHON_VERSION) \
112	am_cv_python_platform=linux2 \
113	am_cv_python_pythondir=/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \
114	am_cv_python_pyexecdir=/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \
115	py_cv_mod_socket_=yes
116
117AVAHI_DEPENDENCIES += python
118AVAHI_CONF_OPTS += --enable-python
119else
120AVAHI_CONF_OPTS += --disable-python
121endif
122
123ifeq ($(BR2_PACKAGE_DBUS_PYTHON),y)
124AVAHI_CONF_OPTS += --enable-python-dbus
125AVAHI_CONF_ENV += py_cv_mod_dbus_=yes
126AVAHI_DEPENDENCIES += dbus-python
127else
128AVAHI_CONF_OPTS += --disable-python-dbus
129endif
130
131AVAHI_CONF_ENV += CFLAGS="$(AVAHI_CFLAGS)"
132
133AVAHI_MAKE_OPTS += LIBS=$(TARGET_NLS_LIBS)
134
135define AVAHI_USERS
136	avahi -1 avahi -1 * - - -
137endef
138
139define AVAHI_REMOVE_INITSCRIPT
140	rm -rf $(TARGET_DIR)/etc/init.d/avahi-*
141endef
142
143AVAHI_POST_INSTALL_TARGET_HOOKS += AVAHI_REMOVE_INITSCRIPT
144
145ifeq ($(BR2_PACKAGE_AVAHI_AUTOIPD),y)
146define AVAHI_INSTALL_AUTOIPD
147	rm -f $(TARGET_DIR)/var/lib/avahi-autoipd
148	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/lib
149	ln -sf /tmp/avahi-autoipd $(TARGET_DIR)/var/lib/avahi-autoipd
150endef
151
152define AVAHI_INSTALL_AUTOIPD_INIT_SYSV
153	$(INSTALL) -D -m 0755 package/avahi/S05avahi-setup.sh $(TARGET_DIR)/etc/init.d/S05avahi-setup.sh
154endef
155
156AVAHI_POST_INSTALL_TARGET_HOOKS += AVAHI_INSTALL_AUTOIPD
157endif
158
159ifeq ($(BR2_PACKAGE_AVAHI_DAEMON),y)
160
161ifeq ($(BR2_PACKAGE_SYSTEMD_SYSUSERS),y)
162define AVAHI_INSTALL_SYSTEMD_SYSUSERS
163	$(INSTALL) -D -m 644 package/avahi/avahi_sysusers.conf \
164		$(TARGET_DIR)/usr/lib/sysusers.d/avahi.conf
165endef
166endif
167
168define AVAHI_INSTALL_INIT_SYSTEMD
169	$(INSTALL) -D -m 644 package/avahi/avahi_tmpfiles.conf \
170		$(TARGET_DIR)/usr/lib/tmpfiles.d/avahi.conf
171
172	$(AVAHI_INSTALL_SYSTEMD_SYSUSERS)
173endef
174
175define AVAHI_INSTALL_DAEMON_INIT_SYSV
176	$(INSTALL) -D -m 0755 package/avahi/S50avahi-daemon $(TARGET_DIR)/etc/init.d/S50avahi-daemon
177endef
178
179endif
180
181define AVAHI_INSTALL_INIT_SYSV
182	$(AVAHI_INSTALL_AUTOIPD_INIT_SYSV)
183	$(AVAHI_INSTALL_DAEMON_INIT_SYSV)
184endef
185
186ifeq ($(BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY),y)
187# applications expects to be able to #include <dns_sd.h>
188define AVAHI_STAGING_INSTALL_LIBDNSSD_LINK
189	ln -sf avahi-compat-libdns_sd/dns_sd.h \
190		$(STAGING_DIR)/usr/include/dns_sd.h
191endef
192
193AVAHI_POST_INSTALL_STAGING_HOOKS += AVAHI_STAGING_INSTALL_LIBDNSSD_LINK
194endif
195
196$(eval $(autotools-package))
197