[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/build-tests.patch b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/build-tests.patch
new file mode 100644
index 0000000..e63457c
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/build-tests.patch
@@ -0,0 +1,44 @@
+Add 'ptest' target to Makefile, to run tests without checking dependencies.
+
+Signed-off-by: Anders Roxell <anders.roxell@enea.com>
+Upstream-Status: Pending
+---
+diff -dNaur bash-3.2.48/Makefile.in.orig bash-3.2.48/Makefile.in
+--- bash-3.2.48/Makefile.in.orig	2006-08-17 23:03:35.000000000 +0500
++++ bash-3.2.48/Makefile.in	2013-07-02 20:20:07.512709327 +0500
+@@ -803,17 +803,31 @@
+ 	fi
+ 
+ recho$(EXEEXT):		$(SUPPORT_SRC)recho.c
+-	@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)recho.c ${LIBS_FOR_BUILD}
++	@$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $<
+ 
+ zecho$(EXEEXT):		$(SUPPORT_SRC)zecho.c
+-	@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)zecho.c ${LIBS_FOR_BUILD}
++	@$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $<
+ 
+ printenv$(EXEEXT):	$(SUPPORT_SRC)printenv.c
+-	@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)printenv.c ${LIBS_FOR_BUILD}
++	@$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $<
+ 
+-test tests check:	force $(Program) $(TESTS_SUPPORT)
++test tests check:
++	@$(MAKE) install-test
++	@$(MAKE) runtest
++
++install-test: buildtest
++ifeq ($(origin INSTALL_TEST_DIR), undefined)
+ 	@-test -d tests || mkdir tests
+ 	@cp $(TESTS_SUPPORT) tests
++else
++	@-test -d $(INSTALL_TEST_DIR) || mkdir -p $(INSTALL_TEST_DIR)
++	@cp -r $(srcdir)/tests/* $(INSTALL_TEST_DIR)/
++	@cp $(TESTS_SUPPORT) $(INSTALL_TEST_DIR)
++endif
++
++buildtest: force $(Program) $(TESTS_SUPPORT)
++
++runtest:
+ 	@( cd $(srcdir)/tests && \
+ 		PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} )
+ 
diff --git a/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/dont-include-target-CFLAGS-in-host-LDFLAGS.patch b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/dont-include-target-CFLAGS-in-host-LDFLAGS.patch
new file mode 100644
index 0000000..ee756dc
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/dont-include-target-CFLAGS-in-host-LDFLAGS.patch
@@ -0,0 +1,33 @@
+From 933bd886af49667e88e2385409449ab598813dab Mon Sep 17 00:00:00 2001
+From: Andre McCurdy <armccurdy@gmail.com>
+Date: Wed, 15 Jul 2015 00:54:33 -0700
+Subject: [PATCH] dont include target CFLAGS in host LDFLAGS
+
+Building the host tool 'mkbuiltins' will fail if the target CFLAGS
+contains an option which isn't supported by the host's gcc. To prevent
+the issue, define LDFLAGS_FOR_BUILD based on CFLAGS_FOR_BUILD instead
+of CFLAGS.
+
+Upstream-Status: Inappropriate [required for bash 3.2.57 (GPLv2) recipe only]
+
+Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
+---
+ builtins/Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/builtins/Makefile.in b/builtins/Makefile.in
+index e027f7a..ebfddf3 100644
+--- a/builtins/Makefile.in
++++ b/builtins/Makefile.in
+@@ -63,7 +63,7 @@ LOCAL_DEFS = @LOCAL_DEFS@
+ 
+ LIBS = @LIBS@
+ LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
+-LDFLAGS_FOR_BUILD = $(LDFLAGS)
++LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
+ LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
+ #LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
+ LIBS_FOR_BUILD = $(LIBS)
+-- 
+1.9.1
+
diff --git a/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/mkbuiltins_have_stringize.patch b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/mkbuiltins_have_stringize.patch
new file mode 100644
index 0000000..c4229a7
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/mkbuiltins_have_stringize.patch
@@ -0,0 +1,29 @@
+On hosts with FORTIFY_SOURCES, stringize support is required, as it's used by
+the macros to wrap functions (e.g. read and open in unistd.h). Those wrappers
+use the STRING() macro from unistd.h. A header in the bash sources overrides
+the unistd.h macro to 'x' when HAVE_STRINGIZE is not defined, causing the
+wrappers to generate calls to 'xread' and 'xopen', which do not exist,
+resulting in a failure to link.
+
+Assume we have stringize support when cross-compiling, which works around the
+issue.
+
+It may be best for upstream to either give up on supporting compilers without
+stringize support, or to not define STRING() at all when FORTIFY_SOURCES is
+defined, letting the unistd.h one be used, instead.
+
+Upstream-Status: Pending
+
+Signed-off-by: Christopher Larson <chris_larson@mentor.com>
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+
+--- bash-4.2.orig/builtins/mkbuiltins.c
++++ bash-4.2/builtins/mkbuiltins.c
+@@ -28,6 +28,7 @@
+ #  define HAVE_STDLIB_H
+
+ #  define HAVE_RENAME
++#  define HAVE_STRINGIZE
+ #endif /* CROSS_COMPILING */
+
+ #if defined (HAVE_UNISTD_H)
diff --git a/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/run-ptest b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/run-ptest
new file mode 100644
index 0000000..8dd3b99
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/run-ptest
@@ -0,0 +1,2 @@
+#!/bin/sh
+make -k THIS_SH=/bin/bash BUILD_DIR=. runtest
diff --git a/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/string-format.patch b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/string-format.patch
new file mode 100644
index 0000000..eda3964
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/string-format.patch
@@ -0,0 +1,21 @@
+Fix a string format warning when using security flags:
+
+| ../bash-3.2.48/print_cmd.c:1152:3: error: format not a string literal and no format arguments [-Werror=format-security]
+|    cprintf (indentation_string);
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/print_cmd.c b/print_cmd.c
+index d1dfd1a..956db53 100644
+--- a/print_cmd.c
++++ b/print_cmd.c
+@@ -1149,7 +1149,7 @@ indent (amount)
+   for (i = 0; amount > 0; amount--)
+     indentation_string[i++] = ' ';
+   indentation_string[i] = '\0';
+-  cprintf (indentation_string);
++  cprintf ("%s", indentation_string);
+ }
+ 
+ static void
diff --git a/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/test-output.patch b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/test-output.patch
new file mode 100644
index 0000000..2b09b7d
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/bash/bash-3.2.57/test-output.patch
@@ -0,0 +1,25 @@
+Add FAIL/PASS output to test output.
+
+Signed-off-by: Björn Stenberg <bjst@enea.com>
+Upstream-Status: Pending
+---
+diff -uNr a/tests/run-all b/tests/run-all
+--- a/tests/run-all	1999-10-08 17:07:46.000000000 +0200
++++ b/tests/run-all	2012-10-27 21:04:18.663331887 +0200
+@@ -22,7 +22,15 @@
+ 	case $x in
+ 	$0|run-minimal|run-gprof)	;;
+ 	*.orig|*~) ;;
+-	*)	echo $x ; sh $x ;;
++    *)  echo $x
++         output=`sh $x`
++         if [ -n "$output" ]; then
++             echo "$output"
++             echo "FAIL: $x"
++         else
++             echo "PASS: $x"
++         fi
++         ;;
+ 	esac
+ done
+ 
diff --git a/meta/meta-gplv2/recipes-extended/bash/bash.inc b/meta/meta-gplv2/recipes-extended/bash/bash.inc
new file mode 100644
index 0000000..0f0d679
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/bash/bash.inc
@@ -0,0 +1,69 @@
+SUMMARY = "An sh-compatible command language interpreter"
+HOMEPAGE = "http://tiswww.case.edu/php/chet/bash/bashtop.html"
+SECTION = "base/shell"
+
+DEPENDS = "ncurses bison-native virtual/libiconv"
+
+inherit autotools gettext texinfo update-alternatives ptest
+
+EXTRA_AUTORECONF += "--exclude=autoheader"
+EXTRA_OECONF = "--enable-job-control --without-bash-malloc"
+
+# If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the
+# startup files, even if they are not interactive.
+# This is what other major distros do. And this is what we wanted. See bug#5359 and bug#7137.
+CFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS"
+
+ALTERNATIVE_${PN} = "bash sh"
+ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash"
+ALTERNATIVE_TARGET[bash] = "${base_bindir}/bash"
+ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh"
+ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash.${BPN}"
+ALTERNATIVE_PRIORITY = "100"
+
+RDEPENDS_${PN} += "base-files"
+RDEPENDS_${PN}_class-nativesdk = ""
+RDEPENDS_${PN}-ptest += "make"
+
+USERADD_PACKAGES = "${PN}-ptest"
+USERADD_PARAM_${PN}-ptest = "--create-home --user-group test"
+
+do_configure_prepend () {
+	if [ ! -e ${S}/acinclude.m4 ]; then
+		cat ${S}/aclocal.m4 > ${S}/acinclude.m4
+	fi
+}
+
+do_compile_ptest () {
+	oe_runmake buildtest
+}
+
+do_install_append () {
+	# Move /usr/bin/bash to /bin/bash, if need
+	if [ "${base_bindir}" != "${bindir}" ]; then
+		mkdir -p ${D}${base_bindir}
+		mv ${D}${bindir}/bash ${D}${base_bindir}
+	fi
+}
+do_install_append_class-target () {
+	# Clean host path in bashbug
+	sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
+		-e "s,-I${WORKDIR}/\S* ,,g" ${D}${bindir}/bashbug
+}
+
+do_install_ptest () {
+	make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test
+	cp ${B}/Makefile ${D}${PTEST_PATH}
+        sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
+	    -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" ${D}${PTEST_PATH}/Makefile
+}
+
+pkg_postinst_${PN} () {
+	grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
+}
+
+pkg_postrm_${PN} () {
+	printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
+}
+
+RPROVIDES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}"
diff --git a/meta/meta-gplv2/recipes-extended/bash/bash_3.2.57.bb b/meta/meta-gplv2/recipes-extended/bash/bash_3.2.57.bb
new file mode 100644
index 0000000..5c288b3
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/bash/bash_3.2.57.bb
@@ -0,0 +1,18 @@
+require bash.inc
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=fd5d9bcabd8ed5a54a01ce8d183d592a"
+
+SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
+           file://mkbuiltins_have_stringize.patch \
+           file://build-tests.patch \
+           file://test-output.patch \
+           file://run-ptest \
+           file://dont-include-target-CFLAGS-in-host-LDFLAGS.patch \
+           file://string-format.patch \
+          "
+
+SRC_URI[md5sum] = "237a8767c990b43ae2c89895c2dbc062"
+SRC_URI[sha256sum] = "3fa9daf85ebf35068f090ce51283ddeeb3c75eb5bc70b1a4a7cb05868bfe06a4"
+
+PARALLEL_MAKE = ""
diff --git a/meta/meta-gplv2/recipes-extended/bc/bc_1.06.bb b/meta/meta-gplv2/recipes-extended/bc/bc_1.06.bb
new file mode 100644
index 0000000..d8c8a86
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/bc/bc_1.06.bb
@@ -0,0 +1,26 @@
+SUMMARY = "Arbitrary precision calculator language"
+HOMEPAGE = "http://www.gnu.org/software/bc/bc.html"
+
+LICENSE = "GPLv2+ & LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
+                    file://COPYING.LIB;md5=d8045f3b8f929c1cb29a1e3fd737b499 \
+                    file://bc/bcdefs.h;endline=31;md5=46dffdaf10a99728dd8ce358e45d46d8 \
+                    file://dc/dc.h;endline=25;md5=2f9c558cdd80e31b4d904e48c2374328 \
+                    file://lib/number.c;endline=31;md5=99434a0898abca7784acfd36b8191199"
+
+SECTION = "base"
+DEPENDS = "flex"
+PR = "r3"
+
+SRC_URI = "${GNU_MIRROR}/bc/bc-${PV}.tar.gz \
+           file://fix-segment-fault.patch "
+
+SRC_URI[md5sum] = "d44b5dddebd8a7a7309aea6c36fda117"
+SRC_URI[sha256sum] = "4ef6d9f17c3c0d92d8798e35666175ecd3d8efac4009d6457b5c99cea72c0e33"
+
+inherit autotools texinfo update-alternatives
+
+ALTERNATIVE_${PN} = "dc"
+ALTERNATIVE_PRIORITY = "100"
+
+BBCLASSEXTEND = "native"
diff --git a/meta/meta-gplv2/recipes-extended/bc/files/fix-segment-fault.patch b/meta/meta-gplv2/recipes-extended/bc/files/fix-segment-fault.patch
new file mode 100644
index 0000000..20c0da2
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/bc/files/fix-segment-fault.patch
@@ -0,0 +1,28 @@
+Upstream-Status: Pending
+
+when run command such as 'echo "a = 13" | bc -l', it segmentation faults.
+This patch is from http://www.mail-archive.com/blfs-support@linuxfromscratch.org/msg04602.html.
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+
+--- bc-1.06/lib/number.c.orig	2003-09-26 21:14:02.000000000 +0000
++++ bc-1.06/lib/number.c	2003-09-26 21:14:26.000000000 +0000
+@@ -34,6 +34,7 @@
+ #include <number.h>
+ #include <assert.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <ctype.h>/* Prototypes needed for external utility routines. */
+ 
+ #define bc_rt_warn rt_warn
+--- bc-1.06/bc/load.c.orig	2003-09-26 21:14:14.000000000 +0000
++++ bc-1.06/bc/load.c	2003-09-26 21:14:26.000000000 +0000
+@@ -156,7 +156,7 @@
+   long  label_no;
+   long  vaf_name;	/* variable, array or function number. */
+   long  func;
+-  program_counter save_adr;
++  static program_counter save_adr;
+ 
+   /* Initialize. */
+   str = code;
diff --git a/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/avoid_heap_overflow.patch b/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/avoid_heap_overflow.patch
new file mode 100644
index 0000000..a315735
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/avoid_heap_overflow.patch
@@ -0,0 +1,26 @@
+Upstream-Status: Inappropriate [bugfix: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-0624]
+CVE: CVE-2010-0624
+
+This patch avoids heap overflow reported by :
+http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-0624
+
+This is a clean patch for the GPLv2 tar recipe.
+
+the GPLv2 tar recipe patch is also applicable to this GPLv2 cpio 
+recipe, as they share code.
+
+Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/25
+
+Index: tar-1.17/lib/rtapelib.c
+===================================================================
+--- tar-1.17.orig/lib/rtapelib.c
++++ tar-1.17/lib/rtapelib.c
+@@ -570,7 +570,7 @@ rmt_read__ (int handle, char *buffer, si
+ 
+   sprintf (command_buffer, "R%lu\n", (unsigned long) length);
+   if (do_command (handle, command_buffer) == -1
+-      || (status = get_status (handle)) == SAFE_READ_ERROR)
++      || ((status = get_status (handle)) == SAFE_READ_ERROR) || (status > length))
+     return SAFE_READ_ERROR;
+ 
+   for (counter = 0; counter < status; counter += rlen, buffer += rlen)
diff --git a/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/fix-memory-overrun.patch b/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/fix-memory-overrun.patch
new file mode 100644
index 0000000..0148e70
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/fix-memory-overrun.patch
@@ -0,0 +1,217 @@
+cpio: Fix memory overrun on reading improperly created link records
+
+Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
+
+http://git.savannah.gnu.org/cgit/cpio.git/commit/?id=746f3ff670dcfcdd28fcc990e79cd6fccc7ae48d
+
+  * src/copyin.c (get_link_name): New function.
+  (list_file, copyin_link): use get_link_name
+
+  * tests/symlink-bad-length.at: New file.
+  * tests/symlink-long.at: New file.
+  * tests/Makefile.am: Add new files.
+  * tests/testsuite.at: Likewise.
+
+  See http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
+
+Upstream-Status: Backport
+
+Signed-off-by: Sergey Poznyakoff <gray@gnu.org.ua>
+
+diff -Nurp cpio-2.8.orig/src/copyin.c cpio-2.8/src/copyin.c
+--- cpio-2.8.orig/src/copyin.c	2007-06-07 19:58:03.000000000 +0800
++++ cpio-2.8/src/copyin.c	2014-12-08 11:30:01.159791484 +0800
+@@ -126,6 +126,28 @@ tape_skip_padding (int in_file_des, int
+ }
+ 
+ 
++static char *
++get_link_name (struct cpio_file_stat *file_hdr, int in_file_des)
++{
++  off_t n = file_hdr->c_filesize + 1;
++  char *link_name;
++
++  if (n == 0 || n > SIZE_MAX)
++    {
++      error (0, 0, _("%s: stored filename length too big"), file_hdr->c_name);
++      link_name = NULL;
++    }
++  else
++    {
++      link_name = xmalloc (n);
++      tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
++      link_name[file_hdr->c_filesize] = '\0';
++      tape_skip_padding (in_file_des, file_hdr->c_filesize);
++    }
++  return link_name;
++}
++
++
+ static void
+ list_file(struct cpio_file_stat* file_hdr, int in_file_des)
+ {
+@@ -136,21 +158,16 @@ list_file(struct cpio_file_stat* file_hd
+ 	{
+ 	  if (archive_format != arf_tar && archive_format != arf_ustar)
+ 	    {
+-	      char *link_name = NULL;	/* Name of hard and symbolic links.  */
+-
+-	      link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
+-	      link_name[file_hdr->c_filesize] = '\0';
+-	      tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
+-	      long_format (file_hdr, link_name);
+-	      free (link_name);
+-	      tape_skip_padding (in_file_des, file_hdr->c_filesize);
+-	      return;
++	      char *link_name = get_link_name (file_hdr, in_file_des);
++	      if (link_name)
++		{
++		  long_format (file_hdr, link_name);
++		  free (link_name);
++		}
+ 	    }
+ 	  else
+-	    {
+ 	      long_format (file_hdr, file_hdr->c_tar_linkname);
+-	      return;
+-	    }
++	  return;
+ 	}
+       else
+ #endif
+@@ -732,10 +749,7 @@ copyin_link(struct cpio_file_stat *file_
+ 
+   if (archive_format != arf_tar && archive_format != arf_ustar)
+     {
+-      link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
+-      link_name[file_hdr->c_filesize] = '\0';
+-      tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
+-      tape_skip_padding (in_file_des, file_hdr->c_filesize);
++      link_name = get_link_name (file_hdr, in_file_des);
+     }
+   else
+     {
+diff -Nurp cpio-2.8.orig/tests/Makefile.am cpio-2.8/tests/Makefile.am
+--- cpio-2.8.orig/tests/Makefile.am	2006-10-24 18:32:13.000000000 +0800
++++ cpio-2.8/tests/Makefile.am	2014-12-08 11:30:52.387789482 +0800
+@@ -45,6 +45,8 @@ TESTSUITE_AT = \
+  testsuite.at\
+  inout.at\
+  symlink.at\
++ symlink-bad-length.at\
++ symlink-long.at\
+  version.at
+ 
+ TESTSUITE = $(srcdir)/testsuite
+diff -Nurp cpio-2.8.orig/tests/symlink-bad-length.at cpio-2.8/tests/symlink-bad-length.at
+--- cpio-2.8.orig/tests/symlink-bad-length.at	1970-01-01 08:00:00.000000000 +0800
++++ cpio-2.8/tests/symlink-bad-length.at	2014-12-08 11:33:25.283783507 +0800
+@@ -0,0 +1,49 @@
++# Process this file with autom4te to create testsuite.  -*- Autotest -*-
++# Copyright (C) 2014 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3, or (at your option)
++# any later version.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++# 02110-1301 USA.
++
++# Cpio v2.11 did segfault with badly set symlink length.
++# References:
++# http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
++
++AT_SETUP([symlink-bad-length])
++AT_KEYWORDS([symlink-long copyout])
++
++AT_DATA([ARCHIVE.base64],
++[x3EjAIBAtIEtJy8nAQAAAHRUYW0FAAAADQBGSUxFAABzb21lIGNvbnRlbnQKAMdxIwBgQ/+hLScv
++JwEAAAB0VEhuBQD/////TElOSwAARklMRcdxAAAAAAAAAAAAAAEAAAAAAAAACwAAAAAAVFJBSUxF
++UiEhIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
++AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
++AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
++AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
++AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
++AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
++AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
++])
++
++AT_CHECK([
++base64 -d ARCHIVE.base64 > ARCHIVE || AT_SKIP_TEST
++cpio -ntv < ARCHIVE
++test $? -eq 2
++],
++[0],
++[-rw-rw-r--   1 10029    10031          13 Nov 25 13:52 FILE
++],[cpio: LINK: stored filename length too big
++cpio: premature end of file
++])
++
++AT_CLEANUP
+diff -Nurp cpio-2.8.orig/tests/symlink-long.at cpio-2.8/tests/symlink-long.at
+--- cpio-2.8.orig/tests/symlink-long.at	1970-01-01 08:00:00.000000000 +0800
++++ cpio-2.8/tests/symlink-long.at	2014-12-08 11:34:28.807781024 +0800
+@@ -0,0 +1,46 @@
++# Process this file with autom4te to create testsuite.  -*- Autotest -*-
++# Copyright (C) 2014 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3, or (at your option)
++# any later version.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++# 02110-1301 USA.
++
++# Cpio v2.11.90 changed the way symlink name is read from archive.
++# References:
++# http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
++
++AT_SETUP([symlink-long])
++AT_KEYWORDS([symlink-long copyout])
++
++AT_CHECK([
++
++# len(dirname) > READBUFSIZE
++dirname=
++for i in {1..52}; do
++    dirname="xxxxxxxxx/$dirname"
++    mkdir "$dirname"
++done
++ln -s "$dirname" x || AT_SKIP_TEST
++
++echo x | cpio -o > ar
++list=`cpio -tv < ar | sed 's|.*-> ||'`
++test "$list" = "$dirname" && echo success || echo fail
++],
++[0],
++[success
++],[2 blocks
++2 blocks
++])
++
++AT_CLEANUP
+diff -Nurp cpio-2.8.orig/tests/testsuite.at cpio-2.8/tests/testsuite.at
+--- cpio-2.8.orig/tests/testsuite.at	2006-10-24 18:32:13.000000000 +0800
++++ cpio-2.8/tests/testsuite.at	2014-12-08 11:34:56.515779942 +0800
+@@ -31,3 +31,5 @@ m4_include([version.at])
+ 
+ m4_include([inout.at])
+ m4_include([symlink.at])
++m4_include([symlink-bad-length.at])
++m4_include([symlink-long.at])
diff --git a/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/m4extensions.patch b/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/m4extensions.patch
new file mode 100644
index 0000000..e16585d
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/m4extensions.patch
@@ -0,0 +1,31 @@
+Upstream-Status: Inappropriate [licensing]
+
+# Define AC_USE_SYSTEM_EXTENSIONS only if it was previously undefined.
+# This is needed to configure correctly with newer versions of autoconf.
+
+diff -urN cpio-2.8.orig/m4/extensions.m4 cpio-2.8/m4/extensions.m4
+--- cpio-2.8.orig/m4/extensions.m4	2006-10-12 04:34:45.000000000 -0700
++++ cpio-2.8/m4/extensions.m4	2010-07-23 14:37:36.000000000 -0700
+@@ -1,4 +1,4 @@
+-# serial 4  -*- Autoconf -*-
++# serial 5  -*- Autoconf -*-
+ # Enable extensions on systems that normally disable them.
+ 
+ # Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+@@ -16,6 +16,7 @@
+ # ------------------------
+ # Enable extensions on systems that normally disable them,
+ # typically due to standards-conformance issues.
++m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [], [
+ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+ [
+   AC_BEFORE([$0], [AC_COMPILE_IFELSE])
+@@ -48,7 +49,7 @@
+     AC_DEFINE([__EXTENSIONS__])
+   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+   AC_DEFINE([_TANDEM_SOURCE])
+-])
++])])
+ 
+ # gl_USE_SYSTEM_EXTENSIONS
+ # ------------------------
diff --git a/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/statdef.patch b/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/statdef.patch
new file mode 100644
index 0000000..a00799f
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/cpio/cpio-2.8/statdef.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Inappropriate [licensing]
+
+# Avoid multiple stat definitions
+# Patch taken from cpio mailing list posting 2010-03-19
+
+diff -urN cpio-2.11.orig/src/filetypes.h cpio-2.11/src/filetypes.h
+--- cpio-2.11.orig/src/filetypes.h	2010-02-12 02:19:23.000000000 -0800
++++ cpio-2.11/src/filetypes.h	2010-07-23 13:17:25.000000000 -0700
+@@ -82,4 +82,6 @@
+ #define lstat stat
+ #endif
+ int lstat ();
++#ifndef stat
+ int stat ();
++#endif
diff --git a/meta/meta-gplv2/recipes-extended/cpio/cpio_2.8.bb b/meta/meta-gplv2/recipes-extended/cpio/cpio_2.8.bb
new file mode 100644
index 0000000..624906b
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/cpio/cpio_2.8.bb
@@ -0,0 +1,19 @@
+require cpio_v2.inc
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b7f772ea3a2489231cb4872656cac34b"
+
+PR = "r4"
+
+SRC_URI += " \
+	    file://statdef.patch \
+	    file://m4extensions.patch \
+	    file://avoid_heap_overflow.patch \
+	    file://fix-memory-overrun.patch \
+	   "
+
+SRC_URI[md5sum] = "0caa356e69e149fb49b76bacc64615a1"
+SRC_URI[sha256sum] = "1b203248874c3b5a728b351f06513e5282f73e0170b7f207fbf8c39f28f6b4ad"
+
+# Required to build with gcc 4.3 and later:
+CFLAGS += "-fgnu89-inline"
diff --git a/meta/meta-gplv2/recipes-extended/cpio/cpio_v2.inc b/meta/meta-gplv2/recipes-extended/cpio/cpio_v2.inc
new file mode 100644
index 0000000..31adb71
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/cpio/cpio_v2.inc
@@ -0,0 +1,43 @@
+SUMMARY = "GNU cpio is a program to manage archives of files"
+DESCRIPTION = "GNU cpio is a tool for creating and extracting archives, or copying files from one place to \
+another. It handles a number of cpio formats as well as reading and writing tar files."
+HOMEPAGE = "http://www.gnu.org/software/cpio/"
+SECTION = "base"
+
+DEPENDS = "texinfo-native"
+
+SRC_URI = "${GNU_MIRROR}/cpio/cpio-${PV}.tar.gz \
+    "
+
+inherit autotools gettext texinfo
+
+S = "${WORKDIR}/cpio-${PV}"
+
+EXTRA_OECONF += "DEFAULT_RMT_DIR=${base_sbindir}"
+
+do_install () {
+    autotools_do_install
+    if [ "${base_bindir}" != "${bindir}" ]; then
+        install -d ${D}${base_bindir}/
+        mv "${D}${bindir}/cpio" "${D}${base_bindir}/cpio"
+        rmdir ${D}${bindir}/
+    fi
+}
+
+PACKAGES =+ "${PN}-rmt"
+
+FILES_${PN}-rmt = "${base_sbindir}/rmt*"
+
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+
+ALTERNATIVE_${PN} = "cpio"
+ALTERNATIVE_${PN}-rmt = "rmt"
+
+ALTERNATIVE_LINK_NAME[cpio] = "${base_bindir}/cpio"
+
+ALTERNATIVE_PRIORITY[rmt] = "50"
+ALTERNATIVE_LINK_NAME[rmt] = "${base_sbindir}/rmt"
+
+BBCLASSEXTEND = "native"
diff --git a/meta/meta-gplv2/recipes-extended/diffutils/diffutils-2.8.1/0001-Make-it-build-with-compile-time-hardening-enabled.patch b/meta/meta-gplv2/recipes-extended/diffutils/diffutils-2.8.1/0001-Make-it-build-with-compile-time-hardening-enabled.patch
new file mode 100644
index 0000000..dc03aa6
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/diffutils/diffutils-2.8.1/0001-Make-it-build-with-compile-time-hardening-enabled.patch
@@ -0,0 +1,32 @@
+From 7448c928240aafbfec08a92530a150bc206673bf Mon Sep 17 00:00:00 2001
+From: Peter Kjellerstedt <pkj@axis.com>
+Date: Thu, 26 Apr 2018 02:40:52 +0200
+Subject: [PATCH] Make it build with compile time hardening enabled
+
+This avoids the following error:
+
+  src/diff3.c: In function 'output_diff3':
+  src/diff3.c:1405:5: error: format not a string literal and no format
+  arguments [-Werror=format-security]
+       fprintf (outputfile, line_prefix);
+       ^~~~~~~
+
+Upstream-Status: Inappropriate [legacy version]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+---
+ src/diff3.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/diff3.c b/src/diff3.c
+index f3d3dcf..7237dea 100644
+--- a/src/diff3.c
++++ b/src/diff3.c
+@@ -1402,7 +1402,7 @@ output_diff3 (FILE *outputfile, struct diff3_block *diff,
+ 	      line = 0;
+ 	      do
+ 		{
+-		  fprintf (outputfile, line_prefix);
++		  fprintf (outputfile, "%s", line_prefix);
+ 		  cp = D_RELNUM (ptr, realfile, line);
+ 		  length = D_RELLEN (ptr, realfile, line);
+ 		  fwrite (cp, sizeof (char), length, outputfile);
diff --git a/meta/meta-gplv2/recipes-extended/diffutils/diffutils-2.8.1/diffutils_fix_for_automake-1.12.patch b/meta/meta-gplv2/recipes-extended/diffutils/diffutils-2.8.1/diffutils_fix_for_automake-1.12.patch
new file mode 100644
index 0000000..f8638bb
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/diffutils/diffutils-2.8.1/diffutils_fix_for_automake-1.12.patch
@@ -0,0 +1,27 @@
+Upstream-Status: Pending
+
+automake 1.12 has depricated automatic de-ANSI-fication support
+
+this patch avoids these kinds of errors:
+
+| configure.ac:90: error: automatic de-ANSI-fication support has been removed
+| /srv/home/nitin/builds/build-gcc47/tmp/sysroots/x86_64-linux/usr/share/aclocal-1.12/protos.m4:12: AM_C_PROTOTYPES is expanded from...
+| /srv/home/nitin/builds/build-gcc47/tmp/work/i586-poky-linux/diffutils-2.8.1-r4/diffutils-2.8.1/m4/prereq.m4:110: jm_PREREQ_QUOTEARG is expanded from...
+| configure.ac:90: the top level
+| autom4te: m4 failed with exit status: 1
+
+Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
+2012/05/04
+
+Index: diffutils-2.8.1/m4/prereq.m4
+===================================================================
+--- diffutils-2.8.1.orig/m4/prereq.m4
++++ diffutils-2.8.1/m4/prereq.m4
+@@ -115,7 +115,6 @@ AC_DEFUN([jm_PREREQ_QUOTEARG],
+   AC_HEADER_STDC
+   AC_C_BACKSLASH_A
+   AC_MBSTATE_T
+-  AM_C_PROTOTYPES
+ ])
+ 
+ AC_DEFUN([jm_PREREQ_REGEX],
diff --git a/meta/meta-gplv2/recipes-extended/diffutils/diffutils-2.8.1/fix_gcc6.patch b/meta/meta-gplv2/recipes-extended/diffutils/diffutils-2.8.1/fix_gcc6.patch
new file mode 100644
index 0000000..f915287
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/diffutils/diffutils-2.8.1/fix_gcc6.patch
@@ -0,0 +1,31 @@
+Fixes to allow diffutils to build with gcc v6.
+
+RP
+2016/5/25
+
+Index: diffutils-2.8.1/lib/posix/regex.h
+===================================================================
+--- diffutils-2.8.1.orig/lib/posix/regex.h
++++ diffutils-2.8.1/lib/posix/regex.h
+@@ -529,7 +529,9 @@ extern int re_exec _RE_ARGS ((const char
+ /* For now unconditionally define __restrict_arr to expand to nothing.
+    Ideally we would have a test for the compiler which allows defining
+    it to restrict.  */
++#ifndef __restrict_arr
+ #define __restrict_arr
++#endif
+ 
+ /* POSIX compatibility.  */
+ extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
+Index: diffutils-2.8.1/src/diff.c
+===================================================================
+--- diffutils-2.8.1.orig/src/diff.c
++++ diffutils-2.8.1/src/diff.c
+@@ -71,6 +71,7 @@ static void usage (void);
+ static bool recursive;
+ 
+ /* In context diffs, show previous lines that match these regexps.  */
++struct re_pattern_buffer function_regexp;
+ static struct regexp_list function_regexp_list;
+ 
+ /* Ignore changes affecting only lines that match these regexps.  */
diff --git a/meta/meta-gplv2/recipes-extended/diffutils/diffutils.inc b/meta/meta-gplv2/recipes-extended/diffutils/diffutils.inc
new file mode 100644
index 0000000..243341a
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/diffutils/diffutils.inc
@@ -0,0 +1,18 @@
+SUMMARY = "Diffutils contains tools used for finding differences between files"
+DESCRIPTION = "Diffutils contains the GNU diff, diff3, \
+sdiff, and cmp utilities. These programs are usually \
+used for creating patch files."
+SECTION = "base"
+
+inherit autotools texinfo update-alternatives gettext
+
+# diffutils assumes non-glibc compilation with uclibc and
+# this causes it to generate its own implementations of
+# standard functionality.  regex.c actually breaks compilation
+# because it uses __mempcpy, there are other things (TBD:
+# see diffutils.mk in buildroot)
+EXTRA_OECONF_libc-uclibc = "--without-included-regex"
+
+ALTERNATIVE_${PN} = "diff cmp"
+ALTERNATIVE_PRIORITY = "100"
+
diff --git a/meta/meta-gplv2/recipes-extended/diffutils/diffutils_2.8.1.bb b/meta/meta-gplv2/recipes-extended/diffutils/diffutils_2.8.1.bb
new file mode 100644
index 0000000..466bf28
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/diffutils/diffutils_2.8.1.bb
@@ -0,0 +1,19 @@
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+
+require diffutils.inc
+
+PR = "r7.0"
+
+SRC_URI = "${GNU_MIRROR}/diffutils/diffutils-${PV}.tar.gz \
+           file://diffutils_fix_for_automake-1.12.patch \
+           file://fix_gcc6.patch \
+           file://0001-Make-it-build-with-compile-time-hardening-enabled.patch \
+           "
+
+SRC_URI[md5sum] = "71f9c5ae19b60608f6c7f162da86a428"
+SRC_URI[sha256sum] = "c5001748b069224dd98bf1bb9ee877321c7de8b332c8aad5af3e2a7372d23f5a"
+
+do_configure_prepend () {
+	chmod u+w ${S}/po/Makefile.in.in
+}
diff --git a/meta/meta-gplv2/recipes-extended/ed/ed_0.5.bb b/meta/meta-gplv2/recipes-extended/ed/ed_0.5.bb
new file mode 100644
index 0000000..e2df13f
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/ed/ed_0.5.bb
@@ -0,0 +1,20 @@
+SUMMARY = "Line-oriented text editor"
+HOMEPAGE = "http://www.gnu.org/software/ed/"
+SECTION = "base"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=6ddd5335ef96fb858a138230af773710 \
+                    file://main.c;beginline=1;endline=17;md5=36d4b85e5ae9028e918d1cc775c2475e"
+
+PR = "r2"
+SRC_URI = "${SAVANNAH_GNU_MIRROR}/ed/ed-${PV}.tar.bz2"
+
+SRC_URI[md5sum] = "4ee21e9dcc9b5b6012c23038734e1632"
+SRC_URI[sha256sum] = "edef2bbde0fbf0d88232782a0eded323f483a0519d6fde9a3b1809056fd35f3e"
+
+inherit autotools texinfo
+
+EXTRA_OECONF = "'CC=${CC}' 'CXX=${CXX}' 'CFLAGS=${CFLAGS}' 'CXXFLAGS=${CXXFLAGS}' 'CPPFLAGS=${CPPFLAGS}' 'LDFLAGS=${LDFLAGS}'"
+
+CONFIGUREOPTS_remove = "--disable-dependency-tracking"
+CONFIGUREOPTS_remove = "--disable-silent-rules"
+EXTRA_OECONF_remove = "--disable-static"
diff --git a/meta/meta-gplv2/recipes-extended/findutils/findutils-4.2.31/findutils-fix-doc-build-error.patch b/meta/meta-gplv2/recipes-extended/findutils/findutils-4.2.31/findutils-fix-doc-build-error.patch
new file mode 100644
index 0000000..2076e44
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/findutils/findutils-4.2.31/findutils-fix-doc-build-error.patch
@@ -0,0 +1,53 @@
+From 33cba24cba7b0973a702e9627bd5b93962948ae4 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Tue, 17 Sep 2013 16:11:16 +0800
+Subject: [PATCH] findutils: fix doc build error
+
+Upstream-Status: Backport
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+---
+ doc/find.texi |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/doc/find.texi b/doc/find.texi
+index 5b5f0cf..b3d9c6b 100644
+--- a/doc/find.texi
++++ b/doc/find.texi
+@@ -63,7 +63,7 @@ translation approved by the Foundation.
+
+ @page
+ @vskip 0pt plus 1filll
+-@insertcopying{}
++@insertcopying
+ @end titlepage
+
+ @contents
+@@ -1466,6 +1466,7 @@ no output is ever sent to it.
+ * Escapes::
+ * Format Directives::
+ * Time Formats::
++* Formatting Flags::
+ @end menu
+
+ @node Escapes
+@@ -1534,7 +1535,6 @@ from the novel you are reading.
+ * Size Directives::
+ * Location Directives::
+ * Time Directives::
+-* Formatting Flags::
+ @end menu
+
+ @node Name Directives
+@@ -1780,7 +1780,7 @@ setting the TZ environment variable).  This is a GNU extension.
+ @end table
+
+ @node Formatting Flags
+-@subsubsection Formatting Flags
++@subsection Formatting Flags
+
+ The @samp{%m} and @samp{%d} directives support the @samp{#}, @samp{0}
+ and @samp{+} flags, but the other directives do not, even if they
+--
+1.7.4.1
+
diff --git a/meta/meta-gplv2/recipes-extended/findutils/findutils-4.2.31/findutils_fix_for_automake-1.12.patch b/meta/meta-gplv2/recipes-extended/findutils/findutils-4.2.31/findutils_fix_for_automake-1.12.patch
new file mode 100644
index 0000000..1b7f8cf
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/findutils/findutils-4.2.31/findutils_fix_for_automake-1.12.patch
@@ -0,0 +1,23 @@
+Upstream-Status: Pending
+
+automake 1.12 has depricated automatic de-ANSI-fication support
+
+this patch avoids these kinds of errors:
+
+| configure.in:75: error: automatic de-ANSI-fication support has been removed
+
+Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
+2012/05/04
+
+Index: findutils-4.2.31/configure.in
+===================================================================
+--- findutils-4.2.31.orig/configure.in
++++ findutils-4.2.31/configure.in
+@@ -72,7 +72,6 @@ dnl gl_EARLY calls AC_GNU_SOURCE anyway.
+ 
+ 
+ AC_ISC_POSIX
+-AM_C_PROTOTYPES
+ 
+ AC_PROG_INSTALL
+ AC_PROG_RANLIB
diff --git a/meta/meta-gplv2/recipes-extended/findutils/findutils-4.2.31/gnulib-extension.patch b/meta/meta-gplv2/recipes-extended/findutils/findutils-4.2.31/gnulib-extension.patch
new file mode 100644
index 0000000..65bd642
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/findutils/findutils-4.2.31/gnulib-extension.patch
@@ -0,0 +1,56 @@
+Upstream-Status: Inappropriate [legacy version]
+
+the old AC_USE_SYSTEM_EXTENSIONS won't work with AC_GNU_SOURCE
+
+against 4.2.31
+07/08/2010 - qhe
+
+diff --git a/gnulib/m4/extensions.m4 b/gnulib/m4/extensions.m4
+index 143a9e5..0f27ceb 100644
+--- a/gnulib/m4/extensions.m4
++++ b/gnulib/m4/extensions.m4
+@@ -12,44 +12,6 @@
+ # enough in this area it's likely we'll need to redefine
+ # AC_USE_SYSTEM_EXTENSIONS for quite some time.
+ 
+-# AC_USE_SYSTEM_EXTENSIONS
+-# ------------------------
+-# Enable extensions on systems that normally disable them,
+-# typically due to standards-conformance issues.
+-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+-[
+-  AC_BEFORE([$0], [AC_COMPILE_IFELSE])
+-  AC_BEFORE([$0], [AC_RUN_IFELSE])
+-
+-  AC_REQUIRE([AC_GNU_SOURCE])
+-  AC_REQUIRE([AC_AIX])
+-  AC_REQUIRE([AC_MINIX])
+-
+-  AH_VERBATIM([__EXTENSIONS__],
+-[/* Enable extensions on Solaris.  */
+-#ifndef __EXTENSIONS__
+-# undef __EXTENSIONS__
+-#endif
+-#ifndef _POSIX_PTHREAD_SEMANTICS
+-# undef _POSIX_PTHREAD_SEMANTICS
+-#endif
+-#ifndef _TANDEM_SOURCE
+-# undef _TANDEM_SOURCE
+-#endif])
+-  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+-    [ac_cv_safe_to_define___extensions__],
+-    [AC_COMPILE_IFELSE(
+-       [AC_LANG_PROGRAM([
+-#	  define __EXTENSIONS__ 1
+-	  AC_INCLUDES_DEFAULT])],
+-       [ac_cv_safe_to_define___extensions__=yes],
+-       [ac_cv_safe_to_define___extensions__=no])])
+-  test $ac_cv_safe_to_define___extensions__ = yes &&
+-    AC_DEFINE([__EXTENSIONS__])
+-  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+-  AC_DEFINE([_TANDEM_SOURCE])
+-])
+-
+ # gl_USE_SYSTEM_EXTENSIONS
+ # ------------------------
+ # Enable extensions on systems that normally disable them,
diff --git a/meta/meta-gplv2/recipes-extended/findutils/findutils.inc b/meta/meta-gplv2/recipes-extended/findutils/findutils.inc
new file mode 100644
index 0000000..bfedf87
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/findutils/findutils.inc
@@ -0,0 +1,23 @@
+SUMMARY = "find, locate, and xargs binaries"
+DESCRIPTION = "The GNU Find Utilities are the basic directory searching utilities of the GNU operating system. \
+These programs are typically used in conjunction with other programs to provide modular and powerful directory \
+search and file locating capabilities to other commands."
+HOMEPAGE = "http://www.gnu.org/software/findutils/"
+BUGTRACKER = "http://savannah.gnu.org/bugs/?group=findutils"
+SECTION = "console/utils"
+
+SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz"
+
+inherit autotools gettext texinfo update-alternatives upstream-version-is-even
+
+ALTERNATIVE_${PN} = "find xargs"
+ALTERNATIVE_PRIORITY = "100"
+
+# diffutils assumes non-glibc compilation with uclibc and
+# this causes it to generate its own implementations of
+# standard functionality.  regex.c actually breaks compilation
+# because it uses __mempcpy, there are other things (TBD:
+# see diffutils.mk in buildroot)
+EXTRA_OECONF_libc-uclibc = "--without-included-regex"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/meta-gplv2/recipes-extended/findutils/findutils_4.2.31.bb b/meta/meta-gplv2/recipes-extended/findutils/findutils_4.2.31.bb
new file mode 100644
index 0000000..7dee018
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/findutils/findutils_4.2.31.bb
@@ -0,0 +1,14 @@
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
+PR = "r4"
+
+require findutils.inc
+
+SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
+           file://gnulib-extension.patch \
+           file://findutils_fix_for_automake-1.12.patch \
+           file://findutils-fix-doc-build-error.patch \
+           "
+
+SRC_URI[md5sum] = "a0e31a0f18a49709bf5a449867c8049a"
+SRC_URI[sha256sum] = "e0d34b8faca0b3cca0703f6c6b498afbe72f0ba16c35980c10ec9ef7724d6204"
diff --git a/meta/meta-gplv2/recipes-extended/gawk/gawk-3.1.5/0001-gawk-fix-non-glibc-gcc-4-compilation.patch b/meta/meta-gplv2/recipes-extended/gawk/gawk-3.1.5/0001-gawk-fix-non-glibc-gcc-4-compilation.patch
new file mode 100644
index 0000000..bc9201b
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/gawk/gawk-3.1.5/0001-gawk-fix-non-glibc-gcc-4-compilation.patch
@@ -0,0 +1,67 @@
+From 53496e2e306b16ac59801553f775bcca164e6a39 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net>
+Date: Wed, 14 Sep 2016 16:20:37 +0100
+Subject: [PATCH] fix gcc >= 4 compilation
+
+| ../gawk-3.1.5/hard-locale.h: In function 'hard_locale':
+| ../gawk-3.1.5/hard-locale.h:43:20: error: invalid storage class for function 'xmalloc'
+|        static ptr_t xmalloc PARAMS ((size_t n));
+|                     ^~~~~~~
+
+| ../gawk-3.1.5/hard-locale.h:45:22: warning: implicit declaration of function 'xmalloc' [-Wimplicit-function-declaration]
+|        char *locale = xmalloc (strlen (p) + 1);
+|                       ^~~~~~~
+| ../gawk-3.1.5/hard-locale.h:45:22: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
+| ../gawk-3.1.5/dfa.c: At top level:
+| ../gawk-3.1.5/dfa.c:125:14: error: conflicting types for 'xmalloc'
+|  static ptr_t xmalloc PARAMS ((size_t n));
+|               ^~~~~~~
+| In file included from ../gawk-3.1.5/dfa.c:112:0:
+| ../gawk-3.1.5/hard-locale.h:45:22: note: previous implicit declaration of 'xmalloc' was here
+|        char *locale = xmalloc (strlen (p) + 1);
+|                       ^~~~~~~
+
+Upstream-Status: Inappropriate [required for gawk 3.1.5 (GPLv2) recipe only]
+
+Signed-off-by: André Draszik <git@andred.net>
+---
+ dfa.c         | 2 +-
+ hard-locale.h | 2 --
+ 2 files changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/dfa.c b/dfa.c
+index 71e3736..97f6045 100644
+--- a/dfa.c
++++ b/dfa.c
+@@ -109,6 +109,7 @@ extern void free();
+ 
+ #include "regex.h"
+ #include "dfa.h"
++static ptr_t xmalloc PARAMS ((size_t n));
+ #include "hard-locale.h"
+ 
+ /* HPUX, define those as macros in sys/param.h */
+@@ -122,7 +123,6 @@ extern void free();
+ static void dfamust PARAMS ((struct dfa *dfa));
+ 
+ static ptr_t xcalloc PARAMS ((size_t n, size_t s));
+-static ptr_t xmalloc PARAMS ((size_t n));
+ static ptr_t xrealloc PARAMS ((ptr_t p, size_t n));
+ #ifdef DEBUG
+ static void prtok PARAMS ((token t));
+diff --git a/hard-locale.h b/hard-locale.h
+index 0f4986b..9ee57e0 100644
+--- a/hard-locale.h
++++ b/hard-locale.h
+@@ -40,8 +40,6 @@ hard_locale (int category)
+       if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0)
+ 	hard = 0;
+ # else
+-      static ptr_t xmalloc PARAMS ((size_t n));
+-
+       char *locale = xmalloc (strlen (p) + 1);
+       strcpy (locale, p);
+ 
+-- 
+2.9.3
+
diff --git a/meta/meta-gplv2/recipes-extended/gawk/gawk-3.1.5/gawk-3.1.5_fix_for_automake-1.12.patch b/meta/meta-gplv2/recipes-extended/gawk/gawk-3.1.5/gawk-3.1.5_fix_for_automake-1.12.patch
new file mode 100644
index 0000000..c42c33c
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/gawk/gawk-3.1.5/gawk-3.1.5_fix_for_automake-1.12.patch
@@ -0,0 +1,41 @@
+Upstream-Status: Pending
+
+automake 1.12 has depricated automatic de-ANSI-fication support
+
+this patch avoids these kinds of errors:
+
+| configure.ac:127: error: automatic de-ANSI-fication support has been removed
+| /srv/home/nitin/builds/build-gcc47/tmp/sysroots/x86_64-linux/usr/share/aclocal-1.12/protos.m4:12: AM_C_PROTOTYPES is expanded from...
+| configure.ac:127: the top level
+| autom4te: m4 failed with exit status: 1
+...
+| Makefile.am:27: error: automatic de-ANSI-fication support has been removed
+
+Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
+2012/05/04
+
+Index: gawk-3.1.5/configure.ac
+===================================================================
+--- gawk-3.1.5.orig/configure.ac
++++ gawk-3.1.5/configure.ac
+@@ -124,7 +124,6 @@ fi
+ 
+ dnl check for C compiler for automake
+ AM_PROG_CC_STDC
+-AM_C_PROTOTYPES
+ 
+ dnl Cygwin doesn't like to get libs with full paths
+ dnl since that overrides linking against DLLs.
+Index: gawk-3.1.5/Makefile.am
+===================================================================
+--- gawk-3.1.5.orig/Makefile.am
++++ gawk-3.1.5/Makefile.am
+@@ -24,7 +24,7 @@
+ ## process this file with automake to produce Makefile.in
+ 
+ # Automatic de-ANSI-fication if needed, make .bz2 files also.
+-AUTOMAKE_OPTIONS = ansi2knr dist-bzip2
++AUTOMAKE_OPTIONS = dist-bzip2
+ 
+ # This undocumented variable insures that aclocal runs
+ # correctly after changing configure.ac
diff --git a/meta/meta-gplv2/recipes-extended/gawk/gawk_3.1.5.bb b/meta/meta-gplv2/recipes-extended/gawk/gawk_3.1.5.bb
new file mode 100644
index 0000000..63fd32f
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/gawk/gawk_3.1.5.bb
@@ -0,0 +1,44 @@
+SUMMARY = "GNU awk text processing utility"
+DESCRIPTION = "The GNU version of awk, a text processing utility. \
+Awk interprets a special-purpose programming language to do \
+quick and easy text pattern matching and reformatting jobs."
+HOMEPAGE = "www.gnu.org/software/gawk"
+BUGTRACKER  = "bug-gawk@gnu.org"
+SECTION = "console/utils"
+
+# gawk <= 3.1.5: GPLv2
+# gawk >= 3.1.6: GPLv3
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
+
+RDEPENDS_gawk += "gawk-common"
+RDEPENDS_pgawk += "gawk-common"
+PR = "r2"
+
+SRC_URI = "\
+    ${GNU_MIRROR}/gawk/gawk-${PV}.tar.gz \
+    file://gawk-3.1.5_fix_for_automake-1.12.patch \
+    file://0001-gawk-fix-non-glibc-gcc-4-compilation.patch \
+"
+
+SRC_URI[md5sum] = "4760325489479cac17fe0114b8f62f30"
+SRC_URI[sha256sum] = "463dcb9d0ca398b1d4f5a332f6cd9cec56441265fca616f2ea1b44d459e9f0f8"
+
+inherit autotools gettext texinfo update-alternatives
+
+PACKAGES += "gawk-common pgawk"
+
+FILES_${PN} = "${bindir}/gawk* ${bindir}/igawk"
+FILES_gawk-common += "${datadir}/awk/* ${libexecdir}/awk/*"
+FILES_pgawk = "${bindir}/pgawk*"
+
+ALTERNATIVE_${PN} = "awk"
+ALTERNATIVE_TARGET[awk] = "${bindir}/gawk"
+ALTERNATIVE_PRIORITY = "100"
+
+CFLAGS += "-D PROTOTYPES"
+
+do_install_append() {
+	# remove the link since we don't package it
+	rm ${D}${bindir}/awk
+}
diff --git a/meta/meta-gplv2/recipes-extended/gperf/gperf.inc b/meta/meta-gplv2/recipes-extended/gperf/gperf.inc
new file mode 100644
index 0000000..a8ce230
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/gperf/gperf.inc
@@ -0,0 +1,22 @@
+DESCRIPTION = "GNU gperf is a perfect hash function generator"
+HOMEPAGE = "http://www.gnu.org/software/gperf"
+SUMMARY  = "Generate a perfect hash function from a set of keywords"
+LICENSE  = "GPLv3+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
+                    file://src/main.cc;beginline=8;endline=19;md5=dec8f611845d047387ed56b5b85fa99b"
+
+SRC_URI  = "${GNU_MIRROR}/gperf/gperf-${PV}.tar.gz"
+
+inherit autotools
+
+# autoreconf couldn't find acinclude.m4 when stepping into subdirectory. Instead of
+# duplicating acinclude.m4 in every subdirectory, use absolute include path to aclocal
+EXTRA_AUTORECONF += " -I ${S}"
+
+do_configure_prepend() {
+        if [ ! -e ${S}/acinclude.m4 ]; then
+                cat ${S}/aclocal.m4 > ${S}/acinclude.m4
+        fi
+}
+
+BBCLASSEXTEND = "native"
diff --git a/meta/meta-gplv2/recipes-extended/gperf/gperf_3.0.3.bb b/meta/meta-gplv2/recipes-extended/gperf/gperf_3.0.3.bb
new file mode 100644
index 0000000..7728861
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/gperf/gperf_3.0.3.bb
@@ -0,0 +1,10 @@
+require gperf.inc
+
+LICENSE  = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=a5f84abb0070adf8a0925d7d534b6e0a \
+                    file://src/main.cc;beginline=8;endline=19;md5=72a3034a19e72f08ee48ef8244a121fd"
+
+PR = "r1"
+
+SRC_URI[md5sum] = "cc20e58975a38075440423c8fb85fd00"
+SRC_URI[sha256sum] = "63287527c8d9e27e801cf0804436f3494bd569db05d49dcdd2a942ae72fa9055"
diff --git a/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/Makevars b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/Makevars
new file mode 100644
index 0000000..8b09f53
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/Makevars
@@ -0,0 +1,25 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Free Software Foundation, Inc.
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
diff --git a/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/fix-for-texinfo-5.1.patch b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/fix-for-texinfo-5.1.patch
new file mode 100644
index 0000000..ce59509
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/fix-for-texinfo-5.1.patch
@@ -0,0 +1,17 @@
+Upstream-Status: Inappropriate [Poky Specific this is gplv2 version]
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+
+Index: grep-2.5.1a/doc/grep.texi
+===================================================================
+--- grep-2.5.1a.orig/doc/grep.texi
++++ grep-2.5.1a/doc/grep.texi
+@@ -288,7 +288,7 @@ This version number should be included i
+ Print a usage message briefly summarizing these command-line options
+ and the bug-reporting address, then exit.
+ 
+-@itemx --binary-files=@var{type}
++@item --binary-files=@var{type}
+ @opindex --binary-files
+ @cindex binary files
+ If the first few bytes of a file indicate that the file contains binary
diff --git a/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/fix64-int-to-pointer.patch b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/fix64-int-to-pointer.patch
new file mode 100644
index 0000000..3b91520
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/fix64-int-to-pointer.patch
@@ -0,0 +1,17 @@
+Always use locale.h as HAVE_LOCALE_H is no longer handled by ./configure
+Upstream-Status: Inappropriate [ old version that will not be maintained ]
+Signed-off-by: Alex DAMIAN <alexandru.damian@intel.com>
+
+diff --recursive --unified grep-2.5.1a-orig/lib/hard-locale.c grep-2.5.1a/lib/hard-locale.c
+--- grep-2.5.1a-orig/lib/hard-locale.c	2001-03-04 07:33:12.000000000 +0200
++++ grep-2.5.1a/lib/hard-locale.c	2013-03-11 17:05:52.086444891 +0200
+@@ -38,9 +38,7 @@
+ # endif
+ #endif
+ 
+-#if HAVE_LOCALE_H
+ # include <locale.h>
+-#endif
+ 
+ #if HAVE_STRING_H
+ # include <string.h>
diff --git a/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/gettext.patch b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/gettext.patch
new file mode 100644
index 0000000..5746335
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/gettext.patch
@@ -0,0 +1,15 @@
+Enable operation with later versions of gettext.
+
+Upstream-Status: Inappropriate
+RP 2012/10/19
+
+Index: grep-2.5.1a/configure.in
+===================================================================
+--- grep-2.5.1a.orig/configure.in	2012-10-19 12:57:51.646970204 +0000
++++ grep-2.5.1a/configure.in	2012-10-19 12:59:49.946968803 +0000
+@@ -140,4 +140,4 @@
+ 	AC_CHECK_LIB(pcre, pcre_exec)
+ fi
+ 
+-AC_OUTPUT(Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile, [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile; echo timestamp > stamp-h])
++AC_OUTPUT(Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile, [echo timestamp > stamp-h])
diff --git a/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/grep-CVE-2012-5667.patch b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/grep-CVE-2012-5667.patch
new file mode 100644
index 0000000..a40a9f3
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/grep-CVE-2012-5667.patch
@@ -0,0 +1,33 @@
+The patch to fix CVE-2012-5667
+Reference: https://bugzilla.redhat.com/attachment.cgi?id=686605&action=diff
+
+Multiple integer overflows in GNU Grep before 2.11 might allow
+context-dependent attackers to execute arbitrary code via vectors
+involving a long input line that triggers a heap-based buffer overflow.
+
+http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-5667
+
+Upstream-Status: Inappropriate [other]
+This version of GNU Grep has been abandoned upstream and they are no longer
+accepting patches.  This is not a backport.
+CVE: CVE-2012-5667
+
+Signed-off-by: Ming Liu <ming.liu@windriver.com>
+---
+ grep.c |    7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+--- a/src/grep.c	2013-05-15 13:39:33.359191769 +0800
++++ a/src/grep.c	2013-05-15 13:50:22.609191882 +0800
+@@ -306,6 +306,11 @@ fillbuf (size_t save, struct stats const
+   int cc = 1;
+   char *readbuf;
+   size_t readsize;
++  const size_t max_save = INT_MAX / 2;
++
++  /* Limit the amount of saved data to INT_MAX to fix CVE-2012-5667 */
++  if (save > max_save)
++     error (2, 0, _("line too long"));
+ 
+   /* Offset from start of buffer to start of old stuff
+      that we want to save.  */
diff --git a/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/grep-egrep-fgrep-Fix-LSB-NG-cases.patch b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/grep-egrep-fgrep-Fix-LSB-NG-cases.patch
new file mode 100644
index 0000000..327ee56
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/grep-egrep-fgrep-Fix-LSB-NG-cases.patch
@@ -0,0 +1,1342 @@
+From c884dd12ec062569335702848fc5f29f436c28fa Mon Sep 17 00:00:00 2001
+From: Li xin <lixin.fnst@cn.fujitsu.com>
+Date: Mon, 25 May 2015 10:15:57 +0900
+Subject: [PATCH] grep egrep fgrep: Fix LSB NG cases.
+
+The LSB core test requires grep egrep and fgrep can
+perform pattern matching in searches without regard
+to case if -i option is specified.
+
+Upstream-Status: backport.
+
+Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
+---
+ lib/posix/regex.h |   4 +
+ src/dfa.c         |  22 +-
+ src/grep.c        |  96 ++++---
+ src/search.c      | 833 +++++++++++++++++++++++++++++++++++++++++++++---------
+ 4 files changed, 768 insertions(+), 187 deletions(-)
+
+diff --git a/lib/posix/regex.h b/lib/posix/regex.h
+index 63c2fef..7bb2b0e 100644
+--- a/lib/posix/regex.h
++++ b/lib/posix/regex.h
+@@ -109,6 +109,10 @@ typedef unsigned long int reg_syntax_t;
+    If not set, \{, \}, {, and } are literals.  */
+ #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
+ 
++/* If this bit is set, then ignore case when matching.
++   If not set, then case is significant.  */
++#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
++
+ /* If this bit is set, +, ? and | aren't recognized as operators.
+    If not set, they are.  */
+ #define RE_LIMITED_OPS (RE_INTERVALS << 1)
+diff --git a/src/dfa.c b/src/dfa.c
+index 590bfa7..27c876a 100644
+--- a/src/dfa.c
++++ b/src/dfa.c
+@@ -414,7 +414,7 @@ update_mb_len_index (unsigned char const *p, int len)
+ 
+ /* This function fetch a wide character, and update cur_mb_len,
+    used only if the current locale is a multibyte environment.  */
+-static wchar_t
++static wint_t
+ fetch_wc (char const *eoferr)
+ {
+   wchar_t wc;
+@@ -423,7 +423,7 @@ fetch_wc (char const *eoferr)
+       if (eoferr != 0)
+ 	dfaerror (eoferr);
+       else
+-	return -1;
++	return WEOF;
+     }
+ 
+   cur_mb_len = mbrtowc(&wc, lexptr, lexleft, &mbs);
+@@ -459,7 +459,7 @@ fetch_wc (char const *eoferr)
+ static void
+ parse_bracket_exp_mb ()
+ {
+-  wchar_t wc, wc1, wc2;
++  wint_t wc, wc1, wc2;
+ 
+   /* Work area to build a mb_char_classes.  */
+   struct mb_char_classes *work_mbc;
+@@ -496,7 +496,7 @@ parse_bracket_exp_mb ()
+     work_mbc->invert = 0;
+   do
+     {
+-      wc1 = -1; /* mark wc1 is not initialized".  */
++      wc1 = WEOF; /* mark wc1 is not initialized".  */
+ 
+       /* Note that if we're looking at some other [:...:] construct,
+ 	 we just treat it as a bunch of ordinary characters.  We can do
+@@ -586,7 +586,7 @@ parse_bracket_exp_mb ()
+ 		      work_mbc->coll_elems[work_mbc->ncoll_elems++] = elem;
+ 		    }
+  		}
+-	      wc = -1;
++	      wc1 = wc = WEOF;
+ 	    }
+ 	  else
+ 	    /* We treat '[' as a normal character here.  */
+@@ -600,7 +600,7 @@ parse_bracket_exp_mb ()
+ 	    wc = fetch_wc(("Unbalanced ["));
+ 	}
+ 
+-      if (wc1 == -1)
++      if (wc1 == WEOF)
+ 	wc1 = fetch_wc(_("Unbalanced ["));
+ 
+       if (wc1 == L'-')
+@@ -630,17 +630,17 @@ parse_bracket_exp_mb ()
+ 	    }
+ 	  REALLOC_IF_NECESSARY(work_mbc->range_sts, wchar_t,
+ 			       range_sts_al, work_mbc->nranges + 1);
+-	  work_mbc->range_sts[work_mbc->nranges] = wc;
++	  work_mbc->range_sts[work_mbc->nranges] = (wchar_t)wc;
+ 	  REALLOC_IF_NECESSARY(work_mbc->range_ends, wchar_t,
+ 			       range_ends_al, work_mbc->nranges + 1);
+-	  work_mbc->range_ends[work_mbc->nranges++] = wc2;
++	  work_mbc->range_ends[work_mbc->nranges++] = (wchar_t)wc2;
+ 	}
+-      else if (wc != -1)
++      else if (wc != WEOF)
+ 	/* build normal characters.  */
+ 	{
+ 	  REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al,
+ 			       work_mbc->nchars + 1);
+-	  work_mbc->chars[work_mbc->nchars++] = wc;
++	  work_mbc->chars[work_mbc->nchars++] = (wchar_t)wc;
+ 	}
+     }
+   while ((wc = wc1) != L']');
+@@ -2552,6 +2552,8 @@ match_mb_charset (struct dfa *d, int s, position pos, int index)
+     }
+ 
+   /* match with a character?  */
++  if (case_fold)
++    wc = towlower (wc);
+   for (i = 0; i<work_mbc->nchars; i++)
+     {
+       if (wc == work_mbc->chars[i])
+diff --git a/src/grep.c b/src/grep.c
+index 2fb2fac..3fd4b47 100644
+--- a/src/grep.c
++++ b/src/grep.c
+@@ -30,6 +30,12 @@
+ # include <sys/time.h>
+ # include <sys/resource.h>
+ #endif
++#if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC
++/* We can handle multibyte string.  */
++# define MBS_SUPPORT
++# include <wchar.h>
++# include <wctype.h>
++#endif
+ #include <stdio.h>
+ #include "system.h"
+ #include "getopt.h"
+@@ -255,19 +261,6 @@ reset (int fd, char const *file, struct stats *stats)
+   bufbeg[-1] = eolbyte;
+   bufdesc = fd;
+ 
+-  if (fstat (fd, &stats->stat) != 0)
+-    {
+-      error (0, errno, "fstat");
+-      return 0;
+-    }
+-  if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
+-    return 0;
+-#ifndef DJGPP
+-  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode)))
+-#else
+-  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
+-#endif
+-    return 0;
+   if (S_ISREG (stats->stat.st_mode))
+     {
+       if (file)
+@@ -558,33 +551,6 @@ prline (char const *beg, char const *lim, int sep)
+     {
+       size_t match_size;
+       size_t match_offset;
+-      if(match_icase)
+-        {
+-	  /* Yuck, this is tricky */
+-          char *buf = (char*) xmalloc (lim - beg);
+-	  char *ibeg = buf;
+-	  char *ilim = ibeg + (lim - beg);
+-	  int i;
+-	  for (i = 0; i < lim - beg; i++)
+-	    ibeg[i] = tolower (beg[i]);
+-	  while ((match_offset = (*execute) (ibeg, ilim-ibeg, &match_size, 1))
+-		 != (size_t) -1)
+-	    {
+-	      char const *b = beg + match_offset;
+-	      if (b == lim)
+-		break;
+-	      fwrite (beg, sizeof (char), match_offset, stdout);
+-	      printf ("\33[%sm", grep_color);
+-	      fwrite (b, sizeof (char), match_size, stdout);
+-	      fputs ("\33[00m", stdout);
+-	      beg = b + match_size;
+-	      ibeg = ibeg + match_offset + match_size;
+-	    }
+-	  fwrite (beg, 1, lim - beg, stdout);
+-	  free (buf);
+-	  lastout = lim;
+-	  return;
+-	}
+       while (lim-beg && (match_offset = (*execute) (beg, lim - beg, &match_size, 1))
+ 	     != (size_t) -1)
+ 	{
+@@ -601,6 +567,7 @@ prline (char const *beg, char const *lim, int sep)
+ 	  fputs ("\33[00m", stdout);
+ 	  beg = b + match_size;
+ 	}
++      fputs ("\33[K", stdout);
+     }
+   fwrite (beg, 1, lim - beg, stdout);
+   if (ferror (stdout))
+@@ -623,7 +590,7 @@ prpending (char const *lim)
+       size_t match_size;
+       --pending;
+       if (outleft
+-	  || (((*execute) (lastout, nl - lastout, &match_size, 0) == (size_t) -1)
++	  || (((*execute) (lastout, nl + 1 - lastout, &match_size, 0) == (size_t) -1)
+ 	      == !out_invert))
+ 	prline (lastout, nl + 1, '-');
+       else
+@@ -895,6 +862,19 @@ grepfile (char const *file, struct stats *stats)
+     }
+   else
+     {
++      if (stat (file, &stats->stat) != 0)
++        {
++          suppressible_error (file, errno);
++          return 1;
++        }
++      if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
++        return 1;
++#ifndef DJGPP
++      if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode) || S_ISFIFO(stats->stat.st_mode)))
++#else
++      if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
++#endif
++        return 1;
+       while ((desc = open (file, O_RDONLY)) < 0 && errno == EINTR)
+ 	continue;
+ 
+@@ -1681,9 +1661,6 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"))
+ 	  out_invert ^= 1;
+ 	  match_lines = match_words = 0;
+ 	}
+-      else
+-	/* Strip trailing newline. */
+-        --keycc;
+     }
+   else
+     if (optind < argc)
+@@ -1697,6 +1674,37 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"))
+   if (!install_matcher (matcher) && !install_matcher ("default"))
+     abort ();
+ 
++#ifdef MBS_SUPPORT
++  if (MB_CUR_MAX != 1 && match_icase)
++    {
++      wchar_t wc;
++      mbstate_t cur_state, prev_state;
++      int i, len = strlen(keys);
++
++      memset(&cur_state, 0, sizeof(mbstate_t));
++      for (i = 0; i <= len ;)
++	{
++	  size_t mbclen;
++	  mbclen = mbrtowc(&wc, keys + i, len - i, &cur_state);
++	  if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0)
++	    {
++	      /* An invalid sequence, or a truncated multibyte character.
++		 We treat it as a singlebyte character.  */
++	      mbclen = 1;
++	    }
++	  else
++	    {
++	      if (iswupper((wint_t)wc))
++		{
++		  wc = towlower((wint_t)wc);
++		  wcrtomb(keys + i, wc, &cur_state);
++		}
++	    }
++	  i += mbclen;
++	}
++    }
++#endif /* MBS_SUPPORT */
++
+   (*compile)(keys, keycc);
+ 
+   if ((argc - optind > 1 && !no_filenames) || with_filenames)
+diff --git a/src/search.c b/src/search.c
+index 7bd233f..3c6a485 100644
+--- a/src/search.c
++++ b/src/search.c
+@@ -18,9 +18,13 @@
+ 
+ /* Written August 1992 by Mike Haertel. */
+ 
++#ifndef _GNU_SOURCE
++# define _GNU_SOURCE 1
++#endif
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
++#include <assert.h>
+ #include <sys/types.h>
+ #if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC
+ /* We can handle multibyte string.  */
+@@ -31,7 +35,7 @@
+ 
+ #include "system.h"
+ #include "grep.h"
+-#include "regex.h"
++#include <regex.h>
+ #include "dfa.h"
+ #include "kwset.h"
+ #include "error.h"
+@@ -39,6 +43,9 @@
+ #ifdef HAVE_LIBPCRE
+ # include <pcre.h>
+ #endif
++#ifdef HAVE_LANGINFO_CODESET
++# include <langinfo.h>
++#endif
+ 
+ #define NCHAR (UCHAR_MAX + 1)
+ 
+@@ -70,9 +77,10 @@ static kwset_t kwset;
+    call the regexp matcher at all. */
+ static int kwset_exact_matches;
+ 
+-#if defined(MBS_SUPPORT)
+-static char* check_multibyte_string PARAMS ((char const *buf, size_t size));
+-#endif
++/* UTF-8 encoding allows some optimizations that we can't otherwise
++   assume in a multibyte encoding. */
++static int using_utf8;
++
+ static void kwsinit PARAMS ((void));
+ static void kwsmusts PARAMS ((void));
+ static void Gcompile PARAMS ((char const *, size_t));
+@@ -84,6 +92,15 @@ static void Pcompile PARAMS ((char const *, size_t ));
+ static size_t Pexecute PARAMS ((char const *, size_t, size_t *, int));
+ 
+ void
++check_utf8 (void)
++{
++#ifdef HAVE_LANGINFO_CODESET
++  if (strcmp (nl_langinfo (CODESET), "UTF-8") == 0)
++    using_utf8 = 1;
++#endif
++}
++
++void
+ dfaerror (char const *mesg)
+ {
+   error (2, 0, mesg);
+@@ -141,38 +158,6 @@ kwsmusts (void)
+     }
+ }
+ 
+-#ifdef MBS_SUPPORT
+-/* This function allocate the array which correspond to "buf".
+-   Then this check multibyte string and mark on the positions which
+-   are not singlebyte character nor the first byte of a multibyte
+-   character.  Caller must free the array.  */
+-static char*
+-check_multibyte_string(char const *buf, size_t size)
+-{
+-  char *mb_properties = malloc(size);
+-  mbstate_t cur_state;
+-  int i;
+-  memset(&cur_state, 0, sizeof(mbstate_t));
+-  memset(mb_properties, 0, sizeof(char)*size);
+-  for (i = 0; i < size ;)
+-    {
+-      size_t mbclen;
+-      mbclen = mbrlen(buf + i, size - i, &cur_state);
+-
+-      if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0)
+-	{
+-	  /* An invalid sequence, or a truncated multibyte character.
+-	     We treat it as a singlebyte character.  */
+-	  mbclen = 1;
+-	}
+-      mb_properties[i] = mbclen;
+-      i += mbclen;
+-    }
+-
+-  return mb_properties;
+-}
+-#endif
+-
+ static void
+ Gcompile (char const *pattern, size_t size)
+ {
+@@ -181,7 +166,8 @@ Gcompile (char const *pattern, size_t size)
+   size_t total = size;
+   char const *motif = pattern;
+ 
+-  re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE);
++  check_utf8 ();
++  re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE | (match_icase ? RE_ICASE : 0));
+   dfasyntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE, match_icase, eolbyte);
+ 
+   /* For GNU regex compiler we have to pass the patterns separately to detect
+@@ -218,6 +204,10 @@ Gcompile (char const *pattern, size_t size)
+       motif = sep;
+     } while (sep && total != 0);
+ 
++  /* Strip trailing newline. */
++  if (size && pattern[size - 1] == '\n')
++    size--;
++
+   /* In the match_words and match_lines cases, we use a different pattern
+      for the DFA matcher that will quickly throw out cases that won't work.
+      Then if DFA succeeds we do some hairy stuff using the regex matcher
+@@ -233,7 +223,7 @@ Gcompile (char const *pattern, size_t size)
+       static char const line_end[] = "\\)$";
+       static char const word_beg[] = "\\(^\\|[^[:alnum:]_]\\)\\(";
+       static char const word_end[] = "\\)\\([^[:alnum:]_]\\|$\\)";
+-      char *n = malloc (sizeof word_beg - 1 + size + sizeof word_end);
++      char *n = xmalloc (sizeof word_beg - 1 + size + sizeof word_end);
+       size_t i;
+       strcpy (n, match_lines ? line_beg : word_beg);
+       i = strlen (n);
+@@ -257,14 +247,15 @@ Ecompile (char const *pattern, size_t size)
+   size_t total = size;
+   char const *motif = pattern;
+ 
++  check_utf8 ();
+   if (strcmp (matcher, "awk") == 0)
+     {
+-      re_set_syntax (RE_SYNTAX_AWK);
++      re_set_syntax (RE_SYNTAX_AWK | (match_icase ? RE_ICASE : 0));
+       dfasyntax (RE_SYNTAX_AWK, match_icase, eolbyte);
+     }
+   else
+     {
+-      re_set_syntax (RE_SYNTAX_POSIX_EGREP);
++      re_set_syntax (RE_SYNTAX_POSIX_EGREP | (match_icase ? RE_ICASE : 0));
+       dfasyntax (RE_SYNTAX_POSIX_EGREP, match_icase, eolbyte);
+     }
+ 
+@@ -301,6 +292,10 @@ Ecompile (char const *pattern, size_t size)
+       motif = sep;
+     } while (sep && total != 0);
+ 
++  /* Strip trailing newline. */
++  if (size && pattern[size - 1] == '\n')
++    size--;
++
+   /* In the match_words and match_lines cases, we use a different pattern
+      for the DFA matcher that will quickly throw out cases that won't work.
+      Then if DFA succeeds we do some hairy stuff using the regex matcher
+@@ -316,7 +311,7 @@ Ecompile (char const *pattern, size_t size)
+       static char const line_end[] = ")$";
+       static char const word_beg[] = "(^|[^[:alnum:]_])(";
+       static char const word_end[] = ")([^[:alnum:]_]|$)";
+-      char *n = malloc (sizeof word_beg - 1 + size + sizeof word_end);
++      char *n = xmalloc (sizeof word_beg - 1 + size + sizeof word_end);
+       size_t i;
+       strcpy (n, match_lines ? line_beg : word_beg);
+       i = strlen(n);
+@@ -339,15 +334,34 @@ EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
+   char eol = eolbyte;
+   int backref, start, len;
+   struct kwsmatch kwsm;
+-  size_t i;
++  size_t i, ret_val;
++  static int use_dfa;
++  static int use_dfa_checked = 0;
+ #ifdef MBS_SUPPORT
+-  char *mb_properties = NULL;
++  int mb_cur_max = MB_CUR_MAX;
++  mbstate_t mbs;
++  memset (&mbs, '\0', sizeof (mbstate_t));
+ #endif /* MBS_SUPPORT */
+ 
++  if (!use_dfa_checked)
++    {
++      char *grep_use_dfa = getenv ("GREP_USE_DFA");
++      if (!grep_use_dfa)
++	{
+ #ifdef MBS_SUPPORT
+-  if (MB_CUR_MAX > 1 && kwset)
+-    mb_properties = check_multibyte_string(buf, size);
++	  /* Turn off DFA when processing multibyte input. */
++	  use_dfa = (MB_CUR_MAX == 1);
++#else
++	  use_dfa = 1;
+ #endif /* MBS_SUPPORT */
++	}
++      else
++	{
++	  use_dfa = atoi (grep_use_dfa);
++	}
++
++      use_dfa_checked = 1;
++    }
+ 
+   buflim = buf + size;
+ 
+@@ -358,47 +372,120 @@ EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
+ 	  if (kwset)
+ 	    {
+ 	      /* Find a possible match using the KWset matcher. */
+-	      size_t offset = kwsexec (kwset, beg, buflim - beg, &kwsm);
++#ifdef MBS_SUPPORT
++	      size_t bytes_left = 0;
++#endif /* MBS_SUPPORT */
++	      size_t offset;
++#ifdef MBS_SUPPORT
++	      /* kwsexec doesn't work with match_icase and multibyte input. */
++	      if (match_icase && mb_cur_max > 1)
++		/* Avoid kwset */
++		offset = 0;
++	      else
++#endif /* MBS_SUPPORT */
++	      offset = kwsexec (kwset, beg, buflim - beg, &kwsm);
+ 	      if (offset == (size_t) -1)
+-		{
++	        goto failure;
+ #ifdef MBS_SUPPORT
+-		  if (MB_CUR_MAX > 1)
+-		    free(mb_properties);
+-#endif
+-		  return (size_t)-1;
++	      if (mb_cur_max > 1 && !using_utf8)
++		{
++		  bytes_left = offset;
++		  while (bytes_left)
++		    {
++		      size_t mlen = mbrlen (beg, bytes_left, &mbs);
++		      if (mlen == (size_t) -1 || mlen == 0)
++			{
++			  /* Incomplete character: treat as single-byte. */
++			  memset (&mbs, '\0', sizeof (mbstate_t));
++			  beg++;
++			  bytes_left--;
++			  continue;
++			}
++
++		      if (mlen == (size_t) -2)
++			/* Offset points inside multibyte character:
++			 * no good. */
++			break;
++
++		      beg += mlen;
++		      bytes_left -= mlen;
++		    }
+ 		}
++	      else
++#endif /* MBS_SUPPORT */
+ 	      beg += offset;
+ 	      /* Narrow down to the line containing the candidate, and
+ 		 run it through DFA. */
+ 	      end = memchr(beg, eol, buflim - beg);
+ 	      end++;
+ #ifdef MBS_SUPPORT
+-	      if (MB_CUR_MAX > 1 && mb_properties[beg - buf] == 0)
++	      if (mb_cur_max > 1 && bytes_left)
+ 		continue;
+-#endif
++#endif /* MBS_SUPPORT */
+ 	      while (beg > buf && beg[-1] != eol)
+ 		--beg;
+-	      if (kwsm.index < kwset_exact_matches)
+-		goto success;
+-	      if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
++	      if (
++#ifdef MBS_SUPPORT
++		  !(match_icase && mb_cur_max > 1) &&
++#endif /* MBS_SUPPORT */
++		  (kwsm.index < kwset_exact_matches))
++		goto success_in_beg_and_end;
++	      if (use_dfa &&
++		  dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
+ 		continue;
+ 	    }
+ 	  else
+ 	    {
+ 	      /* No good fixed strings; start with DFA. */
+-	      size_t offset = dfaexec (&dfa, beg, buflim - beg, &backref);
++#ifdef MBS_SUPPORT
++	      size_t bytes_left = 0;
++#endif /* MBS_SUPPORT */
++	      size_t offset = 0;
++	      if (use_dfa)
++		offset = dfaexec (&dfa, beg, buflim - beg, &backref);
+ 	      if (offset == (size_t) -1)
+ 		break;
+ 	      /* Narrow down to the line we've found. */
++#ifdef MBS_SUPPORT
++	      if (mb_cur_max > 1 && !using_utf8)
++		{
++		  bytes_left = offset;
++		  while (bytes_left)
++		    {
++		      size_t mlen = mbrlen (beg, bytes_left, &mbs);
++		      if (mlen == (size_t) -1 || mlen == 0)
++			{
++			  /* Incomplete character: treat as single-byte. */
++			  memset (&mbs, '\0', sizeof (mbstate_t));
++			  beg++;
++			  bytes_left--;
++			  continue;
++			}
++
++		      if (mlen == (size_t) -2)
++			/* Offset points inside multibyte character:
++			 * no good. */
++			break;
++
++		      beg += mlen;
++		      bytes_left -= mlen;
++		    }
++		}
++	      else
++#endif /* MBS_SUPPORT */
+ 	      beg += offset;
+ 	      end = memchr (beg, eol, buflim - beg);
+ 	      end++;
++#ifdef MBS_SUPPORT
++	      if (mb_cur_max > 1 && bytes_left)
++		continue;
++#endif /* MBS_SUPPORT */
+ 	      while (beg > buf && beg[-1] != eol)
+ 		--beg;
+ 	    }
+ 	  /* Successful, no backreferences encountered! */
+-	  if (!backref)
+-	    goto success;
++	  if (use_dfa && !backref)
++	    goto success_in_beg_and_end;
+ 	}
+       else
+ 	end = beg + size;
+@@ -413,14 +500,11 @@ EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
+ 				       end - beg - 1, &(patterns[i].regs))))
+ 	    {
+ 	      len = patterns[i].regs.end[0] - start;
+-	      if (exact)
+-		{
+-		  *match_size = len;
+-		  return start;
+-		}
++	      if (exact && !match_words)
++	        goto success_in_start_and_len;
+ 	      if ((!match_lines && !match_words)
+ 		  || (match_lines && len == end - beg - 1))
+-		goto success;
++		goto success_in_beg_and_end;
+ 	      /* If -w, check if the match aligns with word boundaries.
+ 		 We do this iteratively because:
+ 		 (a) the line may contain more than one occurence of the
+@@ -431,10 +515,114 @@ EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
+ 	      if (match_words)
+ 		while (start >= 0)
+ 		  {
+-		    if ((start == 0 || !WCHAR ((unsigned char) beg[start - 1]))
+-			&& (len == end - beg - 1
+-			    || !WCHAR ((unsigned char) beg[start + len])))
+-		      goto success;
++		    int lword_match = 0;
++		    if (start == 0)
++		      lword_match = 1;
++		    else
++		      {
++			assert (start > 0);
++#ifdef MBS_SUPPORT
++			if (mb_cur_max > 1)
++			  {
++			    const char *s;
++			    size_t mr;
++			    wchar_t pwc;
++
++			    /* Locate the start of the multibyte character
++			       before the match position (== beg + start). */
++			    if (using_utf8)
++			      {
++				/* UTF-8 is a special case: scan backwards
++				   until we find a 7-bit character or a
++				   lead byte. */
++				s = beg + start - 1;
++				while (s > buf
++				       && (unsigned char) *s >= 0x80
++				       && (unsigned char) *s <= 0xbf)
++				  --s;
++			      }
++			    else
++			      {
++				/* Scan forwards to find the start of the
++				   last complete character before the
++				   match position.  */
++				size_t bytes_left = start - 1;
++				s = beg;
++				while (bytes_left > 0)
++				  {
++				    mr = mbrlen (s, bytes_left, &mbs);
++				    if (mr == (size_t) -1 || mr == 0)
++				      {
++					memset (&mbs, '\0', sizeof (mbs));
++					s++;
++					bytes_left--;
++					continue;
++				      }
++				    if (mr == (size_t) -2)
++				      {
++					memset (&mbs, '\0', sizeof (mbs));
++					break;
++				      }
++				    s += mr;
++				    bytes_left -= mr;
++				  }
++			      }
++			    mr = mbrtowc (&pwc, s, beg + start - s, &mbs);
++			    if (mr == (size_t) -2 || mr == (size_t) -1 ||
++				mr == 0)
++			      {
++				memset (&mbs, '\0', sizeof (mbstate_t));
++				lword_match = 1;
++			      }
++			    else if (!(iswalnum (pwc) || pwc == L'_')
++				     && mr == beg + start - s)
++			      lword_match = 1;
++			  }
++			else
++#endif /* MBS_SUPPORT */
++			if (!WCHAR ((unsigned char) beg[start - 1]))
++			  lword_match = 1;
++		      }
++
++		    if (lword_match)
++		      {
++			int rword_match = 0;
++			if (start + len == end - beg - 1)
++			  rword_match = 1;
++			else
++			  {
++#ifdef MBS_SUPPORT
++			    if (mb_cur_max > 1)
++			      {
++				wchar_t nwc;
++				int mr;
++
++				mr = mbtowc (&nwc, beg + start + len,
++					     end - beg - start - len - 1);
++				if (mr <= 0)
++				  {
++				    memset (&mbs, '\0', sizeof (mbstate_t));
++				    rword_match = 1;
++				  }
++				else if (!iswalnum (nwc) && nwc != L'_')
++				  rword_match = 1;
++			      }
++			    else
++#endif /* MBS_SUPPORT */
++			    if (!WCHAR ((unsigned char) beg[start + len]))
++			      rword_match = 1;
++			  }
++
++			if (rword_match)
++			  {
++			    if (!exact)
++			      /* Returns the whole line. */
++			      goto success_in_beg_and_end;
++			    else
++			      /* Returns just this word match. */
++			      goto success_in_start_and_len;
++			  }
++		      }
+ 		    if (len > 0)
+ 		      {
+ 			/* Try a shorter length anchored at the same place. */
+@@ -461,26 +649,154 @@ EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
+ 	    }
+ 	} /* for Regex patterns.  */
+     } /* for (beg = end ..) */
+-#ifdef MBS_SUPPORT
+-  if (MB_CUR_MAX > 1 && mb_properties)
+-    free (mb_properties);
+-#endif /* MBS_SUPPORT */
++
++ failure:
+   return (size_t) -1;
+ 
+- success:
+-#ifdef MBS_SUPPORT
+-  if (MB_CUR_MAX > 1 && mb_properties)
+-    free (mb_properties);
+-#endif /* MBS_SUPPORT */
+-  *match_size = end - beg;
+-  return beg - buf;
++ success_in_beg_and_end:
++  len = end - beg;
++  start = beg - buf;
++  /* FALLTHROUGH */
++
++ success_in_start_and_len:
++  *match_size = len;
++  return start;
+ }
+ 
++#ifdef MBS_SUPPORT
++static int f_i_multibyte; /* whether we're using the new -Fi MB method */
++static struct
++{
++  wchar_t **patterns;
++  size_t count, maxlen;
++  unsigned char *match;
++} Fimb;
++#endif
++
+ static void
+ Fcompile (char const *pattern, size_t size)
+ {
++  int mb_cur_max = MB_CUR_MAX;
+   char const *beg, *lim, *err;
+ 
++  check_utf8 ();
++#ifdef MBS_SUPPORT
++  /* Support -F -i for UTF-8 input. */
++  if (match_icase && mb_cur_max > 1)
++    {
++      mbstate_t mbs;
++      wchar_t *wcpattern = xmalloc ((size + 1) * sizeof (wchar_t));
++      const char *patternend = pattern;
++      size_t wcsize;
++      kwset_t fimb_kwset = NULL;
++      char *starts = NULL;
++      wchar_t *wcbeg, *wclim;
++      size_t allocated = 0;
++
++      memset (&mbs, '\0', sizeof (mbs));
++# ifdef __GNU_LIBRARY__
++      wcsize = mbsnrtowcs (wcpattern, &patternend, size, size, &mbs);
++      if (patternend != pattern + size)
++	wcsize = (size_t) -1;
++# else
++      {
++	char *patterncopy = xmalloc (size + 1);
++
++	memcpy (patterncopy, pattern, size);
++	patterncopy[size] = '\0';
++	patternend = patterncopy;
++	wcsize = mbsrtowcs (wcpattern, &patternend, size, &mbs);
++	if (patternend != patterncopy + size)
++	  wcsize = (size_t) -1;
++	free (patterncopy);
++      }
++# endif
++      if (wcsize + 2 <= 2)
++	{
++fimb_fail:
++	  free (wcpattern);
++	  free (starts);
++	  if (fimb_kwset)
++	    kwsfree (fimb_kwset);
++	  free (Fimb.patterns);
++	  Fimb.patterns = NULL;
++	}
++      else
++	{
++	  if (!(fimb_kwset = kwsalloc (NULL)))
++	    error (2, 0, _("memory exhausted"));
++
++	  starts = xmalloc (mb_cur_max * 3);
++	  wcbeg = wcpattern;
++	  do
++	    {
++	      int i;
++	      size_t wclen;
++
++	      if (Fimb.count >= allocated)
++		{
++		  if (allocated == 0)
++		    allocated = 128;
++		  else
++		    allocated *= 2;
++		  Fimb.patterns = xrealloc (Fimb.patterns,
++					    sizeof (wchar_t *) * allocated);
++		}
++	      Fimb.patterns[Fimb.count++] = wcbeg;
++	      for (wclim = wcbeg;
++		   wclim < wcpattern + wcsize && *wclim != L'\n'; ++wclim)
++		*wclim = towlower (*wclim);
++	      *wclim = L'\0';
++	      wclen = wclim - wcbeg;
++	      if (wclen > Fimb.maxlen)
++		Fimb.maxlen = wclen;
++	      if (wclen > 3)
++		wclen = 3;
++	      if (wclen == 0)
++		{
++		  if ((err = kwsincr (fimb_kwset, "", 0)) != 0)
++		    error (2, 0, err);
++		}
++	      else
++		for (i = 0; i < (1 << wclen); i++)
++		  {
++		    char *p = starts;
++		    int j, k;
++
++		    for (j = 0; j < wclen; ++j)
++		      {
++			wchar_t wc = wcbeg[j];
++			if (i & (1 << j))
++			  {
++			    wc = towupper (wc);
++			    if (wc == wcbeg[j])
++			      continue;
++			  }
++			k = wctomb (p, wc);
++			if (k <= 0)
++			  goto fimb_fail;
++			p += k;
++		      }
++		    if ((err = kwsincr (fimb_kwset, starts, p - starts)) != 0)
++		      error (2, 0, err);
++		  }
++	      if (wclim < wcpattern + wcsize)
++		++wclim;
++	      wcbeg = wclim;
++	    }
++	  while (wcbeg < wcpattern + wcsize);
++	  f_i_multibyte = 1;
++	  kwset = fimb_kwset;
++	  free (starts);
++	  Fimb.match = xmalloc (Fimb.count);
++	  if ((err = kwsprep (kwset)) != 0)
++	    error (2, 0, err);
++	  return;
++	}
++    }
++#endif /* MBS_SUPPORT */
++
++
+   kwsinit ();
+   beg = pattern;
+   do
+@@ -499,6 +815,76 @@ Fcompile (char const *pattern, size_t size)
+     error (2, 0, err);
+ }
+ 
++#ifdef MBS_SUPPORT
++static int
++Fimbexec (const char *buf, size_t size, size_t *plen, int exact)
++{
++  size_t len, letter, i;
++  int ret = -1;
++  mbstate_t mbs;
++  wchar_t wc;
++  int patterns_left;
++
++  assert (match_icase && f_i_multibyte == 1);
++  assert (MB_CUR_MAX > 1);
++
++  memset (&mbs, '\0', sizeof (mbs));
++  memset (Fimb.match, '\1', Fimb.count);
++  letter = len = 0;
++  patterns_left = 1;
++  while (patterns_left && len <= size)
++    {
++      size_t c;
++
++      patterns_left = 0;
++      if (len < size)
++	{
++	  c = mbrtowc (&wc, buf + len, size - len, &mbs);
++	  if (c + 2 <= 2)
++	    return ret;
++
++	  wc = towlower (wc);
++	}
++      else
++	{
++	  c = 1;
++	  wc = L'\0';
++	}
++
++      for (i = 0; i < Fimb.count; i++)
++	{
++	  if (Fimb.match[i])
++	    {
++	      if (Fimb.patterns[i][letter] == L'\0')
++		{
++		  /* Found a match. */
++		  *plen = len;
++		  if (!exact && !match_words)
++		    return 0;
++		  else
++		    {
++		      /* For -w or exact look for longest match.  */
++		      ret = 0;
++		      Fimb.match[i] = '\0';
++		      continue;
++		    }
++		}
++
++	      if (Fimb.patterns[i][letter] == wc)
++		patterns_left = 1;
++	      else
++		Fimb.match[i] = '\0';
++	    }
++	}
++
++      len += c;
++      letter++;
++    }
++
++  return ret;
++}
++#endif /* MBS_SUPPORT */
++
+ static size_t
+ Fexecute (char const *buf, size_t size, size_t *match_size, int exact)
+ {
+@@ -506,88 +892,268 @@ Fexecute (char const *buf, size_t size, size_t *match_size, int exact)
+   register size_t len;
+   char eol = eolbyte;
+   struct kwsmatch kwsmatch;
++  size_t ret_val;
+ #ifdef MBS_SUPPORT
+-  char *mb_properties;
+-  if (MB_CUR_MAX > 1)
+-    mb_properties = check_multibyte_string (buf, size);
++  int mb_cur_max = MB_CUR_MAX;
++  mbstate_t mbs;
++  memset (&mbs, '\0', sizeof (mbstate_t));
++  const char *last_char = NULL;
+ #endif /* MBS_SUPPORT */
+ 
+-  for (beg = buf; beg <= buf + size; ++beg)
++  for (beg = buf; beg < buf + size; ++beg)
+     {
+-      size_t offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch);
++      size_t offset;
++      offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch);
++
+       if (offset == (size_t) -1)
+-	{
++	goto failure;
+ #ifdef MBS_SUPPORT
+-	  if (MB_CUR_MAX > 1)
+-	    free(mb_properties);
+-#endif /* MBS_SUPPORT */
+-	  return offset;
++      if (mb_cur_max > 1 && !using_utf8)
++	{
++	  size_t bytes_left = offset;
++	  while (bytes_left)
++	    {
++	      size_t mlen = mbrlen (beg, bytes_left, &mbs);
++
++	      last_char = beg;
++	      if (mlen == (size_t) -1 || mlen == 0)
++		{
++		  /* Incomplete character: treat as single-byte. */
++		  memset (&mbs, '\0', sizeof (mbstate_t));
++		  beg++;
++		  bytes_left--;
++		  continue;
++		}
++
++	      if (mlen == (size_t) -2)
++		/* Offset points inside multibyte character: no good. */
++		break;
++
++	      beg += mlen;
++	      bytes_left -= mlen;
++	    }
++
++	  if (bytes_left)
++	    continue;
+ 	}
+-#ifdef MBS_SUPPORT
+-      if (MB_CUR_MAX > 1 && mb_properties[offset+beg-buf] == 0)
+-	continue; /* It is a part of multibyte character.  */
++      else
+ #endif /* MBS_SUPPORT */
+       beg += offset;
+-      len = kwsmatch.size[0];
+-      if (exact)
+-	{
+-	  *match_size = len;
+ #ifdef MBS_SUPPORT
+-	  if (MB_CUR_MAX > 1)
+-	    free (mb_properties);
++      /* For f_i_multibyte, the string at beg now matches first 3 chars of
++	 one of the search strings (less if there are shorter search strings).
++	 See if this is a real match.  */
++      if (f_i_multibyte
++	  && Fimbexec (beg, buf + size - beg, &kwsmatch.size[0], exact))
++	goto next_char;
+ #endif /* MBS_SUPPORT */
+-	  return beg - buf;
+-	}
++      len = kwsmatch.size[0];
++      if (exact && !match_words)
++	goto success_in_beg_and_len;
+       if (match_lines)
+ 	{
+ 	  if (beg > buf && beg[-1] != eol)
+-	    continue;
++	    goto next_char;
+ 	  if (beg + len < buf + size && beg[len] != eol)
+-	    continue;
++	    goto next_char;
+ 	  goto success;
+ 	}
+       else if (match_words)
+-	for (try = beg; len; )
+-	  {
+-	    if (try > buf && WCHAR((unsigned char) try[-1]))
+-	      break;
+-	    if (try + len < buf + size && WCHAR((unsigned char) try[len]))
+-	      {
+-		offset = kwsexec (kwset, beg, --len, &kwsmatch);
+-		if (offset == (size_t) -1)
+-		  {
++	{
++	  while (len)
++	    {
++	      int word_match = 0;
++	      if (beg > buf)
++		{
+ #ifdef MBS_SUPPORT
+-		    if (MB_CUR_MAX > 1)
+-		      free (mb_properties);
++		  if (mb_cur_max > 1)
++		    {
++		      const char *s;
++		      int mr;
++		      wchar_t pwc;
++
++		      if (using_utf8)
++			{
++			  s = beg - 1;
++			  while (s > buf
++				 && (unsigned char) *s >= 0x80
++				 && (unsigned char) *s <= 0xbf)
++			    --s;
++			}
++		      else
++			s = last_char;
++		      mr = mbtowc (&pwc, s, beg - s);
++		      if (mr <= 0)
++			memset (&mbs, '\0', sizeof (mbstate_t));
++		      else if ((iswalnum (pwc) || pwc == L'_')
++			       && mr == (int) (beg - s))
++			goto next_char;
++		    }
++		  else
+ #endif /* MBS_SUPPORT */
+-		    return offset;
+-		  }
+-		try = beg + offset;
+-		len = kwsmatch.size[0];
+-	      }
+-	    else
+-	      goto success;
+-	  }
++		  if (WCHAR ((unsigned char) beg[-1]))
++		    goto next_char;
++		}
++#ifdef MBS_SUPPORT
++	      if (mb_cur_max > 1)
++		{
++		  wchar_t nwc;
++		  int mr;
++
++		  mr = mbtowc (&nwc, beg + len, buf + size - beg - len);
++		  if (mr <= 0)
++		    {
++		      memset (&mbs, '\0', sizeof (mbstate_t));
++		      word_match = 1;
++		    }
++		  else if (!iswalnum (nwc) && nwc != L'_')
++		    word_match = 1;
++		}
++	      else
++#endif /* MBS_SUPPORT */
++		if (beg + len >= buf + size || !WCHAR ((unsigned char) beg[len]))
++		  word_match = 1;
++	      if (word_match)
++		{
++		  if (!exact)
++		    /* Returns the whole line now we know there's a word match. */
++		    goto success;
++		  else
++		    /* Returns just this word match. */
++		    goto success_in_beg_and_len;
++		}
++	      if (len > 0)
++		{
++		  /* Try a shorter length anchored at the same place. */
++		  --len;
++		  offset = kwsexec (kwset, beg, len, &kwsmatch);
++
++		  if (offset == -1)
++		    goto next_char; /* Try a different anchor. */
++#ifdef MBS_SUPPORT
++		  if (mb_cur_max > 1 && !using_utf8)
++		    {
++		      size_t bytes_left = offset;
++		      while (bytes_left)
++			{
++			  size_t mlen = mbrlen (beg, bytes_left, &mbs);
++
++			  last_char = beg;
++			  if (mlen == (size_t) -1 || mlen == 0)
++			    {
++			      /* Incomplete character: treat as single-byte. */
++			      memset (&mbs, '\0', sizeof (mbstate_t));
++			      beg++;
++			      bytes_left--;
++			      continue;
++			    }
++
++			  if (mlen == (size_t) -2)
++			    {
++			      /* Offset points inside multibyte character:
++			       * no good. */
++			      break;
++			    }
++
++			  beg += mlen;
++			  bytes_left -= mlen;
++			}
++
++		      if (bytes_left)
++			{
++			  memset (&mbs, '\0', sizeof (mbstate_t));
++			  goto next_char; /* Try a different anchor. */
++			}
++		    }
++		  else
++#endif /* MBS_SUPPORT */
++		  beg += offset;
++#ifdef MBS_SUPPORT
++		  /* The string at beg now matches first 3 chars of one of
++		     the search strings (less if there are shorter search
++		     strings).  See if this is a real match.  */
++		  if (f_i_multibyte
++		      && Fimbexec (beg, len - offset, &kwsmatch.size[0],
++				   exact))
++		    goto next_char;
++#endif /* MBS_SUPPORT */
++		  len = kwsmatch.size[0];
++		}
++	    }
++	}
+       else
+ 	goto success;
+-    }
+-
++next_char:;
+ #ifdef MBS_SUPPORT
+-  if (MB_CUR_MAX > 1)
+-    free (mb_properties);
++      /* Advance to next character.  For MB_CUR_MAX == 1 case this is handled
++	 by ++beg above.  */
++      if (mb_cur_max > 1)
++	{
++	  if (using_utf8)
++	    {
++	      unsigned char c = *beg;
++	      if (c >= 0xc2)
++		{
++		  if (c < 0xe0)
++		    ++beg;
++		  else if (c < 0xf0)
++		    beg += 2;
++		  else if (c < 0xf8)
++		    beg += 3;
++		  else if (c < 0xfc)
++		    beg += 4;
++		  else if (c < 0xfe)
++		    beg += 5;
++		}
++	    }
++	  else
++	    {
++	      size_t l = mbrlen (beg, buf + size - beg, &mbs);
++
++	      last_char = beg;
++	      if (l + 2 >= 2)
++		beg += l - 1;
++	      else
++		memset (&mbs, '\0', sizeof (mbstate_t));
++	    }
++	}
+ #endif /* MBS_SUPPORT */
++    }
++
++ failure:
+   return -1;
+ 
+  success:
++#ifdef MBS_SUPPORT
++  if (mb_cur_max > 1 && !using_utf8)
++    {
++      end = beg + len;
++      while (end < buf + size)
++	{
++	  size_t mlen = mbrlen (end, buf + size - end, &mbs);
++	  if (mlen == (size_t) -1 || mlen == (size_t) -2 || mlen == 0)
++	    {
++	      memset (&mbs, '\0', sizeof (mbstate_t));
++	      mlen = 1;
++	    }
++	  if (mlen == 1 && *end == eol)
++	    break;
++
++	  end += mlen;
++	}
++    }
++  else
++#endif /* MBS_SUPPORT */
+   end = memchr (beg + len, eol, (buf + size) - (beg + len));
++
+   end++;
+   while (buf < beg && beg[-1] != eol)
+     --beg;
+-  *match_size = end - beg;
+-#ifdef MBS_SUPPORT
+-  if (MB_CUR_MAX > 1)
+-    free (mb_properties);
+-#endif /* MBS_SUPPORT */
++  len = end - beg;
++  /* FALLTHROUGH */
++
++ success_in_beg_and_len:
++  *match_size = len;
+   return beg - buf;
+ }
+ 
+@@ -701,8 +1267,9 @@ Pexecute (char const *buf, size_t size, size_t *match_size, int exact)
+       char eol = eolbyte;
+       if (!exact)
+ 	{
+-	  end = memchr (end, eol, buflim - end);
+-	  end++;
++	  while (end < buflim)
++	    if (*end++ == eol)
++	      break;
+ 	  while (buf < beg && beg[-1] != eol)
+ 	    --beg;
+ 	}
+-- 
+1.8.4.2
+
diff --git a/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/grep_fix_for_automake-1.12.patch b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/grep_fix_for_automake-1.12.patch
new file mode 100644
index 0000000..d9b1e35
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/grep_fix_for_automake-1.12.patch
@@ -0,0 +1,52 @@
+Upstream-Status: Pending
+
+automake 1.12 has depricated automatic de-ANSI-fication support
+
+this patch avoids these kinds of errors:
+
+| configure.in:33: error: automatic de-ANSI-fication support has been removed
+| /srv/home/nitin/builds/build-gcc47/tmp/sysroots/x86_64-linux/usr/share/aclocal-1.12/protos.m4:12: AM_C_PROTOTYPES is expanded from...
+| configure.in:33: the top level
+| autom4te: m4 failed with exit status: 1
+...
+| lib/Makefile.am:2: error: automatic de-ANSI-fication support has been removed
+| src/Makefile.am:2: error: automatic de-ANSI-fication support has been removed
+| autoreconf: automake failed with exit status: 1
+
+Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
+2012/05/04
+
+Index: grep-2.5.1a/configure.in
+===================================================================
+--- grep-2.5.1a.orig/configure.in
++++ grep-2.5.1a/configure.in
+@@ -30,7 +30,6 @@ AC_PROG_RANLIB
+ 
+ dnl Checks for typedefs, structures, and compiler characteristics.
+ AC_SYS_LARGEFILE
+-AM_C_PROTOTYPES
+ AC_TYPE_SIZE_T
+ AC_CHECK_TYPE(ssize_t, int)
+ AC_C_CONST
+Index: grep-2.5.1a/lib/Makefile.am
+===================================================================
+--- grep-2.5.1a.orig/lib/Makefile.am
++++ grep-2.5.1a/lib/Makefile.am
+@@ -1,5 +1,5 @@
+ #
+-AUTOMAKE_OPTIONS = ../src/ansi2knr
++AUTOMAKE_OPTIONS = 
+ 
+ SUBDIRS = posix
+ 
+Index: grep-2.5.1a/src/Makefile.am
+===================================================================
+--- grep-2.5.1a.orig/src/Makefile.am
++++ grep-2.5.1a/src/Makefile.am
+@@ -1,5 +1,5 @@
+ ## Process this file with automake to create Makefile.in
+-AUTOMAKE_OPTIONS = ansi2knr no-dependencies
++AUTOMAKE_OPTIONS = no-dependencies
+ 
+ LN = ln
+ 
diff --git a/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/search-fix-compilation-error-with-security-flags-ena.patch b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/search-fix-compilation-error-with-security-flags-ena.patch
new file mode 100644
index 0000000..e6fac82
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/search-fix-compilation-error-with-security-flags-ena.patch
@@ -0,0 +1,134 @@
+From cc5ffe68438bef47c2313705afc0101eba640092 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <adraszik@tycoint.com>
+Date: Thu, 23 Mar 2017 12:42:38 +0000
+Subject: [PATCH] search: fix compilation error with security flags enabled
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+| ../../grep-2.5.1a/src/search.c: In function 'dfaerror':
+| ../../grep-2.5.1a/src/search.c:106:3: error: format not a string literal and no format arguments [-Werror=format-security]
+|    error (2, 0, mesg);
+|    ^~~~~
+
+Upstream-Status: Inappropriate [required for grep 2.5.1a (GPLv2) recipe only]
+Signed-off-by: André Draszik <adraszik@tycoint.com>
+---
+ src/search.c | 26 +++++++++++++-------------
+ 1 file changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/src/search.c b/src/search.c
+index 3c6a485..9cee0d8 100644
+--- a/src/search.c
++++ b/src/search.c
+@@ -103,7 +103,7 @@ check_utf8 (void)
+ void
+ dfaerror (char const *mesg)
+ {
+-  error (2, 0, mesg);
++  error (2, 0, "%s", mesg);
+ }
+ 
+ static void
+@@ -142,7 +142,7 @@ kwsmusts (void)
+ 	    continue;
+ 	  ++kwset_exact_matches;
+ 	  if ((err = kwsincr (kwset, dm->must, strlen (dm->must))) != 0)
+-	    error (2, 0, err);
++	    error (2, 0, "%s", err);
+ 	}
+       /* Now, we compile the substrings that will require
+ 	 the use of the regexp matcher.  */
+@@ -151,10 +151,10 @@ kwsmusts (void)
+ 	  if (dm->exact)
+ 	    continue;
+ 	  if ((err = kwsincr (kwset, dm->must, strlen (dm->must))) != 0)
+-	    error (2, 0, err);
++	    error (2, 0, "%s", err);
+ 	}
+       if ((err = kwsprep (kwset)) != 0)
+-	error (2, 0, err);
++	error (2, 0, "%s", err);
+     }
+ }
+ 
+@@ -198,7 +198,7 @@ Gcompile (char const *pattern, size_t size)
+ 
+       if ((err = re_compile_pattern (motif, len,
+ 				    &(patterns[pcount].regexbuf))) != 0)
+-	error (2, 0, err);
++	error (2, 0, "%s", err);
+       pcount++;
+ 
+       motif = sep;
+@@ -286,7 +286,7 @@ Ecompile (char const *pattern, size_t size)
+ 
+       if ((err = re_compile_pattern (motif, len,
+ 				    &(patterns[pcount].regexbuf))) != 0)
+-	error (2, 0, err);
++	error (2, 0, "%s", err);
+       pcount++;
+ 
+       motif = sep;
+@@ -755,7 +755,7 @@ fimb_fail:
+ 	      if (wclen == 0)
+ 		{
+ 		  if ((err = kwsincr (fimb_kwset, "", 0)) != 0)
+-		    error (2, 0, err);
++		    error (2, 0, "%s", err);
+ 		}
+ 	      else
+ 		for (i = 0; i < (1 << wclen); i++)
+@@ -778,7 +778,7 @@ fimb_fail:
+ 			p += k;
+ 		      }
+ 		    if ((err = kwsincr (fimb_kwset, starts, p - starts)) != 0)
+-		      error (2, 0, err);
++		      error (2, 0, "%s", err);
+ 		  }
+ 	      if (wclim < wcpattern + wcsize)
+ 		++wclim;
+@@ -790,7 +790,7 @@ fimb_fail:
+ 	  free (starts);
+ 	  Fimb.match = xmalloc (Fimb.count);
+ 	  if ((err = kwsprep (kwset)) != 0)
+-	    error (2, 0, err);
++	    error (2, 0, "%s", err);
+ 	  return;
+ 	}
+     }
+@@ -804,7 +804,7 @@ fimb_fail:
+       for (lim = beg; lim < pattern + size && *lim != '\n'; ++lim)
+ 	;
+       if ((err = kwsincr (kwset, beg, lim - beg)) != 0)
+-	error (2, 0, err);
++	error (2, 0, "%s", err);
+       if (lim < pattern + size)
+ 	++lim;
+       beg = lim;
+@@ -812,7 +812,7 @@ fimb_fail:
+   while (beg < pattern + size);
+ 
+   if ((err = kwsprep (kwset)) != 0)
+-    error (2, 0, err);
++    error (2, 0, "%s", err);
+ }
+ 
+ #ifdef MBS_SUPPORT
+@@ -1220,11 +1220,11 @@ Pcompile (char const *pattern, size_t size)
+ 
+   cre = pcre_compile (re, flags, &ep, &e, pcre_maketables ());
+   if (!cre)
+-    error (2, 0, ep);
++    error (2, 0, "%s", ep);
+ 
+   extra = pcre_study (cre, 0, &ep);
+   if (ep)
+-    error (2, 0, ep);
++    error (2, 0, "%s", ep);
+ 
+   free (re);
+ #endif
+-- 
+2.11.0
+
diff --git a/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/uclibc-fix.patch b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/uclibc-fix.patch
new file mode 100644
index 0000000..de054fc
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/grep/grep-2.5.1a/uclibc-fix.patch
@@ -0,0 +1,55 @@
+Upstream-Status: Inappropriate [licensing]
+
+# Fix to use mempcpy instead of __mempcpy. This is needed for uclibc which
+# doesn't define __mempcpy, only mempcpy. Since both uclibc and glibc have
+# mempcpy, we'll just use that instead.
+# Patch source: OpenEmbedded
+
+Index: grep-2.5.1/intl/localealias.c
+===================================================================
+--- grep-2.5.1.orig/intl/localealias.c	2002-03-14 00:39:06.000000000 +1100
++++ grep-2.5.1/intl/localealias.c	2007-05-17 13:53:58.000000000 +1000
+@@ -65,7 +65,7 @@
+ # define strcasecmp __strcasecmp
+ 
+ # ifndef mempcpy
+-#  define mempcpy __mempcpy
++#  error "mempcpy not detected"
+ # endif
+ # define HAVE_MEMPCPY	1
+ # define HAVE___FSETLOCKING	1
+Index: grep-2.5.1/lib/getopt.c
+===================================================================
+--- grep-2.5.1.orig/lib/getopt.c	2001-03-04 16:33:12.000000000 +1100
++++ grep-2.5.1/lib/getopt.c	2007-05-17 13:51:44.000000000 +1000
+@@ -326,7 +326,7 @@
+ 	nonoption_flags_len = nonoption_flags_max_len = 0;
+       else
+ 	{
+-	  memset (__mempcpy (new_str, __getopt_nonoption_flags,
++	  memset (mempcpy (new_str, __getopt_nonoption_flags,
+ 			     nonoption_flags_max_len),
+ 		  '\0', top + 1 - nonoption_flags_max_len);
+ 	  nonoption_flags_max_len = top + 1;
+@@ -437,7 +437,7 @@
+ 	      if (__getopt_nonoption_flags == NULL)
+ 		nonoption_flags_max_len = -1;
+ 	      else
+-		memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
++		memset (mempcpy (__getopt_nonoption_flags, orig_str, len),
+ 			'\0', nonoption_flags_max_len - len);
+ 	    }
+ 	}
+Index: grep-2.5.1/lib/regex.c
+===================================================================
+--- grep-2.5.1.orig/lib/regex.c	2001-04-03 04:04:45.000000000 +1000
++++ grep-2.5.1/lib/regex.c	2007-05-17 13:51:48.000000000 +1000
+@@ -7842,7 +7842,7 @@
+       if (msg_size > errbuf_size)
+         {
+ #if defined HAVE_MEMPCPY || defined _LIBC
+-	  *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
++	  *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
+ #else
+           memcpy (errbuf, msg, errbuf_size - 1);
+           errbuf[errbuf_size - 1] = 0;
diff --git a/meta/meta-gplv2/recipes-extended/grep/grep_2.5.1a.bb b/meta/meta-gplv2/recipes-extended/grep/grep_2.5.1a.bb
new file mode 100644
index 0000000..b331fee
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/grep/grep_2.5.1a.bb
@@ -0,0 +1,59 @@
+SUMMARY = "Pattern matching utilities"
+DESCRIPTION = "The GNU versions of commonly used grep utilities.  The grep command searches one or more input \
+files for lines containing a match to a specified pattern."
+SECTION = "console/utils"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
+
+PR = "r2"
+
+SRC_URI = "${GNU_MIRROR}/grep/grep-${PV}.tar.bz2 \
+           file://uclibc-fix.patch \
+           file://grep_fix_for_automake-1.12.patch \
+           file://gettext.patch \
+           file://fix64-int-to-pointer.patch \
+           file://Makevars \
+           file://grep-CVE-2012-5667.patch \
+           file://fix-for-texinfo-5.1.patch \
+           file://grep-egrep-fgrep-Fix-LSB-NG-cases.patch \
+           file://search-fix-compilation-error-with-security-flags-ena.patch \
+          "
+
+SRC_URI[md5sum] = "52202fe462770fa6be1bb667bd6cf30c"
+SRC_URI[sha256sum] = "38c8a2bb9223d1fb1b10bdd607cf44830afc92fd451ac4cd07619bf92bdd3132"
+
+inherit autotools gettext texinfo
+
+EXTRA_OECONF_INCLUDED_REGEX = "--without-included-regex"
+EXTRA_OECONF_INCLUDED_REGEX_libc-musl = "--with-included-regex"
+
+EXTRA_OECONF = "--disable-perl-regexp \
+                ${EXTRA_OECONF_INCLUDED_REGEX}"
+
+CFLAGS += "-D PROTOTYPES"
+do_configure_prepend () {
+	rm -f ${S}/m4/init.m4
+	cp -f ${WORKDIR}/Makevars ${S}/po/
+}
+
+do_install () {
+	autotools_do_install
+        if [ "${base_bindir}" != "${bindir}" ]; then
+        	install -d ${D}${base_bindir}
+	        mv ${D}${bindir}/grep ${D}${base_bindir}/grep
+	        mv ${D}${bindir}/egrep ${D}${base_bindir}/egrep
+	        mv ${D}${bindir}/fgrep ${D}${base_bindir}/fgrep
+	        rmdir ${D}${bindir}/
+        fi
+}
+
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+
+ALTERNATIVE_${PN} = "grep egrep fgrep"
+ALTERNATIVE_LINK_NAME[grep] = "${base_bindir}/grep"
+ALTERNATIVE_LINK_NAME[egrep] = "${base_bindir}/egrep"
+ALTERNATIVE_LINK_NAME[fgrep] = "${base_bindir}/fgrep"
+
+export CONFIG_SHELL="/bin/sh"
diff --git a/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/0001-Make-it-build-with-compile-time-hardening-enabled.patch b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/0001-Make-it-build-with-compile-time-hardening-enabled.patch
new file mode 100644
index 0000000..43404fa
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/0001-Make-it-build-with-compile-time-hardening-enabled.patch
@@ -0,0 +1,35 @@
+From a1cd31daf05023a14d8e904a409cecbfc0fae93e Mon Sep 17 00:00:00 2001
+From: Peter Kjellerstedt <pkj@axis.com>
+Date: Mon, 2 Oct 2017 14:34:14 +0200
+Subject: [PATCH 1/2] Make it build with compile time hardening enabled
+
+This avoids the following error:
+
+  src/devices/grohtml/post-html.cc: In member function 'void
+  header_desc::write_headings(FILE*, int)':
+  src/devices/grohtml/post-html.cc:1402:32: error: format not a string
+  literal and no format arguments [-Werror=format-security]
+      fprintf(f, buffer.contents());
+
+Upstream-Status: Inappropriate [legacy version]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+---
+ src/devices/grohtml/post-html.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/devices/grohtml/post-html.cc b/src/devices/grohtml/post-html.cc
+index 3c09d7c..1ad5580 100644
+--- a/src/devices/grohtml/post-html.cc
++++ b/src/devices/grohtml/post-html.cc
+@@ -1399,7 +1399,7 @@ void header_desc::write_headings (FILE *f, int force)
+ 
+ 	  buffer += as_string(h);
+ 	  buffer += '\0';
+-	  fprintf(f, buffer.contents());
++	  fprintf(f, "%s", buffer.contents());
+ 	} else
+ 	  fputs(g->text_string, f);
+ 	h++;
+-- 
+2.12.0
+
diff --git a/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/0002-Drop-local-getopt-implementation-in-favor-of-the-one.patch b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/0002-Drop-local-getopt-implementation-in-favor-of-the-one.patch
new file mode 100644
index 0000000..c47e1a7
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/0002-Drop-local-getopt-implementation-in-favor-of-the-one.patch
@@ -0,0 +1,1839 @@
+From 27a79ebb75b6fe2731be6e48add7c94dc127f8a2 Mon Sep 17 00:00:00 2001
+From: Peter Kjellerstedt <pkj@axis.com>
+Date: Tue, 3 Oct 2017 21:51:04 +0200
+Subject: [PATCH 2/2] Drop local getopt implementation in favor of the one from
+ glibc
+
+This avoids the following error with GCC 7:
+
+  In file included from /usr/include/bits/getopt_posix.h:27:0,
+                   from /usr/include/unistd.h:872,
+                   from src/libs/libgroff/maxfilename.cc:28:
+  /usr/include/bits/getopt_core.h:91:12: error: declaration of 'int
+  getopt(int, char* const*, const char*) throw ()' has a different
+  exception specifier
+   extern int getopt (int ___argc, char *const *___argv,
+                      const char *__shortopts)
+              ^~~~~~
+  In file included from src/include/lib.h:42:0,
+                   from src/libs/libgroff/maxfilename.cc:23:
+  src/include/groff-getopt.h:50:12: note: from previous declaration
+  'int getopt(int, char* const*, const char*)'
+   extern int getopt(int,    // __argc
+              ^~~~~~
+
+Upstream-Status: Inappropriate [legacy version]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+---
+ src/include/Makefile.sub       |    2 -
+ src/include/getopt.h           |  181 ------
+ src/include/groff-getopt.h     |   68 ---
+ src/include/lib.h              |   11 -
+ src/libs/libgroff/Makefile.sub |    4 -
+ src/libs/libgroff/getopt.c     | 1277 ----------------------------------------
+ src/libs/libgroff/getopt1.c    |  188 ------
+ 7 files changed, 1731 deletions(-)
+ delete mode 100644 src/include/getopt.h
+ delete mode 100644 src/include/groff-getopt.h
+ delete mode 100644 src/libs/libgroff/getopt.c
+ delete mode 100644 src/libs/libgroff/getopt1.c
+
+diff --git a/src/include/Makefile.sub b/src/include/Makefile.sub
+index 620d345..205fe8b 100644
+--- a/src/include/Makefile.sub
++++ b/src/include/Makefile.sub
+@@ -9,8 +9,6 @@ HDRS=\
+   error.h \
+   font.h \
+   geometry.h \
+-  getopt.h \
+-  groff-getopt.h \
+   htmlhint.h \
+   index.h \
+   lib.h \
+diff --git a/src/include/getopt.h b/src/include/getopt.h
+deleted file mode 100644
+index 4283c35..0000000
+--- a/src/include/getopt.h
++++ /dev/null
+@@ -1,181 +0,0 @@
+-/* Declarations for getopt.
+-   Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
+-   This file is part of the GNU C Library.
+-
+-   The GNU C Library is free software; you can redistribute it and/or
+-   modify it under the terms of the GNU Lesser General Public
+-   License as published by the Free Software Foundation; either
+-   version 2.1 of the License, or (at your option) any later version.
+-
+-   The GNU C Library is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-   Lesser General Public License for more details.
+-
+-   You should have received a copy of the GNU Lesser General Public
+-   License along with the GNU C Library; if not, write to the Free
+-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-   02111-1307 USA.  */
+-
+-#ifndef _GETOPT_H
+-
+-#ifndef __need_getopt
+-# define _GETOPT_H 1
+-#endif
+-
+-/* If __GNU_LIBRARY__ is not already defined, either we are being used
+-   standalone, or this is the first header included in the source file.
+-   If we are being used with glibc, we need to include <features.h>, but
+-   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is
+-   not defined, include <ctype.h>, which will pull in <features.h> for us
+-   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it
+-   doesn't flood the namespace with stuff the way some other headers do.)  */
+-#if !defined __GNU_LIBRARY__
+-# include <ctype.h>
+-#endif
+-
+-#ifdef	__cplusplus
+-extern "C" {
+-#endif
+-
+-/* For communication from `getopt' to the caller.
+-   When `getopt' finds an option that takes an argument,
+-   the argument value is returned here.
+-   Also, when `ordering' is RETURN_IN_ORDER,
+-   each non-option ARGV-element is returned here.  */
+-
+-extern char *optarg;
+-
+-/* Index in ARGV of the next element to be scanned.
+-   This is used for communication to and from the caller
+-   and for communication between successive calls to `getopt'.
+-
+-   On entry to `getopt', zero means this is the first call; initialize.
+-
+-   When `getopt' returns -1, this is the index of the first of the
+-   non-option elements that the caller should itself scan.
+-
+-   Otherwise, `optind' communicates from one call to the next
+-   how much of ARGV has been scanned so far.  */
+-
+-extern int optind;
+-
+-/* Callers store zero here to inhibit the error message `getopt' prints
+-   for unrecognized options.  */
+-
+-extern int opterr;
+-
+-/* Set to an option character which was unrecognized.  */
+-
+-extern int optopt;
+-
+-#ifndef __need_getopt
+-/* Describe the long-named options requested by the application.
+-   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+-   of `struct option' terminated by an element containing a name which is
+-   zero.
+-
+-   The field `has_arg' is:
+-   no_argument		(or 0) if the option does not take an argument,
+-   required_argument	(or 1) if the option requires an argument,
+-   optional_argument 	(or 2) if the option takes an optional argument.
+-
+-   If the field `flag' is not NULL, it points to a variable that is set
+-   to the value given in the field `val' when the option is found, but
+-   left unchanged if the option is not found.
+-
+-   To have a long-named option do something other than set an `int' to
+-   a compiled-in constant, such as set a value from `optarg', set the
+-   option's `flag' field to zero and its `val' field to a nonzero
+-   value (the equivalent single-letter option character, if there is
+-   one).  For long options that have a zero `flag' field, `getopt'
+-   returns the contents of the `val' field.  */
+-
+-struct option
+-{
+-# if (defined __STDC__ && __STDC__) || defined __cplusplus
+-  const char *name;
+-# else
+-  char *name;
+-# endif
+-  /* has_arg can't be an enum because some compilers complain about
+-     type mismatches in all the code that assumes it is an int.  */
+-  int has_arg;
+-  int *flag;
+-  int val;
+-};
+-
+-/* Names for the values of the `has_arg' field of `struct option'.  */
+-
+-# define no_argument		0
+-# define required_argument	1
+-# define optional_argument	2
+-#endif	/* need getopt */
+-
+-
+-/* Get definitions and prototypes for functions to process the
+-   arguments in ARGV (ARGC of them, minus the program name) for
+-   options given in OPTS.
+-
+-   Return the option character from OPTS just read.  Return -1 when
+-   there are no more options.  For unrecognized options, or options
+-   missing arguments, `optopt' is set to the option letter, and '?' is
+-   returned.
+-
+-   The OPTS string is a list of characters which are recognized option
+-   letters, optionally followed by colons, specifying that that letter
+-   takes an argument, to be placed in `optarg'.
+-
+-   If a letter in OPTS is followed by two colons, its argument is
+-   optional.  This behavior is specific to the GNU `getopt'.
+-
+-   The argument `--' causes premature termination of argument
+-   scanning, explicitly telling `getopt' that there are no more
+-   options.
+-
+-   If OPTS begins with `--', then non-option arguments are treated as
+-   arguments to the option '\0'.  This behavior is specific to the GNU
+-   `getopt'.  */
+-
+-#if (defined __STDC__ && __STDC__) || defined __cplusplus
+-# ifdef __GNU_LIBRARY__
+-/* Many other libraries have conflicting prototypes for getopt, with
+-   differences in the consts, in stdlib.h.  To avoid compilation
+-   errors, only prototype getopt for the GNU C library.  */
+-extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
+-# else /* not __GNU_LIBRARY__ */
+-extern int getopt ();
+-# endif /* __GNU_LIBRARY__ */
+-
+-# ifndef __need_getopt
+-extern int getopt_long (int ___argc, char *const *___argv,
+-			const char *__shortopts,
+-		        const struct option *__longopts, int *__longind);
+-extern int getopt_long_only (int ___argc, char *const *___argv,
+-			     const char *__shortopts,
+-		             const struct option *__longopts, int *__longind);
+-
+-/* Internal only.  Users should not call this directly.  */
+-extern int _getopt_internal (int ___argc, char *const *___argv,
+-			     const char *__shortopts,
+-		             const struct option *__longopts, int *__longind,
+-			     int __long_only);
+-# endif
+-#else /* not __STDC__ */
+-extern int getopt ();
+-# ifndef __need_getopt
+-extern int getopt_long ();
+-extern int getopt_long_only ();
+-
+-extern int _getopt_internal ();
+-# endif
+-#endif /* __STDC__ */
+-
+-#ifdef	__cplusplus
+-}
+-#endif
+-
+-/* Make sure we later can get all the definitions and declarations.  */
+-#undef __need_getopt
+-
+-#endif /* getopt.h */
+diff --git a/src/include/groff-getopt.h b/src/include/groff-getopt.h
+deleted file mode 100644
+index a30e197..0000000
+--- a/src/include/groff-getopt.h
++++ /dev/null
+@@ -1,68 +0,0 @@
+-// -*- C++ -*-
+-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+-     Written by Werner Lemberg (wl@gnu.org)
+-
+-This file is part of groff.
+-
+-groff is free software; you can redistribute it and/or modify it under
+-the terms of the GNU General Public License as published by the Free
+-Software Foundation; either version 2, or (at your option) any later
+-version.
+-
+-groff is distributed in the hope that it will be useful, but WITHOUT ANY
+-WARRANTY; without even the implied warranty of MERCHANTABILITY or
+-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+-for more details.
+-
+-You should have received a copy of the GNU General Public License along
+-with groff; see the file COPYING.  If not, write to the Free Software
+-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+-
+-/*
+-   This file has to be included from within lib.h instead of getopt.h
+-   to avoid problems with picky C++ compilers.
+-*/
+-
+-#ifndef _GROFF_GETOPT_H
+-#define _GROFF_GETOPT_H
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-extern char *optarg;
+-extern int optind;
+-extern int opterr;
+-extern int optopt;
+-
+-struct option
+-{
+-  const char *name;
+-  int has_arg;
+-  int *flag;
+-  int val;
+-};
+-
+-#define no_argument       0
+-#define required_argument 1
+-#define optional_argument 2
+-
+-extern int getopt(int, 			// __argc
+-		  char *const *,	// __argv
+-		  const char *);	// __shortopts
+-extern int getopt_long(int,			// __argc
+-		       char *const *,		// __argv
+-		       const char *,		// __shortopts
+-		       const struct option *,	// __longopts
+-		       int *);			// __longind
+-extern int getopt_long_only(int, 			// __argc
+-			    char *const *,		// __argv
+-			    const char *,		// __shortopts
+-			    const struct option *,	// __longopts
+-			    int *);			// __longind
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif /* _GROFF_GETOPT_H */
+diff --git a/src/include/lib.h b/src/include/lib.h
+index c6468e0..8c77938 100644
+--- a/src/include/lib.h
++++ b/src/include/lib.h
+@@ -31,18 +31,7 @@ extern "C" {
+   const char *if_to_a(int, int);
+ }
+ 
+-/* stdio.h on IRIX, OSF/1, emx, and UWIN include getopt.h */
+-/* unistd.h on CYGWIN includes getopt.h */
+-
+-#if !(defined(__sgi) \
+-      || (defined(__osf__) && defined(__alpha)) \
+-      || defined(_UWIN) \
+-      || defined(__EMX__) \
+-      || defined(__CYGWIN__))
+-#include <groff-getopt.h>
+-#else
+ #include <getopt.h>
+-#endif
+ 
+ char *strsave(const char *s);
+ int is_prime(unsigned);
+diff --git a/src/libs/libgroff/Makefile.sub b/src/libs/libgroff/Makefile.sub
+index ff6bd00..bc0f846 100644
+--- a/src/libs/libgroff/Makefile.sub
++++ b/src/libs/libgroff/Makefile.sub
+@@ -13,8 +13,6 @@ OBJS=\
+   font.$(OBJEXT) \
+   fontfile.$(OBJEXT) \
+   geometry.$(OBJEXT) \
+-  getopt.$(OBJEXT) \
+-  getopt1.$(OBJEXT) \
+   htmlhint.$(OBJEXT) \
+   invalid.$(OBJEXT) \
+   lf.$(OBJEXT) \
+@@ -75,8 +73,6 @@ CCSRCS=\
+ CSRCS=\
+   $(srcdir)/fmod.c \
+   $(srcdir)/getcwd.c \
+-  $(srcdir)/getopt.c \
+-  $(srcdir)/getopt1.c \
+   $(srcdir)/iftoa.c \
+   $(srcdir)/itoa.c \
+   $(srcdir)/matherr.c \
+diff --git a/src/libs/libgroff/getopt.c b/src/libs/libgroff/getopt.c
+deleted file mode 100644
+index 289d137..0000000
+--- a/src/libs/libgroff/getopt.c
++++ /dev/null
+@@ -1,1277 +0,0 @@
+-/* Getopt for GNU.
+-   NOTE: getopt is now part of the C library, so if you don't know what
+-   "Keep this file name-space clean" means, talk to drepper@gnu.org
+-   before changing it!
+-   Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002
+-   	Free Software Foundation, Inc.
+-   This file is part of the GNU C Library.
+-
+-   The GNU C Library is free software; you can redistribute it and/or
+-   modify it under the terms of the GNU Lesser General Public
+-   License as published by the Free Software Foundation; either
+-   version 2.1 of the License, or (at your option) any later version.
+-
+-   The GNU C Library is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-   Lesser General Public License for more details.
+-
+-   You should have received a copy of the GNU Lesser General Public
+-   License along with the GNU C Library; if not, write to the Free
+-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-   02111-1307 USA.  */
+-
+-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
+-   Ditto for AIX 3.2 and <stdlib.h>.  */
+-#ifndef _NO_PROTO
+-# define _NO_PROTO
+-#endif
+-
+-#ifdef HAVE_CONFIG_H
+-# include <config.h>
+-#endif
+-
+-#if !defined __STDC__ || !__STDC__
+-/* This is a separate conditional since some stdc systems
+-   reject `defined (const)'.  */
+-# ifndef const
+-#  define const
+-# endif
+-#endif
+-
+-#include <stdio.h>
+-
+-/* Comment out all this code if we are using the GNU C Library, and are not
+-   actually compiling the library itself.  This code is part of the GNU C
+-   Library, but also included in many other GNU distributions.  Compiling
+-   and linking in this code is a waste when using the GNU C library
+-   (especially if it is a shared library).  Rather than having every GNU
+-   program understand `configure --with-gnu-libc' and omit the object files,
+-   it is simpler to just do this in the source for each such file.  */
+-
+-#define GETOPT_INTERFACE_VERSION 2
+-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+-# include <gnu-versions.h>
+-# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+-#  define ELIDE_CODE
+-# endif
+-#endif
+-
+-#ifndef ELIDE_CODE
+-
+-
+-/* This needs to come after some library #include
+-   to get __GNU_LIBRARY__ defined.  */
+-#ifdef	__GNU_LIBRARY__
+-/* Don't include stdlib.h for non-GNU C libraries because some of them
+-   contain conflicting prototypes for getopt.  */
+-# include <stdlib.h>
+-# include <unistd.h>
+-#endif	/* GNU C library.  */
+-
+-#ifdef VMS
+-# include <unixlib.h>
+-# if HAVE_STRING_H - 0
+-#  include <string.h>
+-# endif
+-#endif
+-
+-#ifndef _
+-/* This is for other GNU distributions with internationalized messages.  */
+-# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
+-#  include <libintl.h>
+-#  ifndef _
+-#   define _(msgid)	gettext (msgid)
+-#  endif
+-# else
+-#  define _(msgid)	(msgid)
+-# endif
+-# if defined _LIBC && defined USE_IN_LIBIO
+-#  include <wchar.h>
+-# endif
+-#endif
+-
+-#ifndef attribute_hidden
+-# define attribute_hidden
+-#endif
+-
+-/* This version of `getopt' appears to the caller like standard Unix `getopt'
+-   but it behaves differently for the user, since it allows the user
+-   to intersperse the options with the other arguments.
+-
+-   As `getopt' works, it permutes the elements of ARGV so that,
+-   when it is done, all the options precede everything else.  Thus
+-   all application programs are extended to handle flexible argument order.
+-
+-   Setting the environment variable POSIXLY_CORRECT disables permutation.
+-   Then the behavior is completely standard.
+-
+-   GNU application programs can use a third alternative mode in which
+-   they can distinguish the relative order of options and other arguments.  */
+-
+-#include "getopt.h"
+-
+-/* For communication from `getopt' to the caller.
+-   When `getopt' finds an option that takes an argument,
+-   the argument value is returned here.
+-   Also, when `ordering' is RETURN_IN_ORDER,
+-   each non-option ARGV-element is returned here.  */
+-
+-char *optarg;
+-
+-/* Index in ARGV of the next element to be scanned.
+-   This is used for communication to and from the caller
+-   and for communication between successive calls to `getopt'.
+-
+-   On entry to `getopt', zero means this is the first call; initialize.
+-
+-   When `getopt' returns -1, this is the index of the first of the
+-   non-option elements that the caller should itself scan.
+-
+-   Otherwise, `optind' communicates from one call to the next
+-   how much of ARGV has been scanned so far.  */
+-
+-/* 1003.2 says this must be 1 before any call.  */
+-int optind = 1;
+-
+-/* Formerly, initialization of getopt depended on optind==0, which
+-   causes problems with re-calling getopt as programs generally don't
+-   know that. */
+-
+-int __getopt_initialized attribute_hidden;
+-
+-/* The next char to be scanned in the option-element
+-   in which the last option character we returned was found.
+-   This allows us to pick up the scan where we left off.
+-
+-   If this is zero, or a null string, it means resume the scan
+-   by advancing to the next ARGV-element.  */
+-
+-static char *nextchar;
+-
+-/* Callers store zero here to inhibit the error message
+-   for unrecognized options.  */
+-
+-int opterr = 1;
+-
+-/* Set to an option character which was unrecognized.
+-   This must be initialized on some systems to avoid linking in the
+-   system's own getopt implementation.  */
+-
+-int optopt = '?';
+-
+-/* Describe how to deal with options that follow non-option ARGV-elements.
+-
+-   If the caller did not specify anything,
+-   the default is REQUIRE_ORDER if the environment variable
+-   POSIXLY_CORRECT is defined, PERMUTE otherwise.
+-
+-   REQUIRE_ORDER means don't recognize them as options;
+-   stop option processing when the first non-option is seen.
+-   This is what Unix does.
+-   This mode of operation is selected by either setting the environment
+-   variable POSIXLY_CORRECT, or using `+' as the first character
+-   of the list of option characters.
+-
+-   PERMUTE is the default.  We permute the contents of ARGV as we scan,
+-   so that eventually all the non-options are at the end.  This allows options
+-   to be given in any order, even with programs that were not written to
+-   expect this.
+-
+-   RETURN_IN_ORDER is an option available to programs that were written
+-   to expect options and other ARGV-elements in any order and that care about
+-   the ordering of the two.  We describe each non-option ARGV-element
+-   as if it were the argument of an option with character code 1.
+-   Using `-' as the first character of the list of option characters
+-   selects this mode of operation.
+-
+-   The special argument `--' forces an end of option-scanning regardless
+-   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
+-   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
+-
+-static enum
+-{
+-  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+-} ordering;
+-
+-/* Value of POSIXLY_CORRECT environment variable.  */
+-static char *posixly_correct;
+-
+-#ifdef	__GNU_LIBRARY__
+-/* We want to avoid inclusion of string.h with non-GNU libraries
+-   because there are many ways it can cause trouble.
+-   On some systems, it contains special magic macros that don't work
+-   in GCC.  */
+-# include <string.h>
+-# define my_index	strchr
+-#else
+-
+-# if HAVE_STRING_H
+-#  include <string.h>
+-# else
+-#  include <strings.h>
+-# endif
+-
+-/* Avoid depending on library functions or files
+-   whose names are inconsistent.  */
+-
+-#ifndef getenv
+-extern char *getenv ();
+-#endif
+-
+-static char *
+-my_index (str, chr)
+-     const char *str;
+-     int chr;
+-{
+-  while (*str)
+-    {
+-      if (*str == chr)
+-	return (char *) str;
+-      str++;
+-    }
+-  return 0;
+-}
+-
+-/* If using GCC, we can safely declare strlen this way.
+-   If not using GCC, it is ok not to declare it.  */
+-#ifdef __GNUC__
+-/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
+-   That was relevant to code that was here before.  */
+-# if (!defined __STDC__ || !__STDC__) && !defined strlen
+-/* gcc with -traditional declares the built-in strlen to return int,
+-   and has done so at least since version 2.4.5. -- rms.  */
+-extern int strlen (const char *);
+-# endif /* not __STDC__ */
+-#endif /* __GNUC__ */
+-
+-#endif /* not __GNU_LIBRARY__ */
+-
+-/* Handle permutation of arguments.  */
+-
+-/* Describe the part of ARGV that contains non-options that have
+-   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
+-   `last_nonopt' is the index after the last of them.  */
+-
+-static int first_nonopt;
+-static int last_nonopt;
+-
+-#ifdef _LIBC
+-/* Stored original parameters.
+-   XXX This is no good solution.  We should rather copy the args so
+-   that we can compare them later.  But we must not use malloc(3).  */
+-extern int __libc_argc;
+-extern char **__libc_argv;
+-
+-/* Bash 2.0 gives us an environment variable containing flags
+-   indicating ARGV elements that should not be considered arguments.  */
+-
+-# ifdef USE_NONOPTION_FLAGS
+-/* Defined in getopt_init.c  */
+-extern char *__getopt_nonoption_flags;
+-
+-static int nonoption_flags_max_len;
+-static int nonoption_flags_len;
+-# endif
+-
+-# ifdef USE_NONOPTION_FLAGS
+-#  define SWAP_FLAGS(ch1, ch2) \
+-  if (nonoption_flags_len > 0)						      \
+-    {									      \
+-      char __tmp = __getopt_nonoption_flags[ch1];			      \
+-      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];	      \
+-      __getopt_nonoption_flags[ch2] = __tmp;				      \
+-    }
+-# else
+-#  define SWAP_FLAGS(ch1, ch2)
+-# endif
+-#else	/* !_LIBC */
+-# define SWAP_FLAGS(ch1, ch2)
+-#endif	/* _LIBC */
+-
+-/* Exchange two adjacent subsequences of ARGV.
+-   One subsequence is elements [first_nonopt,last_nonopt)
+-   which contains all the non-options that have been skipped so far.
+-   The other is elements [last_nonopt,optind), which contains all
+-   the options processed since those non-options were skipped.
+-
+-   `first_nonopt' and `last_nonopt' are relocated so that they describe
+-   the new indices of the non-options in ARGV after they are moved.  */
+-
+-#if defined __STDC__ && __STDC__
+-static void exchange (char **);
+-#endif
+-
+-static void
+-exchange (argv)
+-     char **argv;
+-{
+-  int bottom = first_nonopt;
+-  int middle = last_nonopt;
+-  int top = optind;
+-  char *tem;
+-
+-  /* Exchange the shorter segment with the far end of the longer segment.
+-     That puts the shorter segment into the right place.
+-     It leaves the longer segment in the right place overall,
+-     but it consists of two parts that need to be swapped next.  */
+-
+-#if defined _LIBC && defined USE_NONOPTION_FLAGS
+-  /* First make sure the handling of the `__getopt_nonoption_flags'
+-     string can work normally.  Our top argument must be in the range
+-     of the string.  */
+-  if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
+-    {
+-      /* We must extend the array.  The user plays games with us and
+-	 presents new arguments.  */
+-      char *new_str = malloc (top + 1);
+-      if (new_str == NULL)
+-	nonoption_flags_len = nonoption_flags_max_len = 0;
+-      else
+-	{
+-	  memset (__mempcpy (new_str, __getopt_nonoption_flags,
+-			     nonoption_flags_max_len),
+-		  '\0', top + 1 - nonoption_flags_max_len);
+-	  nonoption_flags_max_len = top + 1;
+-	  __getopt_nonoption_flags = new_str;
+-	}
+-    }
+-#endif
+-
+-  while (top > middle && middle > bottom)
+-    {
+-      if (top - middle > middle - bottom)
+-	{
+-	  /* Bottom segment is the short one.  */
+-	  int len = middle - bottom;
+-	  register int i;
+-
+-	  /* Swap it with the top part of the top segment.  */
+-	  for (i = 0; i < len; i++)
+-	    {
+-	      tem = argv[bottom + i];
+-	      argv[bottom + i] = argv[top - (middle - bottom) + i];
+-	      argv[top - (middle - bottom) + i] = tem;
+-	      SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
+-	    }
+-	  /* Exclude the moved bottom segment from further swapping.  */
+-	  top -= len;
+-	}
+-      else
+-	{
+-	  /* Top segment is the short one.  */
+-	  int len = top - middle;
+-	  register int i;
+-
+-	  /* Swap it with the bottom part of the bottom segment.  */
+-	  for (i = 0; i < len; i++)
+-	    {
+-	      tem = argv[bottom + i];
+-	      argv[bottom + i] = argv[middle + i];
+-	      argv[middle + i] = tem;
+-	      SWAP_FLAGS (bottom + i, middle + i);
+-	    }
+-	  /* Exclude the moved top segment from further swapping.  */
+-	  bottom += len;
+-	}
+-    }
+-
+-  /* Update records for the slots the non-options now occupy.  */
+-
+-  first_nonopt += (optind - last_nonopt);
+-  last_nonopt = optind;
+-}
+-
+-/* Initialize the internal data when the first call is made.  */
+-
+-#if defined __STDC__ && __STDC__
+-static const char *_getopt_initialize (int, char *const *, const char *);
+-#endif
+-static const char *
+-_getopt_initialize (argc, argv, optstring)
+-     int argc;
+-     char *const *argv;
+-     const char *optstring;
+-{
+-  /* Start processing options with ARGV-element 1 (since ARGV-element 0
+-     is the program name); the sequence of previously skipped
+-     non-option ARGV-elements is empty.  */
+-
+-  first_nonopt = last_nonopt = optind;
+-
+-  nextchar = NULL;
+-
+-  posixly_correct = getenv ("POSIXLY_CORRECT");
+-
+-  /* Determine how to handle the ordering of options and nonoptions.  */
+-
+-  if (optstring[0] == '-')
+-    {
+-      ordering = RETURN_IN_ORDER;
+-      ++optstring;
+-    }
+-  else if (optstring[0] == '+')
+-    {
+-      ordering = REQUIRE_ORDER;
+-      ++optstring;
+-    }
+-  else if (posixly_correct != NULL)
+-    ordering = REQUIRE_ORDER;
+-  else
+-    ordering = PERMUTE;
+-
+-#if defined _LIBC && defined USE_NONOPTION_FLAGS
+-  if (posixly_correct == NULL
+-      && argc == __libc_argc && argv == __libc_argv)
+-    {
+-      if (nonoption_flags_max_len == 0)
+-	{
+-	  if (__getopt_nonoption_flags == NULL
+-	      || __getopt_nonoption_flags[0] == '\0')
+-	    nonoption_flags_max_len = -1;
+-	  else
+-	    {
+-	      const char *orig_str = __getopt_nonoption_flags;
+-	      int len = nonoption_flags_max_len = strlen (orig_str);
+-	      if (nonoption_flags_max_len < argc)
+-		nonoption_flags_max_len = argc;
+-	      __getopt_nonoption_flags =
+-		(char *) malloc (nonoption_flags_max_len);
+-	      if (__getopt_nonoption_flags == NULL)
+-		nonoption_flags_max_len = -1;
+-	      else
+-		memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
+-			'\0', nonoption_flags_max_len - len);
+-	    }
+-	}
+-      nonoption_flags_len = nonoption_flags_max_len;
+-    }
+-  else
+-    nonoption_flags_len = 0;
+-#endif
+-
+-  return optstring;
+-}
+-
+-/* Scan elements of ARGV (whose length is ARGC) for option characters
+-   given in OPTSTRING.
+-
+-   If an element of ARGV starts with '-', and is not exactly "-" or "--",
+-   then it is an option element.  The characters of this element
+-   (aside from the initial '-') are option characters.  If `getopt'
+-   is called repeatedly, it returns successively each of the option characters
+-   from each of the option elements.
+-
+-   If `getopt' finds another option character, it returns that character,
+-   updating `optind' and `nextchar' so that the next call to `getopt' can
+-   resume the scan with the following option character or ARGV-element.
+-
+-   If there are no more option characters, `getopt' returns -1.
+-   Then `optind' is the index in ARGV of the first ARGV-element
+-   that is not an option.  (The ARGV-elements have been permuted
+-   so that those that are not options now come last.)
+-
+-   OPTSTRING is a string containing the legitimate option characters.
+-   If an option character is seen that is not listed in OPTSTRING,
+-   return '?' after printing an error message.  If you set `opterr' to
+-   zero, the error message is suppressed but we still return '?'.
+-
+-   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+-   so the following text in the same ARGV-element, or the text of the following
+-   ARGV-element, is returned in `optarg'.  Two colons mean an option that
+-   wants an optional arg; if there is text in the current ARGV-element,
+-   it is returned in `optarg', otherwise `optarg' is set to zero.
+-
+-   If OPTSTRING starts with `-' or `+', it requests different methods of
+-   handling the non-option ARGV-elements.
+-   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+-
+-   Long-named options begin with `--' instead of `-'.
+-   Their names may be abbreviated as long as the abbreviation is unique
+-   or is an exact match for some defined option.  If they have an
+-   argument, it follows the option name in the same ARGV-element, separated
+-   from the option name by a `=', or else the in next ARGV-element.
+-   When `getopt' finds a long-named option, it returns 0 if that option's
+-   `flag' field is nonzero, the value of the option's `val' field
+-   if the `flag' field is zero.
+-
+-   The elements of ARGV aren't really const, because we permute them.
+-   But we pretend they're const in the prototype to be compatible
+-   with other systems.
+-
+-   LONGOPTS is a vector of `struct option' terminated by an
+-   element containing a name which is zero.
+-
+-   LONGIND returns the index in LONGOPT of the long-named option found.
+-   It is only valid when a long-named option has been found by the most
+-   recent call.
+-
+-   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+-   long-named options.  */
+-
+-int
+-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+-     int argc;
+-     char *const *argv;
+-     const char *optstring;
+-     const struct option *longopts;
+-     int *longind;
+-     int long_only;
+-{
+-  int print_errors = opterr;
+-  if (optstring[0] == ':')
+-    print_errors = 0;
+-
+-  if (argc < 1)
+-    return -1;
+-
+-  optarg = NULL;
+-
+-  if (optind == 0 || !__getopt_initialized)
+-    {
+-      if (optind == 0)
+-	optind = 1;	/* Don't scan ARGV[0], the program name.  */
+-      optstring = _getopt_initialize (argc, argv, optstring);
+-      __getopt_initialized = 1;
+-    }
+-
+-  /* Test whether ARGV[optind] points to a non-option argument.
+-     Either it does not have option syntax, or there is an environment flag
+-     from the shell indicating it is not an option.  The later information
+-     is only used when the used in the GNU libc.  */
+-#if defined _LIBC && defined USE_NONOPTION_FLAGS
+-# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'	      \
+-		      || (optind < nonoption_flags_len			      \
+-			  && __getopt_nonoption_flags[optind] == '1'))
+-#else
+-# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
+-#endif
+-
+-  if (nextchar == NULL || *nextchar == '\0')
+-    {
+-      /* Advance to the next ARGV-element.  */
+-
+-      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+-	 moved back by the user (who may also have changed the arguments).  */
+-      if (last_nonopt > optind)
+-	last_nonopt = optind;
+-      if (first_nonopt > optind)
+-	first_nonopt = optind;
+-
+-      if (ordering == PERMUTE)
+-	{
+-	  /* If we have just processed some options following some non-options,
+-	     exchange them so that the options come first.  */
+-
+-	  if (first_nonopt != last_nonopt && last_nonopt != optind)
+-	    exchange ((char **) argv);
+-	  else if (last_nonopt != optind)
+-	    first_nonopt = optind;
+-
+-	  /* Skip any additional non-options
+-	     and extend the range of non-options previously skipped.  */
+-
+-	  while (optind < argc && NONOPTION_P)
+-	    optind++;
+-	  last_nonopt = optind;
+-	}
+-
+-      /* The special ARGV-element `--' means premature end of options.
+-	 Skip it like a null option,
+-	 then exchange with previous non-options as if it were an option,
+-	 then skip everything else like a non-option.  */
+-
+-      if (optind != argc && !strcmp (argv[optind], "--"))
+-	{
+-	  optind++;
+-
+-	  if (first_nonopt != last_nonopt && last_nonopt != optind)
+-	    exchange ((char **) argv);
+-	  else if (first_nonopt == last_nonopt)
+-	    first_nonopt = optind;
+-	  last_nonopt = argc;
+-
+-	  optind = argc;
+-	}
+-
+-      /* If we have done all the ARGV-elements, stop the scan
+-	 and back over any non-options that we skipped and permuted.  */
+-
+-      if (optind == argc)
+-	{
+-	  /* Set the next-arg-index to point at the non-options
+-	     that we previously skipped, so the caller will digest them.  */
+-	  if (first_nonopt != last_nonopt)
+-	    optind = first_nonopt;
+-	  return -1;
+-	}
+-
+-      /* If we have come to a non-option and did not permute it,
+-	 either stop the scan or describe it to the caller and pass it by.  */
+-
+-      if (NONOPTION_P)
+-	{
+-	  if (ordering == REQUIRE_ORDER)
+-	    return -1;
+-	  optarg = argv[optind++];
+-	  return 1;
+-	}
+-
+-      /* We have found another option-ARGV-element.
+-	 Skip the initial punctuation.  */
+-
+-      nextchar = (argv[optind] + 1
+-		  + (longopts != NULL && argv[optind][1] == '-'));
+-    }
+-
+-  /* Decode the current option-ARGV-element.  */
+-
+-  /* Check whether the ARGV-element is a long option.
+-
+-     If long_only and the ARGV-element has the form "-f", where f is
+-     a valid short option, don't consider it an abbreviated form of
+-     a long option that starts with f.  Otherwise there would be no
+-     way to give the -f short option.
+-
+-     On the other hand, if there's a long option "fubar" and
+-     the ARGV-element is "-fu", do consider that an abbreviation of
+-     the long option, just like "--fu", and not "-f" with arg "u".
+-
+-     This distinction seems to be the most useful approach.  */
+-
+-  if (longopts != NULL
+-      && (argv[optind][1] == '-'
+-	  || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
+-    {
+-      char *nameend;
+-      const struct option *p;
+-      const struct option *pfound = NULL;
+-      int exact = 0;
+-      int ambig = 0;
+-      int indfound = -1;
+-      int option_index;
+-
+-      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+-	/* Do nothing.  */ ;
+-
+-      /* Test all long options for either exact match
+-	 or abbreviated matches.  */
+-      for (p = longopts, option_index = 0; p->name; p++, option_index++)
+-	if (!strncmp (p->name, nextchar, nameend - nextchar))
+-	  {
+-	    if ((unsigned int) (nameend - nextchar)
+-		== (unsigned int) strlen (p->name))
+-	      {
+-		/* Exact match found.  */
+-		pfound = p;
+-		indfound = option_index;
+-		exact = 1;
+-		break;
+-	      }
+-	    else if (pfound == NULL)
+-	      {
+-		/* First nonexact match found.  */
+-		pfound = p;
+-		indfound = option_index;
+-	      }
+-	    else if (long_only
+-		     || pfound->has_arg != p->has_arg
+-		     || pfound->flag != p->flag
+-		     || pfound->val != p->val)
+-	      /* Second or later nonexact match found.  */
+-	      ambig = 1;
+-	  }
+-
+-      if (ambig && !exact)
+-	{
+-	  if (print_errors)
+-	    {
+-#if defined _LIBC && defined USE_IN_LIBIO
+-	      char *buf;
+-
+-	      if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
+-			      argv[0], argv[optind]) >= 0)
+-		{
+-
+-		  if (_IO_fwide (stderr, 0) > 0)
+-		    __fwprintf (stderr, L"%s", buf);
+-		  else
+-		    fputs (buf, stderr);
+-
+-		  free (buf);
+-		}
+-#else
+-	      fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+-		       argv[0], argv[optind]);
+-#endif
+-	    }
+-	  nextchar += strlen (nextchar);
+-	  optind++;
+-	  optopt = 0;
+-	  return '?';
+-	}
+-
+-      if (pfound != NULL)
+-	{
+-	  option_index = indfound;
+-	  optind++;
+-	  if (*nameend)
+-	    {
+-	      /* Don't test has_arg with >, because some C compilers don't
+-		 allow it to be used on enums.  */
+-	      if (pfound->has_arg)
+-		optarg = nameend + 1;
+-	      else
+-		{
+-		  if (print_errors)
+-		    {
+-#if defined _LIBC && defined USE_IN_LIBIO
+-		      char *buf;
+-		      int n;
+-#endif
+-
+-		      if (argv[optind - 1][1] == '-')
+-			{
+-			  /* --option */
+-#if defined _LIBC && defined USE_IN_LIBIO
+-			  n = __asprintf (&buf, _("\
+-%s: option `--%s' doesn't allow an argument\n"),
+-					  argv[0], pfound->name);
+-#else
+-			  fprintf (stderr, _("\
+-%s: option `--%s' doesn't allow an argument\n"),
+-				   argv[0], pfound->name);
+-#endif
+-			}
+-		      else
+-			{
+-			  /* +option or -option */
+-#if defined _LIBC && defined USE_IN_LIBIO
+-			  n = __asprintf (&buf, _("\
+-%s: option `%c%s' doesn't allow an argument\n"),
+-					  argv[0], argv[optind - 1][0],
+-					  pfound->name);
+-#else
+-			  fprintf (stderr, _("\
+-%s: option `%c%s' doesn't allow an argument\n"),
+-				   argv[0], argv[optind - 1][0], pfound->name);
+-#endif
+-			}
+-
+-#if defined _LIBC && defined USE_IN_LIBIO
+-		      if (n >= 0)
+-			{
+-			  if (_IO_fwide (stderr, 0) > 0)
+-			    __fwprintf (stderr, L"%s", buf);
+-			  else
+-			    fputs (buf, stderr);
+-
+-			  free (buf);
+-			}
+-#endif
+-		    }
+-
+-		  nextchar += strlen (nextchar);
+-
+-		  optopt = pfound->val;
+-		  return '?';
+-		}
+-	    }
+-	  else if (pfound->has_arg == 1)
+-	    {
+-	      if (optind < argc)
+-		optarg = argv[optind++];
+-	      else
+-		{
+-		  if (print_errors)
+-		    {
+-#if defined _LIBC && defined USE_IN_LIBIO
+-		      char *buf;
+-
+-		      if (__asprintf (&buf, _("\
+-%s: option `%s' requires an argument\n"),
+-				      argv[0], argv[optind - 1]) >= 0)
+-			{
+-			  if (_IO_fwide (stderr, 0) > 0)
+-			    __fwprintf (stderr, L"%s", buf);
+-			  else
+-			    fputs (buf, stderr);
+-
+-			  free (buf);
+-			}
+-#else
+-		      fprintf (stderr,
+-			       _("%s: option `%s' requires an argument\n"),
+-			       argv[0], argv[optind - 1]);
+-#endif
+-		    }
+-		  nextchar += strlen (nextchar);
+-		  optopt = pfound->val;
+-		  return optstring[0] == ':' ? ':' : '?';
+-		}
+-	    }
+-	  nextchar += strlen (nextchar);
+-	  if (longind != NULL)
+-	    *longind = option_index;
+-	  if (pfound->flag)
+-	    {
+-	      *(pfound->flag) = pfound->val;
+-	      return 0;
+-	    }
+-	  return pfound->val;
+-	}
+-
+-      /* Can't find it as a long option.  If this is not getopt_long_only,
+-	 or the option starts with '--' or is not a valid short
+-	 option, then it's an error.
+-	 Otherwise interpret it as a short option.  */
+-      if (!long_only || argv[optind][1] == '-'
+-	  || my_index (optstring, *nextchar) == NULL)
+-	{
+-	  if (print_errors)
+-	    {
+-#if defined _LIBC && defined USE_IN_LIBIO
+-	      char *buf;
+-	      int n;
+-#endif
+-
+-	      if (argv[optind][1] == '-')
+-		{
+-		  /* --option */
+-#if defined _LIBC && defined USE_IN_LIBIO
+-		  n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
+-				  argv[0], nextchar);
+-#else
+-		  fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+-			   argv[0], nextchar);
+-#endif
+-		}
+-	      else
+-		{
+-		  /* +option or -option */
+-#if defined _LIBC && defined USE_IN_LIBIO
+-		  n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
+-				  argv[0], argv[optind][0], nextchar);
+-#else
+-		  fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+-			   argv[0], argv[optind][0], nextchar);
+-#endif
+-		}
+-
+-#if defined _LIBC && defined USE_IN_LIBIO
+-	      if (n >= 0)
+-		{
+-		  if (_IO_fwide (stderr, 0) > 0)
+-		    __fwprintf (stderr, L"%s", buf);
+-		  else
+-		    fputs (buf, stderr);
+-
+-		  free (buf);
+-		}
+-#endif
+-	    }
+-	  nextchar = (char *) "";
+-	  optind++;
+-	  optopt = 0;
+-	  return '?';
+-	}
+-    }
+-
+-  /* Look at and handle the next short option-character.  */
+-
+-  {
+-    char c = *nextchar++;
+-    char *temp = my_index (optstring, c);
+-
+-    /* Increment `optind' when we start to process its last character.  */
+-    if (*nextchar == '\0')
+-      ++optind;
+-
+-    if (temp == NULL || c == ':')
+-      {
+-	if (print_errors)
+-	  {
+-#if defined _LIBC && defined USE_IN_LIBIO
+-	      char *buf;
+-	      int n;
+-#endif
+-
+-	    if (posixly_correct)
+-	      {
+-		/* 1003.2 specifies the format of this message.  */
+-#if defined _LIBC && defined USE_IN_LIBIO
+-		n = __asprintf (&buf, _("%s: illegal option -- %c\n"),
+-				argv[0], c);
+-#else
+-		fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
+-#endif
+-	      }
+-	    else
+-	      {
+-#if defined _LIBC && defined USE_IN_LIBIO
+-		n = __asprintf (&buf, _("%s: invalid option -- %c\n"),
+-				argv[0], c);
+-#else
+-		fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
+-#endif
+-	      }
+-
+-#if defined _LIBC && defined USE_IN_LIBIO
+-	    if (n >= 0)
+-	      {
+-		if (_IO_fwide (stderr, 0) > 0)
+-		  __fwprintf (stderr, L"%s", buf);
+-		else
+-		  fputs (buf, stderr);
+-
+-		free (buf);
+-	      }
+-#endif
+-	  }
+-	optopt = c;
+-	return '?';
+-      }
+-    /* Convenience. Treat POSIX -W foo same as long option --foo */
+-    if (temp[0] == 'W' && temp[1] == ';')
+-      {
+-	char *nameend;
+-	const struct option *p;
+-	const struct option *pfound = NULL;
+-	int exact = 0;
+-	int ambig = 0;
+-	int indfound = 0;
+-	int option_index;
+-
+-	/* This is an option that requires an argument.  */
+-	if (*nextchar != '\0')
+-	  {
+-	    optarg = nextchar;
+-	    /* If we end this ARGV-element by taking the rest as an arg,
+-	       we must advance to the next element now.  */
+-	    optind++;
+-	  }
+-	else if (optind == argc)
+-	  {
+-	    if (print_errors)
+-	      {
+-		/* 1003.2 specifies the format of this message.  */
+-#if defined _LIBC && defined USE_IN_LIBIO
+-		char *buf;
+-
+-		if (__asprintf (&buf,
+-				_("%s: option requires an argument -- %c\n"),
+-				argv[0], c) >= 0)
+-		  {
+-		    if (_IO_fwide (stderr, 0) > 0)
+-		      __fwprintf (stderr, L"%s", buf);
+-		    else
+-		      fputs (buf, stderr);
+-
+-		    free (buf);
+-		  }
+-#else
+-		fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+-			 argv[0], c);
+-#endif
+-	      }
+-	    optopt = c;
+-	    if (optstring[0] == ':')
+-	      c = ':';
+-	    else
+-	      c = '?';
+-	    return c;
+-	  }
+-	else
+-	  /* We already incremented `optind' once;
+-	     increment it again when taking next ARGV-elt as argument.  */
+-	  optarg = argv[optind++];
+-
+-	/* optarg is now the argument, see if it's in the
+-	   table of longopts.  */
+-
+-	for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
+-	  /* Do nothing.  */ ;
+-
+-	/* Test all long options for either exact match
+-	   or abbreviated matches.  */
+-	for (p = longopts, option_index = 0; p->name; p++, option_index++)
+-	  if (!strncmp (p->name, nextchar, nameend - nextchar))
+-	    {
+-	      if ((unsigned int) (nameend - nextchar) == strlen (p->name))
+-		{
+-		  /* Exact match found.  */
+-		  pfound = p;
+-		  indfound = option_index;
+-		  exact = 1;
+-		  break;
+-		}
+-	      else if (pfound == NULL)
+-		{
+-		  /* First nonexact match found.  */
+-		  pfound = p;
+-		  indfound = option_index;
+-		}
+-	      else
+-		/* Second or later nonexact match found.  */
+-		ambig = 1;
+-	    }
+-	if (ambig && !exact)
+-	  {
+-	    if (print_errors)
+-	      {
+-#if defined _LIBC && defined USE_IN_LIBIO
+-		char *buf;
+-
+-		if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
+-				argv[0], argv[optind]) >= 0)
+-		  {
+-		    if (_IO_fwide (stderr, 0) > 0)
+-		      __fwprintf (stderr, L"%s", buf);
+-		    else
+-		      fputs (buf, stderr);
+-
+-		    free (buf);
+-		  }
+-#else
+-		fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+-			 argv[0], argv[optind]);
+-#endif
+-	      }
+-	    nextchar += strlen (nextchar);
+-	    optind++;
+-	    return '?';
+-	  }
+-	if (pfound != NULL)
+-	  {
+-	    option_index = indfound;
+-	    if (*nameend)
+-	      {
+-		/* Don't test has_arg with >, because some C compilers don't
+-		   allow it to be used on enums.  */
+-		if (pfound->has_arg)
+-		  optarg = nameend + 1;
+-		else
+-		  {
+-		    if (print_errors)
+-		      {
+-#if defined _LIBC && defined USE_IN_LIBIO
+-			char *buf;
+-
+-			if (__asprintf (&buf, _("\
+-%s: option `-W %s' doesn't allow an argument\n"),
+-					argv[0], pfound->name) >= 0)
+-			  {
+-			    if (_IO_fwide (stderr, 0) > 0)
+-			      __fwprintf (stderr, L"%s", buf);
+-			    else
+-			      fputs (buf, stderr);
+-
+-			    free (buf);
+-			  }
+-#else
+-			fprintf (stderr, _("\
+-%s: option `-W %s' doesn't allow an argument\n"),
+-				 argv[0], pfound->name);
+-#endif
+-		      }
+-
+-		    nextchar += strlen (nextchar);
+-		    return '?';
+-		  }
+-	      }
+-	    else if (pfound->has_arg == 1)
+-	      {
+-		if (optind < argc)
+-		  optarg = argv[optind++];
+-		else
+-		  {
+-		    if (print_errors)
+-		      {
+-#if defined _LIBC && defined USE_IN_LIBIO
+-			char *buf;
+-
+-			if (__asprintf (&buf, _("\
+-%s: option `%s' requires an argument\n"),
+-					argv[0], argv[optind - 1]) >= 0)
+-			  {
+-			    if (_IO_fwide (stderr, 0) > 0)
+-			      __fwprintf (stderr, L"%s", buf);
+-			    else
+-			      fputs (buf, stderr);
+-
+-			    free (buf);
+-			  }
+-#else
+-			fprintf (stderr,
+-				 _("%s: option `%s' requires an argument\n"),
+-				 argv[0], argv[optind - 1]);
+-#endif
+-		      }
+-		    nextchar += strlen (nextchar);
+-		    return optstring[0] == ':' ? ':' : '?';
+-		  }
+-	      }
+-	    nextchar += strlen (nextchar);
+-	    if (longind != NULL)
+-	      *longind = option_index;
+-	    if (pfound->flag)
+-	      {
+-		*(pfound->flag) = pfound->val;
+-		return 0;
+-	      }
+-	    return pfound->val;
+-	  }
+-	  nextchar = NULL;
+-	  return 'W';	/* Let the application handle it.   */
+-      }
+-    if (temp[1] == ':')
+-      {
+-	if (temp[2] == ':')
+-	  {
+-	    /* This is an option that accepts an argument optionally.  */
+-	    if (*nextchar != '\0')
+-	      {
+-		optarg = nextchar;
+-		optind++;
+-	      }
+-	    else
+-	      optarg = NULL;
+-	    nextchar = NULL;
+-	  }
+-	else
+-	  {
+-	    /* This is an option that requires an argument.  */
+-	    if (*nextchar != '\0')
+-	      {
+-		optarg = nextchar;
+-		/* If we end this ARGV-element by taking the rest as an arg,
+-		   we must advance to the next element now.  */
+-		optind++;
+-	      }
+-	    else if (optind == argc)
+-	      {
+-		if (print_errors)
+-		  {
+-		    /* 1003.2 specifies the format of this message.  */
+-#if defined _LIBC && defined USE_IN_LIBIO
+-		    char *buf;
+-
+-		    if (__asprintf (&buf, _("\
+-%s: option requires an argument -- %c\n"),
+-				    argv[0], c) >= 0)
+-		      {
+-			if (_IO_fwide (stderr, 0) > 0)
+-			  __fwprintf (stderr, L"%s", buf);
+-			else
+-			  fputs (buf, stderr);
+-
+-			free (buf);
+-		      }
+-#else
+-		    fprintf (stderr,
+-			     _("%s: option requires an argument -- %c\n"),
+-			     argv[0], c);
+-#endif
+-		  }
+-		optopt = c;
+-		if (optstring[0] == ':')
+-		  c = ':';
+-		else
+-		  c = '?';
+-	      }
+-	    else
+-	      /* We already incremented `optind' once;
+-		 increment it again when taking next ARGV-elt as argument.  */
+-	      optarg = argv[optind++];
+-	    nextchar = NULL;
+-	  }
+-      }
+-    return c;
+-  }
+-}
+-
+-int
+-getopt (argc, argv, optstring)
+-     int argc;
+-     char *const *argv;
+-     const char *optstring;
+-{
+-  return _getopt_internal (argc, argv, optstring,
+-			   (const struct option *) 0,
+-			   (int *) 0,
+-			   0);
+-}
+-
+-#endif	/* Not ELIDE_CODE.  */
+-
+-#ifdef TEST
+-
+-/* Compile with -DTEST to make an executable for use in testing
+-   the above definition of `getopt'.  */
+-
+-int
+-main (argc, argv)
+-     int argc;
+-     char **argv;
+-{
+-  int c;
+-  int digit_optind = 0;
+-
+-  while (1)
+-    {
+-      int this_option_optind = optind ? optind : 1;
+-
+-      c = getopt (argc, argv, "abc:d:0123456789");
+-      if (c == -1)
+-	break;
+-
+-      switch (c)
+-	{
+-	case '0':
+-	case '1':
+-	case '2':
+-	case '3':
+-	case '4':
+-	case '5':
+-	case '6':
+-	case '7':
+-	case '8':
+-	case '9':
+-	  if (digit_optind != 0 && digit_optind != this_option_optind)
+-	    printf ("digits occur in two different argv-elements.\n");
+-	  digit_optind = this_option_optind;
+-	  printf ("option %c\n", c);
+-	  break;
+-
+-	case 'a':
+-	  printf ("option a\n");
+-	  break;
+-
+-	case 'b':
+-	  printf ("option b\n");
+-	  break;
+-
+-	case 'c':
+-	  printf ("option c with value `%s'\n", optarg);
+-	  break;
+-
+-	case '?':
+-	  break;
+-
+-	default:
+-	  printf ("?? getopt returned character code 0%o ??\n", c);
+-	}
+-    }
+-
+-  if (optind < argc)
+-    {
+-      printf ("non-option ARGV-elements: ");
+-      while (optind < argc)
+-	printf ("%s ", argv[optind++]);
+-      printf ("\n");
+-    }
+-
+-  exit (0);
+-}
+-
+-#endif /* TEST */
+diff --git a/src/libs/libgroff/getopt1.c b/src/libs/libgroff/getopt1.c
+deleted file mode 100644
+index 22a7efb..0000000
+--- a/src/libs/libgroff/getopt1.c
++++ /dev/null
+@@ -1,188 +0,0 @@
+-/* getopt_long and getopt_long_only entry points for GNU getopt.
+-   Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
+-     Free Software Foundation, Inc.
+-   This file is part of the GNU C Library.
+-
+-   The GNU C Library is free software; you can redistribute it and/or
+-   modify it under the terms of the GNU Lesser General Public
+-   License as published by the Free Software Foundation; either
+-   version 2.1 of the License, or (at your option) any later version.
+-
+-   The GNU C Library is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-   Lesser General Public License for more details.
+-
+-   You should have received a copy of the GNU Lesser General Public
+-   License along with the GNU C Library; if not, write to the Free
+-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-   02111-1307 USA.  */
+-
+-#ifdef HAVE_CONFIG_H
+-#include <config.h>
+-#endif
+-
+-#include "getopt.h"
+-
+-#if !defined __STDC__ || !__STDC__
+-/* This is a separate conditional since some stdc systems
+-   reject `defined (const)'.  */
+-#ifndef const
+-#define const
+-#endif
+-#endif
+-
+-#include <stdio.h>
+-
+-/* Comment out all this code if we are using the GNU C Library, and are not
+-   actually compiling the library itself.  This code is part of the GNU C
+-   Library, but also included in many other GNU distributions.  Compiling
+-   and linking in this code is a waste when using the GNU C library
+-   (especially if it is a shared library).  Rather than having every GNU
+-   program understand `configure --with-gnu-libc' and omit the object files,
+-   it is simpler to just do this in the source for each such file.  */
+-
+-#define GETOPT_INTERFACE_VERSION 2
+-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+-#include <gnu-versions.h>
+-#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+-#define ELIDE_CODE
+-#endif
+-#endif
+-
+-#ifndef ELIDE_CODE
+-
+-
+-/* This needs to come after some library #include
+-   to get __GNU_LIBRARY__ defined.  */
+-#ifdef __GNU_LIBRARY__
+-#include <stdlib.h>
+-#endif
+-
+-#ifndef	NULL
+-#define NULL 0
+-#endif
+-
+-int
+-getopt_long (argc, argv, options, long_options, opt_index)
+-     int argc;
+-     char *const *argv;
+-     const char *options;
+-     const struct option *long_options;
+-     int *opt_index;
+-{
+-  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+-}
+-
+-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+-   If an option that starts with '-' (not '--') doesn't match a long option,
+-   but does match a short option, it is parsed as a short option
+-   instead.  */
+-
+-int
+-getopt_long_only (argc, argv, options, long_options, opt_index)
+-     int argc;
+-     char *const *argv;
+-     const char *options;
+-     const struct option *long_options;
+-     int *opt_index;
+-{
+-  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+-}
+-
+-
+-#endif	/* Not ELIDE_CODE.  */
+-
+-#ifdef TEST
+-
+-#include <stdio.h>
+-
+-int
+-main (argc, argv)
+-     int argc;
+-     char **argv;
+-{
+-  int c;
+-  int digit_optind = 0;
+-
+-  while (1)
+-    {
+-      int this_option_optind = optind ? optind : 1;
+-      int option_index = 0;
+-      static struct option long_options[] =
+-      {
+-	{"add", 1, 0, 0},
+-	{"append", 0, 0, 0},
+-	{"delete", 1, 0, 0},
+-	{"verbose", 0, 0, 0},
+-	{"create", 0, 0, 0},
+-	{"file", 1, 0, 0},
+-	{0, 0, 0, 0}
+-      };
+-
+-      c = getopt_long (argc, argv, "abc:d:0123456789",
+-		       long_options, &option_index);
+-      if (c == -1)
+-	break;
+-
+-      switch (c)
+-	{
+-	case 0:
+-	  printf ("option %s", long_options[option_index].name);
+-	  if (optarg)
+-	    printf (" with arg %s", optarg);
+-	  printf ("\n");
+-	  break;
+-
+-	case '0':
+-	case '1':
+-	case '2':
+-	case '3':
+-	case '4':
+-	case '5':
+-	case '6':
+-	case '7':
+-	case '8':
+-	case '9':
+-	  if (digit_optind != 0 && digit_optind != this_option_optind)
+-	    printf ("digits occur in two different argv-elements.\n");
+-	  digit_optind = this_option_optind;
+-	  printf ("option %c\n", c);
+-	  break;
+-
+-	case 'a':
+-	  printf ("option a\n");
+-	  break;
+-
+-	case 'b':
+-	  printf ("option b\n");
+-	  break;
+-
+-	case 'c':
+-	  printf ("option c with value `%s'\n", optarg);
+-	  break;
+-
+-	case 'd':
+-	  printf ("option d with value `%s'\n", optarg);
+-	  break;
+-
+-	case '?':
+-	  break;
+-
+-	default:
+-	  printf ("?? getopt returned character code 0%o ??\n", c);
+-	}
+-    }
+-
+-  if (optind < argc)
+-    {
+-      printf ("non-option ARGV-elements: ");
+-      while (optind < argc)
+-	printf ("%s ", argv[optind++]);
+-      printf ("\n");
+-    }
+-
+-  exit (0);
+-}
+-
+-#endif /* TEST */
+-- 
+2.12.0
+
diff --git a/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/fix-narrowing-conversion-error.patch b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/fix-narrowing-conversion-error.patch
new file mode 100644
index 0000000..4b0176f
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/fix-narrowing-conversion-error.patch
@@ -0,0 +1,61 @@
+From fc289ab69c6d7e4ad489172509a85f68afec43ea Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Fri, 29 Jul 2016 03:19:39 -0400
+Subject: [PATCH] fix narrowing conversion error
+
+While gcc6 used, build old groff (for anti-GPLv3 reasons) failed:
+.....
+|groff-1.18.1.4/src/devices/grolbp/charset.h:69:1: error: narrowing
+conversion of '130' from 'int' to 'char' inside { } [-Wnarrowing]
+......
+
+In upstream git://git.savannah.gnu.org/groff.git,
+the following commit fix the issue, but the license is GPLV3,
+we could not backport it to the old groff which license is GPLV2.
+...
+commit d180038ae0da19655bc2760ae2043efa0550a76c
+Author: Werner LEMBERG <wl@gnu.org>
+Date:   Wed Apr 16 21:11:07 2003 +0000
+    * src/devices/grolbp/charset.h (symset): Use `unsigned char'.
+...
+
+We use another different way to fix the issue.
+
+Upstream-Status: Pending
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ src/devices/grolbp/charset.h | 2 +-
+ src/devices/grolbp/lbp.cc    | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/devices/grolbp/charset.h b/src/devices/grolbp/charset.h
+index adc76f4..e9c6c5b 100644
+--- a/src/devices/grolbp/charset.h
++++ b/src/devices/grolbp/charset.h
+@@ -1,6 +1,6 @@
+ // Definition of the WP54 character set
+ 
+-char symset[] = {
++int symset[] = {
+ 0x57,0x50,0x35,0x34,0x00,0x41,0x76,0x61,0x6e,0x74,0x47,0x61,
+ 0x72,0x64,0x65,0x2d,0x42,0x6f,0x6f,0x6b,0x00,0x41,0x76,
+ 0x61,0x6e,0x74,0x47,0x61,0x72,0x64,0x65,0x2d,0x44,0x65,
+diff --git a/src/devices/grolbp/lbp.cc b/src/devices/grolbp/lbp.cc
+index 76db32a..00d4ca7 100644
+--- a/src/devices/grolbp/lbp.cc
++++ b/src/devices/grolbp/lbp.cc
+@@ -152,8 +152,8 @@ static void wp54charset()
+ {
+   unsigned int i;
+   lbpputs("\033[714;100;29;0;32;120.}");
+-  for (i = 0; i < sizeof(symset); i++)
+-    lbpputc(symset[i]);
++  for (i = 0; i < sizeof(symset)/sizeof(symset[0]); i++)
++    lbpputc((char)symset[i]&0xFF);
+   lbpputs("\033[100;0 D");
+   return;
+ }
+-- 
+2.8.1
+
diff --git a/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-fix-bindir.patch b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-fix-bindir.patch
new file mode 100644
index 0000000..559ae72
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-fix-bindir.patch
@@ -0,0 +1,39 @@
+Upstream-Status: Inappropriate [embedded]
+
+Signed-off-by: Ming Liu <ming.liu@windriver.com>
+---
+ Makefile.sub |   10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/contrib/groffer/Makefile.sub
++++ b/contrib/groffer/Makefile.sub
+@@ -38,16 +38,16 @@ groffer: groffer.sh groffer2.sh version.
+ 	$(RM) $@;
+ 	sed \
+             -e "s|@g@|$(g)|g" \
+-	    -e "s|@BINDIR@|$(DESTDIR)$(bindir)|g" \
++	    -e "s|@BINDIR@|$(bindir)|g" \
+ 	    -e "s|@libdir@|$(DESTDIR)$(libdir)|g" \
+ 	    -e "s|@VERSION@|$(version)$(revision)|g" \
+ 	    $(srcdir)/groffer.sh >$@;
+ 	chmod +x $@
+ 
+ install_data: groffer
+-	-test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir)
+-	-$(RM) $(DESTDIR)$(bindir)/groffer
+-	$(INSTALL_SCRIPT) groffer $(DESTDIR)$(bindir)/groffer
++	-test -d $(bindir) || $(mkinstalldirs) $(bindir)
++	-$(RM) $(bindir)/groffer
++	$(INSTALL_SCRIPT) groffer $(bindir)/groffer
+ 	-test -d $(DESTDIR)$(libdir)/groff/groffer || \
+           $(mkinstalldirs) $(DESTDIR)$(libdir)/groff/groffer
+ 	-$(RM) $(DESTDIR)$(libdir)/groff/groffer/groffer2.sh
+@@ -58,7 +58,7 @@ install_data: groffer
+ 	$(DESTDIR)$(libdir)/groff/groffer/version.sh
+ 
+ uninstall_sub:
+-	-$(RM) $(DESTDIR)$(bindir)/groffer
++	-$(RM) $(bindir)/groffer
+ 	-$(RM) $(DESTDIR)$(libdir)/groff/groffer/groffer2.sh
+ 	-$(RM) $(DESTDIR)$(libdir)/groff/groffer/version.sh
+ 	-rmdir $(DESTDIR)$(libdir)/groff/groffer
diff --git a/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-remove-mom.patch b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-remove-mom.patch
new file mode 100644
index 0000000..c24eff9
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-remove-mom.patch
@@ -0,0 +1,39 @@
+
+Upstream-Status: Inappropriate [embedded]
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+---
+ groff-1.18.1.4/Makefile.in |    7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -460,27 +460,22 @@ OTHERDIRS=\
+   src/roff/grog \
+   src/roff/nroff \
+   contrib/mm \
+   contrib/pic2graph \
+   contrib/eqn2graph \
+-  contrib/groffer \
+-  contrib/mom \
+-  doc
++  contrib/groffer
+ ALLDIRS=$(INCDIRS) $(LIBDIRS) $(PROGDIRS) \
+   $(DEVDIRS) $(OTHERDEVDIRS) $(TTYDEVDIRS) $(OTHERDIRS)
+ EXTRADIRS=\
+   font/devps/generate \
+   font/devdvi/generate \
+   font/devlj4/generate \
+-  src/xditview \
+   doc
+ NOMAKEDIRS=\
+   arch/djgpp \
+   contrib/mm/examples \
+   contrib/mm/mm \
+-  contrib/mom/examples \
+-  contrib/mom/momdoc \
+   src/libs/snprintf
+ DISTDIRS=\
+   $(INCDIRS) $(LIBDIRS) $(PROGDIRS) $(DEVDIRS) $(OTHERDEVDIRS) \
+   $(ALLTTYDEVDIRS) $(OTHERDIRS) $(EXTRADIRS) $(NOMAKEDIRS)
+ TARGETS=all install install_bin install_data clean distclean mostlyclean \
diff --git a/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/man-local.patch b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/man-local.patch
new file mode 100644
index 0000000..e3f1aa6
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/man-local.patch
@@ -0,0 +1,36 @@
+Upstream-Status: Inappropriate [embedded]
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+
+Index: groff-1.18.1.4/tmac/man.local
+===================================================================
+--- groff-1.18.1.4.orig/tmac/man.local	2000-10-26 22:15:17.000000000 +0800
++++ groff-1.18.1.4/tmac/man.local	2010-08-24 14:17:52.070006664 +0800
+@@ -1,2 +1,27 @@
+ .\" This file is loaded after an-old.tmac.
+ .\" Put any local modifications to an-old.tmac here.
++.
++.if n \{\
++.  \" Debian: Map \(oq to ' rather than ` in nroff mode for devices other
++.  \" than utf8.
++.  if !'\*[.T]'utf8' \
++.    tr \[oq]'
++.
++.  \" Debian: Disable the use of SGR (ANSI colour) escape sequences by
++.  \" grotty.
++.  if '\V[GROFF_SGR]'' \
++.    output x X tty: sgr 0
++.
++.  \" Debian: Map \- to the Unicode HYPHEN-MINUS character, to make
++.  \" searching in man pages easier.
++.  if '\*[.T]'utf8' \
++.    char \- \N'45'
++.
++.  \" Debian: Many UTF-8 man pages use "-" instead of "\-" for dashes such
++.  \" as those in command-line options. This is a bug in those pages, but
++.  \" too many fonts are missing the Unicode HYPHEN character, so we render
++.  \" this as the ASCII-compatible HYPHEN-MINUS instead.
++.  if '\*[.T]'utf8' \
++.    char - \N'45'
++.\}
++
diff --git a/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/mdoc-local.patch b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/mdoc-local.patch
new file mode 100644
index 0000000..409c1a5
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/groff/groff-1.18.1.4/mdoc-local.patch
@@ -0,0 +1,36 @@
+
+Upstream-Status: Inappropriate [embedded]
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+
+Index: groff-1.18.1.4/tmac/mdoc.local
+===================================================================
+--- groff-1.18.1.4.orig/tmac/mdoc.local	2001-03-23 08:17:51.000000000 +0800
++++ groff-1.18.1.4/tmac/mdoc.local	2010-08-24 14:20:22.014006846 +0800
+@@ -1,2 +1,26 @@
+ .\" This file is loaded after doc.tmac.
+ .\" Put any local modifications to doc.tmac here.
++.
++.if n \{\
++.  \" Debian: Map \(oq to ' rather than ` in nroff mode for devices other
++.  \" than utf8.
++.  if !'\*[.T]'utf8' \
++.    tr \[oq]'
++.
++.  \" Debian: Disable the use of SGR (ANSI colour) escape sequences by
++.  \" grotty.
++.  if '\V[GROFF_SGR]'' \
++.    output x X tty: sgr 0
++.
++.  \" Debian: Map \- to the Unicode HYPHEN-MINUS character, to make
++.  \" searching in man pages easier.
++.  if '\*[.T]'utf8' \
++.    char \- \N'45'
++.
++.  \" Debian: Many UTF-8 man pages use "-" instead of "\-" for dashes such
++.  \" as those in command-line options. This is a bug in those pages, but
++.  \" too many fonts are missing the Unicode HYPHEN character, so we render
++.  \" this as the ASCII-compatible HYPHEN-MINUS instead.
++.  if '\*[.T]'utf8' \
++.    char - \N'45'
++.\}
diff --git a/meta/meta-gplv2/recipes-extended/groff/groff_1.18.1.4.bb b/meta/meta-gplv2/recipes-extended/groff/groff_1.18.1.4.bb
new file mode 100644
index 0000000..a31cbf1
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/groff/groff_1.18.1.4.bb
@@ -0,0 +1,52 @@
+SUMMARY = "GNU Troff software"
+DESCRIPTION = "The groff (GNU troff) software is a typesetting package which reads plain text mixed with \
+formatting commands and produces formatted output."
+SECTION = "console/utils"
+HOMEPAGE = "http://www.gnu.org/software/groff/"
+LICENSE = "GPLv2"
+PR = "r1"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=e43fc16fccd8519fba405f0a0ff6e8a3"
+
+SRC_URI = "${GNU_MIRROR}/${BPN}/old/${BP}.tar.gz \
+           file://groff-1.18.1.4-remove-mom.patch;striplevel=1 \
+           file://man-local.patch \
+           file://mdoc-local.patch \
+           file://groff-1.18.1.4-fix-bindir.patch \
+           file://fix-narrowing-conversion-error.patch \
+           file://0001-Make-it-build-with-compile-time-hardening-enabled.patch \
+           file://0002-Drop-local-getopt-implementation-in-favor-of-the-one.patch \
+"
+
+inherit autotools texinfo
+
+EXTRA_OECONF="--without-x --prefix=${D} --exec-prefix=${D} --bindir=${D}${bindir} --datadir=${D}${datadir} --mandir=${D}${datadir}/man --infodir=${D}${datadir}info --with-appresdir=${D}${datadir}"
+
+SRC_URI[md5sum] = "ceecb81533936d251ed015f40e5f7287"
+SRC_URI[sha256sum] = "ff3c7c3b6cae5e8cc5062a144de5eff0022e8e970e1774529cc2d5dde46ce50d"
+PARALLEL_MAKE = ""
+
+do_configure (){
+    oe_runconf
+}
+
+do_install_append() {
+	# Some distros have both /bin/perl and /usr/bin/perl, but we set perl location
+	# for target as /usr/bin/perl, so fix it to /usr/bin/perl.
+	for i in afmtodit mmroff; do
+		if [ -f ${D}${bindir}/$i ]; then
+			sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' ${D}${bindir}/$i
+		fi
+	done
+
+	mkdir -p ${D}${sysconfdir}/groff
+	cp -rf ${D}${datadir}/groff/site-tmac/* ${D}${sysconfdir}/groff/
+	cp -rf ${D}${datadir}/groff/site-tmac/* ${D}${datadir}/groff/${PV}/tmac/
+}
+
+pkg_postinst_${PN}() {
+	ln -s tbl $D${bindir}/gtbl
+	echo "export GROFF_FONT_PATH=/usr/share/groff/${PV}/font" >> $D${sysconfdir}/profile
+	echo "export GROFF_TMAC_PATH=/usr/share/groff/${PV}/tmac" >> $D${sysconfdir}/profile
+}
+
diff --git a/meta/meta-gplv2/recipes-extended/gzip/gzip-1.3.12/dup-def-fix.patch b/meta/meta-gplv2/recipes-extended/gzip/gzip-1.3.12/dup-def-fix.patch
new file mode 100644
index 0000000..d9e8d21
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/gzip/gzip-1.3.12/dup-def-fix.patch
@@ -0,0 +1,48 @@
+gzip uses gnulib, whose header conflict with glibc. This patch rename some function to avoid conflict.
+
+Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
+
+Upstream-Status: Inappropriate [licensing]
+
+Index: gzip-1.3.12/gzip.c
+===================================================================
+--- gzip-1.3.12.orig/gzip.c	2010-08-13 10:29:38.000000000 +0800
++++ gzip-1.3.12/gzip.c	2010-08-13 10:29:44.000000000 +0800
+@@ -1637,7 +1637,7 @@
+ 	}
+       }
+ 
+-    if (futimens (ofd, ofname, timespec) != 0)
++    if (futimens_gnulib (ofd, ofname, timespec) != 0)
+       {
+ 	int e = errno;
+ 	WARN ((stderr, "%s: ", program_name));
+Index: gzip-1.3.12/lib/utimens.c
+===================================================================
+--- gzip-1.3.12.orig/lib/utimens.c	2010-08-13 10:33:47.000000000 +0800
++++ gzip-1.3.12/lib/utimens.c	2010-08-13 10:34:02.000000000 +0800
+@@ -75,7 +75,7 @@
+    Return 0 on success, -1 (setting errno) on failure.  */
+ 
+ int
+-futimens (int fd ATTRIBUTE_UNUSED,
++futimens_gnulib (int fd ATTRIBUTE_UNUSED,
+ 	  char const *file, struct timespec const timespec[2])
+ {
+   /* Some Linux-based NFS clients are buggy, and mishandle time stamps
+@@ -185,5 +185,5 @@
+ int
+ utimens (char const *file, struct timespec const timespec[2])
+ {
+-  return futimens (-1, file, timespec);
++  return futimens_gnulib (-1, file, timespec);
+ }
+Index: gzip-1.3.12/lib/utimens.h
+===================================================================
+--- gzip-1.3.12.orig/lib/utimens.h	2010-08-13 10:14:57.000000000 +0800
++++ gzip-1.3.12/lib/utimens.h	2010-08-13 10:21:45.000000000 +0800
+@@ -1,3 +1,3 @@
+ #include <time.h>
+-int futimens (int, char const *, struct timespec const [2]);
++int futimens_gnulib (int, char const *, struct timespec const [2]);
+ int utimens (char const *, struct timespec const [2]);
diff --git a/meta/meta-gplv2/recipes-extended/gzip/gzip-1.3.12/m4-extensions-fix.patch b/meta/meta-gplv2/recipes-extended/gzip/gzip-1.3.12/m4-extensions-fix.patch
new file mode 100644
index 0000000..6b2f698
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/gzip/gzip-1.3.12/m4-extensions-fix.patch
@@ -0,0 +1,56 @@
+remove AC_USE_SYSTEM_EXTENSIONS to fix the autoconf error "AC_REQUIRE: circular
+dependency of AC_GNU_SOURCE"
+
+Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
+
+Upstream-Status: Inappropriate [licensing]
+
+Index: gzip-1.3.12/m4/extensions.m4
+===================================================================
+--- gzip-1.3.12.orig/m4/extensions.m4	2010-08-16 14:18:16.000000000 +0800
++++ gzip-1.3.12/m4/extensions.m4	2010-08-16 14:21:54.000000000 +0800
+@@ -12,44 +12,6 @@
+ # enough in this area it's likely we'll need to redefine
+ # AC_USE_SYSTEM_EXTENSIONS for quite some time.
+ 
+-# AC_USE_SYSTEM_EXTENSIONS
+-# ------------------------
+-# Enable extensions on systems that normally disable them,
+-# typically due to standards-conformance issues.
+-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+-[
+-  AC_BEFORE([$0], [AC_COMPILE_IFELSE])
+-  AC_BEFORE([$0], [AC_RUN_IFELSE])
+-
+-  AC_REQUIRE([AC_GNU_SOURCE])
+-  AC_REQUIRE([AC_AIX])
+-  AC_REQUIRE([AC_MINIX])
+-
+-  AH_VERBATIM([__EXTENSIONS__],
+-[/* Enable extensions on Solaris.  */
+-#ifndef __EXTENSIONS__
+-# undef __EXTENSIONS__
+-#endif
+-#ifndef _POSIX_PTHREAD_SEMANTICS
+-# undef _POSIX_PTHREAD_SEMANTICS
+-#endif
+-#ifndef _TANDEM_SOURCE
+-# undef _TANDEM_SOURCE
+-#endif])
+-  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+-    [ac_cv_safe_to_define___extensions__],
+-    [AC_COMPILE_IFELSE(
+-       [AC_LANG_PROGRAM([
+-#	  define __EXTENSIONS__ 1
+-	  AC_INCLUDES_DEFAULT])],
+-       [ac_cv_safe_to_define___extensions__=yes],
+-       [ac_cv_safe_to_define___extensions__=no])])
+-  test $ac_cv_safe_to_define___extensions__ = yes &&
+-    AC_DEFINE([__EXTENSIONS__])
+-  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+-  AC_DEFINE([_TANDEM_SOURCE])
+-])
+-
+ # gl_USE_SYSTEM_EXTENSIONS
+ # ------------------------
+ # Enable extensions on systems that normally disable them,
diff --git a/meta/meta-gplv2/recipes-extended/gzip/gzip.inc b/meta/meta-gplv2/recipes-extended/gzip/gzip.inc
new file mode 100644
index 0000000..04f8f95
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/gzip/gzip.inc
@@ -0,0 +1,33 @@
+SUMMARY = "Standard GNU compressor"
+DESCRIPTION = "GNU Gzip is a popular data compression program originally written by Jean-loup Gailly for the GNU \
+project. Mark Adler wrote the decompression part"
+HOMEPAGE = "http://www.gnu.org/software/gzip/"
+SECTION = "console/utils"
+# change to GPLv3+ in 2007/07. Previous GPLv2 version is 1.3.12
+
+inherit autotools texinfo
+export DEFS="NO_ASM"
+
+EXTRA_OEMAKE_class-target = "GREP=${base_bindir}/grep"
+EXTRA_OECONF_append_libc-musl = " gl_cv_func_fflush_stdin=yes "
+
+do_install_append () {
+	if [ "${base_bindir}" != "${bindir}" ]; then
+		# Rename and move files into /bin (FHS), which is typical place for gzip
+		install -d ${D}${base_bindir}
+		mv ${D}${bindir}/gunzip ${D}${base_bindir}/gunzip
+		mv ${D}${bindir}/gzip ${D}${base_bindir}/gzip
+		mv ${D}${bindir}/zcat ${D}${base_bindir}/zcat
+		mv ${D}${bindir}/uncompress ${D}${base_bindir}/uncompress
+	fi
+}
+
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+ALTERNATIVE_${PN} = "gunzip gzip zcat"
+ALTERNATIVE_LINK_NAME[gunzip] = "${base_bindir}/gunzip"
+ALTERNATIVE_LINK_NAME[gzip] = "${base_bindir}/gzip"
+ALTERNATIVE_LINK_NAME[zcat] = "${base_bindir}/zcat"
+
+export CONFIG_SHELL="/bin/sh"
diff --git a/meta/meta-gplv2/recipes-extended/gzip/gzip_1.3.12.bb b/meta/meta-gplv2/recipes-extended/gzip/gzip_1.3.12.bb
new file mode 100644
index 0000000..e406282
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/gzip/gzip_1.3.12.bb
@@ -0,0 +1,15 @@
+require gzip.inc
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
+                    file://gzip.h;endline=22;md5=c0934ad1900d927f86556153d4c76d23 \
+                    file://lzw.h;endline=19;md5=c273e09a02edd9801cc74d39683049e9 "
+
+SRC_URI = "${GNU_MIRROR}/gzip/gzip-${PV}.tar.gz \
+           file://m4-extensions-fix.patch \
+           file://dup-def-fix.patch"
+
+SRC_URI[md5sum] = "b5bac2d21840ae077e0217bc5e4845b1"
+SRC_URI[sha256sum] = "3f565be05f7f3d1aff117c030eb7c738300510b7d098cedea796ca8e4cd587af"
+
+PR = "r2"
diff --git a/meta/meta-gplv2/recipes-extended/libidn/libidn_0.6.14.bb b/meta/meta-gplv2/recipes-extended/libidn/libidn_0.6.14.bb
new file mode 100644
index 0000000..c681560
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/libidn/libidn_0.6.14.bb
@@ -0,0 +1,36 @@
+SUMMARY = "Internationalized Domain Name support library"
+DESCRIPTION = "Implementation of the Stringprep, Punycode and IDNA specifications defined by the IETF Internationalized Domain Names (IDN) working group."
+HOMEPAGE = "http://www.gnu.org/software/libidn/"
+SECTION = "libs"
+LICENSE = "LGPLv2.1+ & GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a \
+                    file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \
+                    file://lib/idna.h;beginline=6;endline=18;md5=1336e848ca7b8e25767c3c7e8fa38a89 \
+                    file://src/idn.c;beginline=6;endline=18;md5=56c89e359652a71cda128d75f0ffdac4"
+PR = "r1"
+
+inherit pkgconfig autotools gettext texinfo
+
+SRC_URI = "http://alpha.gnu.org/gnu/libidn/${BPN}-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "040f012a45feb56168853998bb87ad4d"
+SRC_URI[sha256sum] = "98910c2ad664bdf4eed2c2fff88e24f8882636ec9d26669366ff03b469c05ae3"
+
+do_configure_prepend() {
+	# this version of libidn copies AC_USE_SYSTEM_EXTENSIONS from 
+	# autoconf CVS because atm the autoconf it uses is a bit old
+	# now with cross autotool, that macro is already there and this
+	# local definition causes circular dependency. Actually AC_GNU_SOURCE
+	# is identical to AC_USE_SYSTEM_EXTENSIONS. So remove all local
+	# references to the latter here.
+	sed -i -e "/AC_REQUIRE(\[gl_USE_SYSTEM_EXTENSIONS/d" ${S}/lib/gl/m4/gnulib-comp.m4
+	rm -f ${S}/lib/gl/m4/extensions.m4
+}
+
+do_install_append() {
+	rm -rf ${D}${libdir}/Libidn.dll
+	rm -rf ${D}${datadir}/emacs
+}
+
+BBCLASSEXTEND = "native nativesdk"
+
diff --git a/meta/meta-gplv2/recipes-extended/mc/mc/0001-disable-Ctrl-g-key-and-Ctrl-key.patch b/meta/meta-gplv2/recipes-extended/mc/mc/0001-disable-Ctrl-g-key-and-Ctrl-key.patch
new file mode 100644
index 0000000..eddc12f
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/mc/mc/0001-disable-Ctrl-g-key-and-Ctrl-key.patch
@@ -0,0 +1,86 @@
+From 91a1068015a09232bacac9b86fc13b318860f44e Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Fri, 18 Aug 2017 17:05:42 +0800
+Subject: [PATCH] disable Ctrl-g key and Ctrl-\ key
+
+Since ncurses upgraded to 6.0+20170715, it compile failed
+...
+| ../../../mc-4.7.5.2/lib/tty/tty-ncurses.c: In function 'tty_init':
+| ../../../mc-4.7.5.2/lib/tty/tty-ncurses.c:163:13: error:
+dereferencing pointer to incomplete type 'TERMINAL {aka struct term}'
+|      cur_term->Nttyb.c_cc[VINTR] = CTRL ('g');   /* ^g */
+...
+
+We could not backport fix from the latest master which introduce
+gplv3 contamination, but we could revert the following commits.
+...
+commit a20ebb38184e177f2ead8466f3ef1f131352aba7
+Author: Andrew Borodin <aborodin@vmail.ru>
+Date:   Wed Dec 23 16:18:25 2009 +0000
+
+    Ticket #1876: use Ctrl-g key to generate SIGINT signal.
+
+commit 56bf77ae57ba493126a2d1a1e0dd56eb947ccca1
+Author: Andrew Borodin <aborodin@vmail.ru>
+Date:   Sat Feb 6 13:07:35 2010 +0300
+
+    Ticket #1926: Ctrl-\ key behaviour in NCurses-based MC.
+...
+
+Upstream-Status: Inappropriate [gplv2 specific]
+https://github.com/MidnightCommander/mc.git
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ lib/tty/tty-ncurses.c  | 6 ------
+ lib/tty/tty-slang.c    | 4 ++--
+ src/keybind-defaults.c | 1 -
+ 3 files changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c
+index ab61891..6c614ac 100644
+--- a/lib/tty/tty-ncurses.c
++++ b/lib/tty/tty-ncurses.c
+@@ -159,12 +159,6 @@ tty_init (gboolean slow, gboolean ugly_lines)
+     ESCDELAY = 200;
+ #endif /* HAVE_ESCDELAY */
+ 
+-    /* use Ctrl-g to generate SIGINT */
+-    cur_term->Nttyb.c_cc[VINTR] = CTRL ('g');   /* ^g */
+-    /* disable SIGQUIT to allow use Ctrl-\ key */
+-    cur_term->Nttyb.c_cc[VQUIT] = NULL_VALUE;
+-    tcsetattr (cur_term->Filedes, TCSANOW, &cur_term->Nttyb);
+-
+     tty_start_interrupt_key ();
+ 
+     do_enter_ca_mode ();
+diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c
+index f42fd4a..0e92c52 100644
+--- a/lib/tty/tty-slang.c
++++ b/lib/tty/tty-slang.c
+@@ -268,8 +268,8 @@ tty_init (gboolean slow, gboolean ugly_lines)
+ 
+     tcgetattr (fileno (stdin), &boot_mode);
+     /* 255 = ignore abort char; XCTRL('g') for abort char = ^g */
+-    SLang_init_tty (XCTRL ('g'), 1, 0);
+-
++    /* SLang_init_tty (XCTRL ('c'), 1, 0); */
++    SLang_init_tty (255, 1, 0);
+     if (ugly_lines)
+         SLtt_Has_Alt_Charset = 0;
+ 
+diff --git a/src/keybind-defaults.c b/src/keybind-defaults.c
+index 28e3613..075e6b6 100644
+--- a/src/keybind-defaults.c
++++ b/src/keybind-defaults.c
+@@ -368,7 +368,6 @@ const global_keymap_t default_dialog_keymap[] = {
+     {'\n', CK_DialogOK, "Enter"},
+     {KEY_ENTER, CK_DialogOK, "Enter"},
+     {ESC_CHAR, CK_DialogCancel, "Esc"},
+-    {XCTRL ('g'), CK_DialogCancel, "C-g"},
+     {KEY_F (10), CK_DialogCancel, "F10"},
+     {KEY_LEFT, CK_DialogPrevItem, "Left"},
+     {KEY_UP, CK_DialogPrevItem, "Up"},
+-- 
+1.8.3.1
+
diff --git a/meta/meta-gplv2/recipes-extended/mc/mc/mc-CTRL.patch b/meta/meta-gplv2/recipes-extended/mc/mc/mc-CTRL.patch
new file mode 100644
index 0000000..ee4ba9f
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/mc/mc/mc-CTRL.patch
@@ -0,0 +1,31 @@
+Fix build with musl by ensuring CTRL is defined.
+
+musl does not define CTRL in <termios.h>, we could include <sys/ttydefaults.h>
+explicitly but it's easier just to ensure CTRL is defined.
+
+This patch is taken from Sabotage Linux, the license statement for patches and
+build scripts in Sabotage Linux says:
+
+    To the extent possible under law, Christian Neukirchen has waived
+    all copyright and related or neighboring rights to this work.
+
+    http://creativecommons.org/publicdomain/zero/1.0/
+
+Therefore this should be good to include in OpenEmbedded.
+
+Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
+
+Upstream-Status: Accepted (should be included in v4.8.14)
+
+diff -u mc-4.8.1.7.org/lib/tty/tty-ncurses.c mc-4.8.1.7/lib/tty/tty-ncurses.c
+--- mc-4.8.1.7.org/lib/tty/tty-ncurses.c
++++ mc-4.8.1.7/lib/tty/tty-ncurses.c
+@@ -65,7 +65,7 @@
+ 
+ /*** file scope macro definitions ****************************************************************/
+ 
+-#if defined(_AIX) && !defined(CTRL)
++#if !defined(CTRL)
+ #define CTRL(x) ((x) & 0x1f)
+ #endif
+ 
diff --git a/meta/meta-gplv2/recipes-extended/mc/mc_4.7.5.2.bb b/meta/meta-gplv2/recipes-extended/mc/mc_4.7.5.2.bb
new file mode 100644
index 0000000..ca84966
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/mc/mc_4.7.5.2.bb
@@ -0,0 +1,48 @@
+SUMMARY = "Midnight Commander is an ncurses based file manager"
+HOMEPAGE = "http://www.midnight-commander.org/"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
+SECTION = "console/utils"
+DEPENDS = "ncurses glib-2.0"
+RDEPENDS_${PN} = "ncurses-terminfo"
+
+PR = "r3"
+
+SRC_URI = "http://www.midnight-commander.org/downloads/${BPN}-${PV}.tar.bz2 \
+           file://mc-CTRL.patch \
+           file://0001-disable-Ctrl-g-key-and-Ctrl-key.patch \
+           "
+
+SRC_URI[md5sum] = "bdae966244496cd4f6d282d80c9cf3c6"
+SRC_URI[sha256sum] = "a68338862bb30017eb65ed569a58e80ab66ae8cef11c886440c9e9f4d1efc6ab"
+
+inherit autotools gettext pkgconfig
+
+EXTRA_OECONF = "--with-screen=ncurses --without-gpm-mouse --without-x --without-samba"
+
+do_install_append () {
+	sed -i -e '1s,#!.*perl,#!${bindir}/env perl,' ${D}${libexecdir}/mc/extfs.d/*
+	sed -i -e '1s,#!.*python,#!${bindir}/env python,' ${D}${libexecdir}/mc/extfs.d/*
+}
+
+PACKAGES =+ "${BPN}-helpers-perl ${BPN}-helpers-python ${BPN}-helpers ${BPN}-fish"
+
+SUMMARY_${BPN}-helpers-perl = "Midnight Commander Perl-based helper scripts"
+FILES_${BPN}-helpers-perl = "${libexecdir}/mc/extfs.d/a+ ${libexecdir}/mc/extfs.d/apt+ \
+                             ${libexecdir}/mc/extfs.d/deb ${libexecdir}/mc/extfs.d/deba \
+                             ${libexecdir}/mc/extfs.d/debd ${libexecdir}/mc/extfs.d/dpkg+ \
+                             ${libexecdir}/mc/extfs.d/mailfs ${libexecdir}/mc/extfs.d/patchfs \ 
+                             ${libexecdir}/mc/extfs.d/rpms+ ${libexecdir}/mc/extfs.d/ulib \ 
+                             ${libexecdir}/mc/extfs.d/uzip"
+RDEPENDS_${BPN}-helpers-perl = "perl"
+
+SUMMARY_${BPN}-helpers-python = "Midnight Commander Python-based helper scripts"
+FILES_${BPN}-helpers-python = "${libexecdir}/mc/extfs.d/s3+ ${libexecdir}/mc/extfs.d/uc1541"
+RDEPENDS_${BPN}-helpers-python = "python"
+
+SUMMARY_${BPN}-helpers = "Midnight Commander shell helper scripts"
+FILES_${BPN}-helpers = "${libexecdir}/mc/extfs.d/* ${libexecdir}/mc/ext.d/*"
+
+SUMMARY_${BPN}-fish = "Midnight Commander Fish scripts"
+FILES_${BPN}-fish = "${libexecdir}/mc/fish"
+
diff --git a/meta/meta-gplv2/recipes-extended/msmtp/files/msmtp-fixup-api-and-compiler-warning.patch b/meta/meta-gplv2/recipes-extended/msmtp/files/msmtp-fixup-api-and-compiler-warning.patch
new file mode 100644
index 0000000..14c95d7
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/msmtp/files/msmtp-fixup-api-and-compiler-warning.patch
@@ -0,0 +1,244 @@
+msmtp: fixup api and compiler warnings
+
+Upstream-Status: Inappropriate [upstream rewrote with GPLv3]
+
+Author: Morgan Little <morgan.little@windriver.com>
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+
+diff -Naur msmtp-1.4.12.orig/configure.ac msmtp-1.4.12/configure.ac
+--- msmtp-1.4.12.orig/configure.ac
++++ msmtp-1.4.12/configure.ac
+@@ -40,8 +40,8 @@
+ dnl System
+ case "${target}" in *-*-mingw32*) windows=yes ;; *) windows=no ;; esac
+ 
+-dnl gnulib 
+-gl_INIT
++#dnl gnulib 
++#gl_INIT
+ 
+ dnl Gettext
+ AM_GNU_GETTEXT([external])
+diff -Naur msmtp-1.4.12.orig/gnulib/base64.c msmtp-1.4.12/gnulib/base64.c
+--- msmtp-1.4.12.orig/gnulib/base64.c
++++ msmtp-1.4.12/gnulib/base64.c
+@@ -64,8 +64,8 @@
+    possible.  If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero
+    terminate the output buffer. */
+ void
+-base64_encode (const char *restrict in, size_t inlen,
+-	       char *restrict out, size_t outlen)
++base64_encode (const char *in, size_t inlen,
++	       char *out, size_t outlen)
+ {
+   static const char b64str[64] =
+     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+@@ -310,8 +310,8 @@
+    that, when applicable, you must remove any line terminators that is
+    part of the data stream before calling this function.  */
+ bool
+-base64_decode (const char *restrict in, size_t inlen,
+-	       char *restrict out, size_t *outlen)
++base64_decode (const char *in, size_t inlen,
++	       char *out, size_t *outlen)
+ {
+   size_t outleft = *outlen;
+ 
+diff -Naur msmtp-1.4.12.orig/gnulib/base64.h msmtp-1.4.12/gnulib/base64.h
+--- msmtp-1.4.12.orig/gnulib/base64.h
++++ msmtp-1.4.12/gnulib/base64.h
+@@ -31,13 +31,13 @@
+ 
+ extern bool isbase64 (char ch);
+ 
+-extern void base64_encode (const char *restrict in, size_t inlen,
+-			   char *restrict out, size_t outlen);
++extern void base64_encode (const char *in, size_t inlen,
++			   char *out, size_t outlen);
+ 
+ extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
+ 
+-extern bool base64_decode (const char *restrict in, size_t inlen,
+-			   char *restrict out, size_t *outlen);
++extern bool base64_decode (const char *in, size_t inlen,
++			   char *out, size_t *outlen);
+ 
+ extern bool base64_decode_alloc (const char *in, size_t inlen,
+ 				 char **out, size_t *outlen);
+diff -Naur msmtp-1.4.12.orig/gnulib/Makefile.am msmtp-1.4.12/gnulib/Makefile.am
+--- msmtp-1.4.12.orig/gnulib/Makefile.am
++++ msmtp-1.4.12/gnulib/Makefile.am
+@@ -59,20 +59,18 @@
+ 
+ ## begin gnulib module crypto/hmac-md5
+ 
++libgnu_a_SOURCES += hmac-md5.c
+ 
+ EXTRA_DIST += hmac-md5.c hmac.h
+ 
+-EXTRA_libgnu_a_SOURCES += hmac-md5.c
+-
+ ## end   gnulib module crypto/hmac-md5
+ 
+ ## begin gnulib module crypto/md5
+ 
++libgnu_a_SOURCES += md5.c
+ 
+ EXTRA_DIST += md5.c md5.h
+ 
+-EXTRA_libgnu_a_SOURCES += md5.c
+-
+ ## end   gnulib module crypto/md5
+ 
+ ## begin gnulib module getdelim
+@@ -149,11 +147,10 @@
+ 
+ ## begin gnulib module memxor
+ 
++libgnu_a_SOURCES += memxor.c
+ 
+ EXTRA_DIST += memxor.c memxor.h
+ 
+-EXTRA_libgnu_a_SOURCES += memxor.c
+-
+ ## end   gnulib module memxor
+ 
+ ## begin gnulib module size_max
+@@ -219,47 +216,6 @@
+ 
+ ## end   gnulib module stdint
+ 
+-## begin gnulib module stdio
+-
+-BUILT_SOURCES += stdio.h
+-
+-# We need the following in order to create <stdio.h> when the system
+-# doesn't have one that works with the given compiler.
+-stdio.h: stdio_.h
+-	rm -f $@-t $@
+-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+-	  sed -e 's|@''ABSOLUTE_STDIO_H''@|$(ABSOLUTE_STDIO_H)|g' \
+-	      -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
+-	      -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
+-	      -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
+-	      -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
+-	      -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
+-	      -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
+-	      -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
+-	      -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
+-	      -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+-	      -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
+-	      -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
+-	      -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
+-	      -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
+-	      -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
+-	      -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
+-	      -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
+-	      -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
+-	      -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
+-	      -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
+-	      -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
+-	      -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+-	      -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+-	      < $(srcdir)/stdio_.h; \
+-	} > $@-t
+-	mv $@-t $@
+-MOSTLYCLEANFILES += stdio.h stdio.h-t
+-
+-EXTRA_DIST += stdio_.h
+-
+-## end   gnulib module stdio
+-
+ ## begin gnulib module sys_socket
+ 
+ BUILT_SOURCES += $(SYS_SOCKET_H)
+@@ -302,40 +258,6 @@
+ 
+ ## end   gnulib module sysexits
+ 
+-## begin gnulib module unistd
+-
+-BUILT_SOURCES += unistd.h
+-
+-# We need the following in order to create an empty placeholder for
+-# <unistd.h> when the system doesn't have one.
+-unistd.h: unistd_.h
+-	rm -f $@-t $@
+-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+-	  sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
+-	      -e 's|@''ABSOLUTE_UNISTD_H''@|$(ABSOLUTE_UNISTD_H)|g' \
+-	      -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
+-	      -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
+-	      -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
+-	      -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
+-	      -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
+-	      -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
+-	      -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
+-	      -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
+-	      -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+-	      -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
+-	      -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
+-	      -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
+-	      -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
+-	      -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+-	      < $(srcdir)/unistd_.h; \
+-	} > $@-t
+-	mv $@-t $@
+-MOSTLYCLEANFILES += unistd.h unistd.h-t
+-
+-EXTRA_DIST += unistd_.h
+-
+-## end   gnulib module unistd
+-
+ ## begin gnulib module vasnprintf
+ 
+ 
+@@ -375,11 +297,10 @@
+ 
+ ## begin gnulib module xalloc
+ 
++libgnu_a_SOURCES += xmalloc.c
+ 
+ EXTRA_DIST += xalloc.h xmalloc.c
+ 
+-EXTRA_libgnu_a_SOURCES += xmalloc.c
+-
+ ## end   gnulib module xalloc
+ 
+ ## begin gnulib module xsize
+diff -Naur msmtp-1.4.12.orig/gnulib/memxor.c msmtp-1.4.12/gnulib/memxor.c
+--- msmtp-1.4.12.orig/gnulib/memxor.c
++++ msmtp-1.4.12/gnulib/memxor.c
+@@ -23,7 +23,7 @@
+ #include "memxor.h"
+ 
+ void *
+-memxor (void *restrict dest, const void *restrict src, size_t n)
++memxor (void *dest, const void *src, size_t n)
+ {
+   char const *s = src;
+   char *d = dest;
+diff -Naur msmtp-1.4.12.orig/gnulib/memxor.h msmtp-1.4.12/gnulib/memxor.h
+--- msmtp-1.4.12.orig/gnulib/memxor.h
++++ msmtp-1.4.12/gnulib/memxor.h
+@@ -26,6 +26,6 @@
+ /* Compute binary exclusive OR of memory areas DEST and SRC, putting
+    the result in DEST, of length N bytes.  Returns a pointer to
+    DEST. */
+-void *memxor (void *restrict dest, const void *restrict src, size_t n);
++void *memxor (void *dest, const void *src, size_t n);
+ 
+ #endif /* MEMXOR_H */
+diff -Naur msmtp-1.4.12.orig/gnulib/xsize.h msmtp-1.4.12/gnulib/xsize.h
+--- msmtp-1.4.12.orig/gnulib/xsize.h
++++ msmtp-1.4.12/gnulib/xsize.h
+@@ -24,9 +24,7 @@
+ 
+ /* Get SIZE_MAX.  */
+ #include <limits.h>
+-#if HAVE_STDINT_H
+ # include <stdint.h>
+-#endif
+ 
+ /* The size of memory objects is often computed through expressions of
+    type size_t. Example:
diff --git a/meta/meta-gplv2/recipes-extended/msmtp/files/msmtp-replace-deprecated-function.patch b/meta/meta-gplv2/recipes-extended/msmtp/files/msmtp-replace-deprecated-function.patch
new file mode 100644
index 0000000..ca1fd0e
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/msmtp/files/msmtp-replace-deprecated-function.patch
@@ -0,0 +1,60 @@
+From 090017efca9396a7cef0ccdc645a88c5457c63b8 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Wed, 29 Jun 2016 01:22:46 -0400
+Subject: [PATCH] Replace deprecated function gnutls_protocol_set_priority
+
+The function gnutls_protocol_set_priority is deprecated
+since GnuTLS >= 2.12.0 and replaced by gnutls_priority_set_direct.
+
+Reference:
+http://www.gnutls.org/manual/html_node/Upgrading-from-previous-versions.html#Upgrading-from-previous-versions
+
+Upstream-Status: Inappropriate [upstream rewrote with GPLv3]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+---
+ src/tls.c | 20 +++++++++++++++++---
+ 1 file changed, 17 insertions(+), 3 deletions(-)
+
+diff --git a/src/tls.c b/src/tls.c
+index 10818fa..881e94b 100644
+--- a/src/tls.c
++++ b/src/tls.c
+@@ -928,7 +928,15 @@ int tls_init(tls_t *tls, const char *key_file, const char *cert_file,
+ 	const char *trust_file, int force_sslv3, char **errstr)
+ {
+ #ifdef HAVE_LIBGNUTLS
++#if GNUTLS_VERSION_MAJOR >= 2 && GNUTLS_VERSION_MINOR >= 12
++    const char *force_sslv3_str = ":-VERS-TLS-ALL:+VERS-SSL3.0";
++#else
++    const char *force_sslv3_str =
++        ":-VERS-TLS1.2:-VERS-TLS1.1:-VERS-TLS1.0:+VERS-SSL3.0";
++#endif
+     int error_code;
++    char *priorities;
++    const char *error_pos;
+     
+     if ((error_code = gnutls_init(&tls->session, GNUTLS_CLIENT)) != 0)
+     {
+@@ -945,9 +953,15 @@ int tls_init(tls_t *tls, const char *key_file, const char *cert_file,
+     }
+     if (force_sslv3)
+     {
+-	const int force_sslv3_proto_prio[2] = { GNUTLS_SSL3, 0 };
+-	if ((error_code = gnutls_protocol_set_priority(tls->session, 
+-			force_sslv3_proto_prio)) != 0)
++	priorities = xstrdup("NORMAL");
++	error_pos = NULL;
++
++	priorities = xrealloc(priorities,
++		strlen(priorities) + strlen(force_sslv3_str) + 1);
++	strcat(priorities, force_sslv3_str);
++
++	if ((error_code = gnutls_priority_set_direct(tls->session,
++			priorities, &error_pos)) != 0)
+ 	{
+ 	    *errstr = xasprintf(_("cannot force SSLv3: %s"),
+ 	    	    gnutls_strerror(error_code));
+-- 
+2.8.1
+
diff --git a/meta/meta-gplv2/recipes-extended/msmtp/msmtp_1.4.12.bb b/meta/meta-gplv2/recipes-extended/msmtp/msmtp_1.4.12.bb
new file mode 100644
index 0000000..e03d432
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/msmtp/msmtp_1.4.12.bb
@@ -0,0 +1,35 @@
+SUMMARY = "msmtp is an SMTP client."
+DESCRIPTION = "A sendmail replacement for use in MTAs like mutt"
+HOMEPAGE = "http://msmtp.sourceforge.net/"
+SECTION = "console/network"
+
+LICENSE = "GPLv2"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+
+DEPENDS = "zlib gnutls"
+
+SRC_URI = "http://sourceforge.net/projects/msmtp/files/msmtp/${PV}/${BPN}-${PV}.tar.bz2 \
+           file://msmtp-fixup-api-and-compiler-warning.patch \
+           file://msmtp-replace-deprecated-function.patch \
+           "
+
+SRC_URI[md5sum] = "ba5b61d5f7667d288f1cfadccfff8ac5"
+SRC_URI[sha256sum] = "ab794bb014cdaeae0a1460a7aca1869dab8c93383bf01f41aca41b3d99b69509"
+
+EXTRA_OECONF += "--with-libgnutls-prefix=${STAGING_DIR}/${HOST_SYS}"
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[libidn] = "--with-libidn,--without-libidn,libidn"
+
+inherit gettext autotools update-alternatives
+
+ALTERNATIVE_${PN} = "sendmail"
+ALTERNATIVE_TARGET[sendmail] = "${bindir}/msmtp"
+ALTERNATIVE_LINK_NAME[sendmail] = "${sbindir}/sendmail"
+ALTERNATIVE_PRIORITY = "100"
+
+pkg_postinst_${PN}_linuxstdbase () {
+    # /usr/lib/sendmail is required by LSB specification
+    [ ! -L $D/usr/lib/sendmail ] && ln -sf ${sbindir}/sendmail $D/usr/lib
+}
diff --git a/meta/meta-gplv2/recipes-extended/sed/sed-4.1.2/Makevars b/meta/meta-gplv2/recipes-extended/sed/sed-4.1.2/Makevars
new file mode 100644
index 0000000..8b09f53
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/sed/sed-4.1.2/Makevars
@@ -0,0 +1,25 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Free Software Foundation, Inc.
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
diff --git a/meta/meta-gplv2/recipes-extended/sed/sed-4.1.2/fix_return_type.patch b/meta/meta-gplv2/recipes-extended/sed/sed-4.1.2/fix_return_type.patch
new file mode 100644
index 0000000..836551e
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/sed/sed-4.1.2/fix_return_type.patch
@@ -0,0 +1,18 @@
+Upstream-Status: Pending
+
+Change the getline return type to match its declaration.
+
+Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
+
+diff -urN sed-4.1.2-orig/lib/getline.c sed-4.1.2/lib/getline.c
+--- sed-4.1.2-orig/lib/getline.c	2010-08-31 08:47:50.070094024 +0800
++++ sed-4.1.2/lib/getline.c	2010-08-31 08:48:50.982178172 +0800
+@@ -30,7 +30,7 @@
+    necessary.  Returns the number of characters read (not including the
+    null terminator), or -1 on error or EOF.  */
+ 
+-size_t
++ssize_t
+ getline (lineptr, n, stream)
+      char **lineptr;
+      size_t *n;
diff --git a/meta/meta-gplv2/recipes-extended/sed/sed-4.1.2/sed-4.1.2_fix_for_automake-1.12.patch b/meta/meta-gplv2/recipes-extended/sed/sed-4.1.2/sed-4.1.2_fix_for_automake-1.12.patch
new file mode 100644
index 0000000..86b64a1
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/sed/sed-4.1.2/sed-4.1.2_fix_for_automake-1.12.patch
@@ -0,0 +1,37 @@
+Upstream-Status: Pending
+
+automake-1.12.x has deprecated use of @mkdir_p@, fix the issue by using @MKDIR_P@ instead.
+
+Avoid this build issue:
+| make[1]: mkdir_p@: Command not found
+| make[1]: *** [install-data-yes] Error 127
+
+Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
+2012/07/13
+
+Index: sed-4.1.2/intl/Makefile.in
+===================================================================
+--- sed-4.1.2.orig/intl/Makefile.in
++++ sed-4.1.2/intl/Makefile.in
+@@ -40,7 +40,7 @@ subdir = intl
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+ mkinstalldirs = $(mkdir_p)
+-mkdir_p = @mkdir_p@
++mkdir_p = @MKDIR_P@
+ 
+ l = @INTL_LIBTOOL_SUFFIX_PREFIX@
+ 
+Index: sed-4.1.2/po/Makefile.in.in
+===================================================================
+--- sed-4.1.2.orig/po/Makefile.in.in
++++ sed-4.1.2/po/Makefile.in.in
+@@ -29,7 +29,7 @@ gettextsrcdir = $(datadir)/gettext/po
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+ mkinstalldirs = $(mkdir_p)
+-mkdir_p = @mkdir_p@
++mkdir_p = @MKDIR_P@
+ 
+ CC = @CC@
+ GMSGFMT = @GMSGFMT@
diff --git a/meta/meta-gplv2/recipes-extended/sed/sed_4.1.2.bb b/meta/meta-gplv2/recipes-extended/sed/sed_4.1.2.bb
new file mode 100644
index 0000000..40e3a53
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/sed/sed_4.1.2.bb
@@ -0,0 +1,35 @@
+SUMMARY = "Stream EDitor (text filtering utility)"
+HOMEPAGE = "http://www.gnu.org/software/sed/"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
+                    file://sed/sed.h;beginline=1;endline=17;md5=e00ffd1837f298439a214fd197f6a407"
+SECTION = "console/utils"
+PR = "r7"
+
+SRC_URI = "${GNU_MIRROR}/sed/sed-${PV}.tar.gz \
+           file://fix_return_type.patch \
+           file://sed-4.1.2_fix_for_automake-1.12.patch \
+           file://Makevars"
+
+SRC_URI[md5sum] = "928f0e06422f414091917401f1a834d0"
+SRC_URI[sha256sum] = "638e837ba765d5da0a30c98b57c2953cecea96827882f594612acace93ceeeab"
+
+inherit autotools texinfo update-alternatives gettext
+
+do_configure_prepend () {
+	cp ${WORKDIR}/Makevars ${S}/po/
+}
+
+do_install () {
+	autotools_do_install
+	install -d ${D}${base_bindir}
+	if [ ! ${D}${bindir} -ef ${D}${base_bindir} ]; then
+	    mv ${D}${bindir}/sed ${D}${base_bindir}/sed
+	    rmdir ${D}${bindir}/
+	fi
+}
+
+ALTERNATIVE_${PN} = "sed"
+ALTERNATIVE_LINK_NAME[sed] = "${base_bindir}/sed"
+ALTERNATIVE_PRIORITY = "100"
+
diff --git a/meta/meta-gplv2/recipes-extended/tar/tar-1.17/avoid_heap_overflow.patch b/meta/meta-gplv2/recipes-extended/tar/tar-1.17/avoid_heap_overflow.patch
new file mode 100644
index 0000000..af5026f
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/tar/tar-1.17/avoid_heap_overflow.patch
@@ -0,0 +1,23 @@
+Upstream-Status: Inappropriate [bugfix: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-0624]
+CVE: CVE-2010-0624
+
+This patch avoids heap overflow reported by :
+http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-0624
+
+This is a clean patch for the GPLv2 tar recipe.
+
+Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/25
+
+Index: tar-1.17/lib/rtapelib.c
+===================================================================
+--- tar-1.17.orig/lib/rtapelib.c
++++ tar-1.17/lib/rtapelib.c
+@@ -570,7 +570,7 @@ rmt_read__ (int handle, char *buffer, si
+ 
+   sprintf (command_buffer, "R%lu\n", (unsigned long) length);
+   if (do_command (handle, command_buffer) == -1
+-      || (status = get_status (handle)) == SAFE_READ_ERROR)
++      || ((status = get_status (handle)) == SAFE_READ_ERROR) || (status > length))
+     return SAFE_READ_ERROR;
+ 
+   for (counter = 0; counter < status; counter += rlen, buffer += rlen)
diff --git a/meta/meta-gplv2/recipes-extended/tar/tar-1.17/gcc43build.patch b/meta/meta-gplv2/recipes-extended/tar/tar-1.17/gcc43build.patch
new file mode 100644
index 0000000..f8059a0
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/tar/tar-1.17/gcc43build.patch
@@ -0,0 +1,37 @@
+Upstream-Status: Inappropriate [licensing]
+
+# Fix errors when built with gcc 4.3
+# Patch taken from Debian bug #452096
+
+diff -urN tar-1.17.orig/lib/argp-fmtstream.h tar-1.17/lib/argp-fmtstream.h
+--- tar-1.17.orig/lib/argp-fmtstream.h	2006-01-11 12:24:05.000000000 -0800
++++ tar-1.17/lib/argp-fmtstream.h	2010-07-22 22:36:12.000000000 -0700
+@@ -198,7 +198,11 @@
+ #endif
+ 
+ #ifndef ARGP_FS_EI
+-#define ARGP_FS_EI extern inline
++ #if defined __GNUC_STDC_INLINE__
++   #define ARGP_FS_EI extern inline __attribute__((__gnu_inline__))
++ #else
++   #define ARGP_FS_EI extern inline
++ #endif
+ #endif
+ 
+ ARGP_FS_EI size_t
+diff -urN tar-1.17.orig/lib/argp.h tar-1.17/lib/argp.h
+--- tar-1.17.orig/lib/argp.h	2007-03-30 00:09:11.000000000 -0700
++++ tar-1.17/lib/argp.h	2010-07-22 22:38:44.000000000 -0700
+@@ -580,7 +580,11 @@
+ # endif
+ 
+ # ifndef ARGP_EI
+-#  define ARGP_EI extern __inline__
++#  if defined __GNUC_STDC_INLINE__
++#    define ARGP_EI extern __inline__ __attribute__((__gnu_inline__))
++#  else
++#    define ARGP_EI extern __inline__
++#  endif
+ # endif
+ 
+ ARGP_EI void
diff --git a/meta/meta-gplv2/recipes-extended/tar/tar-1.17/m4extensions.patch b/meta/meta-gplv2/recipes-extended/tar/tar-1.17/m4extensions.patch
new file mode 100644
index 0000000..30534c2
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/tar/tar-1.17/m4extensions.patch
@@ -0,0 +1,30 @@
+Upstream-Status: Inappropriate [licensing]
+
+# Define AC_USE_SYSTEM_EXTENSIONS only if it was previously undefined.
+# This is needed to configure correctly with newer versions of autoconf.
+
+--- tar-1.17/m4/extensions.m4.orig	2010-07-22 22:21:35.000000000 -0700
++++ tar-1.17/m4/extensions.m4	2010-07-22 22:23:41.000000000 -0700
+@@ -1,4 +1,4 @@
+-# serial 4  -*- Autoconf -*-
++# serial 5  -*- Autoconf -*-
+ # Enable extensions on systems that normally disable them.
+ 
+ # Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+@@ -16,6 +16,7 @@
+ # ------------------------
+ # Enable extensions on systems that normally disable them,
+ # typically due to standards-conformance issues.
++m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [], [
+ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+ [
+   AC_BEFORE([$0], [AC_COMPILE_IFELSE])
+@@ -48,7 +49,7 @@
+     AC_DEFINE([__EXTENSIONS__])
+   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+   AC_DEFINE([_TANDEM_SOURCE])
+-])
++])])
+ 
+ # gl_USE_SYSTEM_EXTENSIONS
+ # ------------------------
diff --git a/meta/meta-gplv2/recipes-extended/tar/tar.inc b/meta/meta-gplv2/recipes-extended/tar/tar.inc
new file mode 100644
index 0000000..93e4da1
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/tar/tar.inc
@@ -0,0 +1,52 @@
+SUMMARY = "GNU file archiving program"
+DESCRIPTION = "GNU tar saves many files together into a single tape \
+or disk archive, and can restore individual files from the archive."
+HOMEPAGE = "http://www.gnu.org/software/tar/"
+SECTION = "base"
+
+SRC_URI = "${GNU_MIRROR}/tar/tar-${PV}.tar.bz2"
+
+inherit autotools gettext texinfo
+
+EXTRA_OECONF += "DEFAULT_RMT_DIR=${base_sbindir}"
+
+# Let aclocal use the relative path for the m4 file rather than the
+# absolute since tar has a lot of m4 files, otherwise there might
+# be an "Argument list too long" error when it is built in a long/deep
+# directory.
+acpaths = "-I ./m4"
+
+do_install () {
+    autotools_do_install
+    ln -s tar ${D}${bindir}/gtar
+}
+
+do_install_append_class-target() {
+    if [ "${base_bindir}" != "${bindir}" ]; then
+        install -d ${D}${base_bindir}
+        mv ${D}${bindir}/tar ${D}${base_bindir}/tar
+        mv ${D}${bindir}/gtar ${D}${base_bindir}/gtar
+        rmdir ${D}${bindir}/
+    fi
+}
+
+PACKAGES =+ "${PN}-rmt"
+
+FILES_${PN}-rmt = "${base_sbindir}/rmt*"
+
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+
+ALTERNATIVE_${PN} = "tar"
+ALTERNATIVE_${PN}-rmt = "rmt"
+ALTERNATIVE_${PN}_class-nativesdk = ""
+ALTERNATIVE_${PN}-rmt_class-nativesdk = ""
+
+ALTERNATIVE_LINK_NAME[tar] = "${base_bindir}/tar"
+ALTERNATIVE_LINK_NAME[rmt] = "${base_sbindir}/rmt"
+
+PROVIDES_append_class-native = " tar-replacement-native"
+NATIVE_PACKAGE_PATH_SUFFIX = "/${PN}"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/meta-gplv2/recipes-extended/tar/tar_1.17.bb b/meta/meta-gplv2/recipes-extended/tar/tar_1.17.bb
new file mode 100644
index 0000000..b9ca206
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/tar/tar_1.17.bb
@@ -0,0 +1,14 @@
+require tar.inc
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
+
+PR = "r3"
+
+SRC_URI += "file://m4extensions.patch \
+    file://gcc43build.patch \
+    file://avoid_heap_overflow.patch \
+    "
+
+SRC_URI[md5sum] = "c6c4f1c075dbf0f75c29737faa58f290"
+SRC_URI[sha256sum] = "19f9021dda51a16295e4706e80870e71f87107675e51c176a491eba0fc4ca492"
diff --git a/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/check-locale-h.patch b/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/check-locale-h.patch
new file mode 100644
index 0000000..f4d6660
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/check-locale-h.patch
@@ -0,0 +1,28 @@
+fix the macro check
+
+Upstream-Status: Pending
+
+configure does not check if locale.h exists, but check setlocale,
+if setlocale exist, the locale.h should exist.
+
+Signed-off-by: Roy Li <rongqing.li@windriver.com>
+---
+ lib/system.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/system.h b/lib/system.h
+index 946eb3c..c70037b 100644
+--- a/lib/system.h
++++ b/lib/system.h
+@@ -42,7 +42,7 @@ extern char *substring (const char *, const char *);
+ #include <ctype.h>
+ 
+ /* All systems nowadays probably have these functions, but ... */
+-#ifdef HAVE_LOCALE_H
++#ifdef HAVE_SETLOCALE
+ #include <locale.h>
+ #endif
+ #ifndef HAVE_SETLOCALE
+-- 
+1.7.10.4
+
diff --git a/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/do-compile-native-tools.patch b/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/do-compile-native-tools.patch
new file mode 100644
index 0000000..81ebe26
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/do-compile-native-tools.patch
@@ -0,0 +1,49 @@
+From 458e9450cecf703f55536e609365162719585900 Mon Sep 17 00:00:00 2001
+From: "Roy.Li" <rongqing.li@windriver.com>
+Date: Wed, 10 Sep 2014 17:03:29 +0800
+Subject: [PATCH] do not compile host tools, since we have native
+
+Upstream-Status: Pending
+
+Signed-off-by: Roy.Li <rongqing.li@windriver.com>
+---
+ configure.ac | 23 +----------------------
+ 1 file changed, 1 insertion(+), 22 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b46130d..cf58654 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -90,28 +90,7 @@ AC_CANONICAL_BUILD
+ # $native_tools is also added to SUBDIRS in the main Makefile.am,
+ # so that make compiles the native tools first.
+ #
+-if test "$cross_compiling" = no; then
+-  native_tools=
+-else
+-  native_tools=tools
+-  test -d "$native_tools" || mkdir "$native_tools"
+-  confdir=`(cd "$srcdir";pwd)`
+-  # Make sure the secondary configure won't fail with
+-  # "error: source directory already configured".
+-  rm -f config.status
+-  AC_MSG_NOTICE([[Doing configure of native tools (${build}).]])
+-  cd "$native_tools" || exit 1
+-  # Run secondary configure in alternate environment or
+-  # it gets the wrong CC etc.  env -i gives this build host configure
+-  # a clean environment.
+-  env -i CC="${BUILD_CC}" AR="${BUILD_AR}" RANLIB="${BUILD_RANLIB}" \
+-      PATH="${PATH}" \
+-      tools_only=1 \
+-    ${confdir}/configure --build=${build} --host=${build} \
+-                         --disable-rpath --disable-nls
+-  cd .. || exit 1
+-  AC_MSG_NOTICE([[Continuing with main configure (${host}).]])
+-fi
++native_tools=
+ AC_SUBST(native_tools)
+ AM_CONDITIONAL(TOOLS_ONLY, [[test "x$tools_only" = x1]])
+ 
+-- 
+1.9.1
+
diff --git a/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/use_host_makedoc.patch b/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/use_host_makedoc.patch
new file mode 100644
index 0000000..11e21aa
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/use_host_makedoc.patch
@@ -0,0 +1,17 @@
+Upstream-Status: Inappropriate [cross build specific]
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+
+Index: texinfo-5.1/info/Makefile.am
+===================================================================
+--- texinfo-5.1.orig/info/Makefile.am
++++ texinfo-5.1/info/Makefile.am
+@@ -67,7 +67,7 @@ cmd_sources = $(srcdir)/session.c $(srcdir)/echo-area.c $(srcdir)/infodoc.c \
+ # The $(EXEEXT) should be added by Automake, but isn't. Fine.
+ $(generated_sources): makedoc$(EXEEXT) $(cmd_sources)
+ 	rm -f $(generated_sources)
+-	$(top_builddir)/$(native_tools)/info/makedoc $(cmd_sources)
++	makedoc $(cmd_sources)
+ 
+ # The following hack is necessary to hint make before the automatic
+ # dependencies are built.
diff --git a/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/using-native-makeinfo.patch b/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/using-native-makeinfo.patch
new file mode 100644
index 0000000..2297051
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/texinfo/texinfo-4.8/using-native-makeinfo.patch
@@ -0,0 +1,24 @@
+From 9b0df7d6d3c18cfac82c291d60a5357d1bc8d9d0 Mon Sep 17 00:00:00 2001
+From: "Roy.Li" <rongqing.li@windriver.com>
+Date: Wed, 10 Sep 2014 17:10:03 +0800
+Subject: [PATCH] using native makeinfo
+
+Upstream-Status: Pending
+
+Signed-off-by: Roy.Li <rongqing.li@windriver.com>
+---
+ doc/Makefile.am                                |   2 +-
+
+diff --git a/doc/Makefile.am b/doc/Makefile.am
+index 63df818..b6ceb34 100644
+--- a/doc/Makefile.am
++++ b/doc/Makefile.am
+@@ -19,7 +19,7 @@ man_MANS = info.1 infokey.1 install-info.1 makeinfo.1 texindex.1 texi2dvi.1 \
+ 
+ # Use the programs built in our distribution, taking account of possible
+ # cross-compiling.
+-MAKEINFO = $(top_builddir)/$(native_tools)/makeinfo/makeinfo
++MAKEINFO = makeinfo
+ INSTALL_INFO = $(top_builddir)/$(native_tools)/util/install-info
+ 
+ TXI_XLATE = txi-cs.tex txi-de.tex txi-en.tex txi-es.tex txi-fr.tex \
diff --git a/meta/meta-gplv2/recipes-extended/texinfo/texinfo_4.8.bb b/meta/meta-gplv2/recipes-extended/texinfo/texinfo_4.8.bb
new file mode 100644
index 0000000..13678e0
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/texinfo/texinfo_4.8.bb
@@ -0,0 +1,55 @@
+SUMMARY = "Documentation system for on-line information and printed output"
+DESCRIPTION = "Texinfo is a documentation system that can produce both \
+online information and printed output from a single source file. The \
+GNU Project uses the Texinfo file format for most of its documentation."
+HOMEPAGE = "http://www.gnu.org/software/texinfo/"
+SECTION = "console/utils"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+
+PROVIDES_append_class-native = " texinfo-4.8-replacement-native"
+
+DEPENDS = "zlib ncurses texinfo-4.8-replacement-native"
+DEPENDS_class-native = "zlib-native ncurses-native"
+
+TARGET_PATCH = "file://use_host_makedoc.patch \
+           file://using-native-makeinfo.patch \
+"
+TARGET_PATCH_class-native = ""
+
+SRC_URI = "${GNU_MIRROR}/texinfo/${BP}.tar.gz \
+           file://check-locale-h.patch \
+           file://do-compile-native-tools.patch \
+           ${TARGET_PATCH} \
+          "
+
+SRC_URI[md5sum] = "4e9a1a591ed236003d0d4b008bf07eef"
+SRC_URI[sha256sum] = "1f3cdeebe65fdf510f55d765ab1031b54416aa5bc2635b6a54ef9bcb2367c917"
+
+tex_texinfo = "texmf/tex/texinfo"
+
+inherit gettext autotools
+
+do_install_append() {
+	mkdir -p ${D}${datadir}/${tex_texinfo}
+	install -p -m644 ${S}/doc/texinfo.tex ${S}/doc/txi-??.tex ${D}${datadir}/${tex_texinfo}
+}
+
+do_install_append_class-native() {
+	install -m 755 info/makedoc ${D}${bindir}
+	install -m 755 makeinfo/makeinfo ${D}${bindir}
+}
+
+PACKAGES += "info info-doc"
+
+FILES_info = "${bindir}/info ${bindir}/infokey ${bindir}/install-info"
+FILES_info-doc = "${infodir}/info.info ${infodir}/dir ${infodir}/info-*.info \
+                  ${mandir}/man1/info.1* ${mandir}/man5/info.5* \
+                  ${mandir}/man1/infokey.1* ${mandir}/man1/install-info.1*"
+
+FILES_${PN} = "${bindir}/makeinfo ${bindir}/texi* ${bindir}/pdftexi2dvi ${bindir}/pod2texi ${datadir}/texinfo"
+FILES_${PN}-doc = "${infodir}/texinfo* \
+                   ${datadir}/${tex_texinfo} \
+                   ${mandir}/man1 ${mandir}/man5"
+
+BBCLASSEXTEND = "native"
diff --git a/meta/meta-gplv2/recipes-extended/time/time-1.7/debian.patch b/meta/meta-gplv2/recipes-extended/time/time-1.7/debian.patch
new file mode 100644
index 0000000..23ea0e3
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/time/time-1.7/debian.patch
@@ -0,0 +1,1301 @@
+Upstream-Status: Backport
+
+--- time-1.7.orig/configure.in
++++ time-1.7/configure.in
+@@ -1,11 +1,8 @@
+ 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
++AM_MAINTAINER_MODE
+ 
+ dnl Checks for programs.
+ AC_PROG_CC
+@@ -15,7 +12,7 @@
+ 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
+--- time-1.7.orig/version.texi
++++ time-1.7/version.texi
+@@ -1,3 +1,3 @@
+-@set UPDATED 12 June 1996
++@set UPDATED 9 May 2002
+ @set EDITION 1.7
+ @set VERSION 1.7
+--- time-1.7.orig/time.c
++++ time-1.7/time.c
+@@ -147,6 +147,10 @@
+   NULL
+ };
+ 
++
++/* If true, do not show the exit message */
++static boolean quiet;
++
+ /* If true, show an English description next to each statistic.  */
+ static boolean verbose;
+ 
+@@ -172,6 +176,7 @@
+   {"help", no_argument, NULL, 'h'},
+   {"output-file", required_argument, NULL, 'o'},
+   {"portability", no_argument, NULL, 'p'},
++  {"quiet", no_argument,NULL, 'q'},
+   {"verbose", no_argument, NULL, 'v'},
+   {"version", no_argument, NULL, 'V'},
+   {NULL, no_argument, NULL, 0}
+@@ -333,7 +338,8 @@
+   else if (WIFSIGNALED (resp->waitstatus))
+     fprintf (fp, "Command terminated by signal %d\n",
+ 	     WTERMSIG (resp->waitstatus));
+-  else if (WIFEXITED (resp->waitstatus) && WEXITSTATUS (resp->waitstatus))
++  else if (WIFEXITED (resp->waitstatus) && WEXITSTATUS (resp->waitstatus)
++	   && !quiet)
+     fprintf (fp, "Command exited with non-zero status %d\n",
+ 	     WEXITSTATUS (resp->waitstatus));
+ 
+@@ -523,6 +529,7 @@
+   char *format;			/* Format found in environment.  */
+ 
+   /* Initialize the option flags.  */
++  quiet = false;
+   verbose = false;
+   outfile = NULL;
+   outfp = stderr;
+@@ -536,7 +543,7 @@
+   if (format)
+     output_format = format;
+ 
+-  while ((optc = getopt_long (argc, argv, "+af:o:pvV", longopts, (int *) 0))
++  while ((optc = getopt_long (argc, argv, "+af:o:pqvV", longopts, (int *) 0))
+ 	 != EOF)
+     {
+       switch (optc)
+@@ -555,6 +562,9 @@
+ 	case 'p':
+ 	  output_format = posix_format;
+ 	  break;
++	case 'q':
++	  quiet = true;
++	  break;
+ 	case 'v':
+ 	  verbose = true;
+ 	  break;
+@@ -642,9 +652,9 @@
+   fflush (outfp);
+ 
+   if (WIFSTOPPED (res.waitstatus))
+-    exit (WSTOPSIG (res.waitstatus));
++    exit (WSTOPSIG (res.waitstatus) + 128);
+   else if (WIFSIGNALED (res.waitstatus))
+-    exit (WTERMSIG (res.waitstatus));
++    exit (WTERMSIG (res.waitstatus) + 128);
+   else if (WIFEXITED (res.waitstatus))
+     exit (WEXITSTATUS (res.waitstatus));
+ }
+@@ -657,7 +667,7 @@
+   fprintf (stream, "\
+ Usage: %s [-apvV] [-f format] [-o file] [--append] [--verbose]\n\
+        [--portability] [--format=format] [--output=file] [--version]\n\
+-       [--help] command [arg...]\n",
++       [--quiet] [--help] command [arg...]\n",
+ 	   program_name);
+   exit (status);
+ }
+--- time-1.7.orig/resuse.h
++++ time-1.7/resuse.h
+@@ -36,19 +36,8 @@
+ # 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.  */
+-struct rusage
+-{
+-  struct timeval ru_utime;	/* User time used.  */
+-  struct timeval ru_stime;	/* System time used.  */
+-  int ru_maxrss, ru_ixrss, ru_idrss, ru_isrss,
+-  ru_minflt, ru_majflt, ru_nswap, ru_inblock, 
+-  ru_oublock, ru_msgsnd, ru_msgrcv, ru_nsignals,
+-  ru_nvcsw, ru_nivcsw;
+-};
+ # endif
+ #endif
+ 
+--- time-1.7.orig/time.texi
++++ time-1.7/time.texi
+@@ -11,6 +11,12 @@
+ @finalout
+ @end iftex
+ 
++@dircategory Individual utilities
++@direntry
++* time: (time).                     Run programs and summarize
++                                    system resource usage.
++@end direntry
++
+ @ifinfo
+ This file documents the the GNU @code{time} command for running programs
+ and summarizing the system resources they use.
+@@ -185,6 +191,10 @@
+ sys %S
+ @end example
+ 
++@item -q
++@itemx --quiet
++Suppress non-zero error code from the executed program.
++
+ @item -v
+ @itemx --verbose
+ @cindex format
+--- time-1.7.orig/time.info
++++ time-1.7/time.info
+@@ -1,5 +1,10 @@
+-This is Info file ./time.info, produced by Makeinfo-1.55 from the input
+-file time.texi.
++This is time.info, produced by makeinfo version 4.1 from time.texi.
++
++INFO-DIR-SECTION Individual utilities
++START-INFO-DIR-ENTRY
++* time: (time).                     Run programs and summarize
++                                    system resource usage.
++END-INFO-DIR-ENTRY
+ 
+    This file documents the the GNU `time' command for running programs
+ and summarizing the system resources they use.
+@@ -31,7 +36,7 @@
+ 
+ * Resource Measurement::  Measuring program resource use.
+ 
+- -- The Detailed Node Listing --
++ --- The Detailed Node Listing ---
+ 
+ Measuring Program Resource Use
+ 
+@@ -58,14 +63,14 @@
+    The `time' command runs another program, then displays information
+ about the resources used by that program, collected by the system while
+ the program was running.  You can select which information is reported
+-and the format in which it is shown (*note Setting Format::.), or have
++and the format in which it is shown (*note Setting Format::), or have
+ `time' save the information in a file instead of displaying it on the
+-screen (*note Redirecting::.).
++screen (*note Redirecting::).
+ 
+    The resources that `time' can report on fall into the general
+ categories of time, memory, and I/O and IPC calls.  Some systems do not
+ provide much information about program resource use; `time' reports
+-unavailable information as zero values (*note Accuracy::.).
++unavailable information as zero values (*note Accuracy::).
+ 
+    The format of the `time' command is:
+ 
+@@ -132,6 +137,10 @@
+           user %U
+           sys %S
+ 
++`-q'
++`--quiet'
++     Suppress non-zero error code from the executed program.
++
+ `-v'
+ `--verbose'
+      Use the built-in verbose format, which displays each available
+@@ -174,7 +183,7 @@
+    The resource specifiers, which are a superset of those recognized by
+ the `tcsh' builtin `time' command, are listed below.  Not all resources
+ are measured by all versions of Unix, so some of the values might be
+-reported as zero (*note Accuracy::.).
++reported as zero (*note Accuracy::).
+ 
+ * Menu:
+ 
+@@ -308,11 +317,11 @@
+ `-o FILE'
+ `--output=FILE'
+      Write the resource use statistics to FILE.  By default, this
+-     *overwrites* the file, destroying the file's previous contents.
++     _overwrites_ the file, destroying the file's previous contents.
+ 
+ `-a'
+ `--append'
+-     *Append* the resource use information to the output file instead
++     _Append_ the resource use information to the output file instead
+      of overwriting it.  This option is only useful with the `-o' or
+      `--output' option.
+ 
+@@ -437,7 +446,7 @@
+ 
+ `-a'
+ `--append'
+-     *Append* the resource use information to the output file instead
++     _Append_ the resource use information to the output file instead
+      of overwriting it.
+ 
+ `-f FORMAT'
+@@ -462,17 +471,17 @@
+ 
+ 
+ Tag Table:
+-Node: Top934
+-Node: Resource Measurement1725
+-Node: Setting Format3678
+-Node: Format String4907
+-Node: Time Resources6214
+-Node: Memory Resources6844
+-Node: I/O Resources7549
+-Node: Command Info8747
+-Node: Redirecting8964
+-Node: Examples9754
+-Node: Accuracy12064
+-Node: Invoking time13586
++Node: Top1115
++Node: Resource Measurement1908
++Node: Setting Format3858
++Node: Format String5164
++Node: Time Resources6470
++Node: Memory Resources7100
++Node: I/O Resources7805
++Node: Command Info9003
++Node: Redirecting9220
++Node: Examples10010
++Node: Accuracy12320
++Node: Invoking time13842
+ 
+ End Tag Table
+--- time-1.7.orig/time.html
++++ time-1.7/time.html
+@@ -0,0 +1,1021 @@
++<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
++                      "http://www.w3.org/TR/html40/loose.dtd">
++<HTML>
++<!-- Created on September, 1 2003 by texi2html 1.66 -->
++<!--
++Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
++            Karl Berry  <karl@freefriends.org>
++            Olaf Bachmann <obachman@mathematik.uni-kl.de>
++            and many others.
++Maintained by: Many creative people <dev@texi2html.cvshome.org>
++Send bugs and suggestions to <users@texi2html.cvshome.org>
++
++-->
++<HEAD>
++<TITLE>Measuring Program Resource Use</TITLE>
++
++<META NAME="description" CONTENT="Measuring Program Resource Use">
++<META NAME="keywords" CONTENT="Measuring Program Resource Use">
++<META NAME="resource-type" CONTENT="document">
++<META NAME="distribution" CONTENT="global">
++<META NAME="Generator" CONTENT="texi2html 1.66">
++
++</HEAD>
++
++<BODY LANG="en" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
++
++<A NAME="SEC_Top"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H1>Measuring Program Resource Use</H1>
++
++<P>
++
++This file documents the the GNU <CODE>time</CODE> command for running programs
++and summarizing the system resources they use.
++This is edition 1.7, for version 1.7.
++</P>
++<P>
++
++</P>
++<TABLE BORDER="0" CELLSPACING="0">
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC1">1. Measuring Program Resource Use</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Measuring program resource use.</TD></TR>
++<TR><TH COLSPAN="3" ALIGN="left" VALIGN="TOP">
++</TH></TR>
++<TR><TH COLSPAN="3" ALIGN="left" VALIGN="TOP"> -- The Detailed Node Listing ---
++</TH></TR>
++<TR><TH COLSPAN="3" ALIGN="left" VALIGN="TOP">
++</TH></TR>
++<TR><TH COLSPAN="3" ALIGN="left" VALIGN="TOP">Measuring Program Resource Use
++</TH></TR>
++<TR><TH COLSPAN="3" ALIGN="left" VALIGN="TOP">
++</TH></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC2">1.1 Setting the Output Format</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Selecting the information reported by <CODE>time</CODE>.</TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC3">1.2 The Format String</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">The information <CODE>time</CODE> can report.</TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC8">1.3 Redirecting Output</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Writing the information to a file.</TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC9">1.4 Examples</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Examples of using <CODE>time</CODE>.</TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC10">1.5 Accuracy</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Limitations on the accuracy of <CODE>time</CODE> output.</TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC11">1.6 Running the <CODE>time</CODE> Command</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Summary of the options to the <CODE>time</CODE> command.</TD></TR>
++<TR><TH COLSPAN="3" ALIGN="left" VALIGN="TOP">
++</TH></TR>
++<TR><TH COLSPAN="3" ALIGN="left" VALIGN="TOP">The Format String
++</TH></TR>
++<TR><TH COLSPAN="3" ALIGN="left" VALIGN="TOP">
++</TH></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC4">1.2.1 Time Resources</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC5">1.2.2 Memory Resources</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC6">1.2.3 I/O Resources</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC7">1.2.4 Command Info</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
++</TABLE>
++<P>
++
++<HR SIZE=1>
++<A NAME="SEC1"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC2"> &gt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[ &lt;&lt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<A NAME="Resource Measurement"></A>
++<H1> 1. Measuring Program Resource Use </H1>
++<!--docid::SEC1::-->
++<P>
++
++The <CODE>time</CODE> command runs another program, then displays information
++about the resources used by that program, collected by the system while
++the program was running.  You can select which information is reported
++and the format in which it is shown (see section <A HREF="time.html#SEC2">1.1 Setting the Output Format</A>), or have
++<CODE>time</CODE> save the information in a file instead of displaying it on the
++screen (see section <A HREF="time.html#SEC8">1.3 Redirecting Output</A>).
++</P>
++<P>
++
++The resources that <CODE>time</CODE> can report on fall into the general
++categories of time, memory, and I/O and IPC calls.  Some systems do not
++provide much information about program resource use; <CODE>time</CODE>
++reports unavailable information as zero values (see section <A HREF="time.html#SEC10">1.5 Accuracy</A>).
++</P>
++<P>
++
++The format of the <CODE>time</CODE> command is:
++</P>
++<P>
++
++<TABLE><tr><td>&nbsp;</td><td class=example><pre>time [option<small>...</small>] <VAR>command</VAR> [<VAR>arg</VAR><small>...</small>]
++</pre></td></tr></table><P>
++
++<A NAME="IDX1"></A>
++<CODE>time</CODE> runs the program <VAR>command</VAR>, with any given arguments
++<VAR>arg</VAR><small>...</small>.  When <VAR>command</VAR> finishes, <CODE>time</CODE> displays
++information about resources used by <VAR>command</VAR>.
++</P>
++<P>
++
++Here is an example of using <CODE>time</CODE> to measure the time and other
++resources used by running the program <CODE>grep</CODE>:
++</P>
++<P>
++
++<TABLE><tr><td>&nbsp;</td><td class=example><pre>eg$ time grep nobody /etc/aliases
++nobody:/dev/null
++etc-files:nobody
++misc-group:nobody
++0.07user 0.50system 0:06.69elapsed 8%CPU (0avgtext+489avgdata 324maxresident)k
++46inputs+7outputs (43major+251minor)pagefaults 0swaps
++</pre></td></tr></table><P>
++
++Mail suggestions and bug reports for GNU <CODE>time</CODE> to
++<CODE>bug-gnu-utils@prep.ai.mit.edu</CODE>.  Please include the version of
++<CODE>time</CODE>, which you can get by running `<SAMP>time --version</SAMP>', and the
++operating system and C compiler you used.
++</P>
++<P>
++
++<TABLE BORDER="0" CELLSPACING="0">
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC2">1.1 Setting the Output Format</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Selecting the information reported by <CODE>time</CODE>.</TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC3">1.2 The Format String</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">The information <CODE>time</CODE> can report.</TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC8">1.3 Redirecting Output</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Writing the information to a file.</TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC9">1.4 Examples</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Examples of using <CODE>time</CODE>.</TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC10">1.5 Accuracy</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Limitations on the accuracy of <CODE>time</CODE> output.</TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC11">1.6 Running the <CODE>time</CODE> Command</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Summary of the options to the <CODE>time</CODE> command.</TD></TR>
++</TABLE>
++<P>
++
++<A NAME="Setting Format"></A>
++<HR SIZE="6">
++<A NAME="SEC2"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC3"> &gt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt;&lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H2> 1.1 Setting the Output Format </H2>
++<!--docid::SEC2::-->
++<P>
++
++<CODE>time</CODE> uses a <EM>format string</EM> to determine which information to
++display about the resources used by the command it runs.  See section <A HREF="time.html#SEC3">1.2 The Format String</A>, for the interpretation of the format string contents.
++</P>
++<P>
++
++You can specify a format string with the command line options listed
++below.  If no format is specified on the command line, but the
++<CODE>TIME</CODE> environment variable is set, its value is used as the format
++string.  Otherwise, the default format built into <CODE>time</CODE> is used:
++</P>
++<P>
++
++<TABLE><tr><td>&nbsp;</td><td class=example><pre>%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
++%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
++</pre></td></tr></table><P>
++
++The command line options to set the format are:
++</P>
++<P>
++
++</P>
++<DL COMPACT>
++<DT><CODE>-f <VAR>format</VAR></CODE>
++<DD><DT><CODE>--format=<VAR>format</VAR></CODE>
++<DD>Use <VAR>format</VAR> as the format string.
++<P>
++
++</P>
++<DT><CODE>-p</CODE>
++<DD><DT><CODE>--portability</CODE>
++<DD>Use the following format string, for conformance with POSIX standard
++1003.2:
++<P>
++
++<TABLE><tr><td>&nbsp;</td><td class=example><pre>real %e
++user %U
++sys %S
++</pre></td></tr></table><P>
++
++</P>
++<DT><CODE>-q</CODE>
++<DD><DT><CODE>--quiet</CODE>
++<DD>Suppress non-zero error code from the executed program.
++<P>
++
++</P>
++<DT><CODE>-v</CODE>
++<DD><DT><CODE>--verbose</CODE>
++<DD><A NAME="IDX2"></A>
++Use the built-in verbose format, which displays each available piece of
++information on the program's resource use on its own line, with an
++English description of its meaning.
++</DL>
++<P>
++
++<A NAME="Format String"></A>
++<HR SIZE="6">
++<A NAME="SEC3"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC2"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC4"> &gt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt;&lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H2> 1.2 The Format String </H2>
++<!--docid::SEC3::-->
++<P>
++
++<A NAME="IDX3"></A>
++<A NAME="IDX4"></A>
++The <EM>format string</EM> controls the contents of the <CODE>time</CODE> output.
++It consists of <EM>resource specifiers</EM> and <EM>escapes</EM>, interspersed
++with plain text.
++</P>
++<P>
++
++A backslash introduces an <EM>escape</EM>, which is translated
++into a single printing character upon output.  The valid escapes are
++listed below.  An invalid escape is output as a question mark followed
++by a backslash.
++</P>
++<P>
++
++</P>
++<DL COMPACT>
++<DT><CODE>\t</CODE>
++<DD>a tab character
++<P>
++
++</P>
++<DT><CODE>\n</CODE>
++<DD>a newline
++<P>
++
++</P>
++<DT><CODE>\\</CODE>
++<DD>a literal backslash
++</DL>
++<P>
++
++<CODE>time</CODE> always prints a newline after printing the resource use
++information, so normally format strings do not end with a newline
++character (or `<SAMP>\n</SAMP>').
++</P>
++<P>
++
++A resource specifier consists of a percent sign followed by another
++character.  An invalid resource specifier is output as a question mark
++followed by the invalid character.  Use `<SAMP>%%</SAMP>' to output a literal
++percent sign.
++</P>
++<P>
++
++The resource specifiers, which are a superset of those recognized by the
++<CODE>tcsh</CODE> builtin <CODE>time</CODE> command, are listed below.  Not all
++resources are measured by all versions of Unix, so some of the values
++might be reported as zero (see section <A HREF="time.html#SEC10">1.5 Accuracy</A>).
++</P>
++<P>
++
++<TABLE BORDER="0" CELLSPACING="0">
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC4">1.2.1 Time Resources</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC5">1.2.2 Memory Resources</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC6">1.2.3 I/O Resources</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
++<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="time.html#SEC7">1.2.4 Command Info</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
++</TABLE>
++<P>
++
++<A NAME="Time Resources"></A>
++<HR SIZE="6">
++<A NAME="SEC4"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC3"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC5"> &gt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt;&lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H3> 1.2.1 Time Resources </H3>
++<!--docid::SEC4::-->
++<P>
++
++</P>
++<DL COMPACT>
++<DT><CODE>E</CODE>
++<DD>Elapsed real (wall clock) time used by the process, in
++[hours:]minutes:seconds.
++<P>
++
++</P>
++<DT><CODE>e</CODE>
++<DD>Elapsed real (wall clock) time used by the process, in
++seconds.
++<P>
++
++</P>
++<DT><CODE>S</CODE>
++<DD>Total number of CPU-seconds used by the system on behalf of the process
++(in kernel mode), in seconds.
++<P>
++
++</P>
++<DT><CODE>U</CODE>
++<DD>Total number of CPU-seconds that the process used directly (in user
++mode), in seconds.
++<P>
++
++</P>
++<DT><CODE>P</CODE>
++<DD>Percentage of the CPU that this job got.  This is just user + system
++times divied by the total running time.
++</DL>
++<P>
++
++<A NAME="Memory Resources"></A>
++<HR SIZE="6">
++<A NAME="SEC5"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC4"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC6"> &gt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt;&lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H3> 1.2.2 Memory Resources </H3>
++<!--docid::SEC5::-->
++<P>
++
++</P>
++<DL COMPACT>
++<DT><CODE>M</CODE>
++<DD>Maximum resident set size of the process during its lifetime, in
++Kilobytes.
++<P>
++
++</P>
++<DT><CODE>t</CODE>
++<DD>Average resident set size of the process, in Kilobytes.
++<P>
++
++</P>
++<DT><CODE>K</CODE>
++<DD>Average total (data+stack+text) memory use of the process, in Kilobytes.
++<P>
++
++</P>
++<DT><CODE>D</CODE>
++<DD>Average size of the process's unshared data area, in Kilobytes.
++<P>
++
++</P>
++<DT><CODE>p</CODE>
++<DD>Average size of the process's unshared stack, in Kilobytes.
++<P>
++
++</P>
++<DT><CODE>X</CODE>
++<DD>Average size of the process's shared text, in Kilobytes.
++<P>
++
++</P>
++<DT><CODE>Z</CODE>
++<DD>System's page size, in bytes.  This is a per-system constant, but
++varies between systems.
++</DL>
++<P>
++
++<A NAME="I/O Resources"></A>
++<HR SIZE="6">
++<A NAME="SEC6"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC5"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC7"> &gt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt;&lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H3> 1.2.3 I/O Resources </H3>
++<!--docid::SEC6::-->
++<P>
++
++</P>
++<DL COMPACT>
++<DT><CODE>F</CODE>
++<DD>Number of major, or I/O-requiring, page faults that occurred while the
++process was running.  These are faults where the page has actually
++migrated out of primary memory.
++<P>
++
++</P>
++<DT><CODE>R</CODE>
++<DD>Number of minor, or recoverable, page faults.  These are pages that are
++not valid (so they fault) but which have not yet been claimed by other
++virtual pages.  Thus the data in the page is still valid but the system
++tables must be updated.
++<P>
++
++</P>
++<DT><CODE>W</CODE>
++<DD>Number of times the process was swapped out of main memory.
++<P>
++
++</P>
++<DT><CODE>c</CODE>
++<DD>Number of times the process was context-switched involuntarily (because
++the time slice expired).
++<P>
++
++</P>
++<DT><CODE>w</CODE>
++<DD>Number of times that the program was context-switched voluntarily, for
++instance while waiting for an I/O operation to complete.
++<P>
++
++</P>
++<DT><CODE>I</CODE>
++<DD>Number of file system inputs by the process.
++<P>
++
++</P>
++<DT><CODE>O</CODE>
++<DD>Number of file system outputs by the process.
++<P>
++
++</P>
++<DT><CODE>r</CODE>
++<DD>Number of socket messages received by the process.
++<P>
++
++</P>
++<DT><CODE>s</CODE>
++<DD>Number of socket messages sent by the process.
++<P>
++
++</P>
++<DT><CODE>k</CODE>
++<DD>Number of signals delivered to the process.
++</DL>
++<P>
++
++<A NAME="Command Info"></A>
++<HR SIZE="6">
++<A NAME="SEC7"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC6"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC8"> &gt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt;&lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H3> 1.2.4 Command Info </H3>
++<!--docid::SEC7::-->
++<P>
++
++</P>
++<DL COMPACT>
++<DT><CODE>C</CODE>
++<DD>Name and command line arguments of the command being timed.
++<P>
++
++</P>
++<DT><CODE>x</CODE>
++<DD>Exit status of the command.
++</DL>
++<P>
++
++<A NAME="Redirecting"></A>
++<HR SIZE="6">
++<A NAME="SEC8"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC7"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC9"> &gt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt;&lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H2> 1.3 Redirecting Output </H2>
++<!--docid::SEC8::-->
++<P>
++
++By default, <CODE>time</CODE> writes the resource use statistics to the
++standard error stream.  The options below make it write the statistics
++to a file instead.  Doing this can be useful if the program you're
++running writes to the standard error or you're running <CODE>time</CODE>
++noninteractively or in the background.
++</P>
++<P>
++
++</P>
++<DL COMPACT>
++<DT><CODE>-o <VAR>file</VAR></CODE>
++<DD><DT><CODE>--output=<VAR>file</VAR></CODE>
++<DD>Write the resource use statistics to <VAR>file</VAR>.  By default, this
++<EM>overwrites</EM> the file, destroying the file's previous contents.
++<P>
++
++</P>
++<DT><CODE>-a</CODE>
++<DD><DT><CODE>--append</CODE>
++<DD><EM>Append</EM> the resource use information to the output file instead
++of overwriting it.  This option is only useful with the `<SAMP>-o</SAMP>' or
++`<SAMP>--output</SAMP>' option.
++</DL>
++<P>
++
++<A NAME="Examples"></A>
++<HR SIZE="6">
++<A NAME="SEC9"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC8"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC10"> &gt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt;&lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H2> 1.4 Examples </H2>
++<!--docid::SEC9::-->
++<P>
++
++Run the command `<SAMP>wc /etc/hosts</SAMP>' and show the default information:
++</P>
++<P>
++
++<TABLE><tr><td>&nbsp;</td><td class=example><pre>eg$ time wc /etc/hosts
++      35     111    1134 /etc/hosts
++0.00user 0.01system 0:00.04elapsed 25%CPU (0avgtext+0avgdata 0maxresident)k
++1inputs+1outputs (0major+0minor)pagefaults 0swaps
++</pre></td></tr></table><P>
++
++Run the command `<SAMP>ls -Fs</SAMP>' and show just the user, system, and
++wall-clock time:
++</P>
++<P>
++
++<TABLE><tr><td>&nbsp;</td><td class=example><pre>eg$ time -f &quot;\t%E real,\t%U user,\t%S sys&quot; ls -Fs
++total 16
++1 account/      1 db/           1 mail/         1 run/
++1 backups/      1 emacs/        1 msgs/         1 rwho/
++1 crash/        1 games/        1 preserve/     1 spool/
++1 cron/         1 log/          1 quotas/       1 tmp/
++        0:00.03 real,   0.00 user,      0.01 sys
++</pre></td></tr></table><P>
++
++Edit the file `<TT>.bashrc</TT>' and have <CODE>time</CODE> append the elapsed time
++and number of signals to the file `<TT>log</TT>', reading the format string
++from the environment variable <CODE>TIME</CODE>:
++</P>
++<P>
++
++<TABLE><tr><td>&nbsp;</td><td class=example><pre>eg$ export TIME=&quot;\t%E,\t%k&quot; # If using bash or ksh
++eg$ setenv TIME &quot;\t%E,\t%k&quot; # If using csh or tcsh
++eg$ time -a -o log emacs .bashrc
++eg$ cat log
++        0:16.55,        726
++</pre></td></tr></table><P>
++
++Run the command `<SAMP>sleep 4</SAMP>' and show all of the information about it
++verbosely:
++</P>
++<P>
++
++<TABLE><tr><td>&nbsp;</td><td class=example><pre>eg$ time -v sleep 4
++        Command being timed: &quot;sleep 4&quot;
++        User time (seconds): 0.00
++        System time (seconds): 0.05
++        Percent of CPU this job got: 1%
++        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.26
++        Average shared text size (kbytes): 36
++        Average unshared data size (kbytes): 24
++        Average stack size (kbytes): 0
++        Average total size (kbytes): 60
++        Maximum resident set size (kbytes): 32
++        Average resident set size (kbytes): 24
++        Major (requiring I/O) page faults: 3
++        Minor (reclaiming a frame) page faults: 0
++        Voluntary context switches: 11
++        Involuntary context switches: 0
++        Swaps: 0
++        File system inputs: 3
++        File system outputs: 1
++        Socket messages sent: 0
++        Socket messages received: 0
++        Signals delivered: 1
++        Page size (bytes): 4096
++        Exit status: 0
++</pre></td></tr></table><P>
++
++<A NAME="Accuracy"></A>
++<HR SIZE="6">
++<A NAME="SEC10"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC9"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC11"> &gt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt;&lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H2> 1.5 Accuracy </H2>
++<!--docid::SEC10::-->
++<P>
++
++The elapsed time is not collected atomically with the execution of the
++program; as a result, in bizarre circumstances (if the <CODE>time</CODE>
++command gets stopped or swapped out in between when the program being
++timed exits and when <CODE>time</CODE> calculates how long it took to run), it
++could be much larger than the actual execution time.
++</P>
++<P>
++
++When the running time of a command is very nearly zero, some values
++(e.g., the percentage of CPU used) may be reported as either zero (which
++is wrong) or a question mark.
++</P>
++<P>
++
++Most information shown by <CODE>time</CODE> is derived from the <CODE>wait3</CODE>
++system call.  The numbers are only as good as those returned by
++<CODE>wait3</CODE>.  Many systems do not measure all of the resources that
++<CODE>time</CODE> can report on; those resources are reported as zero.  The
++systems that measure most or all of the resources are based on 4.2 or
++4.3BSD.  Later BSD releases use different memory management code that
++measures fewer resources.
++</P>
++<P>
++
++On systems that do not have a <CODE>wait3</CODE> call that returns status
++information, the <CODE>times</CODE> system call is used instead.  It provides
++much less information than <CODE>wait3</CODE>, so on those systems <CODE>time</CODE>
++reports most of the resources as zero.
++</P>
++<P>
++
++The `<SAMP>%I</SAMP>' and `<SAMP>%O</SAMP>' values are allegedly only &quot;real&quot; input
++and output and do not include those supplied by caching devices.  The
++meaning of &quot;real&quot; I/O reported by `<SAMP>%I</SAMP>' and `<SAMP>%O</SAMP>' may be
++muddled for workstations, especially diskless ones.
++</P>
++<P>
++
++<A NAME="Invoking time"></A>
++<HR SIZE="6">
++<A NAME="SEC11"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC10"> &lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC1"> &lt;&lt; </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top"> Up </A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H2> 1.6 Running the <CODE>time</CODE> Command </H2>
++<!--docid::SEC11::-->
++<P>
++
++The format of the <CODE>time</CODE> command is:
++</P>
++<P>
++
++<TABLE><tr><td>&nbsp;</td><td class=example><pre>time [option<small>...</small>] <VAR>command</VAR> [<VAR>arg</VAR><small>...</small>]
++</pre></td></tr></table><P>
++
++<A NAME="IDX5"></A>
++<CODE>time</CODE> runs the program <VAR>command</VAR>, with any given arguments
++<VAR>arg</VAR><small>...</small>.  When <VAR>command</VAR> finishes, <CODE>time</CODE> displays
++information about resources used by <VAR>command</VAR> (on the standard error
++output, by default).  If <VAR>command</VAR> exits with non-zero status or is
++terminated by a signal, <CODE>time</CODE> displays a warning message and the
++exit status or signal number.
++</P>
++<P>
++
++Options to <CODE>time</CODE> must appear on the command line before
++<VAR>command</VAR>.  Anything on the command line after <VAR>command</VAR> is
++passed as arguments to <VAR>command</VAR>.
++</P>
++<P>
++
++</P>
++<DL COMPACT>
++<DT><CODE>-o <VAR>file</VAR></CODE>
++<DD><DT><CODE>--output=<VAR>file</VAR></CODE>
++<DD>Write the resource use statistics to <VAR>file</VAR>.
++<P>
++
++</P>
++<DT><CODE>-a</CODE>
++<DD><DT><CODE>--append</CODE>
++<DD><EM>Append</EM> the resource use information to the output file instead
++of overwriting it.
++<P>
++
++</P>
++<DT><CODE>-f <VAR>format</VAR></CODE>
++<DD><DT><CODE>--format=<VAR>format</VAR></CODE>
++<DD>Use <VAR>format</VAR> as the format string.
++<P>
++
++</P>
++<DT><CODE>--help</CODE>
++<DD>Print a summary of the command line options to <CODE>time</CODE> and exit.
++<P>
++
++</P>
++<DT><CODE>-p</CODE>
++<DD><DT><CODE>--portability</CODE>
++<DD>Use the POSIX format.
++<P>
++
++</P>
++<DT><CODE>-v</CODE>
++<DD><DT><CODE>--verbose</CODE>
++<DD><A NAME="IDX6"></A>
++Use the built-in verbose format.
++<P>
++
++</P>
++<DT><CODE>-V</CODE>
++<DD><DT><CODE>--version</CODE>
++<DD><A NAME="IDX7"></A>
++Print the version number of <CODE>time</CODE> and exit.
++</DL>
++<P>
++
++<HR SIZE="6">
++<A NAME="SEC_Contents"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H1>Table of Contents</H1>
++<BLOCKQUOTE>
++<A NAME="TOC1" HREF="time.html#SEC1">1. Measuring Program Resource Use</A>
++<BR>
++<BLOCKQUOTE>
++<A NAME="TOC2" HREF="time.html#SEC2">1.1 Setting the Output Format</A>
++<BR>
++<A NAME="TOC3" HREF="time.html#SEC3">1.2 The Format String</A>
++<BR>
++<BLOCKQUOTE>
++<A NAME="TOC4" HREF="time.html#SEC4">1.2.1 Time Resources</A>
++<BR>
++<A NAME="TOC5" HREF="time.html#SEC5">1.2.2 Memory Resources</A>
++<BR>
++<A NAME="TOC6" HREF="time.html#SEC6">1.2.3 I/O Resources</A>
++<BR>
++<A NAME="TOC7" HREF="time.html#SEC7">1.2.4 Command Info</A>
++<BR>
++</BLOCKQUOTE>
++<A NAME="TOC8" HREF="time.html#SEC8">1.3 Redirecting Output</A>
++<BR>
++<A NAME="TOC9" HREF="time.html#SEC9">1.4 Examples</A>
++<BR>
++<A NAME="TOC10" HREF="time.html#SEC10">1.5 Accuracy</A>
++<BR>
++<A NAME="TOC11" HREF="time.html#SEC11">1.6 Running the <CODE>time</CODE> Command</A>
++<BR>
++</BLOCKQUOTE>
++</BLOCKQUOTE>
++<HR SIZE=1>
++<A NAME="SEC_OVERVIEW"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H1>Short Table of Contents</H1>
++<BLOCKQUOTE>
++<A NAME="TOC1" HREF="time.html#SEC1">1. Measuring Program Resource Use</A>
++<BR>
++
++</BLOCKQUOTE>
++<HR SIZE=1>
++<A NAME="SEC_About"></A>
++<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
++<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Top">Top</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_Contents">Contents</A>]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
++<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="time.html#SEC_About"> ? </A>]</TD>
++</TR></TABLE>
++<H1>About this document</H1>
++This document was generated
++by 
++using <A HREF="http://texi2html.cvshome.org"><I>texi2html</I></A>
++<P></P>
++The buttons in the navigation panels have the following meaning:
++<P></P>
++<table border = "1">
++<TR>
++<TH> Button </TH>
++<TH> Name </TH>
++<TH> Go to </TH>
++<TH> From 1.2.3 go to</TH>
++</TR>
++<TR>
++<TD ALIGN="CENTER">
++ [ &lt; ] </TD>
++<TD ALIGN="CENTER">
++Back
++</TD>
++<TD>
++previous section in reading order
++</TD>
++<TD>
++1.2.2
++</TD>
++</TR>
++<TR>
++<TD ALIGN="CENTER">
++ [ &gt; ] </TD>
++<TD ALIGN="CENTER">
++Forward
++</TD>
++<TD>
++next section in reading order
++</TD>
++<TD>
++1.2.4
++</TD>
++</TR>
++<TR>
++<TD ALIGN="CENTER">
++ [ &lt;&lt; ] </TD>
++<TD ALIGN="CENTER">
++FastBack
++</TD>
++<TD>
++beginning of this chapter or previous chapter
++</TD>
++<TD>
++1
++</TD>
++</TR>
++<TR>
++<TD ALIGN="CENTER">
++ [ Up ] </TD>
++<TD ALIGN="CENTER">
++Up
++</TD>
++<TD>
++up section
++</TD>
++<TD>
++1.2
++</TD>
++</TR>
++<TR>
++<TD ALIGN="CENTER">
++ [ &gt;&gt; ] </TD>
++<TD ALIGN="CENTER">
++FastForward
++</TD>
++<TD>
++next chapter
++</TD>
++<TD>
++2
++</TD>
++</TR>
++<TR>
++<TD ALIGN="CENTER">
++ [Top] </TD>
++<TD ALIGN="CENTER">
++Top
++</TD>
++<TD>
++cover (top) of document
++</TD>
++<TD>
++ &nbsp; 
++</TD>
++</TR>
++<TR>
++<TD ALIGN="CENTER">
++ [Contents] </TD>
++<TD ALIGN="CENTER">
++Contents
++</TD>
++<TD>
++table of contents
++</TD>
++<TD>
++ &nbsp; 
++</TD>
++</TR>
++<TR>
++<TD ALIGN="CENTER">
++ [Index] </TD>
++<TD ALIGN="CENTER">
++Index
++</TD>
++<TD>
++concept index
++</TD>
++<TD>
++ &nbsp; 
++</TD>
++</TR>
++<TR>
++<TD ALIGN="CENTER">
++ [ ? ] </TD>
++<TD ALIGN="CENTER">
++About
++</TD>
++<TD>
++this page
++</TD>
++<TD>
++ &nbsp; 
++</TD>
++</TR>
++</TABLE>
++    <P>
++      where the <STRONG> Example </STRONG> assumes that the current position
++      is at <STRONG> Subsubsection One-Two-Three </STRONG> of a document of
++      the following structure:</P>
++    <UL>
++      <LI> 1. Section One
++        <UL>
++          <LI>1.1 Subsection One-One
++            <UL>
++              <LI>...</LI>
++            </UL>
++          <LI>1.2 Subsection One-Two
++            <UL>
++              <LI>1.2.1 Subsubsection One-Two-One</LI>
++              <LI>1.2.2 Subsubsection One-Two-Two</LI>
++              <LI>1.2.3 Subsubsection One-Two-Three &nbsp; &nbsp;
++                <STRONG>&lt;== Current Position </STRONG></LI>
++              <LI>1.2.4 Subsubsection One-Two-Four</LI>
++            </UL>
++          </LI>
++          <LI>1.3 Subsection One-Three
++            <UL>
++              <LI>...</LI>
++            </UL>
++          </LI>
++          <LI>1.4 Subsection One-Four</LI>
++        </UL>
++      </LI>
++    </UL>
++
++<HR SIZE=1>
++<BR>
++<FONT SIZE="-1">
++This document was generated
++by <I>root</I> on <I>September, 1 2003</I>
++using <A HREF="http://texi2html.cvshome.org"><I>texi2html</I></A>
++</FONT>
++
++</BODY>
++</HTML>
diff --git a/meta/meta-gplv2/recipes-extended/time/time_1.7.bb b/meta/meta-gplv2/recipes-extended/time/time_1.7.bb
new file mode 100644
index 0000000..e5713db
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/time/time_1.7.bb
@@ -0,0 +1,24 @@
+SUMMARY = "Tool that measures CPU resources"
+DESCRIPTION = "time measures many of the CPU resources, such as time and \
+memory, that other programs use."
+HOMEPAGE = "http://www.gnu.org/software/time/"
+SECTION = "utils"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b"
+
+inherit texinfo update-alternatives
+
+ALTERNATIVE_${PN} = "time"
+ALTERNATIVE_PRIORITY = "100"
+
+BBCLASSEXTEND = "native nativesdk"
+
+PR = "r2"
+
+SRC_URI = "${GNU_MIRROR}/time/time-${PV}.tar.gz \
+	   file://debian.patch"
+
+SRC_URI[md5sum] = "e38d2b8b34b1ca259cf7b053caac32b3"
+SRC_URI[sha256sum] = "e37ea79a253bf85a85ada2f7c632c14e481a5fd262a362f6f4fd58e68601496d"
+
+inherit autotools
diff --git a/meta/meta-gplv2/recipes-extended/which/which-2.18/automake-foreign.patch b/meta/meta-gplv2/recipes-extended/which/which-2.18/automake-foreign.patch
new file mode 100644
index 0000000..495cdc6
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/which/which-2.18/automake-foreign.patch
@@ -0,0 +1,28 @@
+Subject: [PATCH] automake foreign strictness
+
+Use foreign strictness to avoid automake errors.
+
+Upstream-Status: Inappropriate [upstream no longer active]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+---
+ configure.ac |    5 +++--
+ 1 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b30b6f5..bd3222c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,6 +1,7 @@
+ dnl Process this file with autoconf to produce a configure script.
+-AC_INIT(which.c)
+-AM_INIT_AUTOMAKE(which, 2.18)
++AC_INIT([which],[2.18])
++AC_CONFIG_SRCDIR(which.c)
++AM_INIT_AUTOMAKE([foreign])
+ AM_CONFIG_HEADER(config.h)
+ AM_MAINTAINER_MODE
+ 
+-- 
+1.7.1
+
diff --git a/meta/meta-gplv2/recipes-extended/which/which-2.18/fix_name_conflict_group_member.patch b/meta/meta-gplv2/recipes-extended/which/which-2.18/fix_name_conflict_group_member.patch
new file mode 100644
index 0000000..0e0988b
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/which/which-2.18/fix_name_conflict_group_member.patch
@@ -0,0 +1,53 @@
+Upstream-Status: Inappropriate [this is 2.18(GPLv2) specific]
+
+# glibc also implements the function group_member. To avoid name conflict,
+# here let us append a "_" to which's version.
+#
+# Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>, 2010-08-20
+# (this patch is licensed under GPLv2)
+
+--- which-2.18/bash.c
++++ which-2.18/bash.c
+@@ -45,7 +45,12 @@
+  * - changed all occurences of 'gid_t' into 'GID_T'.
+  * - exported functions needed in which.c
+  */
+-static int group_member (GID_T gid);
++
++/*
++ * glibc also implements the function group_member. To avoid name conflict,
++ * here let us append a "_" to which's version.
++ */
++static int _group_member (GID_T gid);
+ static char* extract_colon_unit (char const* string, int *p_index);
+ 
+ /*===========================================================================
+@@ -200,8 +205,8 @@
+ 
+ /* From bash-2.05b / general.c / line 805 */
+ /* Return non-zero if GID is one that we have in our groups list. */
+-int
+-group_member (GID_T gid)
++static int
++_group_member (GID_T gid)
+ {
+ #if defined (HAVE_GETGROUPS)
+   register int i;
+@@ -290,7 +295,7 @@
+     return (X_BIT (u_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS;
+ 
+   /* Otherwise, if we are in the owning group, the group permissions apply. */
+-  if (group_member (finfo.st_gid))
++  if (_group_member (finfo.st_gid))
+     return (X_BIT (g_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS;
+ 
+   /* Otherwise, if we are in the other group, the other permissions apply. */
+@@ -331,7 +336,7 @@
+ /* Given a string containing units of information separated by colons,
+    return the next one pointed to by (P_INDEX), or NULL if there are no more.
+    Advance (P_INDEX) to the character after the colon. */
+-char*
++static char*
+ extract_colon_unit (char const* string, int* p_index)
+ {
+   int i, start, len;
diff --git a/meta/meta-gplv2/recipes-extended/which/which_2.18.bb b/meta/meta-gplv2/recipes-extended/which/which_2.18.bb
new file mode 100644
index 0000000..eb6cc99
--- /dev/null
+++ b/meta/meta-gplv2/recipes-extended/which/which_2.18.bb
@@ -0,0 +1,34 @@
+SUMMARY = "Displays the full path of shell commands"
+DESCRIPTION = "Which is a utility that prints out the full path of the \
+executables that bash(1) would execute when the passed \
+program names would have been entered on the shell prompt. \
+It does this by using the exact same algorithm as bash."
+SECTION = "libs"
+HOMEPAGE = "http://carlo17.home.xs4all.nl/which/"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
+
+PR = "r2"
+
+SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/which/which-2.18.tar.gz/42d51938e48b91f6e19fabf216f5c3e9/which-${PV}.tar.gz \
+           file://fix_name_conflict_group_member.patch \
+           file://automake-foreign.patch \
+"
+
+SRC_URI[md5sum] = "42d51938e48b91f6e19fabf216f5c3e9"
+SRC_URI[sha256sum] = "9445cd7e02ec0c26a44fd56098464ded064ba5d93dd2e15ec12410ba56b2e544"
+
+DEPENDS = "cwautomacros-native"
+
+inherit autotools texinfo update-alternatives
+
+do_configure_prepend() {
+	OLD="@ACLOCAL_CWFLAGS@"
+	NEW="-I ${STAGING_DIR_NATIVE}/${datadir}/cwautomacros/m4"
+	sed -i "s#${OLD}#${NEW}#g" `grep -rl ${OLD} ${S}`
+}
+
+ALTERNATIVE_${PN} = "which"
+ALTERNATIVE_PRIORITY = "100"
+