Bug 1428182 - 5. Update libevent patch for Android builds; r=nfroyd
Support for accept4 and arc4random_buf depends on which set of NDK
headers we're using. accept4 is supported for API >= 21 for unified and
non-unified headers. arc4random_buf is supported for API >= 21 if using
non-unified headers, and it's always supported if using unified headers
(the unified headers provide shims for API < 21).
MozReview-Commit-ID: FY8n5jWXB1K
--- a/ipc/chromium/src/third_party/libevent/README.mozilla
+++ b/ipc/chromium/src/third_party/libevent/README.mozilla
@@ -29,10 +29,10 @@ ipc/chromium/src/third_party/libevent/pa
See bug 931354 and bug 1259218.
- "dont-use-issetugid-on-android.patch". Fixes Android startup crashes.
See bug 1030899.
- "linux-no-sysctl.patch". Fixes the build on Linux systems without sysctl.h.
See bug 1263429.
-- "android-arc4random-buf.patch". Fixes the build for clang/android builds.
- See bug 1281596 and bug 1282141.
+- "android-api-level.patch". Fixes the build under clang or NDK r16.
+ See bug 1281596, bug 1282141, and bug 1428182.
--- a/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
+++ b/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
@@ -19,23 +19,31 @@
/* Define if libevent should not allow replacing the mm functions */
/* #undef EVENT__DISABLE_MM_REPLACEMENT */
/* Define if libevent should not be compiled with thread support */
/* #undef EVENT__DISABLE_THREAD_SUPPORT */
/* Define to 1 if you have the `accept4' function. */
+#if __ANDROID_API__ >= 21
#define EVENT__HAVE_ACCEPT4 1
+#else
+/* #undef EVENT__HAVE_ACCEPT4 */
+#endif
/* Define to 1 if you have the `arc4random' function. */
#define EVENT__HAVE_ARC4RANDOM 1
/* Define to 1 if you have the `arc4random_buf' function. */
+#if __ANDROID_API__ >= 21 || defined(__ANDROID_API_L__)
+#define EVENT__HAVE_ARC4RANDOM_BUF 1
+#else
/* #undef EVENT__HAVE_ARC4RANDOM_BUF */
+#endif
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define EVENT__HAVE_ARPA_INET_H 1
/* Define to 1 if you have the `clock_gettime' function. */
#define EVENT__HAVE_CLOCK_GETTIME 1
/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you
rename from ipc/chromium/src/third_party/libevent/patches/android-arc4random-buf.patch
rename to ipc/chromium/src/third_party/libevent/patches/android-api-level.patch
--- a/ipc/chromium/src/third_party/libevent/patches/android-arc4random-buf.patch
+++ b/ipc/chromium/src/third_party/libevent/patches/android-api-level.patch
@@ -1,22 +1,35 @@
diff --git a/ipc/chromium/src/third_party/libevent/android/event2/event-config.h b/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
--- a/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
+++ b/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
-@@ -25,17 +25,17 @@
+@@ -19,23 +19,31 @@
+
+ /* Define if libevent should not allow replacing the mm functions */
+ /* #undef EVENT__DISABLE_MM_REPLACEMENT */
+
+ /* Define if libevent should not be compiled with thread support */
+ /* #undef EVENT__DISABLE_THREAD_SUPPORT */
/* Define to 1 if you have the `accept4' function. */
++#if __ANDROID_API__ >= 21
#define EVENT__HAVE_ACCEPT4 1
++#else
++/* #undef EVENT__HAVE_ACCEPT4 */
++#endif
/* Define to 1 if you have the `arc4random' function. */
#define EVENT__HAVE_ARC4RANDOM 1
/* Define to 1 if you have the `arc4random_buf' function. */
--#define EVENT__HAVE_ARC4RANDOM_BUF 1
++#if __ANDROID_API__ >= 21 || defined(__ANDROID_API_L__)
+ #define EVENT__HAVE_ARC4RANDOM_BUF 1
++#else
+/* #undef EVENT__HAVE_ARC4RANDOM_BUF */
++#endif
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define EVENT__HAVE_ARPA_INET_H 1
/* Define to 1 if you have the `clock_gettime' function. */
#define EVENT__HAVE_CLOCK_GETTIME 1
/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you