--- /dev/null
+--- mDNSPosix/Makefile.orig 2007-04-27 19:32:18.000000000 +0200
++++ mDNSPosix/Makefile 2007-04-27 19:37:54.000000000 +0200
+@@ -265,7 +265,6 @@
+
+ COREDIR = ../mDNSCore
+ SHAREDDIR = ../mDNSShared
+-JDK = /usr/jdk
+
+ CC = @cc
+ LD = ld -shared
+@@ -426,18 +425,18 @@
+ RUNLEVELSCRIPTSDIR = /etc
+ else
+ # else install into /etc/rc.d/ (*BSD)
+-STARTUPSCRIPTDIR = $(INSTBASE)/etc/rc.d
++STARTUPSCRIPTDIR = $(DESTDIR)$(INSTBASE)/etc/rc.d
+ endif
+ endif
+ endif
+
+-CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_OS) $(CFLAGS_DEBUG)
++CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_OS) $(CFLAGS_DEBUG) $(OPT_CFLAGS)
+
+ #############################################################################
+
+ all: setup Daemon libdns_sd Clients SAClient SAResponder SAProxyResponder Identify NetMonitor dnsextd $(OPTIONALTARG)
+
+-install: setup InstalledDaemon InstalledStartup InstalledLib InstalledManPages InstalledClients $(OPTINSTALL)
++install: setup InstalledDaemon InstalledLib InstalledManPages InstalledClients $(OPTINSTALL)
+
+ # 'setup' sets up the build directory structure the way we want
+ setup:
+@@ -473,7 +472,7 @@
+ CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o
+
+ $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS)
+- @$(LD) $(LINKOPTS) -o $@ $+
++ @$(LD) $(LIBFLAGS) -Wl,-soname=libdns_sd.$(LDSUFFIX).$(LIBVERS) -o $@ $+
+ @$(STRIP) $@
+
+ Clients: setup libdns_sd ../Clients/build/dns-sd
+@@ -487,95 +486,59 @@
+ @echo "Name Service Switch module done"
+
+ $(BUILDDIR)/$(NSSLIBFILE): $(CLIENTLIBOBJS) $(OBJDIR)/nss_mdns.c.so.o
+- @$(LD) $(LINKOPTS) -o $@ $+
++ @$(LD) $(LIBFLAGS) -Wl,-soname=$(NSSLINKNAME) -o $@ $+
+ @$(STRIP) $@
+
+ #############################################################################
+
+ # The Install targets place built stuff in their proper places
+-InstalledDaemon: $(INSTBASE)/sbin/mdnsd
++InstalledDaemon: $(DESTDIR)$(INSTBASE)/sbin/mdnsd
+ @echo $+ " installed"
+
+-InstalledLib: $(INSTBASE)/lib/libdns_sd.$(LDSUFFIX).$(LIBVERS) $(INSTBASE)/include/dns_sd.h
++InstalledLib: $(DESTDIR)$(INSTBASE)/lib/libdns_sd.$(LDSUFFIX).$(LIBVERS) $(DESTDIR)$(INSTBASE)/include/dns_sd.h
+ @echo $+ " installed"
+
+-InstalledStartup: $(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAME)
++InstalledStartup: $(DESTDIR)$(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAME)
+ @echo $+ " installed"
+
+-InstalledManPages: $(MANPATH)/man8/mdnsd.8
++InstalledManPages: $(DESTDIR)$(MANPATH)/man8/mdnsd.8
+ @echo $+ " installed"
+
+-InstalledClients: $(INSTBASE)/bin/dns-sd
++InstalledClients: $(DESTDIR)$(INSTBASE)/bin/dns-sd
+ @echo $+ " installed"
+
+-InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) /etc/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8
++InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) $(DESTDIR)etc/nss_mdns.conf $(DESTDIR)$(MANPATH)/man5/nss_mdns.conf.5 $(DESTDIR)$(MANPATH)/man8/libnss_mdns.8
+ @echo $+ " installed"
+
+-# Note: If daemon already installed, we make sure it's stopped before overwriting it
+-$(INSTBASE)/sbin/mdnsd: $(BUILDDIR)/mdnsd
+- @if test -x $@; then $(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAME) stop; fi
++$(DESTDIR)$(INSTBASE)/lib/libdns_sd.$(LDSUFFIX).$(LIBVERS): $(BUILDDIR)/libdns_sd.$(LDSUFFIX)
+ $(CP) $< $@
++ $(LN) libdns_sd.$(LDSUFFIX).$(LIBVERS) $(DESTDIR)$(INSTBASE)/lib/libdns_sd.$(LDSUFFIX)
+
+-$(INSTBASE)/lib/libdns_sd.$(LDSUFFIX).$(LIBVERS): $(BUILDDIR)/libdns_sd.$(LDSUFFIX)
++$(DESTDIR)$(INSTBASE)/include/dns_sd.h: $(SHAREDDIR)/dns_sd.h
+ $(CP) $< $@
+- $(LN) $@ $(INSTBASE)/lib/libdns_sd.$(LDSUFFIX)
+-ifdef LDCONFIG
+- # -m means 'merge into existing database', -R means 'rescan directories'
+- $(LDCONFIG) -mR
+-endif
+-
+-$(INSTBASE)/include/dns_sd.h: $(SHAREDDIR)/dns_sd.h
+- $(CP) $< $@
+-
+-# We make this target dependent on $(INSTBASE)/sbin/mdnsd because we need to ensure
+-# that the daemon is installed *before* we try to execute the command to start it.
+-$(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAME): mdnsd.sh $(STARTUPSCRIPTDIR) $(INSTBASE)/sbin/mdnsd
+- $(CP) $< $@
+- chmod ugo+x $@
+- $@ start
+-ifdef RUNLEVELSCRIPTSDIR
+-ifeq ($(wildcard $(RUNLEVELSCRIPTSDIR)/runlevels/default), $(RUNLEVELSCRIPTSDIR)/runlevels/default)
+- $(LN) $@ $(RUNLEVELSCRIPTSDIR)/runlevels/default/mdns
+-else
+- $(LN) $@ $(RUNLEVELSCRIPTSDIR)/rc2.d/S52mdns
+- $(LN) $@ $(RUNLEVELSCRIPTSDIR)/rc3.d/S52mdns
+- $(LN) $@ $(RUNLEVELSCRIPTSDIR)/rc4.d/S52mdns
+- $(LN) $@ $(RUNLEVELSCRIPTSDIR)/rc5.d/S52mdns
+- $(LN) $@ $(RUNLEVELSCRIPTSDIR)/rc0.d/K16mdns
+- $(LN) $@ $(RUNLEVELSCRIPTSDIR)/rc6.d/K16mdns
+-endif
+-endif
+
+-$(MANPATH)/man5/%.5: %.5
++$(DESTDIR)$(MANPATH)/man5/%.5: %.5
+ cp $< $@
+ chmod 444 $@
+
+-$(MANPATH)/man8/%.8: %.8
++$(DESTDIR)$(MANPATH)/man8/%.8: %.8
+ cp $< $@
+ chmod 444 $@
+
+-$(MANPATH)/man8/mdnsd.8: $(SHAREDDIR)/mDNSResponder.8
++$(DESTDIR)$(MANPATH)/man8/mdnsd.8: $(SHAREDDIR)/mDNSResponder.8
+ cp $< $@
+ chmod 444 $@
+
+-$(INSTBASE)/bin/dns-sd: ../Clients/build/dns-sd
++$(DESTDIR)$(INSTBASE)/bin/dns-sd: ../Clients/build/dns-sd
++ mkdir $(DESTDIR)$(INSTBASE)/bin
+ $(CP) $< $@
+
+-$(NSSINSTPATH)/$(NSSLINKNAME): $(NSSINSTPATH)/$(NSSLIBFILE)
+- $(LN) $< $@
+- ldconfig
+-
+-$(NSSINSTPATH)/$(NSSLIBFILE): $(BUILDDIR)/$(NSSLIBFILE)
+- $(CP) $< $@
+- chmod 444 $@
++$(DESTDIR)$(NSSINSTPATH)/$(NSSLINKNAME): $(DESTDIR)$(NSSINSTPATH)/$(NSSLIBFILE)
++ $(LN) $(NSSLIBFILE) $@
+
+-/etc/nss_mdns.conf: nss_mdns.conf
++$(DESTDIR)$(NSSINSTPATH)/$(NSSLIBFILE): $(BUILDDIR)/$(NSSLIBFILE)
+ $(CP) $< $@
+ chmod 444 $@
+- # Check the nsswitch.conf file.
+- # If 'mdns' does not already appear on the "hosts:" line, then add it right before 'dns'
+- cp -f /etc/nsswitch.conf /etc/nsswitch.conf.pre-mdns
+- sed -e '/mdns/!s/^\(hosts:.*\)dns\(.*\)/\1mdns dns\2/' /etc/nsswitch.conf.pre-mdns > /etc/nsswitch.conf
+
+ #############################################################################
+
--- /dev/null
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/mDNSResponder/mDNSResponder-107.6.ebuild,v 1.1 2007/04/27 19:48:15 carlo Exp $
+
+inherit eutils base toolchain-funcs flag-o-matic java-utils-2
+
+DESCRIPTION="The mDNSResponder project is a component of Bonjour, Apple's initiative for zero-configuration networking."
+HOMEPAGE="http://developer.apple.com/networking/bonjour/index.html"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/${P}.tar.gz"
+LICENSE="APSL-2 BSD"
+
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE="debug doc ipv6 java"
+
+DEPEND="!sys-auth/nss-mdns
+ java? ( >=virtual/jdk-1.5 )"
+RDEPEND="!sys-auth/nss-mdns
+ java? ( >=virtual/jre-1.5 )"
+
+PATCHES="${FILESDIR}/mDNSResponder-107.6-Makefiles.diff"
+pkg_setup() {
+ if use elibc_FreeBSD; then
+ os=freebsd
+ else
+ os=linux
+ fi
+}
+
+mdnsmake() {
+ local debug jdk __ipv6
+ use java && jdk="JDK=$(java-config -O)"
+ use debug && debug='DEBUG=1'
+ use ipv6 && __ipv6='HAVE_IPV6=1' || __ipv6='HAVE_IPV6=0'
+ einfo "Running emake " os="${os}" CC="$(tc-getCC)" LD="$(tc-getCC) -shared" \
+ ${jdk} ${debug} OPT_CFLAGS="${CFLAGS}" LIBFLAGS="${LDFLAGS}" \
+ LOCALBASE="/usr" "$@"
+ emake -j1 os="${os}" CC="$(tc-getCC)" LD="$(tc-getCC) -shared" \
+ ${jdk} ${debug} OPT_CFLAGS="${CFLAGS}" LIBFLAGS="${LDFLAGS}" \
+ LOCALBASE="/usr" ${__ipv6} "$@"
+}
+
+src_compile() {
+ cd ${S}/mDNSPosix
+ mdnsmake || die "make failed"
+
+ if use java; then
+ mdnsmake Java || die "make mDNSPosix java failed"
+ if use doc ; then
+ mdnsmake JavaDoc || die "make mDNSPosix java doc failed"
+ fi
+ fi
+}
+
+src_install() {
+ cd "${S}/mDNSPosix"
+
+ dodir /usr/sbin
+ dodir /usr/lib
+ dodir /usr/include
+ dodir /lib
+ dodir /etc
+ dodir /usr/share/man/man5
+ dodir /usr/share/man/man8
+
+ local debug
+ local objdir="prod"
+ if use debug; then
+ debug="DEBUG=1"
+ objdir=debug
+ fi
+
+ #emake -j1 LOCALBASE="/usr" DESTDIR="${D}" os=${os} ${debug} install || die "install failed"
+
+ dosbin ${S}/mDNSPosix/build/${objdir}/dnsextd
+ dosbin ${S}/mDNSPosix/build/${objdir}/mDNSResponderPosix
+ dosbin ${S}/mDNSPosix/build/${objdir}/mDNSNetMonitor
+
+ dobin ${S}/Clients/build/dns-sd
+ dobin ${S}/mDNSPosix/build/${objdir}/mDNSProxyResponderPosix
+ dobin ${S}/mDNSPosix/build/${objdir}/mDNSIdentify
+
+ newinitd ${FILESDIR}/mdnsd.init.d mdnsd
+ newinitd ${FILESDIR}/mDNSResponderPosix.init.d mDNSResponderPosix
+ newconfd ${FILESDIR}/mDNSResponderPosix.conf.d mDNSResponderPosix
+ newinitd ${FILESDIR}/dnsextd.init.d dnsextd
+ newconfd ${FILESDIR}/dnsextd.conf.d dnsextd
+
+ insinto /etc
+ doins ${FILESDIR}/mDNSResponderPosix.conf
+
+ dodoc ${S}/README.txt
+
+ # Fix multilib-strictness
+ local libdir=$(get_libdir)
+ if [[ $libdir != lib ]] ; then
+ mv ${D}/lib ${D}/$(get_libdir)
+ mv ${D}/usr/lib ${D}/usr/$(get_libdir)
+ fi
+
+ if use java; then
+ java-pkg_dojar ${S}/mDNSPosix/build/prod/dns_sd.jar
+ java-pkg_doso ${S}/mDNSPosix/build/prod/libjdns_sd.so
+ use doc && java-pkg_dojavadoc ${S}/mDNSPosix/build/prod
+ fi
+
+}
+
+pkg_postinst() {
+ echo
+ elog "To enable multicast dns lookups for applications"
+ elog "that are not multicast dns aware, edit the 'hosts:'"
+ elog "line in /etc/nsswitch.conf to include 'mdns', e.g.:"
+ elog "hosts: files mdns dns"
+ echo
+}