No Description

001-cross_compile.patch 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. --- a/Clients/Makefile
  2. +++ b/Clients/Makefile
  3. @@ -27,6 +27,8 @@
  4. #############################################################################
  5. +CC = @cc
  6. +
  7. # On OS X the dns_sd library functions are included in libSystem, which is implicitly linked with every executable
  8. # 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
  9. ifneq "$(wildcard /usr/lib/libSystem.dylib)" ""
  10. @@ -46,10 +48,10 @@ build:
  11. mkdir build
  12. build/dns-sd: build dns-sd.c ClientCommon.c
  13. - $(CC) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@
  14. + $(CC) $(CFLAGS) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@
  15. build/dns-sd64: build dns-sd.c ClientCommon.c
  16. - $(CC) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@ -m64
  17. + $(CC) $(CFLAGS) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@ -m64
  18. # Note, we can make a 'fat' version of dns-sd using 'lipo', as shown below, but we
  19. # don't, because we don't want or need a 'fat' version of dns-sd, because it will
  20. --- a/mDNSPosix/Makefile
  21. +++ b/mDNSPosix/Makefile
  22. @@ -54,11 +54,12 @@ COREDIR = ../mDNSCore
  23. SHAREDDIR ?= ../mDNSShared
  24. JDK = /usr/jdk
  25. -CC = @cc
  26. +CC = @gcc
  27. BISON = @bison
  28. FLEX = @flex
  29. ST = @strip
  30. -LD = ld -shared
  31. +LD = @ld
  32. +SOOPTS = -shared
  33. CP = cp
  34. RM = rm
  35. LN = ln -s -f
  36. @@ -92,7 +93,7 @@ CFLAGS_DEBUG = -O0 -DMDNS_DEBUGMSGS=0
  37. CFLAGS_OS = -DNOT_HAVE_DAEMON -DNOT_HAVE_SA_LEN -DNOT_HAVE_SOCKLEN_T -DNOT_HAVE_IF_NAMETOINDEX \
  38. -DLOG_PERROR=0 -D_XPG4_2 -D__EXTENSIONS__ -DHAVE_BROKEN_RECVIF_NAME -DTARGET_OS_SOLARIS
  39. CC = gcc
  40. -LD = gcc -shared
  41. +LD = gcc
  42. LINKOPTS = -lsocket -lnsl -lresolv
  43. JAVACFLAGS_OS += -I$(JDK)/include/solaris
  44. ifneq ($(DEBUG),1)
  45. @@ -148,7 +149,8 @@ CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp
  46. -D__MAC_OS_X_VERSION_MIN_REQUIRED=__MAC_OS_X_VERSION_10_4 \
  47. -D__APPLE_USE_RFC_2292 #-Wunreachable-code
  48. CC = gcc
  49. -LD = $(CC) -dynamiclib
  50. +LD = $(CC)
  51. +SOOPTS= -dynamiclib
  52. LINKOPTS = -lSystem
  53. LDSUFFIX = dylib
  54. JDK = /System/Library/Frameworks/JavaVM.framework/Home
  55. @@ -170,8 +172,9 @@ NSSLIBFILE := $(NSSLIBNAME)-$(NSSVERSIO
  56. NSSLINKNAME := $(NSSLIBNAME).so.2
  57. NSSINSTPATH := /lib
  58. -# If not otherwise defined, we install into /usr/lib and /usr/include
  59. +# If not otherwise defined, we install into /usr/lib, /usr/include and /etc
  60. # and our startup script is called mdns (e.g. /etc/init.d/mdns)
  61. +ETCBASE?=/etc
  62. INSTBASE?=/usr
  63. STARTUPSCRIPTNAME?=mdns
  64. @@ -257,7 +260,7 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$
  65. CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o
  66. $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS)
  67. - @$(LD) $(LINKOPTS) -o $@ $+
  68. + @$(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+
  69. @$(STRIP) $@
  70. Clients: setup libdns_sd ../Clients/build/dns-sd
  71. @@ -292,7 +295,7 @@ InstalledManPages: $(MANPATH)/man8/mdnsd
  72. InstalledClients: $(INSTBASE)/bin/dns-sd
  73. @echo $+ " installed"
  74. -InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) /etc/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8
  75. +InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) $(ETCBASE)/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8
  76. @echo $+ " installed"
  77. # Note: If daemon already installed, we make sure it's stopped before overwriting it
  78. @@ -347,19 +350,21 @@ $(INSTBASE)/bin/dns-sd: ../Clients/build
  79. $(NSSINSTPATH)/$(NSSLINKNAME): $(NSSINSTPATH)/$(NSSLIBFILE)
  80. $(LN) $< $@
  81. - ldconfig
  82. +ifdef LDCONFIG
  83. + $(LDCONFIG)
  84. +endif
  85. $(NSSINSTPATH)/$(NSSLIBFILE): $(BUILDDIR)/$(NSSLIBFILE)
  86. $(CP) $< $@
  87. chmod 444 $@
  88. -/etc/nss_mdns.conf: nss_mdns.conf
  89. +$(ETCBASE)/nss_mdns.conf: nss_mdns.conf
  90. $(CP) $< $@
  91. chmod 444 $@
  92. # Check the nsswitch.conf file.
  93. # If 'mdns' does not already appear on the "hosts:" line, then add it right before 'dns'
  94. - cp -f /etc/nsswitch.conf /etc/nsswitch.conf.pre-mdns
  95. - sed -e '/mdns/!s/^\(hosts:.*\)dns\(.*\)/\1mdns dns\2/' /etc/nsswitch.conf.pre-mdns > /etc/nsswitch.conf
  96. + -[ -f $(ETCBASE)/nsswitch.conf ] && cp -f $(ETCBASE)/nsswitch.conf $(ETCBASE)/nsswitch.conf.pre-mdns
  97. + -[ -f $(ETCBASE)/nsswitch.conf ] && sed -e '/mdns/!s/^\(hosts:.*\)dns\(.*\)/\1mdns dns\2/' $(ETCBASE)/nsswitch.conf.pre-mdns > $(ETCBASE)/nsswitch.conf
  98. #############################################################################