--- /dev/null
+#
+# Copyright (C) 2007 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:=lsof
+PKG_VERSION:=4.77
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).dfsg.1.orig.tar.gz
+PKG_SOURCE_URL:=http://ftp2.de.debian.org/debian/pool/main/l/lsof
+PKG_MD5SUM:=6751a1cbdefb751b7cb2e22e6e5bdacb
+PKG_CAT:=zcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).dfsg.1.orig
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lsof
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=LiSt Open Files - a diagnostic tool
+ URL:=http://www.akadia.com/services/lsof_intro.html
+endef
+
+define Build/Configure
+ cd $(PKG_BUILD_DIR); \
+ ./Configure -n linux
+endef
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CC=$(TARGET_CC) \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS)"
+endef
+
+define Package/lsof/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/lsof $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,lsof))
--- /dev/null
+diff -ru lsof_4.77.orig/lsof_4.77_src/lib/Makefile.skel lsof_4.77/lsof_4.77_src/lib/Makefile.skel
+--- lsof_4.77.orig/lib/Makefile.skel 2001-02-13 03:12:22.000000000 +0100
++++ lsof_4.77/lib/Makefile.skel 2006-11-29 13:51:44.000000000 +0100
+@@ -21,8 +21,8 @@
+ all: ${LIB}
+
+ ${LIB}: ${OBJ}
+- ${AR}
+- ${RANLIB}
++ ${AR} ${LIB} ${OBJ}
++ ${RANLIB} ${LIB}
+
+ clean: FRC
+ rm -f ${LIB} ${OBJ} errs Makefile.bak a.out core
--- /dev/null
+--- lsof_4.77/print.orig.c 2006-08-23 13:37:43.000000000 -0600
++++ lsof_4.77/print.c 2006-08-23 13:38:29.000000000 -0600
+@@ -148,6 +148,7 @@
+ static void
+ fill_portmap()
+ {
++#if !defined __UCLIBC__ || (defined __UCLIBC__ && defined __UCLIBC_HAS_RPC__)
+ char buf[128], *cp, *nm;
+ CLIENT *c;
+ int h, port, pr;
+@@ -266,6 +267,7 @@
+ Pth[pr][h] = pt;
+ }
+ clnt_destroy(c);
++#endif
+ }
+
+
--- /dev/null
+diff -ru lsof_4.77.orig/lsof_4.77_src/dialects/linux/dlsof.h lsof_4.77/lsof_4.77_src/dialects/linux/dlsof.h
+--- lsof_4.77.orig/dialects/linux/dlsof.h 2006-03-28 00:57:14.000000000 +0200
++++ lsof_4.77/dialects/linux/dlsof.h 2006-11-29 14:03:07.000000000 +0100
+@@ -49,7 +49,7 @@
+ #include <unistd.h>
+ #include <netinet/in.h>
+
+-# if defined(GLIBCV)
++# if defined(GLIBCV) || defined __UCLIBC__
+ #include <netinet/tcp.h>
+ # else /* !defined(GLIBCV) */
+ #include <linux/tcp.h>