--- /dev/null
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=quagga
+PKG_VERSION:=0.98.2
+PKG_RELEASE:=1
+PKG_MD5SUM:=8757b155aa2458f6158ccd330d0e1b39
+
+PKG_SOURCE_URL:=http://www.quagga.net/download/ \
+ http://www.de.quagga.net/download/ \
+ http://www.uk.quagga.net/download/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_CAT:=zcat
+PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)-all_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg/quagga
+
+PKG_ZEBRA_DIR:=$(PKG_BUILD_DIR)/ipkg/zebra
+PKG_BGPD_DIR:=$(PKG_BUILD_DIR)/ipkg/bgpd
+PKG_OSPFD_DIR:=$(PKG_BUILD_DIR)/ipkg/ospfd
+PKG_RIPD_DIR:=$(PKG_BUILD_DIR)/ipkg/ripd
+
+# separate ipkg for zebra,bgpd,ospf and ripd
+PKG_ZEBRA:=$(PACKAGE_DIR)/$(PKG_NAME)-zebra_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+PKG_BGPD:=$(PACKAGE_DIR)/$(PKG_NAME)-bgpd_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+PKG_RIPD:=$(PACKAGE_DIR)/$(PKG_NAME)-ripd_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+PKG_OSPFD:=$(PACKAGE_DIR)/$(PKG_NAME)-ospfd_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+
+TARGETS:=$(PKG_IPK)
+ifneq ($(BR2_PACKAGE_QUAGGA_ZEBRA),)
+TARGETS += $(PKG_ZEBRA)
+endif
+ifneq ($(BR2_PACKAGE_QUAGGA_BGPD),)
+TARGETS += $(PKG_BGPD)
+endif
+ifneq ($(BR2_PACKAGE_QUAGGA_RIPD),)
+TARGETS += $(PKG_RIPD)
+endif
+ifneq ($(BR2_PACKAGE_QUAGGA_OSPFD),)
+TARGETS += $(PKG_OSPFD)
+endif
+
+INSTALL_TARGETS := $(IPKG_STATE_DIR)/info/quagga.list
+ifeq ($(BR2_PACKAGE_QUAGGA_ZEBRA),y)
+INSTALL_TARGETS := $(IPKG_STATE_DIR)/info/quagga-zebra.list
+endif
+ifeq ($(BR2_PACKAGE_QUAGGA_BGPD),y)
+INSTALL_TARGETS := $(IPKG_STATE_DIR)/info/quagga-bgpd.list
+endif
+ifeq ($(BR2_PACKAGE_QUAGGA_RIPD),y)
+INSTALL_TARGETS := $(IPKG_STATE_DIR)/info/quagga-ripd.list
+endif
+ifeq ($(BR2_PACKAGE_QUAGGA_OSPFD),y)
+INSTALL_TARGETS := $(IPKG_STATE_DIR)/info/quagga-ospfd.list
+endif
+
+$(DL_DIR)/$(PKG_SOURCE):
+ $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL)
+
+$(PKG_BUILD_DIR)/.unpacked: $(DL_DIR)/$(PKG_SOURCE)
+ $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ $(PATCH) $(PKG_BUILD_DIR) ./patches
+ touch $(PKG_BUILD_DIR)/.unpacked
+
+$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.unpacked
+ (cd $(PKG_BUILD_DIR); 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 \
+ --exec-prefix=/usr \
+ --bindir=/usr/bin \
+ --sbindir=/usr/sbin \
+ --libexecdir=/usr/lib \
+ --datadir=/usr/share \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --infodir=/usr/info \
+ --disable-static \
+ --disable-ipv6 \
+ --disable-vtysh \
+ --enable-user=quagga \
+ --enable-group=quagga \
+ --sysconfdir=/etc/quagga \
+ --disable-exampledir \
+ );
+ touch $(PKG_BUILD_DIR)/.configured
+
+$(PKG_IPK_DIR)/zebra: $(PKG_BUILD_DIR)/.configured
+ $(MAKE) -C $(PKG_BUILD_DIR)
+ $(MAKE) DESTDIR=$(PKG_IPK_DIR) -C $(PKG_BUILD_DIR) install
+
+$(PKG_IPK): $(PKG_IPK_DIR)/zebra
+ cp -a ./ipkg/* $(PKG_IPK_DIR)/
+ $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) control/$(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
+ mkdir -p $(PKG_IPK_DIR)/usr/sbin
+ mkdir -p $(PKG_IPK_DIR)/usr/lib
+ mkdir -p $(PKG_IPK_DIR)/etc/quagga
+ rm $(PKG_IPK_DIR)/usr/lib/*.la
+ rm -rf $(PKG_IPK_DIR)/usr/include
+ rm -rf $(PKG_IPK_DIR)/usr/info
+ rm -rf $(PKG_IPK_DIR)/usr/man
+ $(STRIP) $(PKG_IPK_DIR)/usr/lib/*
+ $(STRIP) $(PKG_IPK_DIR)/usr/sbin/*
+ mkdir -p $(PACKAGE_DIR)
+ $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
+
+$(IPKG_STATE_DIR)/info/quagga.list: $(PKG_IPK)
+ $(IPKG) install $(PKG_IPK)
+
+$(PKG_ZEBRA): $(PKG_IPK_DIR)/zebra
+ mkdir -p $(PKG_ZEBRA_DIR)/etc/quagga
+ mkdir -p $(PKG_ZEBRA_DIR)/usr/sbin
+ mkdir -p $(PKG_ZEBRA_DIR)/usr/lib
+ cp -a ./ipkg/* $(PKG_ZEBRA_DIR)/
+ $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_ZEBRA_DIR) control/$(PKG_NAME)-zebra.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
+ cp $(PKG_IPK_DIR)/usr/sbin/zebra $(PKG_ZEBRA_DIR)/usr/sbin
+ cp $(PKG_IPK_DIR)/usr/lib/libzebra* $(PKG_ZEBRA_DIR)/usr/lib
+ $(IPKG_BUILD) $(PKG_ZEBRA_DIR) $(PACKAGE_DIR)
+
+$(IPKG_STATE_DIR)/info/quagga-zebra.list: $(PKG_ZEBRA)
+ $(IPKG) install $(PKG_ZEBRA)
+
+$(PKG_BGPD): $(PKG_IPK_DIR)/zebra
+ mkdir -p $(PKG_BGPD_DIR)/etc/quagga
+ mkdir -p $(PKG_BGPD_DIR)/usr/sbin
+ cp -a ./ipkg/* $(PKG_BGPD_DIR)/
+ $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_BGPD_DIR) control/$(PKG_NAME)-bgpd.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
+ cp $(PKG_IPK_DIR)/usr/sbin/bgpd $(PKG_BGPD_DIR)/usr/sbin
+ $(IPKG_BUILD) $(PKG_BGPD_DIR) $(PACKAGE_DIR)
+
+$(IPKG_STATE_DIR)/info/quagga-bgpd.list: $(PKG_BGPD)
+ $(IPKG) install $(PKG_BGPD)
+
+$(PKG_RIPD): $(PKG_IPK_DIR)/zebra
+ mkdir -p $(PKG_RIPD_DIR)/etc/quagga
+ mkdir -p $(PKG_RIPD_DIR)/usr/sbin
+ cp -a ./ipkg/* $(PKG_RIPD_DIR)/
+ $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_RIPD_DIR) control/$(PKG_NAME)-ripd.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
+ cp $(PKG_IPK_DIR)/usr/sbin/ripd $(PKG_RIPD_DIR)/usr/sbin
+ $(IPKG_BUILD) $(PKG_RIPD_DIR) $(PACKAGE_DIR)
+
+$(IPKG_STATE_DIR)/info/quagga-ripd.list: $(PKG_RIPD)
+ $(IPKG) install $(PKG_RIPD)
+
+$(PKG_OSPFD): $(PKG_IPK_DIR)/zebra
+ mkdir -p $(PKG_OSPFD_DIR)/etc/quagga
+ mkdir -p $(PKG_OSPFD_DIR)/usr/sbin
+ mkdir -p $(PKG_OSPFD_DIR)/usr/lib
+ cp -a ./ipkg/* $(PKG_OSPFD_DIR)/
+ $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_OSPFD_DIR) control/$(PKG_NAME)-ospfd.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
+ cp $(PKG_IPK_DIR)/usr/sbin/ospfd $(PKG_OSPFD_DIR)/usr/sbin
+ cp $(PKG_IPK_DIR)/usr/lib/libospf* $(PKG_OSPFD_DIR)/usr/lib
+ $(IPKG_BUILD) $(PKG_OSPFD_DIR) $(PACKAGE_DIR)
+
+$(IPKG_STATE_DIR)/info/quagga-ospfd.list: $(PKG_OSPFD)
+ $(IPKG) install $(PKG_OSPFD)
+
+source: $(DL_DIR)/$(PKG_SOURCE)
+prepare: $(PKG_BUILD_DIR)/.unpacked
+compile: $(TARGETS)
+install: $(INSTALL_TARGETS)
+
+clean:
+ rm -rf $(PKG_BUILD_DIR)
+ rm -f $(PKG_IPK) $(PKG_ZEBRA) $(PKG_OSPFD) $(PKG_RIPD) $(PKG_BGPD)
--- /dev/null
+#!/bin/sh
+
+name=quagga
+id=51
+
+# do not change below
+# check if we are on real system
+if [ -z "${IPKG_INSTROOT}" ]; then
+ # create copies of passwd and group, if we use squashfs
+ rootfs=`mount |awk '/root/ { print $5 }'`
+ if [ "$rootfs" = "squashfs" ]; then
+ if [ -h /etc/group ]; then
+ rm /etc/group
+ cp /rom/etc/group /etc/group
+ fi
+ if [ -h /etc/passwd ]; then
+ rm /etc/passwd
+ cp /rom/etc/passwd /etc/passwd
+ fi
+ fi
+fi
+
+echo ""
+if [ -z "$(grep ^\\${name}: ${IPKG_INSTROOT}/etc/group)" ]; then
+ echo "adding group $name to /etc/group"
+ echo "${name}:x:${id}:" >> ${IPKG_INSTROOT}/etc/group
+fi
+
+if [ -z "$(grep ^\\${name}: ${IPKG_INSTROOT}/etc/passwd)" ]; then
+ echo "adding user $name to /etc/passwd"
+ echo "${name}:x:${id}:${id}:${name}:/tmp/.${name}:/bin/false" >> ${IPKG_INSTROOT}/etc/passwd
+fi
+
+grep -q '^zebra[[:space:]]*2601/tcp' ${IPKG_INSTROOT}/etc/services 2>/dev/null
+if [ $? -ne 0 ]; then
+echo "zebrasrv 2600/tcp" >>${IPKG_INSTROOT}/etc/services
+echo "zebra 2601/tcp" >>${IPKG_INSTROOT}/etc/services
+echo "ripd 2602/tcp" >>${IPKG_INSTROOT}/etc/services
+echo "ripngd 2603/tcp" >>${IPKG_INSTROOT}/etc/services
+echo "ospfd 2604/tcp" >>${IPKG_INSTROOT}/etc/services
+echo "bgpd 2605/tcp" >>${IPKG_INSTROOT}/etc/services
+echo "ospf6d 2606/tcp" >>${IPKG_INSTROOT}/etc/services
+echo "ospfapi 2607/tcp" >>${IPKG_INSTROOT}/etc/services
+echo "isisd 2608/tcp" >>${IPKG_INSTROOT}/etc/services
+fi
--- /dev/null
+--- quagga-0.98.2/configure.orig Thu Feb 3 17:39:29 2005
++++ quagga-0.98.2/configure Sat Feb 12 06:47:14 2005
+@@ -12491,72 +12491,6 @@
+
+
+
+-echo "$as_me:$LINENO: checking for broken CMSG_FIRSTHDR" >&5
+-echo $ECHO_N "checking for broken CMSG_FIRSTHDR... $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; }; }
+-else
+- cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h. */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h. */
+-
+-#ifdef SUNOS_5
+-#define _XPG4_2
+-#define __EXTENSIONS__
+-#endif
+-#include <stdlib.h>
+-#include <sys/types.h>
+-#include <sys/socket.h>
+-
+-main()
+-{
+- struct msghdr msg;
+- char buf[4];
+-
+- msg.msg_control = buf;
+- msg.msg_controllen = 0;
+-
+- if (CMSG_FIRSTHDR(&msg) != NULL)
+- exit(0);
+- exit (1);
+-}
+-_ACEOF
+-rm -f conftest$ac_exeext
+-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+- (eval $ac_link) 2>&5
+- ac_status=$?
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+- (eval $ac_try) 2>&5
+- ac_status=$?
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); }; }; then
+- echo "$as_me:$LINENO: result: yes - using workaround" >&5
+-echo "${ECHO_T}yes - using workaround" >&6
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_BROKEN_CMSG_FIRSTHDR
+-_ACEOF
+-
+-else
+- echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-( exit $ac_status )
+-echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6
+-fi
+-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+-fi
+-
+ echo "$as_me:$LINENO: checking route read method check" >&5
+ echo $ECHO_N "checking route read method check... $ECHO_C" >&6
+ if test "${zebra_rtread+set}" = set; then
+@@ -12654,10 +12588,7 @@
+ if test "${zebra_ipforward_path+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+- for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
+-do
+- test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
+-done
++ zebra_ipforward_path="/proc/net/snmp"
+ case $zebra_ipforward_path in
+ "/proc/net/snmp") IPFORWARD=ipforward_proc.o
+ zebra_ipforward_path="proc";;