Index: mDNSResponder-107.5/Clients/Makefile =================================================================== --- mDNSResponder-107.5.orig/Clients/Makefile +++ mDNSResponder-107.5/Clients/Makefile @@ -51,12 +51,16 @@ ############################################################################# -# On OS X the dns_sd library functions are included in libSystem, which is implicitly linked with every executable -# If /usr/lib/libSystem.dylib exists, then we're on OS X, so we don't need also to link the "dns_sd" shared library -ifneq "$(wildcard /usr/lib/libSystem.dylib)" "" -LIBS = -else -LIBS = -L../mDNSPosix/build/prod/ -ldns_sd +ifneq "$(wildcard ../mDNSPosix/build/prod/libdns_sd.*)" "" + LIBS ?= -L../mDNSPosix/build/prod/ -ldns_sd +endif + +ifneq "$(wildcard ../mDNSPosix/build/debug/libdns_sd.*)" "" + LIBS ?= -L../mDNSPosix/build/debug/ -ldns_sd +endif + +ifneq "$(wildcard /usr/lib/libdns_sd.*)" "" + LIBS ?= -ldns_sd endif targets: build/dns-sd @@ -68,4 +72,4 @@ build: mkdir build build/dns-sd: build dns-sd.c - cc $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -o $@ + $(CC) $(CFLAGS_OPT) $(LDFLAGS) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -o $@ Index: mDNSResponder-107.5/mDNSPosix/Makefile =================================================================== --- mDNSResponder-107.5.orig/mDNSPosix/Makefile +++ mDNSResponder-107.5/mDNSPosix/Makefile @@ -401,13 +401,13 @@ 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: @@ -443,7 +443,7 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$ 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) $(LIBFLAGS) -o $@ $+ + @$(LD) $(LIBFLAGS) -Wl,-soname=libdns_sd.$(LDSUFFIX).$(LIBVERS) -o $@ $+ @$(STRIP) $@ Clients: setup libdns_sd ../Clients/build/dns-sd @@ -457,49 +457,45 @@ nss_mdns: setup $(BUILDDIR)/$(NSSLIBFILE @echo "Name Service Switch module done" $(BUILDDIR)/$(NSSLIBFILE): $(CLIENTLIBOBJS) $(OBJDIR)/nss_mdns.c.so.o - @$(LD) $(LIBFLAGS) -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: $(DESTDIR)$(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 +$(DESTDIR)$(INSTBASE)/sbin/mdnsd: $(BUILDDIR)/mdnsd @if test -x $@; then $(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAME) stop; fi $(CP) $< $@ -$(INSTBASE)/lib/libdns_sd.$(LDSUFFIX).$(LIBVERS): $(BUILDDIR)/libdns_sd.$(LDSUFFIX) +$(DESTDIR)$(INSTBASE)/lib/libdns_sd.$(LDSUFFIX).$(LIBVERS): $(BUILDDIR)/libdns_sd.$(LDSUFFIX) $(CP) $< $@ - $(LN) $@ $(INSTBASE)/lib/libdns_sd.$(LDSUFFIX) -ifdef LDCONFIG - # -m means 'merge into existing database', -R means 'rescan directories' - $(LDCONFIG) -mR -endif + $(LN) libdns_sd.$(LDSUFFIX).$(LIBVERS) $(DESTDIR)$(INSTBASE)/lib/libdns_sd.$(LDSUFFIX) -$(INSTBASE)/include/dns_sd.h: $(SHAREDDIR)/dns_sd.h +$(DESTDIR)$(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 +$(DESTDIR)$(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAME): mdnsd.sh $(STARTUPSCRIPTDIR) $(CP) $< $@ chmod ugo+x $@ $@ start @@ -516,36 +512,32 @@ else 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 +$(DESTDIR)$(NSSINSTPATH)/$(NSSLINKNAME): $(DESTDIR)$(NSSINSTPATH)/$(NSSLIBFILE) + $(LN) $(NSSLIBFILE) $@ -$(NSSINSTPATH)/$(NSSLIBFILE): $(BUILDDIR)/$(NSSLIBFILE) +$(DESTDIR)$(NSSINSTPATH)/$(NSSLIBFILE): $(BUILDDIR)/$(NSSLIBFILE) $(CP) $< $@ chmod 444 $@ -/etc/nss_mdns.conf: nss_mdns.conf +$(DESTDIR)etc/nss_mdns.conf: nss_mdns.conf $(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 #############################################################################