--- /dev/null
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PECL_NAME:=libevent
+PECL_LONGNAME:=Libevent - event notification
+
+PKG_NAME:=php7-pecl-$(PECL_NAME)
+PKG_VERSION=2016-08-30-$(PKG_SOURCE_VERSION)
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/expressif/pecl-event-libevent.git
+PKG_SOURCE_VERSION:=9e72744ce6224beafc7b54ce2a3a990f1c552a5a
+PKG_SOURCE_SUBDIR:=$(PECL_NAME)-$(PKG_SOURCE_VERSION)
+PKG_SOURCE:=$(PECL_NAME)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
+
+PKG_LICENSE:=PHPv3.01
+PKG_LICENSE_FILES:=
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PECL_NAME)-$(PKG_SOURCE_VERSION)
+PKG_BUILD_PARALLEL:=1
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+include ../php7/pecl.mk
+
+CONFIGURE_ARGS+= --with-libevent=shared,"$(STAGING_DIR)/usr"
+
+$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME),+libevent2 +php7-mod-sockets,25))
+$(eval $(call BuildPackage,$(PKG_NAME)))
--- /dev/null
+--- a/libevent.c
++++ b/libevent.c
+@@ -42,10 +42,12 @@
+ (rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type))
+ #endif
+
+-#ifdef PHP_WIN32
++//#ifdef PHP_WIN32
+ /* XXX compiling with 2.x on Windows. Luckily the ext code works thanks to the
+ compat exports from the libevent. However it might need to be adapted to the
+ never version, so this ifdefs would go away. */
++#if 1
++/* force use of libevent2 on OpenWrt and by-pass compat event.h */
+ # include <event2/event.h>
+ # include <event2/event_compat.h>
+ # include <event2/event_struct.h>