[packages] time: add the GNU time utility
authorStephen Walker <stephendwalker@gmail.com>
Mon, 15 Aug 2011 03:38:32 +0000 (03:38 +0000)
committerStephen Walker <stephendwalker@gmail.com>
Mon, 15 Aug 2011 03:38:32 +0000 (03:38 +0000)
SVN-Revision: 27986

utils/time/Makefile [new file with mode: 0644]
utils/time/patches/001-fix-configure.patch [new file with mode: 0644]
utils/time/patches/002-fix-rusage.patch [new file with mode: 0644]

diff --git a/utils/time/Makefile b/utils/time/Makefile
new file mode 100644 (file)
index 0000000..7ec8322
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=time
+PKG_VERSION:=1.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/time
+PKG_MD5SUM:=e38d2b8b34b1ca259cf7b053caac32b3
+
+PKG_FIXUP:=libtool
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/time
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=The GNU time utility
+  URL:=http://www.gnu.org/software/time/
+endef
+
+define Package/time/description
+  `time' is a program that measures many of the CPU resources, such as time and
+  memory, that other programs use.  The GNU version can format the output in
+  arbitrary ways by using a printf-style format string to include various
+  resource measurements.  Some systems do not provide much information about
+  program resource use; `time' reports unavailable information as zero values.
+endef
+
+define Package/time/preinst
+#!/bin/sh
+if [ -e $${IPKG_INSTROOT}/usr/bin/time ]; then
+  rm $${IPKG_INSTROOT}/usr/bin/time;
+fi
+endef
+
+define Package/time/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/time $(1)/usr/bin/
+endef
+
+define Package/time/postrm
+#!/bin/sh
+ln -sf ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/time
+$${IPKG_INSTROOT}/usr/bin/time 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/time
+exit 0
+endef
+
+$(eval $(call BuildPackage,time))
diff --git a/utils/time/patches/001-fix-configure.patch b/utils/time/patches/001-fix-configure.patch
new file mode 100644 (file)
index 0000000..6d4af09
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/configure.in
++++ b/configure.in
+@@ -1,9 +1,6 @@
+ dnl Process this file with autoconf to produce a configure script.
+ AC_INIT(time.c)
+-VERSION=1.7
+-AC_SUBST(VERSION)
+-PACKAGE=time
+-AC_SUBST(PACKAGE)
++AM_INIT_AUTOMAKE(time, 1.7)
+ AC_ARG_PROGRAM
+@@ -15,7 +12,7 @@ AC_PROG_INSTALL
+ dnl Checks for header files.
+ AC_HEADER_STDC
+ AC_HEADER_SYS_WAIT
+-AC_CHECK_HEADERS(unistd.h string.h sys/rusage.h)
++AC_CHECK_HEADERS(unistd.h string.h sys/rusage.h sys/resource.h)
+ dnl Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
diff --git a/utils/time/patches/002-fix-rusage.patch b/utils/time/patches/002-fix-rusage.patch
new file mode 100644 (file)
index 0000000..714cf0c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/resuse.h
++++ b/resuse.h
+@@ -36,7 +36,7 @@ struct timeval
+ # include <sys/rusage.h>
+ #else
+ # define TV_MSEC tv_usec / 1000
+-# if HAVE_WAIT3
++# if HAVE_SYS_RESOURCE_H
+ #  include <sys/resource.h>
+ # else
+ /* Process resource usage structure.  */