Squashed 'yocto-poky/' content from commit ea562de

git-subtree-dir: yocto-poky
git-subtree-split: ea562de57590c966cd5a75fda8defecd397e6436
diff --git a/meta/recipes-support/apr/apr-util/configfix.patch b/meta/recipes-support/apr/apr-util/configfix.patch
new file mode 100644
index 0000000..dbb1148
--- /dev/null
+++ b/meta/recipes-support/apr/apr-util/configfix.patch
@@ -0,0 +1,51 @@
+Upstream-Status: Inappropriate [configuration]
+
+Index: apr-util-1.3.4/apu-config.in
+===================================================================
+--- apr-util-1.3.4.orig/apu-config.in	2009-01-12 17:08:06.000000000 +0000
++++ apr-util-1.3.4/apu-config.in	2009-01-12 17:09:00.000000000 +0000
+@@ -134,14 +134,7 @@
+     exit 0
+     ;;
+     --includes)
+-    if test "$location" = "installed"; then
+         flags="$flags -I$includedir $INCLUDES"
+-    elif test "$location" = "source"; then
+-        flags="$flags -I$APU_SOURCE_DIR/include $INCLUDES"
+-    else
+-        # this is for VPATH builds
+-        flags="$flags -I$APU_BUILD_DIR/include -I$APU_SOURCE_DIR/include $INCLUDES"
+-    fi
+     ;;
+     --ldflags)
+     flags="$flags $LDFLAGS"
+@@ -155,28 +148,10 @@
+     exit 0
+     ;;
+     --link-ld)
+-    if test "$location" = "installed"; then
+-        ### avoid using -L if libdir is a "standard" location like /usr/lib
+         flags="$flags -L$libdir -l$APRUTIL_LIBNAME"
+-    else
+-        flags="$flags -L$APU_BUILD_DIR -l$APRUTIL_LIBNAME"
+-    fi
+     ;;
+     --link-libtool)
+-    # If the LA_FILE exists where we think it should be, use it.  If we're
+-    # installed and the LA_FILE does not exist, assume to use -L/-l
+-    # (the LA_FILE may not have been installed).  If we're building ourselves,
+-    # we'll assume that at some point the .la file be created.
+-    if test -f "$LA_FILE"; then
+-        flags="$flags $LA_FILE"
+-    elif test "$location" = "installed"; then
+-        ### avoid using -L if libdir is a "standard" location like /usr/lib
+-        # Since the user is specifying they are linking with libtool, we
+-        # *know* that -R will be recognized by libtool.
+-        flags="$flags -L$libdir -R$libdir -l$APRUTIL_LIBNAME"
+-    else
+-        flags="$flags $LA_FILE"
+-    fi
++        flags="$flags -l$APRUTIL_LIBNAME"
+     ;;
+     --apu-la-file)
+     if test -f "$LA_FILE"; then
diff --git a/meta/recipes-support/apr/apr-util/configure_fixes.patch b/meta/recipes-support/apr/apr-util/configure_fixes.patch
new file mode 100644
index 0000000..91e244c
--- /dev/null
+++ b/meta/recipes-support/apr/apr-util/configure_fixes.patch
@@ -0,0 +1,31 @@
+Upstream-Status: Inappropriate [configuration]
+
+Index: apr-util-1.4.1/configure.in
+===================================================================
+--- apr-util-1.4.1.orig/configure.in	2009-12-18 03:15:19.000000000 +0800
++++ apr-util-1.4.1/configure.in	2011-12-30 13:32:07.000000000 +0800
+@@ -8,15 +8,15 @@
+ AC_CONFIG_HEADER(include/private/apu_config.h)
+ AC_CONFIG_AUX_DIR(build)
+ 
+-sinclude(build/apu-conf.m4)
+-sinclude(build/apu-iconv.m4)
+-sinclude(build/apu-hints.m4)
+-sinclude(build/apr_common.m4)
+-sinclude(build/find_apr.m4)
+-sinclude(build/crypto.m4)
+-sinclude(build/dbm.m4)
+-sinclude(build/dbd.m4)
+-sinclude(build/dso.m4)
++#sinclude(build/apu-conf.m4)
++#sinclude(build/apu-iconv.m4)
++#sinclude(build/apu-hints.m4)
++#sinclude(build/apr_common.m4)
++#sinclude(build/find_apr.m4)
++#sinclude(build/crypto.m4)
++#sinclude(build/dbm.m4)
++#sinclude(build/dbd.m4)
++#sinclude(build/dso.m4)
+ 
+ dnl Generate ./config.nice for reproducing runs of configure
+ dnl 
diff --git a/meta/recipes-support/apr/apr-util/run-ptest b/meta/recipes-support/apr/apr-util/run-ptest
new file mode 100644
index 0000000..ae19a1d
--- /dev/null
+++ b/meta/recipes-support/apr/apr-util/run-ptest
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+cd test
+./testall |sed \
+  -e 's|\(.*\):  SUCCESS|PASS: \1|' \
+  -e 's|\(.*\):  FAILED|FAIL: \1|'
diff --git a/meta/recipes-support/apr/apr-util_1.5.4.bb b/meta/recipes-support/apr/apr-util_1.5.4.bb
new file mode 100644
index 0000000..6a14d14
--- /dev/null
+++ b/meta/recipes-support/apr/apr-util_1.5.4.bb
@@ -0,0 +1,81 @@
+SUMMARY = "Apache Portable Runtime (APR) companion library"
+HOMEPAGE = "http://apr.apache.org/"
+SECTION = "libs"
+DEPENDS = "apr expat gdbm"
+
+BBCLASSEXTEND = "native nativesdk"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=519e0a18e03f7c023070568c14b077bb \
+                    file://include/apu_version.h;endline=17;md5=806685a84e71f10c80144c48eb35df42"
+
+SRC_URI = "${APACHE_MIRROR}/apr/${BPN}-${PV}.tar.gz \
+           file://configfix.patch \
+           file://configure_fixes.patch \
+           file://run-ptest \
+"
+
+SRC_URI[md5sum] = "866825c04da827c6e5f53daff5569f42"
+SRC_URI[sha256sum] = "976a12a59bc286d634a21d7be0841cc74289ea9077aa1af46be19d1a6e844c19"
+
+EXTRA_OECONF = "--with-apr=${STAGING_BINDIR_CROSS}/apr-1-config \ 
+		--without-odbc \
+		--without-pgsql \
+		--with-dbm=gdbm \
+		--with-gdbm=${STAGING_DIR_HOST}${prefix} \
+		--without-sqlite2 \
+		--without-sqlite3 \
+		--with-expat=${STAGING_DIR_HOST}${prefix}"
+
+
+inherit autotools lib_package binconfig
+
+PR = "r1"
+
+OE_BINCONFIG_EXTRA_MANGLE = " -e 's:location=source:location=installed:'"
+
+do_configure_append() {
+	if [ "${CLASSOVERRIDE}" = "class-target" ]; then
+		cp ${STAGING_DATADIR}/apr/apr_rules.mk ${B}/build/rules.mk
+	fi
+}
+do_configure_prepend_class-native() {
+	mkdir ${B}/build
+	cp ${STAGING_DATADIR_NATIVE}/apr/apr_rules.mk ${B}/build/rules.mk
+}
+do_configure_append_class-native() {
+	sed -i "s#LIBTOOL=\$(SHELL) \$(apr_builddir)#LIBTOOL=\$(SHELL) ${STAGING_BINDIR_NATIVE}#" ${B}/build/rules.mk
+	# sometimes there isn't SHELL
+	sed -i "s#LIBTOOL=\$(apr_builddir)#LIBTOOL=${STAGING_BINDIR_NATIVE}#" ${B}/build/rules.mk
+}
+
+do_configure_prepend_class-nativesdk() {
+	cp ${STAGING_DATADIR}/apr/apr_rules.mk ${S}/build/rules.mk
+}
+
+do_configure_append_class-nativesdk() {
+	sed -i "s#\(apr_builddir\)=.*#\1=${STAGING_DATADIR}/build-1#" ${S}/build/rules.mk
+	sed -i "s#\(apr_builders\)=.*#\1=${STAGING_DATADIR}/build-1#" ${S}/build/rules.mk
+	sed -i "s#\(top_builddir\)=.*#\1=${STAGING_DATADIR}/build-1#" ${S}/build/rules.mk
+	sed -i "s#\(LIBTOOL=\$(apr_builddir)\).*#\1/libtool#" ${S}/build/rules.mk
+}
+
+FILES_${PN}     += "${libdir}/apr-util-1/apr_dbm_gdbm-1.so"
+FILES_${PN}-dev += "${libdir}/aprutil.exp ${libdir}/apr-util-1/apr_dbm_gdbm.so* ${libdir}/apr-util-1/apr_dbm_gdbm.la"
+FILES_${PN}-dbg += "${libdir}/apr-util-1/.debug/*"
+FILES_${PN}-staticdev += "${libdir}/apr-util-1/apr_dbm_gdbm.a"
+
+inherit ptest
+
+do_compile_ptest() {
+	cd ${B}/test
+	oe_runmake
+}
+
+do_install_ptest() {
+	t=${D}${PTEST_PATH}/test
+	mkdir $t
+	for i in testall data; do \
+	  cp -r ${B}/test/$i $t; \
+	done
+}
diff --git a/meta/recipes-support/apr/apr/Fix-packet-discards-HTTP-redirect.patch b/meta/recipes-support/apr/apr/Fix-packet-discards-HTTP-redirect.patch
new file mode 100644
index 0000000..6805b8b
--- /dev/null
+++ b/meta/recipes-support/apr/apr/Fix-packet-discards-HTTP-redirect.patch
@@ -0,0 +1,32 @@
+Fix packet discards HTTP redirect.
+
+Disconnect the connection by poll() timeout.
+If timeout=0 and apr_wait_for_io_or_timeout()=APR_TIMEUP then
+apr_socket_recv() returns EAGAIN.
+
+Upstream-Status: Pending
+
+Signed-off-by: Noriaki Yoshitane <yoshitane.nrs@cnt.ncos.nec.co.jp>
+Signed-off-by: Li Wang <li.wang@windriver.com>
+---
+ network_io/unix/sendrecv.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c
+index c133a26..e8faf15 100644
+--- a/network_io/unix/sendrecv.c
++++ b/network_io/unix/sendrecv.c
+@@ -85,6 +85,10 @@ apr_status_t apr_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len)
+                       && (sock->timeout > 0)) {
+ do_select:
+         arv = apr_wait_for_io_or_timeout(NULL, sock, 1);
++        if ((arv == APR_TIMEUP) && (sock->timeout == 0)) {
++            *len = 0;
++            return EAGAIN;
++        }
+         if (arv != APR_SUCCESS) {
+             *len = 0;
+             return arv;
+-- 
+1.7.9.5
+
diff --git a/meta/recipes-support/apr/apr/cleanup.patch b/meta/recipes-support/apr/apr/cleanup.patch
new file mode 100644
index 0000000..b6784e0
--- /dev/null
+++ b/meta/recipes-support/apr/apr/cleanup.patch
@@ -0,0 +1,43 @@
+Upstream-Status: Inappropriate [configuration]
+
+Index: apr-1.4.2/build/buildcheck.sh
+===================================================================
+--- apr-1.4.2.orig/build/buildcheck.sh	2009-11-13 08:27:16.000000000 +0800
++++ apr-1.4.2/build/buildcheck.sh	2010-11-26 15:44:00.000000000 +0800
+@@ -32,35 +32,4 @@
+ echo "buildconf: autoconf version $ac_version (ok)"
+ fi
+ 
+-# Sample libtool --version outputs:
+-# ltmain.sh (GNU libtool) 1.3.3 (1.385.2.181 1999/07/02 15:49:11)
+-# ltmain.sh (GNU libtool 1.1361 2004/01/02 23:10:52) 1.5a
+-# output is multiline from 1.5 onwards
+-
+-# Require libtool 1.4 or newer
+-libtool=`build/PrintPath glibtool1 glibtool libtool libtool15 libtool14`
+-lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
+-if test -z "$lt_pversion"; then
+-echo "buildconf: libtool not found."
+-echo "           You need libtool version 1.4 or newer installed"
+-echo "           to build APR from SVN."
+-exit 1
+-fi
+-lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
+-IFS=.; set $lt_version; IFS=' '
+-lt_status="good"
+-if test "$1" = "1"; then
+-   if test "$2" -lt "4"; then
+-      lt_status="bad"
+-   fi
+-fi
+-if test $lt_status = "good"; then
+-   echo "buildconf: libtool version $lt_pversion (ok)"
+-   exit 0
+-fi
+-
+-echo "buildconf: libtool version $lt_pversion found."
+-echo "           You need libtool version 1.4 or newer installed"
+-echo "           to build APR from SVN."
+-
+-exit 1
++exit 0
diff --git a/meta/recipes-support/apr/apr/configfix.patch b/meta/recipes-support/apr/apr/configfix.patch
new file mode 100644
index 0000000..605c4f6
--- /dev/null
+++ b/meta/recipes-support/apr/apr/configfix.patch
@@ -0,0 +1,53 @@
+Upstream-Status: Inappropriate [configuration]
+
+Index: apr-1.3.3/apr-config.in
+===================================================================
+--- apr-1.3.3.orig/apr-config.in	2009-01-12 15:16:31.000000000 +0000
++++ apr-1.3.3/apr-config.in	2009-01-12 15:19:25.000000000 +0000
+@@ -152,14 +152,7 @@
+     flags="$flags $LDFLAGS"
+     ;;
+     --includes)
+-    if test "$location" = "installed"; then
+         flags="$flags -I$includedir $EXTRA_INCLUDES"
+-    elif test "$location" = "source"; then
+-        flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
+-    else
+-        # this is for VPATH builds
+-        flags="$flags -I$APR_BUILD_DIR/include -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
+-    fi
+     ;;
+     --srcdir)
+     echo $APR_SOURCE_DIR
+@@ -181,29 +167,14 @@
+     exit 0
+     ;;
+     --link-ld)
+-    if test "$location" = "installed"; then
+-        ### avoid using -L if libdir is a "standard" location like /usr/lib
+-        flags="$flags -L$libdir -l${APR_LIBNAME}"
+-    else
+-        ### this surely can't work since the library is in .libs?
+-        flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}"
+-    fi
++        flags="$flags -l${APR_LIBNAME}"
+     ;;
+     --link-libtool)
+     # If the LA_FILE exists where we think it should be, use it.  If we're
+     # installed and the LA_FILE does not exist, assume to use -L/-l
+     # (the LA_FILE may not have been installed).  If we're building ourselves,
+     # we'll assume that at some point the .la file be created.
+-    if test -f "$LA_FILE"; then
+-        flags="$flags $LA_FILE"
+-    elif test "$location" = "installed"; then
+-        ### avoid using -L if libdir is a "standard" location like /usr/lib
+-        # Since the user is specifying they are linking with libtool, we
+-        # *know* that -R will be recognized by libtool.
+-        flags="$flags -L$libdir -R$libdir -l${APR_LIBNAME}"
+-    else
+-        flags="$flags $LA_FILE"
+-    fi
++        flags="$flags -l${APR_LIBNAME}"
+     ;;
+     --shlib-path-var)
+     echo "$SHLIBPATH_VAR"
diff --git a/meta/recipes-support/apr/apr/configure_fixes.patch b/meta/recipes-support/apr/apr/configure_fixes.patch
new file mode 100644
index 0000000..0514000
--- /dev/null
+++ b/meta/recipes-support/apr/apr/configure_fixes.patch
@@ -0,0 +1,68 @@
+Upstream-Status: Inappropriate [configuration]
+
+Index: apr-1.3.3/configure.in
+===================================================================
+--- apr-1.3.3.orig/configure.in
++++ apr-1.3.3/configure.in
+@@ -794,39 +794,6 @@ AC_CHECK_FUNCS([mmap munmap shm_open shm
+                 create_area])
+ 
+ APR_CHECK_DEFINE(MAP_ANON, sys/mman.h)
+-AC_CHECK_FILE(/dev/zero)
+-
+-# Not all systems can mmap /dev/zero (such as HP-UX).  Check for that.
+-if test "$ac_cv_func_mmap" = "yes" &&
+-   test "$ac_cv_file__dev_zero" = "yes"; then
+-    AC_MSG_CHECKING(for mmap that can map /dev/zero)
+-    AC_TRY_RUN([
+-#include <sys/types.h>
+-#include <sys/stat.h>
+-#include <fcntl.h>
+-#ifdef HAVE_SYS_MMAN_H
+-#include <sys/mman.h>
+-#endif
+-    int main()
+-    {
+-        int fd;
+-        void *m;
+-        fd = open("/dev/zero", O_RDWR);
+-        if (fd < 0) {
+-            return 1;
+-        }
+-        m = mmap(0, sizeof(void*), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+-        if (m == (void *)-1) {  /* aka MAP_FAILED */
+-            return 2;
+-        }
+-        if (munmap(m, sizeof(void*)) < 0) {
+-            return 3;
+-        }
+-        return 0;
+-    }], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no])
+-
+-    AC_MSG_RESULT($ac_cv_file__dev_zero)
+-fi
+ 
+ # Now we determine which one is our anonymous shmem preference.
+ haveshmgetanon="0"
+@@ -1518,13 +1485,14 @@ else
+     bigendian=0
+ fi
+ 
+-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>
+-#include <sys/uio.h>],struct iovec,0)
+-if test "$ac_cv_sizeof_struct_iovec" = "0"; then
+-    have_iovec=0
+-else
+-    have_iovec=1
+-fi
++#APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>
++##include <sys/uio.h>],struct iovec,0)
++#if test "$ac_cv_sizeof_struct_iovec" = "0"; then
++#    have_iovec=0
++#else
++#    have_iovec=1
++#fi
++have_iovec=1
+ 
+ AC_SUBST(voidp_size)
+ AC_SUBST(short_value)
diff --git a/meta/recipes-support/apr/apr/run-ptest b/meta/recipes-support/apr/apr/run-ptest
new file mode 100644
index 0000000..ae19a1d
--- /dev/null
+++ b/meta/recipes-support/apr/apr/run-ptest
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+cd test
+./testall |sed \
+  -e 's|\(.*\):  SUCCESS|PASS: \1|' \
+  -e 's|\(.*\):  FAILED|FAIL: \1|'
diff --git a/meta/recipes-support/apr/apr/upgrade-and-fix-1.5.1.patch b/meta/recipes-support/apr/apr/upgrade-and-fix-1.5.1.patch
new file mode 100644
index 0000000..9569645
--- /dev/null
+++ b/meta/recipes-support/apr/apr/upgrade-and-fix-1.5.1.patch
@@ -0,0 +1,45 @@
+Makefile.in: fix cross compiling failed
+
+The tools/gen_test_char was invoked at build time,
+and it didn't work for the cross compiling, so we
+compile it with $BUILD_CC.
+
+Remove the 'tools' dir creation, it always existed.
+And it caused gen_test_char unexpected rebuilt at
+do_install time.
+
+Upstream-Status: inappropriate [oe specific]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ Makefile.in | 10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index a2a5194..5fe028f 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -46,7 +46,6 @@ LT_VERSION = @LT_VERSION@
+ 
+ CLEAN_TARGETS = apr-config.out apr.exp exports.c export_vars.c .make.dirs \
+ 	build/apr_rules.out tools/gen_test_char@EXEEXT@ \
+-	tools/gen_test_char.o tools/gen_test_char.lo \
+ 	include/private/apr_escape_test_char.h
+ DISTCLEAN_TARGETS = config.cache config.log config.status \
+ 	include/apr.h include/arch/unix/apr_private.h \
+@@ -129,13 +128,8 @@ check: $(TARGET_LIB)
+ etags:
+ 	etags `find . -name '*.[ch]'`
+ 
+-OBJECTS_gen_test_char = tools/gen_test_char.lo $(LOCAL_LIBS)
+-tools/gen_test_char.lo: tools/gen_test_char.c
+-	$(APR_MKDIR) tools
+-	$(LT_COMPILE)
+-
+-tools/gen_test_char@EXEEXT@: $(OBJECTS_gen_test_char)
+-	$(LINK_PROG) $(OBJECTS_gen_test_char) $(ALL_LIBS)
++tools/gen_test_char@EXEEXT@: tools/gen_test_char.c
++	$(BUILD_CC) $(CFLAGS_FOR_BUILD) $< -o $@
+ 
+ include/private/apr_escape_test_char.h: tools/gen_test_char@EXEEXT@
+ 	$(APR_MKDIR) include/private
diff --git a/meta/recipes-support/apr/apr_1.5.2.bb b/meta/recipes-support/apr/apr_1.5.2.bb
new file mode 100644
index 0000000..c1f7f38
--- /dev/null
+++ b/meta/recipes-support/apr/apr_1.5.2.bb
@@ -0,0 +1,96 @@
+SUMMARY = "Apache Portable Runtime (APR) library"
+HOMEPAGE = "http://apr.apache.org/"
+SECTION = "libs"
+DEPENDS = "util-linux"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4dfd4cd216828c8cae5de5a12f3844c8 \
+                    file://include/apr_lib.h;endline=17;md5=ee42fa7575dc40580a9e01c1b75fae96"
+
+BBCLASSEXTEND = "native nativesdk"
+
+SRC_URI = "${APACHE_MIRROR}/apr/${BPN}-${PV}.tar.bz2 \
+           file://configure_fixes.patch \
+           file://cleanup.patch \
+           file://configfix.patch \
+           file://run-ptest \
+           file://upgrade-and-fix-1.5.1.patch \
+           file://Fix-packet-discards-HTTP-redirect.patch \
+"
+
+SRC_URI[md5sum] = "4e9769f3349fe11fc0a5e1b224c236aa"
+SRC_URI[sha256sum] = "7d03ed29c22a7152be45b8e50431063736df9e1daa1ddf93f6a547ba7a28f67a"
+
+inherit autotools-brokensep lib_package binconfig multilib_header ptest
+
+OE_BINCONFIG_EXTRA_MANGLE = " -e 's:location=source:location=installed:'"
+
+# Added to fix some issues with cmake. Refer to https://github.com/bmwcarit/meta-ros/issues/68#issuecomment-19896928
+CACHED_CONFIGUREVARS += "apr_cv_mutex_recursive=yes"
+
+# Also suppress trying to use sctp.
+#
+CACHED_CONFIGUREVARS += "ac_cv_header_netinet_sctp_h=no ac_cv_header_netinet_sctp_uio_h=no"
+
+do_configure_prepend() {
+	# Avoid absolute paths for grep since it causes failures
+	# when using sstate between different hosts with different
+	# install paths for grep.
+	export GREP="grep"
+
+	cd ${S}
+	./buildconf
+}
+
+FILES_${PN}-dev += "${libdir}/apr.exp ${datadir}/build-1/*"
+RDEPENDS_${PN}-dev += "bash"
+
+#for some reason, build/libtool.m4 handled by buildconf still be overwritten
+#when autoconf, so handle it again.
+do_configure_append() {
+	sed -i -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' ${S}/build/libtool.m4
+	sed -i -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' ${S}/build/apr_rules.mk
+}
+
+do_install_append() {
+	oe_multilib_header apr.h
+	install -d ${D}${datadir}/apr
+	cp ${S}/${HOST_SYS}-libtool ${D}${datadir}/build-1/libtool
+}
+
+SSTATE_SCAN_FILES += "apr_rules.mk libtool"
+
+SYSROOT_PREPROCESS_FUNCS += "apr_sysroot_preprocess"
+
+apr_sysroot_preprocess () {
+	d=${SYSROOT_DESTDIR}${datadir}/apr
+	install -d $d/
+	cp ${S}/build/apr_rules.mk $d/
+	sed -i s,apr_builddir=.*,apr_builddir=,g $d/apr_rules.mk
+	sed -i s,apr_builders=.*,apr_builders=,g $d/apr_rules.mk
+	sed -i s,LIBTOOL=.*,LIBTOOL=${HOST_SYS}-libtool,g $d/apr_rules.mk
+	sed -i s,\$\(apr_builders\),${STAGING_DATADIR}/apr/,g $d/apr_rules.mk
+	cp ${S}/build/mkdir.sh $d/
+	cp ${S}/build/make_exports.awk $d/
+	cp ${S}/build/make_var_export.awk $d/
+}
+
+do_compile_ptest() {
+	cd ${S}/test
+	oe_runmake
+}
+
+do_install_ptest() {
+	t=${D}${PTEST_PATH}/test
+	mkdir -p $t/.libs
+	cp -r ${S}/test/data $t/
+	cp -r ${S}/test/.libs/*.so $t/.libs/
+	cp ${S}/test/proc_child $t/
+	cp ${S}/test/readchild $t/
+	cp ${S}/test/sockchild $t/
+	cp ${S}/test/sockperf $t/
+	cp ${S}/test/testall $t/
+	cp ${S}/test/tryread $t/
+}
+
+export CONFIG_SHELL="/bin/bash"