Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..9d6aa8a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,122 @@
+#
+#    Copyright (c) 2010-2011 Nest, Inc.
+#    All rights reserved.
+#
+#    This document is the property of Nest. It is considered
+#    confidential and proprietary information.
+#
+#    This document may not be reproduced or transmitted in any form,
+#    in whole or in part, without the express written permission of
+#    Nest.
+#
+#    Description:
+#      This file is the makefile for the "list open files" (lsof) utility.
+#
+
+
+include pre.mak
+
+PackageName		:= lsof
+
+PackageExtension	:= tar.bz2
+PackageSeparator	:= _
+
+PackagePatchArgs	:= -g 0 -p2
+
+PackageArchive		:= $(PackageName).$(PackageExtension)
+PackageWrapperDir	:= $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageSourceArchive	:= $(PackageWrapperDir)/$(PackageName)$(PackageSeparator)$(PackageVersion)$(PackageSeparator)src.tar
+PackageSourceDir	:= $(PackageWrapperDir)/$(PackageName)$(PackageSeparator)$(PackageVersion)$(PackageSeparator)src
+
+PackageBuildMakefile	= $(call GenerateBuildPaths,Configure)
+
+CleanPaths		+= $(PackageLicenseFile)
+
+SOURCEDIRS                      = $(PackageSourceDir)
+$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
+
+all: $(PackageDefaultGoal)
+
+# Expand the wrapper directory which contains another archive
+# containing the source.
+
+$(PackageSourceArchive): $(PackageArchive)
+	$(call expand-archive,$(<),.)
+	$(Verbose)touch $(@)
+
+# Generate the package license contents.
+
+$(PackageSourceDir)/00README: $(BuildDirectory)/source
+
+$(PackageLicenseFile): $(PackageSourceDir)/00README
+	$(Verbose)$(SED) -n -e '/^License$$/,/\*\/$$/{;p;/\*\/$$/q;}' < $< > $@
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageSourceArchive) $(PackagePatchPaths)
+	$(call expand-archive,$(<),$(PackageWrapperDir))
+	$(Verbose)touch $(@)
+	$(call patch-directory,$(@),$(PackagePatchArgs),$(PackagePatchPaths))
+
+# Prepare the sources.
+
+$(BuildDirectory)/source: | $(PackageSourceDir)
+	$(Verbose)touch $@
+
+# Patch the sources, if necessary.
+
+$(BuildDirectory)/patch: $(BuildDirectory)/source
+	$(Verbose)touch $@
+
+# Generate the package build makefile.
+
+$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory)
+	$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
+
+# Configure the source for building.
+
+$(BuildDirectory)/configure: $(BuildDirectory)/source $(PackageBuildMakefile)
+	$(Verbose)cd $(BuildDirectory) && \
+	LSOF_CC="$(CC) $(CPPOPTFLAGS)" \
+	LINUX_CLIB="-DGLIBCV=211" \
+	LSOF_INCLUDE="$(LinuxIncludePath)" \
+	LINUX_INCL="$(LinuxIncludePath)" \
+	INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+	./Configure \
+	-n \
+	$(TargetOS)
+	$(Verbose)touch $@
+
+# Build the source.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/build: $(BuildDirectory)/configure
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+	all
+	$(Verbose)touch $@
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+	INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+	DESTDIR=$(ResultDirectory) \
+	install
+	$(Verbose)touch $@
+
+.PHONY: stage
+stage: $(BuildDirectory)/stage
+
+clean:
+	$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(PackageWrapperDir)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/lsof.patches/lsof-50.description b/lsof.patches/lsof-50.description
new file mode 100644
index 0000000..178860a
--- /dev/null
+++ b/lsof.patches/lsof-50.description
@@ -0,0 +1 @@
+This patch ensures that strftime and localtime are assumed to be present in a cross-compiled environment where LINUX_CLIB has been specified.
diff --git a/lsof.patches/lsof-50.patch b/lsof.patches/lsof-50.patch
new file mode 100644
index 0000000..3b4edc4
--- /dev/null
+++ b/lsof.patches/lsof-50.patch
@@ -0,0 +1,14 @@
+diff -aruN a/lsof_4.85_src/Configure b/lsof_4.85_src/Configure
+--- a/lsof_4.85_src/Configure	2011-09-27 10:27:40.000000000 -0700
++++ b/lsof_4.85_src/Configure	2012-01-02 13:14:04.450661164 -0800
+@@ -5318,8 +5318,8 @@
+ $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
+ if test -x ${LSOF_TMPC}.x	# {
+ then
+-  ./${LSOF_TMPC}.x
+-  if test $? -eq 0	# }
++  ./${LSOF_TMPC}.x > /dev/null 2>&1
++  if test $? -eq 0 || test "X$LINUX_CLIB" != "X"	# }
+   then
+     LSOF_CFGF="$LSOF_CFGF -DHAS_STRFTIME"
+     echo "present"
diff --git a/lsof.patches/lsof-51.description b/lsof.patches/lsof-51.description
new file mode 100644
index 0000000..7a3d3c5
--- /dev/null
+++ b/lsof.patches/lsof-51.description
@@ -0,0 +1 @@
+This patch adds a functional set of install commands.
diff --git a/lsof.patches/lsof-51.patch b/lsof.patches/lsof-51.patch
new file mode 100644
index 0000000..74d36f1
--- /dev/null
+++ b/lsof.patches/lsof-51.patch
@@ -0,0 +1,43 @@
+diff -aruN a/lsof_4.84_src/dialects/linux/Makefile b/lsof_4.84_src/dialects/linux/Makefile
+--- a/lsof_4.84_src/dialects/linux/Makefile	2008-04-15 06:30:04.000000000 -0700
++++ b/lsof_4.84_src/dialects/linux/Makefile	2010-09-08 12:07:58.000000000 -0700
+@@ -5,9 +5,9 @@
+ 
+ PROG=	lsof
+ 
+-BIN=	${DESTDIR}
++BIN=	${DESTDIR}/usr/bin
+ 
+-DOC=	${DESTDIR}
++DOC=	${DESTDIR}/usr/share/man/man8
+ 
+ I=/usr/include
+ S=/usr/include/sys
+@@ -51,23 +51,10 @@
+ 	(cd lib; ${MAKE} -f Makefile.skel clean)
+ 
+ install: all FRC
+-	@echo ''
+-	@echo 'Please write your own install rule.  Lsof should be installed'
+-	@echo 'setuid to root if you wish any lsof user to be able to examine'
+-	@echo 'all open files.  Your install rule actions might look something'
+-	@echo 'like this:'
+-	@echo ''
+-	@echo '    install -m 4xxx -o root -g $${GRP} $${PROG} $${BIN}'
+-	@echo '    install -m 444 $${MAN} $${DOC}'
+-	@echo ''
+-	@echo 'You will have to complete the 4xxx modes, the GRP value, and'
+-	@echo 'the skeletons for the BIN and DOC strings, given at the'
+-	@echo 'beginning of this Makefile, e.g.,'
+-	@echo ''
+-	@echo '    BIN= $${DESTDIR}/usr/local/etc'
+-	@echo '    DOC= $${DESTDIR}/usr/man/man8'
+-	@echo '    GRP= sys'
+-	@echo ''
++	mkdir -p ${BIN}
++	install ${PROG} ${BIN}
++	mkdir -p ${DOC}
++	install ${MAN} ${DOC}
+ 
+ ${LIB}: FRC
+ 	(cd lib; ${MAKE} DEBUG="${DEBUG}" CFGF="${CFGF}")
diff --git a/lsof.tar.bz2 b/lsof.tar.bz2
new file mode 100644
index 0000000..b7f32ad
--- /dev/null
+++ b/lsof.tar.bz2
Binary files differ
diff --git a/lsof.url b/lsof.url
new file mode 100644
index 0000000..ea4a69c
--- /dev/null
+++ b/lsof.url
@@ -0,0 +1 @@
+ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_4.85.tar.bz2
diff --git a/lsof.version b/lsof.version
new file mode 100644
index 0000000..12cf98e
--- /dev/null
+++ b/lsof.version
@@ -0,0 +1 @@
+4.85