You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
4.4 KiB

  1. --- a/Clients/Makefile
  2. +++ b/Clients/Makefile
  3. @@ -23,6 +23,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. @@ -42,10 +44,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,10 +54,11 @@ COREDIR = ../mDNSCore
  23. SHAREDDIR ?= ../mDNSShared
  24. JDK = /usr/jdk
  25. -CC = @cc
  26. +CC = @gcc
  27. BISON = @bison
  28. FLEX = @flex
  29. -LD = ld -shared
  30. +LD = @ld
  31. +SOOPTS = -shared
  32. CP = cp
  33. RM = rm
  34. LN = ln -s -f
  35. @@ -82,7 +83,7 @@ else
  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. # Configure per-OS peculiarities
  43. @@ -91,7 +92,7 @@ CFLAGS_DEBUG = -O0 -DMDNS_DEBUGMSGS=0
  44. CFLAGS_OS = -DNOT_HAVE_DAEMON -DNOT_HAVE_SA_LEN -DNOT_HAVE_SOCKLEN_T -DNOT_HAVE_IF_NAMETOINDEX \
  45. -DLOG_PERROR=0 -D_XPG4_2 -D__EXTENSIONS__ -DHAVE_BROKEN_RECVIF_NAME -DTARGET_OS_SOLARIS
  46. CC = gcc
  47. -LD = gcc -shared
  48. +LD = gcc
  49. LINKOPTS = -lsocket -lnsl -lresolv
  50. JAVACFLAGS_OS += -I$(JDK)/include/solaris
  51. ifneq ($(DEBUG),1)
  52. @@ -147,7 +148,8 @@ CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp
  53. -D__MAC_OS_X_VERSION_MIN_REQUIRED=__MAC_OS_X_VERSION_10_4 \
  54. -D__APPLE_USE_RFC_2292 #-Wunreachable-code
  55. CC = gcc
  56. -LD = $(CC) -dynamiclib
  57. +LD = $(CC)
  58. +SOOPTS= -dynamiclib
  59. LINKOPTS = -lSystem
  60. LDSUFFIX = dylib
  61. JDK = /System/Library/Frameworks/JavaVM.framework/Home
  62. @@ -169,8 +171,9 @@ NSSLIBFILE := $(NSSLIBNAME)-$(NSSVERSIO
  63. NSSLINKNAME := $(NSSLIBNAME).so.2
  64. NSSINSTPATH := /lib
  65. -# If not otherwise defined, we install into /usr/lib and /usr/include
  66. +# If not otherwise defined, we install into /usr/lib, /usr/include and /etc
  67. # and our startup script is called mdns (e.g. /etc/init.d/mdns)
  68. +ETCBASE?=/etc
  69. INSTBASE?=/usr
  70. STARTUPSCRIPTNAME?=mdns
  71. @@ -256,7 +259,7 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$
  72. CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o
  73. $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS)
  74. - @$(LD) $(LINKOPTS) -o $@ $+
  75. + @$(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+
  76. @$(STRIP) $@
  77. Clients: setup libdns_sd ../Clients/build/dns-sd
  78. @@ -291,7 +294,7 @@ InstalledManPages: $(MANPATH)/man8/mdnsd
  79. InstalledClients: $(INSTBASE)/bin/dns-sd
  80. @echo $+ " installed"
  81. -InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) /etc/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8
  82. +InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) $(ETCBASE)/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8
  83. @echo $+ " installed"
  84. # Note: If daemon already installed, we make sure it's stopped before overwriting it
  85. @@ -346,19 +349,21 @@ $(INSTBASE)/bin/dns-sd: ../Clients/build
  86. $(NSSINSTPATH)/$(NSSLINKNAME): $(NSSINSTPATH)/$(NSSLIBFILE)
  87. $(LN) $< $@
  88. - ldconfig
  89. +ifdef LDCONFIG
  90. + $(LDCONFIG)
  91. +endif
  92. $(NSSINSTPATH)/$(NSSLIBFILE): $(BUILDDIR)/$(NSSLIBFILE)
  93. $(CP) $< $@
  94. chmod 444 $@
  95. -/etc/nss_mdns.conf: nss_mdns.conf
  96. +$(ETCBASE)/nss_mdns.conf: nss_mdns.conf
  97. $(CP) $< $@
  98. chmod 444 $@
  99. # Check the nsswitch.conf file.
  100. # If 'mdns' does not already appear on the "hosts:" line, then add it right before 'dns'
  101. - cp -f /etc/nsswitch.conf /etc/nsswitch.conf.pre-mdns
  102. - sed -e '/mdns/!s/^\(hosts:.*\)dns\(.*\)/\1mdns dns\2/' /etc/nsswitch.conf.pre-mdns > /etc/nsswitch.conf
  103. + -[ -f $(ETCBASE)/nsswitch.conf ] && cp -f $(ETCBASE)/nsswitch.conf $(ETCBASE)/nsswitch.conf.pre-mdns
  104. + -[ -f $(ETCBASE)/nsswitch.conf ] && sed -e '/mdns/!s/^\(hosts:.*\)dns\(.*\)/\1mdns dns\2/' $(ETCBASE)/nsswitch.conf.pre-mdns > $(ETCBASE)/nsswitch.conf
  105. #############################################################################