--- /dev/null
+#
+# Copyright (C) 2007-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=apr
+PKG_VERSION:=1.5.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://mirrors.ibiblio.org/apache/apr/
+PKG_MD5SUM:=5486180ec5a23efb5cae6d4292b300ab
+PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
+PKG_LICENSE:=Apache License
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4 build/ltmain.sh
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libapr
+ SECTION:=libs
+ CATEGORY:=Libraries
+ DEPENDS:=+libpthread +librt +libuuid
+ TITLE:=Apache Portable Runtime Library
+ URL:=http://apr.apache.org/
+endef
+
+TARGET_CFLAGS += $(FPIC)
+TARGET_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+
+CONFIGURE_ARGS += \
+ --with-devrandom=/dev/urandom \
+ --disable-dso \
+ --enable-ipv6
+
+# XXX: ac_cv_sizeof_struct_iovec=1 is just to trick configure
+CONFIGURE_VARS += \
+ ac_cv_sizeof_struct_iovec=1 \
+ ac_cv_struct_rlimit=yes \
+ apr_cv_process_shared_works=no \
+ apr_cv_mutex_robust_shared=no \
+ apr_cv_tcp_nodelay_with_cork=yes \
+ apr_cv_use_lfs64=yes \
+ LDFLAGS="$$$$LDFLAGS -lpthread" \
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/include/apr-1 $(1)/usr/lib $(1)/usr/lib/pkgconfig $(1)/usr/share/build-1
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/apr-1-config \
+ $(1)/usr/bin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/apr-1/* \
+ $(1)/usr/include/apr-1/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libapr-1.{la,a,so*} \
+ $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/apr-1.pc \
+ $(1)/usr/lib/pkgconfig/
+ $(CP) $(PKG_INSTALL_DIR)/usr/share/build-1/* \
+ $(1)/usr/share/build-1/
+ $(SED) 's,^datadir=\"/usr/share\",datadir=\"$(STAGING_DIR)/usr/share\",g' $(1)/usr/bin/apr-1-config
+ $(SED) 's,^installbuilddir=\"/usr/share/build-1\",installbuilddir=\"$(STAGING_DIR)/usr/share/build-1\",g' $(1)/usr/bin/apr-1-config
+ $(SED) 's,^libdir=\"$$$${exec_prefix}/lib,libdir=\"$(STAGING_DIR)/usr/lib,g' $(1)/usr/bin/apr-1-config
+ $(SED) 's,^includedir=\"$$$${prefix}/include/,includedir=\"$(STAGING_DIR)/usr/include/,g' $(1)/usr/bin/apr-1-config
+ $(SED) 's,-L$$$$libdir,,g' $(1)/usr/bin/apr-1-config
+ $(SED) 's,-R$$$$libdir,,g' $(1)/usr/bin/apr-1-config
+ $(SED) 's,/usr/share/build-1,$(STAGING_DIR)/usr/share/build-1,g' $(1)/usr/share/build-1/apr_rules.mk
+endef
+
+define Package/libapr/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libapr-1.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libapr))
--- /dev/null
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -3,6 +3,7 @@ srcdir=@srcdir@
+ VPATH=@srcdir@
+ top_srcdir=@apr_srcdir@
+ top_blddir=@apr_builddir@
++top_builddir=@top_builddir@
+
+ #
+ # APR (Apache Portable Runtime) library Makefile.
+--- a/configure.in
++++ b/configure.in
+@@ -246,9 +246,6 @@ case $host in
+ gcc $CFLAGS $CPPFLAGS -o $LIBTOOL.exe $LIBTOOL.c
+ ;;
+ *)
+- if test "x$LTFLAGS" = "x"; then
+- LTFLAGS='--silent'
+- fi
+ if test "$experimental_libtool" = "yes"; then
+ # Use a custom-made libtool replacement
+ echo "using jlibtool"
--- /dev/null
+https://dev.openwrt.org/ticket/9287
+
+--- a/time/unix/time.c
++++ b/time/unix/time.c
+@@ -75,7 +75,7 @@ APR_DECLARE(apr_time_t) apr_time_now(voi
+ {
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+- return tv.tv_sec * APR_USEC_PER_SEC + tv.tv_usec;
++ return tv.tv_sec * (apr_time_t)APR_USEC_PER_SEC + (apr_time_t)tv.tv_usec;
+ }
+
+ static void explode_time(apr_time_exp_t *xt, apr_time_t t,
--- /dev/null
+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 $BUILDCC.
+
+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(-)
+
+Index: apr-1.5.1/Makefile.in
+===================================================================
+--- apr-1.5.1.orig/Makefile.in
++++ apr-1.5.1/Makefile.in
+@@ -20,7 +20,7 @@ INCDIR=./include
+ OSDIR=$(top_srcdir)/include/arch/@OSDIR@
+ DEFOSDIR=$(INCDIR)/arch/@DEFAULT_OSDIR@
+ INCLUDES=-I$(INCDIR) -I$(OSDIR) -I$(DEFOSDIR) -I$(top_srcdir)/include/arch/@DEFAULT_OSDIR@ -I$(top_srcdir)/include -I$(top_srcdir)/include/private -I$(top_blddir)/include/private
+-
++BUILDCC=gcc
+ #
+ # Macros for target determination
+ #
+@@ -47,7 +47,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 \
+@@ -130,13 +129,8 @@ check: $(TARGET_LIB)
+ etags:
+ etags `find . -name '*.[ch]'`
+
+-make_tools_dir:
+- $(APR_MKDIR) tools
+-
+-OBJECTS_gen_test_char = tools/gen_test_char.lo $(LOCAL_LIBS)
+-tools/gen_test_char.lo: make_tools_dir
+-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
++ $(BUILDCC) $(CFLAGS_FOR_BUILD) $< -o $@
+
+ include/private/apr_escape_test_char.h: tools/gen_test_char@EXEEXT@
+ $(APR_MKDIR) include/private