nixpkgs/pkgs/development/libraries/avahi/default.nix

96 lines
3.2 KiB
Nix
Raw Normal View History

{ fetchurl, fetchpatch, stdenv, pkgconfig, libdaemon, dbus, perlPackages
2020-07-02 08:56:08 +03:00
, expat, gettext, intltool, glib, libiconv, writeShellScriptBin
2018-12-03 00:47:16 +03:00
, gtk3Support ? false, gtk3 ? null
2013-07-07 14:35:25 +04:00
, qt4 ? null
, qt4Support ? false
2019-04-18 08:36:26 +03:00
, withLibdnssdCompat ? false
, python ? null
, withPython ? false }:
assert qt4Support -> qt4 != null;
2020-07-02 08:56:08 +03:00
let
# despite the configure script claiming it supports $PKG_CONFIG, it doesnt respect it
pkgconfig-helper = writeShellScriptBin "pkg-config" ''exec $PKG_CONFIG "$@"'';
in
stdenv.mkDerivation rec {
2019-02-25 10:42:04 +03:00
name = "avahi${stdenv.lib.optionalString withLibdnssdCompat "-compat"}-${version}";
2017-08-01 07:34:56 +03:00
version = "0.7";
src = fetchurl {
url = "https://github.com/lathiat/avahi/releases/download/v${version}/avahi-${version}.tar.gz";
2017-08-01 07:34:56 +03:00
sha256 = "0128n7jlshw4bpx0vg8lwj8qwdisjxi7mvniwfafgnkzzrfrpaap";
};
2020-06-25 03:39:29 +03:00
prePatch = ''
substituteInPlace configure \
--replace pkg-config "$PKG_CONFIG"
'';
patches = [
./no-mkdir-localstatedir.patch
(fetchpatch {
name ="CVE-2017-6519-CVE-2018-100084.patch";
url = "https://github.com/lathiat/avahi/commit/e111def44a7df4624a4aa3f85fe98054bffb6b4f.patch";
sha256 = "06n7b7kz6xcc35c7xjfc1kj3k2llyjgi09nhy0ci32l1bhacjw0q";
})
];
buildInputs = [ libdaemon dbus glib expat libiconv ]
++ (with perlPackages; [ perl XMLParser ])
2018-12-03 00:47:16 +03:00
++ (stdenv.lib.optional gtk3Support gtk3)
++ (stdenv.lib.optional qt4Support qt4);
2019-04-18 08:36:26 +03:00
propagatedBuildInputs =
stdenv.lib.optionals withPython (with python.pkgs; [ python pygobject3 dbus-python ]);
2020-07-02 08:56:08 +03:00
nativeBuildInputs = [ pkgconfig pkgconfig-helper gettext intltool glib ];
configureFlags =
[ "--disable-qt3" "--disable-gdbm" "--disable-mono"
"--disable-gtk" "--with-dbus-sys=${placeholder "out"}/share/dbus-1/system.d"
2018-12-03 00:47:16 +03:00
(stdenv.lib.enableFeature gtk3Support "gtk3")
"--${if qt4Support then "enable" else "disable"}-qt4"
2019-04-18 08:36:26 +03:00
(stdenv.lib.enableFeature withPython "python")
"--localstatedir=/var" "--with-distro=none"
2017-12-20 21:58:56 +03:00
# A systemd unit is provided by the avahi-daemon NixOS module
"--with-systemdsystemunitdir=no" ]
2013-07-07 14:35:25 +04:00
++ stdenv.lib.optional withLibdnssdCompat "--enable-compat-libdns_sd"
# autoipd won't build on darwin
++ stdenv.lib.optional stdenv.isDarwin "--disable-autoipd";
NIX_CFLAGS_COMPILE = "-DAVAHI_SERVICE_DIR=\"/etc/avahi/services\"";
2013-07-07 14:35:25 +04:00
preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
sed -i '20 i\
#define __APPLE_USE_RFC_2292' \
avahi-core/socket.c
'';
postInstall =
# Maintain compat for mdnsresponder and howl
stdenv.lib.optionalString withLibdnssdCompat ''
ln -s avahi-compat-libdns_sd/dns_sd.h "$out/include/dns_sd.h"
'';
/* # these don't exist (anymore?)
ln -s avahi-compat-howl $out/include/howl
ln -s avahi-compat-howl.pc $out/lib/pkgconfig/howl.pc
*/
2013-07-07 14:35:25 +04:00
meta = with stdenv.lib; {
description = "mDNS/DNS-SD implementation";
homepage = "http://avahi.org";
2013-07-07 14:35:25 +04:00
license = licenses.lgpl2Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ lovek323 globin ];
2013-07-07 14:35:25 +04:00
longDescription = ''
Avahi is a system which facilitates service discovery on a local
network. It is an implementation of the mDNS (for "Multicast
DNS") and DNS-SD (for "DNS-Based Service Discovery")
protocols.
'';
};
}