--- /dev/null
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: $
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=stund
+PKG_VERSION:=0.96
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION)_Aug13.tgz
+PKG_SOURCE_URL:=@SF/stun
+PKG_MD5SUM:=3273abb1a6f299f4e611b658304faefa
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/stun/Default
+ SECTION:=net
+ CATEGORY:=Network
+ DEPENDS:=+uclibcxx
+ URL:=http://sourceforge.net/projects/stun
+endef
+
+define Package/stun/Default/description
+ The STUN protocol (Simple Traversal of UDP through NATs) is described in the
+ IETF RFC 3489, available at http://www.ietf.org/rfc/rfc3489.txt. It's used to
+ help clients behind NAT to tunnel incoming calls through. This server is the
+ counterpart to help the client identify the NAT and have it open the proper
+ ports for it.
+endef
+
+define Package/stund
+$(call Package/stun/Default)
+ TITLE:=STUN server
+endef
+
+define Package/stund/description
+$(call Package/stun/Default/description)
+endef
+
+define Package/stun-client
+$(call Package/stun/Default)
+ TITLE:=STUN test client
+endef
+
+define Package/stun-client/description
+$(call Package/stun/Default/description)
+endef
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CXX="$(TARGET_CXX)" \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ DESTDIR="$(PKG_INSTALL_DIR)" \
+ CXXFLAGS="$$$$CXXFLAGS -fno-builtin -fno-rtti -nostdinc++" \
+ CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/uClibc++ -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
+ LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -L$(TOOLCHAIN_DIR)/usr/lib \
+ -nodefaultlibs -luClibc++ -lgcc" \
+ all
+endef
+
+
+define Package/stund/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/server $(1)/usr/sbin/stund
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/stund.init $(1)/etc/init.d/
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_DATA) ./files/stund.config $(1)/etc/config/stund
+endef
+
+define Package/stun-client/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/client $(1)/usr/sbin/stun-client
+endef
+
+$(eval $(call BuildPackage,stund))
+$(eval $(call BuildPackage,stun-client))
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## fix_non_i386.dpatch by Kilian Krause <kilian@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Remove i386-only code analogous to twinkle
+@DPATCH@
+diff -urNad stun-0.96~/stun.cxx stun-0.96/stun.cxx
+--- stun-0.96~/stun.cxx 2005-08-14 00:39:03.000000000 +0000
++++ stun-0.96/stun.cxx 2006-01-03 00:54:33.000000000 +0000
+@@ -669,16 +669,8 @@
+ tick = hightick;
+ tick <<= 32;
+ tick |= lowtick;
+-#elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) )
+- asm("rdtsc" : "=A" (tick));
+-#elif defined (__SUNPRO_CC) || defined( __sparc__ )
+- tick = gethrtime();
+-#elif defined(__MACH__)
+- int fd=open("/dev/random",O_RDONLY);
+- read(fd,&tick,sizeof(tick));
+- closesocket(fd);
+ #else
+-# error Need some way to seed the random number generator
++ tick = time(NULL);
+ #endif
+ int seed = int(tick);
+ #ifdef WIN32