lol
1{ fetchurl, stdenv, pkgconfig, libdaemon, dbus, perl, perlXMLParser
2, expat, gettext, intltool, glib, libiconv
3, qt4 ? null
4, qt4Support ? false
5, withLibdnssdCompat ? false }:
6
7assert qt4Support -> qt4 != null;
8
9stdenv.mkDerivation rec {
10 name = "avahi-${version}";
11 version = "0.6.32";
12
13 src = fetchurl {
14 url = "https://github.com/lathiat/avahi/releases/download/v${version}/avahi-${version}.tar.gz";
15 sha256 = "0m5l3ny9i2z1l27y4wm731c0zdkmfn6l1szbajx0ljjiblc92jfm";
16 };
17
18 patches = [ ./no-mkdir-localstatedir.patch ];
19
20 buildInputs = [ libdaemon dbus perl perlXMLParser glib expat libiconv ]
21 ++ (stdenv.lib.optional qt4Support qt4);
22
23 nativeBuildInputs = [ pkgconfig gettext intltool ];
24
25 configureFlags =
26 [ "--disable-qt3" "--disable-gdbm" "--disable-mono"
27 "--disable-gtk" "--disable-gtk3"
28 "--${if qt4Support then "enable" else "disable"}-qt4"
29 "--disable-python" "--localstatedir=/var" "--with-distro=none" ]
30 ++ stdenv.lib.optional withLibdnssdCompat "--enable-compat-libdns_sd"
31 # autoipd won't build on darwin
32 ++ stdenv.lib.optional stdenv.isDarwin "--disable-autoipd";
33
34 preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
35 sed -i '20 i\
36 #define __APPLE_USE_RFC_2292' \
37 avahi-core/socket.c
38 '';
39
40 postInstall =
41 # Maintain compat for mdnsresponder and howl
42 stdenv.lib.optionalString withLibdnssdCompat ''
43 ln -s avahi-compat-libdns_sd/dns_sd.h "$out/include/dns_sd.h"
44 '';
45 /* # these don't exist (anymore?)
46 ln -s avahi-compat-howl $out/include/howl
47 ln -s avahi-compat-howl.pc $out/lib/pkgconfig/howl.pc
48 */
49
50 meta = with stdenv.lib; {
51 description = "mDNS/DNS-SD implementation";
52 homepage = http://avahi.org;
53 license = licenses.lgpl2Plus;
54 platforms = platforms.unix;
55 maintainers = with maintainers; [ lovek323 ];
56
57 longDescription = ''
58 Avahi is a system which facilitates service discovery on a local
59 network. It is an implementation of the mDNS (for "Multicast
60 DNS") and DNS-SD (for "DNS-Based Service Discovery")
61 protocols.
62 '';
63 };
64}