summaryrefslogtreecommitdiff
blob: a84142bc54454c04e265efcbf96683430d11f718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
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
 
 #############################################################################