add new package bind per case 0000507
authorDavid Anders <dave123@abcsinc.com>
Wed, 25 Jan 2006 20:56:55 +0000 (20:56 -0000)
committerDavid Anders <dave123@abcsinc.com>
Wed, 25 Jan 2006 20:56:55 +0000 (20:56 -0000)
package/Config.in
package/bind/Config.in [new file with mode: 0644]
package/bind/bind-cross-fix.patch [new file with mode: 0644]
package/bind/bind-dlopen.patch [new file with mode: 0644]
package/bind/bind.mk [new file with mode: 0644]
package/bind/bind.sysvinit [new file with mode: 0644]
package/bind/bind9 [new file with mode: 0644]

index 0a579ba8325512c067b68aae31c0668d64b73682..ffdd43748bfd15e67d5ce899bc07c97b8a4e17a9 100644 (file)
@@ -30,6 +30,7 @@ source "package/at/Config.in"
 source "package/autoconf/Config.in"
 source "package/automake/Config.in"
 source "package/berkeleydb/Config.in"
+source "package/bind/Config.in"
 source "package/bison/Config.in"
 source "package/boa/Config.in"
 source "package/bridge/Config.in"
diff --git a/package/bind/Config.in b/package/bind/Config.in
new file mode 100644 (file)
index 0000000..19d3068
--- /dev/null
@@ -0,0 +1,22 @@
+config BR2_PACKAGE_BIND
+       bool "bind"
+       default n
+       help
+         BIND (Berkeley Internet Name Domain) is an implementation of
+         the Domain Name System (DNS) protocols and provides an openly
+         redistributable reference implementation of the major
+         components of the Domain Name System, including:
+
+           * a Domain Name System server (named)
+           * a Domain Name System resolver library
+           * tools for verifying the proper operation of the DNS server 
+
+         The BIND DNS Server is used on the vast majority of name
+         serving machines on the Internet, providing a robust and
+         stable architecture on top of which an organization's naming
+         architecture can be built. The resolver library included in
+         the BIND distribution provides the standard APIs for
+         translation between domain names and Internet addresses and is
+         intended to be linked with applications requiring name service. 
+
+         http://www.isc.org/sw/bind/
diff --git a/package/bind/bind-cross-fix.patch b/package/bind/bind-cross-fix.patch
new file mode 100644 (file)
index 0000000..07a9084
--- /dev/null
@@ -0,0 +1,43 @@
+diff -Naur bind-9.3.1/configure bind/configure
+--- bind-9.3.1/configure       2004-12-08 20:09:03.000000000 -0800
++++ bind/configure     2005-09-09 16:06:50.000000000 -0700
+@@ -23678,11 +23678,9 @@
+ echo "$as_me:$LINENO: checking for inet_ntop with IPv6 support" >&5
+ echo $ECHO_N "checking for inet_ntop with IPv6 support... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++  echo "$as_me:$LINENO: result: assuming target platform has working inet_ntop" >&5
++echo "${ECHO_T}assuming target platform has working inet_ntop" >&6
++      ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+diff -Naur bind-9.3.1/configure.in bind/configure.in
+--- bind-9.3.1/configure.in    2004-12-08 20:07:10.000000000 -0800
++++ bind/configure.in  2005-09-09 16:06:39.000000000 -0700
+@@ -1414,7 +1414,9 @@
+         [AC_MSG_RESULT(no)
+         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
+         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
+-        ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"])
++        ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
++        [AC_MSG_RESULT(assuming target platform has working inet_ntop)
++        ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"])
+ # On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
+--- bind-9.3.1/lib/dns/Makefile.in     2005-09-09 16:21:34.000000000 -0700
++++ bind/lib/dns/Makefile.in   2005-09-09 16:28:16.000000000 -0700
+@@ -156,7 +156,7 @@
+       ./gen -s ${srcdir} > code.h
+ gen: gen.c
+-      ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ ${srcdir}/gen.c ${LIBS}
++      cc ${ALL_CFLAGS} -o $@ ${srcdir}/gen.c
+ rbtdb64.@O@: rbtdb.c
diff --git a/package/bind/bind-dlopen.patch b/package/bind/bind-dlopen.patch
new file mode 100644 (file)
index 0000000..b846d47
--- /dev/null
@@ -0,0 +1,89 @@
+--- bind-9.3.1/bin/named/Makefile.in   2004-09-06 14:47:25.000000000 -0700
++++ bind/bin/named/Makefile.in 2005-09-19 15:55:17.000000000 -0700
+@@ -29,7 +29,7 @@
+ DBDRIVER_OBJS =
+ DBDRIVER_SRCS =
+ DBDRIVER_INCLUDES =
+-DBDRIVER_LIBS =
++DBDRIVER_LIBS = -ldl
+ CINCLUDES =   -I${srcdir}/include -I${srcdir}/unix/include \
+               ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
+diff -aur bind-9.3.1/bin/named/main.c bind/bin/named/main.c
+--- bind-9.3.1/bin/named/main.c        2004-10-24 17:42:54.000000000 -0700
++++ bind/bin/named/main.c      2005-09-14 10:49:28.000000000 -0700
+@@ -22,6 +22,7 @@
+ #include <ctype.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <dlfcn.h>
+ #include <isc/app.h>
+ #include <isc/commandline.h>
+@@ -540,6 +541,7 @@
+ static void
+ setup(void) {
+       isc_result_t result;
++      void        *handle;
+       /*
+        * Get the user and group information before changing the root
+@@ -655,13 +657,33 @@
+       /*
+        * Add calls to register sdb drivers here.
+        */
+-      /* xxdb_init(); */
+-
++      handle = dlopen ("cadb.so", RTLD_NOW);
++      if (!handle) {
++          fprintf (stderr, "failed to load cadb driver: %s\n", dlerror());
++      } else {
++          isc_result_t (*cadbinit)(void);
++          const char *error;
++          
++          dlerror();    /* Clear any existing error */
++          *(void **) (&cadbinit) = dlsym(handle, "cadb_init");
++          if ((error = dlerror()) != NULL)  {
++              fprintf (stderr, "failing loading cadbinit symbol: %s\n", error);
++              exit(1);
++          }
++         
++          if((*cadbinit)() != ISC_R_SUCCESS) {
++              fprintf (stderr, "cadbinit failed");
++              exit(1);
++          }
++      }
++      
+       ns_server_create(ns_g_mctx, &ns_g_server);
+ }
+ static void
+ cleanup(void) {
++      void *handle;
++
+       destroy_managers();
+       ns_server_destroy(&ns_g_server);
+@@ -671,7 +693,21 @@
+       /*
+        * Add calls to unregister sdb drivers here.
+        */
+-      /* xxdb_clear(); */
++      handle = dlopen ("cadb.so", RTLD_NOW);
++      if (!handle) {
++          fprintf (stderr, "failed to load cadb driver: %s\n", dlerror());
++      } else {
++          isc_result_t (*cadbclear)(void);
++          const char *error;
++          
++          dlerror();    /* Clear any existing error */
++          *(void **) (&cadbclear) = dlsym(handle, "cadb_clear");
++          if ((error = dlerror()) != NULL)  {
++              fprintf (stderr, "failing loading cadbclear symbol: %s\n", error);
++          } else {
++              (*cadbclear)();
++          }
++      }
+       isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
+                     ISC_LOG_NOTICE, "exiting");
diff --git a/package/bind/bind.mk b/package/bind/bind.mk
new file mode 100644 (file)
index 0000000..c321cab
--- /dev/null
@@ -0,0 +1,101 @@
+#############################################################
+#
+# bind
+#
+#############################################################
+BIND_VER:=9.3.1
+BIND_SOURCE:=bind-$(BIND_VER).tar.gz
+BIND_SITE:=ftp://ftp.isc.org/isc/bind9/$(BIND_VER)
+BIND_DIR1:=$(TOOL_BUILD_DIR)/bind-$(BIND_VER)
+BIND_DIR2:=$(BUILD_DIR)/bind-$(BIND_VER)
+BIND_CAT:=zcat
+BIND_BINARY:=bin/named/named
+BIND_TARGET_BINARY:=usr/sbin/named
+
+$(DL_DIR)/$(BIND_SOURCE):
+        $(WGET) -P $(DL_DIR) $(BIND_SITE)/$(BIND_SOURCE)
+
+bind-source: $(DL_DIR)/$(BIND_SOURCE)
+
+#############################################################
+#
+# build bind for use on the target system
+#
+#############################################################
+$(BIND_DIR2)/.unpacked: $(DL_DIR)/$(BIND_SOURCE)
+       $(BIND_CAT) $(DL_DIR)/$(BIND_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+       toolchain/patch-kernel.sh $(BIND_DIR2) package/bind/ bind\*.patch
+       touch  $(BIND_DIR2)/.unpacked
+
+$(BIND_DIR2)/Makefile: $(BIND_DIR2)/.unpacked
+       (cd $(BIND_DIR2); rm -rf config.cache; \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               ./configure \
+               --target=$(GNU_TARGET_NAME) \
+               --host=$(GNU_TARGET_NAME) \
+               --build=$(GNU_HOST_NAME) \
+               --prefix=/usr \
+               --libexecdir=/usr/lib \
+               --libdir=/lib \
+               --includedir=/include \
+               --sysconfdir=/etc \
+               --localstatedir=/var \
+               --without-openssl \
+               --with-randomdev=/dev/random \
+               --enable-ipv6 \
+               --disable-static \
+               --with-libtool \
+       );
+
+$(BIND_DIR2)/$(BIND_BINARY): $(BIND_DIR2)/Makefile
+       $(MAKE) $(TARGET_CONFIGURE_OPTS) -j1 -C $(BIND_DIR2)
+       touch -c $(BIND_DIR2)/$(BIND_BINARY)
+
+#############################################################
+#
+# install bind binaries
+#
+#############################################################
+$(TARGET_DIR)/$(BIND_TARGET_BINARY): $(BIND_DIR2)/$(BIND_BINARY)
+       $(MAKE) $(TARGET_CONFIGURE_OPTS) -j1 MAKEDEFS="INSTALL_DATA=true" \
+               DESTDIR=$(TARGET_DIR) -C $(BIND_DIR2)/bin install
+       cd $(TARGET_DIR)/usr/man; rmdir --ignore-fail-on-non-empty man8 man5 `pwd`
+       $(INSTALL) -m 0755 -D package/bind/bind.sysvinit $(TARGET_DIR)/etc/init.d/S81named
+
+bind-bin: $(TARGET_DIR)/$(BIND_TARGET_BINARY) bind-lib
+
+#############################################################
+#
+# install bind libraries
+#
+#############################################################
+$(STAGING_DIR)/lib/libdns.so: $(BIND_DIR2)/$(BIND_BINARY)
+       $(MAKE) $(TARGET_CONFIGURE_OPTS) -j1 DESTDIR=$(STAGING_DIR) -C $(BIND_DIR2)/lib install
+
+$(TARGET_DIR)/usr/lib/libdns.so: $(STAGING_DIR)/lib/libdns.so
+       mkdir -p $(TARGET_DIR)/usr/lib
+       cd $(STAGING_DIR)/lib; \
+           cp -a libdns.* libisc.* libisccc.* libbind9.* liblwres.* libisccfg.* \
+               $(TARGET_DIR)/usr/lib
+                                       
+bind-lib: $(STAGING_DIR)/lib/libdns.so $(TARGET_DIR)/usr/lib/libdns.so
+                                     
+bind: uclibc bind-bin bind-lib
+
+bind-clean:
+       $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(BIND_DIR2) uninstall
+       -$(MAKE) -C $(BIND_DIR2) clean
+
+bind-dirclean:
+       rm -rf $(BIND_DIR2)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_BIND)),y)
+TARGETS+=bind
+endif
+
diff --git a/package/bind/bind.sysvinit b/package/bind/bind.sysvinit
new file mode 100644 (file)
index 0000000..a9babd2
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# System-V init to control the bind DNS Daemon
+#
+
+NAME=named
+DAEMON=/usr/sbin/$NAME
+
+# this file contains a few tunable parameters
+test -r /etc/default/named && . /etc/default/named
+
+test -f $DAEMON || exit 0
+
+set -e
+
+case "$1" in
+       start)
+               test -z "$CHROOT" || ARGS="$ARGS -t $CHROOT"
+               test -z "$SETUID" || ARGS="$ARGS -u $SETUID"
+               if [ ! -f $CHROOT/etc/rndc.key ]; then
+                   echo -n "Initializing $NAME control key: rndc-confgen"
+                   set +e 
+                   touch $CHROOT/etc/rndc.key # handle symlinks
+                   rndc-confgen -a -r /dev/urandom $ARGS || echo "."
+                   set -e
+               fi
+               test -z "$CONF" || ARGS="$ARGS -c $CONF"
+               echo -n "Starting domain name daemon: $NAME"
+               trap 'echo failed' 0
+               start-stop-daemon -S -x $DAEMON -- $ARGS
+               trap - 0
+               echo "."
+               ;;
+       stop)
+               echo -n "Stopping domain name daemon: $NAME"
+               rndc stop || start-stop-daemon -K -x $DAEMON
+               echo "."
+               ;;
+       restart)
+               $0 stop
+               sleep 2
+               $0 start && exit $?
+               ;;
+       reload|force-reload)
+               rndc reload && exit $?
+               ;;
+       *)
+               echo "Usage: $0 {start|stop|restart|reload|force-reload}"
+               exit 1 
+esac
+
+exit 0
diff --git a/package/bind/bind9 b/package/bind/bind9
new file mode 100644 (file)
index 0000000..aa07b41
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+# for a chrooted server: "-u bind -t /var/lib/named"
+OPTIONS=""
+
+test -x /usr/sbin/rndc || exit 0
+
+case "$1" in
+    start)
+       echo -n "Starting domain name service: named"
+
+       # dirs under /var/run can go away on reboots.
+       mkdir -p /var/run/bind/run
+       chmod 775 /var/run/bind/run
+       chown root:bind /var/run/bind/run >/dev/null 2>&1 || true
+
+       if [ ! -x /usr/sbin/named ]; then
+           echo "named binary missing - not starting"
+           exit 1
+       fi
+       if start-stop-daemon --start --quiet --exec /usr/sbin/named \
+               --pidfile /var/run/bind/run/named.pid -- $OPTIONS; then
+           if [ -x /sbin/resolvconf ] ; then
+               echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo
+           fi
+       fi
+       echo "."        
+    ;;
+
+    stop)
+       echo -n "Stopping domain name service: named"
+       if [ -x /sbin/resolvconf ]; then
+           /sbin/resolvconf -d lo
+       fi
+       /usr/sbin/rndc stop
+       echo "."        
+    ;;
+
+    reload)
+       /usr/sbin/rndc reload
+    ;;
+
+    restart|force-reload)
+       $0 stop
+       sleep 2
+       $0 start
+    ;;
+    
+    *)
+       echo "Usage: /etc/init.d/bind {start|stop|reload|restart|force-reload}" >&2
+       exit 1
+    ;;
+esac
+
+exit 0