1#
2# Copyright (C) 2007-2012 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9
10ifeq ($(BUILD_VARIANT),dbus)
11PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)/dbus/$(PKG_NAME)-$(PKG_VERSION)
12PKG_ALT_DIR=$(BUILD_DIR)/$(PKG_NAME)/nodbus/$(PKG_NAME)-$(PKG_VERSION)
13else
14PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)/nodbus/$(PKG_NAME)-$(PKG_VERSION)
15PKG_ALT_DIR=$(BUILD_DIR)/$(PKG_NAME)/dbus/$(PKG_NAME)-$(PKG_VERSION)
16endif
17
18
19PKG_NAME:=avahi
20PKG_VERSION:=0.6.31
21PKG_RELEASE:=5
22
23
24PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
25PKG_SOURCE_URL:=http://avahi.org/download/
26PKG_MD5SUM:=2f22745b8f7368ad5a0a3fddac343f2d
27
28PKG_FIXUP:=autoreconf
29PKG_REMOVE_FILES:=autogen.sh
30
31PKG_INSTALL:=1
32PKG_BUILD_PARALLEL:=1
33
34
35
36include $(INCLUDE_DIR)/package.mk
37
38define Package/avahi/Default
39  SECTION:=net
40  CATEGORY:=Network
41  TITLE:=An mDNS/DNS-SD implementation
42  URL:=http://www.avahi.org/
43endef
44
45define Package/avahi/Default/description
46 Avahi is an mDNS/DNS-SD (aka RendezVous/Bonjour/ZeroConf) 
47 implementation (library). It facilitates 
48 service discovery on a local network -- this means that 
49 you can plug your laptop or computer into a network and
50 instantly be able to view other people who you can chat with, 
51 find printers to print to or find files being shared.
52 This kind of technology is already found in MacOS X
53 (branded 'Rendezvous', 'Bonjour' and sometimes 'ZeroConf')
54 and is very convenient.
55endef
56
57define Package/libavahi
58  $(call Package/avahi/Default)
59  SECTION:=libs
60  CATEGORY:=Libraries
61  DEPENDS:=+libdaemon +libpthread +libgdbm +SSP_SUPPORT:libssp
62  TITLE+= (library)
63endef
64
65define Package/libavahi/description
66$(call Package/avahi/Default/description)
67 .
68 The libavahi package contains the mDNS/DNS-SD shared libraries,
69 used by other programs. Specifically, it provides
70 libavahi-core and libavahi-common libraries.
71 By default, it is built without D-Bus support,
72 i.e. the --disable-dbus configuration flag is set.
73 To enable D-Bus support, select the package
74 libavahi-dbus-support.
75endef
76
77define Package/avahi-autoipd
78  $(call Package/avahi/Default)
79  SUBMENU:=IP Addresses and Names
80  DEPENDS:=+libdaemon
81  TITLE:=IPv4LL network address configuration daemon
82endef
83
84define Package/avahi-autoipd/description
85$(call Package/avahi/Default/description)
86 .
87 This package implements IPv4LL, "Dynamic Configuration of IPv4 Link-Local 
88 Addresses" (IETF RFC3927), a protocol for automatic IP address configuration 
89 from the link-local 169.254.0.0/16 range without the need for a central 
90 server. It is primarily intended to be used in ad-hoc networks which lack a
91 DHCP server.
92endef
93
94define Package/avahi-daemon
95  $(call Package/avahi/Default)
96  SUBMENU:=IP Addresses and Names
97  ifeq ($(BUILD_VARIANT),dbus)
98  DEPENDS:=+libavahi +libexpat +librt +libdbus
99  else
100  DEPENDS:=+libavahi +libexpat +librt
101  endif
102  TITLE+= (daemon)
103endef
104
105define Package/avahi-daemon/description
106$(call Package/avahi/Default/description)
107 .
108 This package contains an mDNS/DNS-SD daemon.
109endef
110
111define Package/avahi-daemon/conffiles
112/etc/avahi/avahi-daemon.conf
113endef
114
115define Package/avahi-dnsconfd
116  $(call Package/avahi/Default)
117  SUBMENU:=IP Addresses and Names
118  DEPENDS:=+libavahi
119  TITLE:=A Unicast DNS server from mDNS/DNS-SD configuration daemon
120endef
121
122define Package/avahi-dnsconfd/description
123$(call Package/avahi/Default/description)
124 .
125 This package contains a Unicast DNS server from mDNS/DNS-SD configuration
126 daemon, which may be used to configure conventional DNS servers using mDNS
127 in a DHCP-like fashion. Especially useful on IPv6.
128endef
129
130define Package/libavahi-dbus-support
131  $(call Package/avahi/Default)
132  SECTION:=libs
133  CATEGORY:=Libraries
134  VARIANT:=dbus
135  DEPENDS:=+dbus +libavahi
136  TITLE+= (D-Bus support)
137endef
138
139define Package/libavahi-dbus-support/description
140$(call Package/libavahi/description)
141 .
142 The libavahi-dbus-support package enables
143 D-Bus support in avahi, needed to support
144 the libavahi-client library and avahi-utils.
145 Selecting this package modifies the build configuration
146 so that avahi packages are built with support for D-BUS enabled;
147 it does not generate a separate binary of its own.
148 It also automatically adds the D-Bus package to the build.
149 libavahi-dbus-support is selected automatically if you select
150 libavahi-client or avahi-utils.
151endef
152
153define Package/libavahi-client
154  $(call Package/avahi/Default)
155  SECTION:=libs
156  CATEGORY:=Libraries
157  DEPENDS:=+libavahi-dbus-support +avahi-daemon
158  TITLE+= (libavahi-client library)
159endef
160
161define Package/libavahi-client/description
162$(call Package/avahi/Default/description)
163 .
164 This packages adds the libavahi-client library.
165 It also automatically adds the required
166 libavahi-dbus-support and the avahi-daemon packages.
167 For more information please see the avahi documentation.
168endef
169
170define Package/avahi-utils
171  $(call Package/avahi/Default)
172  SUBMENU:=IP Addresses and Names
173  DEPENDS:=+libavahi-client
174  TITLE+= (utilities)
175endef
176
177define Package/avahi-utils/description
178$(call Package/avahi/Default/description)
179 .
180 This packages installs the following avahi utility programs:
181 avahi-browse, avahi-publish, avahi-resolve, avahi-set-host-name.
182 It also automatically adds the required libavahi-client package.
183 For more information please see the avahi documentation.
184endef
185
186TARGET_CFLAGS += $(FPIC) -DGETTEXT_PACKAGE
187
188CONFIGURE_ARGS+= \
189	--enable-shared \
190	--enable-static \
191	--disable-glib \
192	--disable-gobject \
193	--disable-qt3 \
194	--disable-qt4 \
195	--disable-gtk \
196	--disable-gtk3 \
197	--with-xml=expat \
198	--disable-dbm \
199	--enable-gdbm \
200	--enable-libdaemon \
201	--disable-python \
202	--disable-pygtk \
203	--disable-python-dbus \
204	--disable-mono \
205	--disable-monodoc \
206	--disable-doxygen-doc \
207	--disable-doxygen-dot \
208	--disable-doxygen-man \
209	--disable-doxygen-rtf \
210	--disable-doxygen-xml \
211	--disable-doxygen-chm \
212	--disable-doxygen-chi \
213	--disable-doxygen-html \
214	--disable-doxygen-ps \
215	--disable-doxygen-pdf \
216	--disable-xmltoman \
217	--with-distro=none \
218	--with-avahi-user=root \
219	--with-avahi-group=root \
220	--with-autoipd-user=root \
221	--with-autoipd-group=root
222
223ifneq ($(CONFIG_SSP_SUPPORT),y)
224CONFIGURE_ARGS+= \
225	--disable-stack-protector
226endif
227
228ifeq ($(BUILD_VARIANT),dbus)
229CONFIGURE_ARGS += \
230	--enable-dbus
231else
232CONFIGURE_ARGS += \
233	--disable-dbus	
234endif
235
236CONFIGURE_VARS+= \
237	CFLAGS="$$$$CFLAGS -DNDEBUG -DDISABLE_SYSTEMD" \
238	ac_cv_header_sys_capability_h=no \
239
240define Build/InstallDev
241	$(INSTALL_DIR) $(1)/usr/include
242	$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
243	$(INSTALL_DIR) $(1)/usr/lib
244	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libavahi-* $(1)/usr/lib/
245	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
246	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/
247endef
248
249define Package/libavahi-dbus-support/install
250	$(INSTALL_DIR) $(1)/etc/dbus-1/system.d
251	$(CP) $(PKG_INSTALL_DIR)/etc/dbus-1/system.d/* $(1)/etc/dbus-1/system.d
252	$(CP) ./files/avahi-dbus.conf $(1)/etc/dbus-1/system.d
253endef
254
255define Package/libavahi/install
256	# The next line removes the ".build" file from the "other" build.
257	# The effect is that, if the other build is re-selected in the future,
258	# the build system will be forced to replace all the code in the
259	# installer packages, removing anything from the current build.
260	# "Other" means this: if the current build is "dbus", the other is "nodebus",
261	# and if the current build is "nodbus", the other is "dbus".
262	$(RM) -f $(PKG_ALT_DIR)/.built
263	$(INSTALL_DIR) $(1)/usr/lib
264	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libavahi-{common,core}.so.* $(1)/usr/lib/
265endef
266
267define Package/libavahi-client/install
268	$(INSTALL_DIR) $(1)/usr/lib
269	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libavahi-client.so.* $(1)/usr/lib/
270endef
271
272define Package/avahi-utils/install
273	$(INSTALL_DIR) $(1)/usr/bin
274	$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
275endef
276
277define Package/avahi-autoipd/install
278	$(INSTALL_DIR) $(1)/etc/avahi
279	$(CP) $(PKG_INSTALL_DIR)/etc/avahi/avahi-autoipd.action $(1)/etc/avahi/
280	$(INSTALL_DIR) $(1)/usr/sbin
281	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/avahi-autoipd $(1)/usr/sbin/
282endef
283
284define Package/avahi-daemon/install
285	$(INSTALL_DIR) $(1)/usr/sbin
286	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/avahi-daemon $(1)/usr/sbin/
287	$(INSTALL_DIR) $(1)/etc/avahi
288	rm -f $(1)/etc/avahi/services
289	ln -s /tmp/avahi/services $(1)/etc/avahi/services
290	$(INSTALL_DIR) $(1)/usr/config/avahi/services
291	$(INSTALL_DATA) ./files/avahi-daemon.conf $(1)/etc/avahi/
292	$(INSTALL_DATA) ./files/service-http $(1)/usr/config/avahi/services/http.service
293	$(INSTALL_DATA) ./files/afpd.service $(1)/usr/config/avahi/services/afpd.service
294	$(INSTALL_DATA) ./files/smbd.service $(1)/usr/config/avahi/services/smbd.service
295	$(INSTALL_DATA) ./files/adisk.service $(1)/usr/config/avahi/services/adisk.service
296	$(INSTALL_DIR) $(1)/etc/init.d
297	$(INSTALL_BIN) ./files/avahi-daemon.init $(1)/etc/init.d/avahi-daemon
298endef
299
300define Package/avahi-dnsconfd/install
301	$(INSTALL_DIR) $(1)/etc/avahi
302	$(CP) $(PKG_INSTALL_DIR)/etc/avahi/avahi-dnsconfd.action $(1)/etc/avahi/
303	$(INSTALL_DIR) $(1)/usr/sbin
304	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/avahi-dnsconfd $(1)/usr/sbin/
305endef
306
307$(eval $(call BuildPackage,libavahi-client))
308$(eval $(call BuildPackage,avahi-utils))
309$(eval $(call BuildPackage,libavahi-dbus-support))
310$(eval $(call BuildPackage,libavahi))
311$(eval $(call BuildPackage,avahi-autoipd))
312$(eval $(call BuildPackage,avahi-daemon))
313$(eval $(call BuildPackage,avahi-dnsconfd))
314
315