[package] add mDNSReponder (#6102)
[openwrt/svn-archive/archive.git] / net / mdnsresponder / patches / 001-cross_compile.patch
1 Only in mDNSResponder-107.6/Clients: build
2 diff -u --recursive mDNSResponder-107.6-vanilla/Clients/Makefile mDNSResponder-107.6/Clients/Makefile
3 --- mDNSResponder-107.6-vanilla/Clients/Makefile 2009-10-16 07:06:53.290266578 -0400
4 +++ mDNSResponder-107.6/Clients/Makefile 2009-10-17 04:28:28.447826030 -0400
5 @@ -49,6 +49,8 @@
6
7 #############################################################################
8
9 +CC = @cc
10 +
11 # On OS X the dns_sd library functions are included in libSystem, which is implicitly linked with every executable
12 # 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
13 ifneq "$(wildcard /usr/lib/libSystem.dylib)" ""
14 @@ -66,4 +68,4 @@
15 mkdir build
16
17 build/dns-sd: build dns-sd.c
18 - cc $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -o $@
19 + $(CC) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -o $@
20 diff -u --recursive mDNSResponder-107.6-vanilla/mDNSPosix/Makefile mDNSResponder-107.6/mDNSPosix/Makefile
21 --- mDNSResponder-107.6-vanilla/mDNSPosix/Makefile 2009-10-16 07:06:53.303266301 -0400
22 +++ mDNSResponder-107.6/mDNSPosix/Makefile 2009-10-17 06:36:22.154299346 -0400
23 @@ -267,8 +267,9 @@
24 SHAREDDIR = ../mDNSShared
25 JDK = /usr/jdk
26
27 -CC = @cc
28 -LD = ld -shared
29 +CC = @gcc
30 +LD = @ld
31 +SOOPTS = -shared
32 CP = cp
33 RM = rm
34 LN = ln -s -f
35 @@ -293,7 +294,7 @@
36 CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
37 OBJDIR = objects/prod
38 BUILDDIR = build/prod
39 -STRIP = strip -S
40 +STRIP = @strip -S
41 endif
42
43 # Configure per-OS peculiarities
44 @@ -301,7 +302,7 @@
45 CFLAGS_OS = -DNOT_HAVE_DAEMON -DNOT_HAVE_SA_LEN -DNOT_HAVE_SOCKLEN_T -DNOT_HAVE_IF_NAMETOINDEX \
46 -DLOG_PERROR=0 -D_XPG4_2 -D__EXTENSIONS__ -DHAVE_BROKEN_RECVIF_NAME
47 CC = gcc
48 -LD = gcc -shared
49 +LD = gcc
50 LINKOPTS = -lsocket -lnsl -lresolv
51 JAVACFLAGS_OS += -I$(JDK)/include/solaris
52 ifneq ($(DEBUG),1)
53 @@ -347,7 +348,8 @@
54
55 ifeq ($(os),jaguar)
56 CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp -Werror -DNOT_HAVE_SOCKLEN_T
57 -LD = libtool -dynamic
58 +LD = libtool
59 +SOOPTS = -dynamic
60 LINKOPTS = -lSystem
61 LDSUFFIX = dylib
62 JDK = /System/Library/Frameworks/JavaVM.framework/Home
63 @@ -356,7 +358,8 @@
64
65 ifeq ($(os),panther)
66 CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp -Werror
67 -LD = libtool -dynamic
68 +LD = libtool
69 +SOOPTS = -dynamic
70 LINKOPTS = -lSystem
71 LDSUFFIX = dylib
72 JDK = /System/Library/Frameworks/JavaVM.framework/Home
73 @@ -366,7 +369,8 @@
74 ifeq ($(os),tiger)
75 CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp -Werror -Wdeclaration-after-statement #-Wunreachable-code
76 CC = @gcc-4.0
77 -LD = $(CC) -dynamiclib
78 +LD = $(CC)
79 +SOOPTS = -dynamiclib
80 LINKOPTS = -lSystem
81 LDSUFFIX = dylib
82 JDK = /System/Library/Frameworks/JavaVM.framework/Home
83 @@ -390,8 +394,9 @@
84 NSSLINKNAME := $(NSSLIBNAME).so.2
85 NSSINSTPATH := /lib
86
87 -# If not otherwise defined, we install into /usr/lib and /usr/include
88 +# If not otherwise defined, we install into /usr/lib, /usr/include & /etc
89 # and our startup script is called mdns (e.g. /etc/init.d/mdns)
90 +ETCBASE?=/etc
91 INSTBASE?=/usr
92 STARTUPSCRIPTNAME?=mdns
93
94 @@ -473,7 +478,7 @@
95 CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o
96
97 $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS)
98 - @$(LD) $(LINKOPTS) -o $@ $+
99 + @$(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+
100 @$(STRIP) $@
101
102 Clients: setup libdns_sd ../Clients/build/dns-sd
103 @@ -508,7 +513,7 @@
104 InstalledClients: $(INSTBASE)/bin/dns-sd
105 @echo $+ " installed"
106
107 -InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) /etc/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8
108 +InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) $(ETCBASE)/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8
109 @echo $+ " installed"
110
111 # Note: If daemon already installed, we make sure it's stopped before overwriting it
112 @@ -563,19 +568,21 @@
113
114 $(NSSINSTPATH)/$(NSSLINKNAME): $(NSSINSTPATH)/$(NSSLIBFILE)
115 $(LN) $< $@
116 - ldconfig
117 +ifdef LDCONFIG
118 + $(LDCONFIG)
119 +endif
120
121 $(NSSINSTPATH)/$(NSSLIBFILE): $(BUILDDIR)/$(NSSLIBFILE)
122 $(CP) $< $@
123 chmod 444 $@
124
125 -/etc/nss_mdns.conf: nss_mdns.conf
126 +$(ETCBASE)/nss_mdns.conf: nss_mdns.conf
127 $(CP) $< $@
128 chmod 444 $@
129 # Check the nsswitch.conf file.
130 # If 'mdns' does not already appear on the "hosts:" line, then add it right before 'dns'
131 - cp -f /etc/nsswitch.conf /etc/nsswitch.conf.pre-mdns
132 - sed -e '/mdns/!s/^\(hosts:.*\)dns\(.*\)/\1mdns dns\2/' /etc/nsswitch.conf.pre-mdns > /etc/nsswitch.conf
133 + -[ -f $(ETCBASE)/nsswitch.conf ] && cp -f $(ETCBASE)/nsswitch.conf $(ETCBASE)/nsswitch.conf.pre-mdns
134 + -[ -f $(ETCBASE)/nsswitch.conf ] && sed -e '/mdns/!s/^\(hosts:.*\)dns\(.*\)/\1mdns dns\2/' $(ETCBASE)/nsswitch.conf.pre-mdns > $(ETCBASE)/nsswitch.conf
135
136 #############################################################################
137