packages/mdnsreposnder: various changes:
authorNicolas Thill <nico@openwrt.org>
Sat, 12 Nov 2011 01:30:33 +0000 (01:30 +0000)
committerNicolas Thill <nico@openwrt.org>
Sat, 12 Nov 2011 01:30:33 +0000 (01:30 +0000)
 * split into mdns-utils (client utilities), mdnsd (server daemon) & mdnsresponder (meta package)
 * provide a default mDNSReponder config file advertising the SSH server
 * use new service functions

SVN-Revision: 28970

net/mdnsresponder/Makefile
net/mdnsresponder/files/mDNSResponder.conf [new file with mode: 0644]
net/mdnsresponder/files/mDNSResponder.init
net/mdnsresponder/files/mdnsd.init [new file with mode: 0755]

index 3f6c926..f47bd99 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2009 OpenWrt.org
+# Copyright (C) 2009-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,8 +9,8 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mDNSResponder
 PKG_VERSION:=214.3.2
-PKG_RELEASE:=1
-PKG_INSTALL:=1
+PKG_RELEASE:=2
+
 PKG_SOURCE:=mDNSResponder-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://opensource.apple.com/tarballs/mDNSResponder/
 PKG_MD5SUM:=05d39f40767ccece4b740c5afad14a23
@@ -18,30 +18,68 @@ PKG_MD5SUM:=05d39f40767ccece4b740c5afad14a23
 PKG_BUILD_DIR:=$(BUILD_DIR)/mDNSResponder-$(PKG_VERSION)
 
 PKG_BUILD_PARALLEL:=0
+PKG_INSTALL:=1
 
 include $(INCLUDE_DIR)/package.mk
 
-define Package/mdnsresponder
+define Package/mDNSResponder/Default
   SECTION:=net
   CATEGORY:=Network
   SUBMENU:=IP Addresses and Names
-  TITLE:=mDNSResponder
+  TITLE:=mDNS
   URL:=http://developer.apple.com/networking/bonjour/
 endef
 
-define Package/mdnsresponder/decription
+define Package/mDNSResponder/Default/description
   Bonjour, also known as zero-configuration networking, enables
   automatic discovery of computers, devices, and services on
   IP networks.
 endef
 
-define Build/Configure
-       $(call Build/Configure/Default)
+define Package/mdns-utils
+$(call Package/mDNSResponder/Default)
+  TITLE+= client utilities
+endef
+
+define Package/mdns-utils/description
+$(call Package/mDNSResponder/Default/description)
+ .
+ This package contains mDNS client utilities:
+ - dns-sd
+ - mDNSClient
+ - mDNSIdentify
+ - mDNSNetMonitor
+ - mDNSProxyResponder
+ - mDNSResponder
+endef
+
+define Package/mdnsd
+$(call Package/mDNSResponder/Default)
+  TITLE+= server daemon
+endef
+
+define Package/mdnsd/description
+$(call Package/mDNSResponder/Default/description)
+ .
+ This package contains the mDNS server daemon.
+endef
+
+define Package/mdnsresponder
+$(call Package/mDNSResponder/Default)
+  TITLE+= suite (meta)
+  DEPENDS+= +mdns-utils +mdnsd
+endef
+
+define Package/mdnsresponder/description
+$(call Package/mDNSResponder/Default/description)
+ .
+ This meta package contains only dependencies on other packages.
 endef
 
 # I have no idea why -lc is required, but without it, C library symbols are
 # not found:
 MAKE_FLAGS += \
+       CFLAGS_DEBUG="$(TARGET_CFLAGS)" \
        LINKOPTS=-lc \
        LDCONFIG= \
        ETCBASE="$(PKG_INSTALL_DIR)/etc" \
@@ -55,7 +93,7 @@ MAKE_PATH = mDNSPosix
 
 define Build/Compile
        $(call Build/Compile/Default)
-       # mDNSResponder's "make install" does not seem to create:
+       # XXX: mDNSResponder's "make install" does not seem to create:
        mkdir -p $(PKG_INSTALL_DIR)/lib/
        mkdir -p $(PKG_INSTALL_DIR)/usr/bin/
        mkdir -p $(PKG_INSTALL_DIR)/usr/sbin/
@@ -72,28 +110,49 @@ define Build/Compile
        mkdir -p $(PKG_INSTALL_DIR)/etc/rc.d/rc5.d/
        mkdir -p $(PKG_INSTALL_DIR)/etc/rc.d/rc0.d/
        mkdir -p $(PKG_INSTALL_DIR)/etc/rc.d/rc6.d/
+       # XXX: mDNSResponder's makefile creates absolute link
+       rm -f $(PKG_INSTALL_DIR)/usr/lib/libdns_sd.so
+       ln -fs libdns_sd.so.1 $(PKG_INSTALL_DIR)/usr/lib/libdns_sd.so
 endef
 
 define Build/InstallDev
-       $(INSTALL_DIR) $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_BUILD_DIR)/mDNSShared/dns_sd.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/*.so* $(1)/usr/lib/
+endef
+
+define Package/mdns-utils/conffile
+  /etc/init.d/mDNSResponder
+endef
+
+define Package/mdns-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/dns-sd $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSClientPosix $(1)/usr/bin/mDNSClient
+       $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSIdentify $(1)/usr/bin/mDNSIdentify
+       $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSNetMonitor $(1)/usr/bin/mDNSNetMonitor
+       $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSProxyResponderPosix $(1)/usr/bin/mDNSProxyResponder
+       $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSResponderPosix $(1)/usr/bin/mDNSResponder
        $(INSTALL_DIR) $(1)/usr/lib/
-       $(CP) \
-               $(PKG_BUILD_DIR)/mDNSPosix/build/prod/*.so* \
-               $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdns_sd.so* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/mDNSResponder.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/mDNSResponder.init $(1)/etc/init.d/mDNSResponder
+endef
+
+define Package/mdnsd/install
        $(INSTALL_DIR) $(1)/usr/sbin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/mdnsd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/mdnsd.init $(1)/etc/init.d/mdnsd
 endef
 
 define Package/mdnsresponder/install
-        $(INSTALL_DIR) $(1)/etc/init.d
-       $(INSTALL_BIN) ./files/mDNSResponder.init $(1)/etc/init.d/mDNSResponder
-       $(INSTALL_DIR) $(1)/usr/lib/
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdns_sd.so.1 $(1)/usr/lib/
-       # Note: mDNSResponder's makefile creates the following link incorrectly:
-       ln -s libdns_sd.so.1 $(1)/usr/lib/libdns_sd.so
-       $(INSTALL_DIR) $(1)/usr/sbin/
-       $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mdnsd $(1)/usr/sbin/
-       $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSResponderPosix $(1)/usr/sbin/
+       :
 endef
 
+$(eval $(call BuildPackage,mdns-utils))
+$(eval $(call BuildPackage,mdnsd))
 $(eval $(call BuildPackage,mdnsresponder))
diff --git a/net/mdnsresponder/files/mDNSResponder.conf b/net/mdnsresponder/files/mDNSResponder.conf
new file mode 100644 (file)
index 0000000..23aab16
--- /dev/null
@@ -0,0 +1,4 @@
+"OpenWrt SSH"
+_ssh._tcp. local
+22
+OpenWrt SSH server
index 9702061..87f9e90 100644 (file)
@@ -1,14 +1,14 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2009 OpenWrt.org
+# Copyright (C) 2009-2011 OpenWrt.org
 
-START=60
+START=61
+
+SERVICE_USE_PID=1
 
 start() {
-       /usr/sbin/mDNSResponderPosix -b -f /etc/mdns.conf
-       /usr/sbin/mdnsd
+       service_start /usr/bin/mDNSResponder -b -f /etc/mDNSResponder.conf
 }
 
 stop() {
-       killall mDNSResponderPosix 2> /dev/null
-       killall mdnsd 2> /dev/null
+       service_stop /usr/bin/mDNSResponder
 }
diff --git a/net/mdnsresponder/files/mdnsd.init b/net/mdnsresponder/files/mdnsd.init
new file mode 100755 (executable)
index 0000000..2add84c
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2011 OpenWrt.org
+
+START=60
+
+SERVICE_USE_PID=1
+
+start() {
+       [ -d /var/run/mdnsd ] || {
+               mkdir -m 0755 -p /var/run/mdnsd
+               chown nobody:nogroup /var/run/mdnsd
+       }
+       service_start /usr/sbin/mdnsd
+}
+
+stop() {
+       service_stop /usr/sbin/mdnsd
+}