libevent: add version 2.0.21 to align with stx 3.0
Add version 2.0.21 to align with stx 3.0:
- Add the recipe for version 2.0.21
- Set the preferred version to 2.0.21
- Enable build with openssl10
- Add patch libevent-ipv6-client-socket.patch from
libevent-2.0.21-4.el7.tis.2.src.rpm
Issue-ID: INF-176
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Change-Id: I798e5fdf2afec0f44206e280de71231173367bbe
diff --git a/meta-stx/conf/distro/include/stx-preferred-vers.inc b/meta-stx/conf/distro/include/stx-preferred-vers.inc
index 4c4afdf..4aa1eb3 100644
--- a/meta-stx/conf/distro/include/stx-preferred-vers.inc
+++ b/meta-stx/conf/distro/include/stx-preferred-vers.inc
@@ -17,6 +17,7 @@
PREFERRED_VERSION_dnsmasq = "2.76"
PREFERRED_VERSION_json-c = "0.11"
PREFERRED_VERSION_keyutils = "1.6"
+PREFERRED_VERSION_libevent = "2.0.21"
PREFERRED_VERSION_python-voluptuous = "0.8.9"
PREFERRED_VERSION_python3-cherrypy = "18.2.0"
PREFERRED_VERSION_python-cheroot = "7.0.0"
diff --git a/meta-stx/recipes-support/libevent/libevent/disable_tests.patch b/meta-stx/recipes-support/libevent/libevent/disable_tests.patch
new file mode 100644
index 0000000..5d2c690
--- /dev/null
+++ b/meta-stx/recipes-support/libevent/libevent/disable_tests.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Inappropriate [disable feature]
+
+Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
+diff -Nurd libevent-2.0.21-stable/test/Makefile.am libevent-2.0.21-stable/test/Makefile.am
+--- libevent-2.0.21-stable/test/Makefile.am 2012-05-31 07:08:19.000000000 +0300
++++ libevent-2.0.21-stable/test/Makefile.am 2013-02-08 02:06:20.227475872 +0200
+@@ -19,8 +19,6 @@
+ EXTRA_PROGRAMS = regress
+ noinst_HEADERS = tinytest.h tinytest_macros.h regress.h tinytest_local.h
+
+-TESTS = $(top_srcdir)/test/test.sh
+-
+ BUILT_SOURCES =
+ if BUILD_REGRESS
+ BUILT_SOURCES += regress.gen.c regress.gen.h
diff --git a/meta-stx/recipes-support/libevent/libevent/libevent-disable_tests.patch b/meta-stx/recipes-support/libevent/libevent/libevent-disable_tests.patch
new file mode 100644
index 0000000..5d2c690
--- /dev/null
+++ b/meta-stx/recipes-support/libevent/libevent/libevent-disable_tests.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Inappropriate [disable feature]
+
+Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
+diff -Nurd libevent-2.0.21-stable/test/Makefile.am libevent-2.0.21-stable/test/Makefile.am
+--- libevent-2.0.21-stable/test/Makefile.am 2012-05-31 07:08:19.000000000 +0300
++++ libevent-2.0.21-stable/test/Makefile.am 2013-02-08 02:06:20.227475872 +0200
+@@ -19,8 +19,6 @@
+ EXTRA_PROGRAMS = regress
+ noinst_HEADERS = tinytest.h tinytest_macros.h regress.h tinytest_local.h
+
+-TESTS = $(top_srcdir)/test/test.sh
+-
+ BUILT_SOURCES =
+ if BUILD_REGRESS
+ BUILT_SOURCES += regress.gen.c regress.gen.h
diff --git a/meta-stx/recipes-support/libevent/libevent/libevent-ipv6-client-socket.patch b/meta-stx/recipes-support/libevent/libevent/libevent-ipv6-client-socket.patch
new file mode 100644
index 0000000..d11e942
--- /dev/null
+++ b/meta-stx/recipes-support/libevent/libevent/libevent-ipv6-client-socket.patch
@@ -0,0 +1,55 @@
+---
+ http.c | 25 ++++++++++++++++++-------
+ 1 file changed, 18 insertions(+), 7 deletions(-)
+
+--- a/http.c
++++ b/http.c
+@@ -1325,6 +1325,9 @@ evhttp_error_cb(struct bufferevent *bufe
+ struct evhttp_connection *evcon = arg;
+ struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
+
++ if (evcon->fd == -1)
++ evcon->fd = bufferevent_getfd(bufev);
++
+ switch (evcon->state) {
+ case EVCON_CONNECTING:
+ if (what & BEV_EVENT_TIMEOUT) {
+@@ -1390,6 +1393,9 @@ evhttp_connection_cb(struct bufferevent
+ int error;
+ ev_socklen_t errsz = sizeof(error);
+
++ if (evcon->fd == -1)
++ evcon->fd = bufferevent_getfd(bufev);
++
+ if (!(what & BEV_EVENT_CONNECTED)) {
+ /* some operating systems return ECONNREFUSED immediately
+ * when connecting to a local address. the cleanup is going
+@@ -2189,16 +2195,21 @@ evhttp_connection_connect(struct evhttp_
+ EVUTIL_ASSERT(!(evcon->flags & EVHTTP_CON_INCOMING));
+ evcon->flags |= EVHTTP_CON_OUTGOING;
+
+- evcon->fd = bind_socket(
+- evcon->bind_address, evcon->bind_port, 0 /*reuse*/);
+- if (evcon->fd == -1) {
+- event_debug(("%s: failed to bind to \"%s\"",
+- __func__, evcon->bind_address));
+- return (-1);
++ if (evcon->bind_address || evcon->bind_port) {
++ evcon->fd = bind_socket(
++ evcon->bind_address, evcon->bind_port, 0 /*reuse*/);
++ if (evcon->fd == -1) {
++ event_debug(("%s: failed to bind to \"%s\"",
++ __func__, evcon->bind_address));
++ return (-1);
++ }
++
++ bufferevent_setfd(evcon->bufev, evcon->fd);
++ } else {
++ bufferevent_setfd(evcon->bufev, -1);
+ }
+
+ /* Set up a callback for successful connection setup */
+- bufferevent_setfd(evcon->bufev, evcon->fd);
+ bufferevent_setcb(evcon->bufev,
+ NULL /* evhttp_read_cb */,
+ NULL /* evhttp_write_cb */,
diff --git a/meta-stx/recipes-support/libevent/libevent/libevent-obsolete_automake_macros.patch b/meta-stx/recipes-support/libevent/libevent/libevent-obsolete_automake_macros.patch
new file mode 100644
index 0000000..b559232
--- /dev/null
+++ b/meta-stx/recipes-support/libevent/libevent/libevent-obsolete_automake_macros.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Submitted [https://sourceforge.net/tracker/?func=detail&aid=3603774&group_id=50884&atid=461322]
+
+Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
+diff -Nurd libevent-2.0.21-stable/configure.in libevent-2.0.21-stable/configure.in
+--- libevent-2.0.21-stable/configure.in 2012-11-18 08:34:13.000000000 +0200
++++ libevent-2.0.21-stable/configure.in 2013-02-08 02:03:58.403476183 +0200
+@@ -12,7 +12,7 @@
+ AC_CONFIG_MACRO_DIR([m4])
+
+ AM_INIT_AUTOMAKE(libevent,2.0.21-stable)
+-AM_CONFIG_HEADER(config.h)
++AC_CONFIG_HEADERS(config.h)
+ AC_DEFINE(NUMERIC_VERSION, 0x02001500, [Numeric representation of the version])
+
+ dnl Initialize prefix.
diff --git a/meta-stx/recipes-support/libevent/libevent/obsolete_automake_macros.patch b/meta-stx/recipes-support/libevent/libevent/obsolete_automake_macros.patch
new file mode 100644
index 0000000..b559232
--- /dev/null
+++ b/meta-stx/recipes-support/libevent/libevent/obsolete_automake_macros.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Submitted [https://sourceforge.net/tracker/?func=detail&aid=3603774&group_id=50884&atid=461322]
+
+Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
+diff -Nurd libevent-2.0.21-stable/configure.in libevent-2.0.21-stable/configure.in
+--- libevent-2.0.21-stable/configure.in 2012-11-18 08:34:13.000000000 +0200
++++ libevent-2.0.21-stable/configure.in 2013-02-08 02:03:58.403476183 +0200
+@@ -12,7 +12,7 @@
+ AC_CONFIG_MACRO_DIR([m4])
+
+ AM_INIT_AUTOMAKE(libevent,2.0.21-stable)
+-AM_CONFIG_HEADER(config.h)
++AC_CONFIG_HEADERS(config.h)
+ AC_DEFINE(NUMERIC_VERSION, 0x02001500, [Numeric representation of the version])
+
+ dnl Initialize prefix.
diff --git a/meta-stx/recipes-support/libevent/libevent_2.0.21.bb b/meta-stx/recipes-support/libevent/libevent_2.0.21.bb
new file mode 100644
index 0000000..af7344e
--- /dev/null
+++ b/meta-stx/recipes-support/libevent/libevent_2.0.21.bb
@@ -0,0 +1,46 @@
+#
+## Copyright (C) 2019 Wind River Systems, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SUMMARY = "An asynchronous event notification library"
+HOMEPAGE = "http://libevent.org/"
+BUGTRACKER = "https://github.com/libevent/libevent/issues"
+SECTION = "libs"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=45c5316ff684bcfe2f9f86d8b1279559"
+
+SRC_URI = " \
+ https://github.com/downloads/libevent/libevent/${BP}-stable.tar.gz \
+ file://libevent-obsolete_automake_macros.patch \
+ file://libevent-disable_tests.patch \
+ file://libevent-ipv6-client-socket.patch \
+"
+
+SRC_URI[md5sum] = "b2405cc9ebf264aa47ff615d9de527a2"
+SRC_URI[sha256sum] = "22a530a8a5ba1cb9c080cba033206b17dacd21437762155c6d30ee6469f574f5"
+
+S = "${WORKDIR}/${BP}-stable"
+
+inherit openssl10
+
+PACKAGECONFIG ??= "openssl"
+PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl10"
+
+inherit autotools
+
+# Needed for Debian packaging
+LEAD_SONAME = "libevent-2.0.so"
+
+BBCLASSEXTEND = "native nativesdk"