# $Id: PKGBUILD 70504 2010-02-27 03:24:54Z dgriffiths $
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>

pkgname=avahi
pkgver=0.6.25
pkgrel=3
pkgdesc="A multicast/unicast DNS-SD framework"
arch=('i686' 'x86_64')
url="http://www.avahi.org/"
license=('LGPL')
depends=('dbus>=1.1.20-1' 'libcap>=2.16' 'libdaemon>=0.11' 'gdbm' 'glib2' 'expat')
optdepends=('qt3: Qt3 UI support'
	'libglade: avahi-discover-standalone'
	'nss-mdns: NSS support for mDNS'
	'pygtk: avahi-discover'
	'dbus-python: avahi-discover')
makedepends=('mono' 'pygtk' 'gtk-sharp-2' 'dbus-python' 'qt3' 'libglade' 'intltool')
backup=(etc/avahi/avahi-daemon.conf etc/avahi/services/{sftp-,}ssh.service)
install=avahi.install
conflicts=('howl' 'mdnsresponder')
provides=('howl' 'mdnsresponder')
replaces=('howl' 'mdnsresponder')
options=('!libtool')
source=(http://www.avahi.org/download/avahi-${pkgver}.tar.gz gnome-nettool.png avahi-daemon-dbus.patch)

build() {
  [ -z "${QTDIR}" ] && . /etc/profile.d/qt3.sh
  export MONO_SHARED_DIR=${srcdir}/.wabi
  mkdir -p ${MONO_SHARED_DIR}

  cd ${srcdir}/${pkgname}-${pkgver}

  sed -i 's|Requires.private|Requires|' avahi-qt3.pc.in

  ./configure --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --disable-qt4 \
    --disable-monodoc \
    --disable-doxygen-doc \
    --disable-xmltoman \
    --enable-compat-libdns_sd \
    --enable-compat-howl \
    --with-distro=archlinux \
    --with-avahi-priv-access-group=network \
    --enable-autoipd \
    --with-autoipd-user=avahi \
    --with-autoipd-group=avahi

  make || return 1
  make DESTDIR=${pkgdir} install

  rm -rf ${MONO_SHARED_DIR}
  
  sed -i -e 's/netdev/network/g' ${pkgdir}/etc/dbus-1/system.d/avahi-dbus.conf
   
  # howl and mdnsresponder compatability
  cd ${pkgdir}/usr/include
  ln -s avahi-compat-libdns_sd/dns_sd.h dns_sd.h
  ln -s avahi-compat-howl howl
  cd ${pkgdir}/usr/lib/pkgconfig
  ln -s avahi-compat-howl.pc howl.pc
  mkdir -p ${pkgdir}/usr/share/pixmaps
  install -m 644 ${srcdir}/gnome-nettool.png ${pkgdir}/usr/share/pixmaps/gnome-nettool.png

  cd ${pkgdir}
  patch -p0 < ${srcdir}/avahi-daemon-dbus.patch || return 1
}
md5sums=('a83155a6e29e3988f07e5eea3287b21e'
         '42c2905307c7a5dc6ac4b75f4c3d65a3'
	 '0e1f5900b56fcfa1bffddb4f233f539f')