Add lsof, thanks h3sp4wn (#1548)
authorFlorian Fainelli <florian@openwrt.org>
Tue, 10 Apr 2007 10:20:35 +0000 (10:20 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Tue, 10 Apr 2007 10:20:35 +0000 (10:20 +0000)
SVN-Revision: 6917

utils/lsof/Makefile [new file with mode: 0644]
utils/lsof/patches/001-lsof_makefile.patch [new file with mode: 0644]
utils/lsof/patches/002-lsof_noportmap.patch [new file with mode: 0644]
utils/lsof/patches/003-lsof_uclibc.patch [new file with mode: 0644]

diff --git a/utils/lsof/Makefile b/utils/lsof/Makefile
new file mode 100644 (file)
index 0000000..0525734
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# 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))
diff --git a/utils/lsof/patches/001-lsof_makefile.patch b/utils/lsof/patches/001-lsof_makefile.patch
new file mode 100644 (file)
index 0000000..acd636a
--- /dev/null
@@ -0,0 +1,14 @@
+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
diff --git a/utils/lsof/patches/002-lsof_noportmap.patch b/utils/lsof/patches/002-lsof_noportmap.patch
new file mode 100644 (file)
index 0000000..5f0c17e
--- /dev/null
@@ -0,0 +1,18 @@
+--- 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
+ }
diff --git a/utils/lsof/patches/003-lsof_uclibc.patch b/utils/lsof/patches/003-lsof_uclibc.patch
new file mode 100644 (file)
index 0000000..e53e37b
--- /dev/null
@@ -0,0 +1,12 @@
+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>