summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 18:16:58 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 18:16:58 +0000
commite97831dd75f59483cca12b7cb397bdbc0e945cd4 (patch)
treef5ec6d49617faeeaaa45c0dc08887c6587330881
parent227b543c559f7d0ca172964494dce5b216f235ef (diff)
downloadchromium_src-e97831dd75f59483cca12b7cb397bdbc0e945cd4.zip
chromium_src-e97831dd75f59483cca12b7cb397bdbc0e945cd4.tar.gz
chromium_src-e97831dd75f59483cca12b7cb397bdbc0e945cd4.tar.bz2
Allow using system libevent instead of the bundled one.
Patch by Bernard Cafarelli <voyageur@gentoo.org> TEST=none BUG=22140 Review URL: http://codereview.chromium.org/524061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35711 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--AUTHORS1
-rw-r--r--base/message_pump_libevent.cc4
-rw-r--r--chrome/browser/debugger/devtools_remote_listen_socket.cc4
-rw-r--r--net/base/listen_socket.cc4
-rw-r--r--net/base/telnet_server.cc4
-rw-r--r--net/socket/tcp_client_socket_libevent.cc5
-rw-r--r--third_party/libevent/libevent.gyp108
7 files changed, 87 insertions, 43 deletions
diff --git a/AUTHORS b/AUTHORS
index d840494..4810b99 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -58,3 +58,4 @@ Dominic Jodoin <dominic.jodoin@gmail.com>
Kaspar Brand <googlecontrib@velox.ch>
Clemens Fruhwirth <clemens@endorphin.org>
Kevin Lee Helpingstine <sig11@reprehensible.net>
+Bernard Cafarelli <voyageur@gentoo.org>
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index 04ea2ab..01ebee5 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -13,7 +13,11 @@
#include "base/scoped_nsautorelease_pool.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
+#if defined(USE_SYSTEM_LIBEVENT)
+#include <event.h>
+#else
#include "third_party/libevent/event.h"
+#endif
// Lifecycle of struct event
// Libevent uses two main data structures:
diff --git a/chrome/browser/debugger/devtools_remote_listen_socket.cc b/chrome/browser/debugger/devtools_remote_listen_socket.cc
index 61db3d5..9a2443b6 100644
--- a/chrome/browser/debugger/devtools_remote_listen_socket.cc
+++ b/chrome/browser/debugger/devtools_remote_listen_socket.cc
@@ -18,8 +18,12 @@
#include "base/message_loop.h"
#include "base/message_pump_libevent.h"
#include "net/base/net_errors.h"
+#if defined(USE_SYSTEM_LIBEVENT)
+#include <event.h>
+#else
#include "third_party/libevent/event.h"
#endif
+#endif
#include "base/eintr_wrapper.h"
#include "base/platform_thread.h"
diff --git a/net/base/listen_socket.cc b/net/base/listen_socket.cc
index fd099b7..88e9592 100644
--- a/net/base/listen_socket.cc
+++ b/net/base/listen_socket.cc
@@ -13,8 +13,12 @@
#include <sys/socket.h>
#include <arpa/inet.h>
#include "net/base/net_errors.h"
+#if defined(USE_SYSTEM_LIBEVENT)
+#include <event.h>
+#else
#include "third_party/libevent/event.h"
#endif
+#endif
#include "base/eintr_wrapper.h"
#include "net/base/net_util.h"
diff --git a/net/base/telnet_server.cc b/net/base/telnet_server.cc
index 51ebf35..91c6cac 100644
--- a/net/base/telnet_server.cc
+++ b/net/base/telnet_server.cc
@@ -13,7 +13,11 @@
#include <sys/socket.h>
#include "base/message_loop.h"
#include "net/base/net_errors.h"
+#if defined(USE_SYSTEM_LIBEVENT)
+#include <event.h>
+#else
#include "third_party/libevent/event.h"
+#endif
#include "base/message_pump_libevent.h"
#endif
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc
index 1321d00..107a18b 100644
--- a/net/socket/tcp_client_socket_libevent.cc
+++ b/net/socket/tcp_client_socket_libevent.cc
@@ -16,8 +16,11 @@
#include "net/base/io_buffer.h"
#include "net/base/load_log.h"
#include "net/base/net_errors.h"
+#if defined(USE_SYSTEM_LIBEVENT)
+#include <event.h>
+#else
#include "third_party/libevent/event.h"
-
+#endif
namespace net {
diff --git a/third_party/libevent/libevent.gyp b/third_party/libevent/libevent.gyp
index 20ac4d64..6d03930 100644
--- a/third_party/libevent/libevent.gyp
+++ b/third_party/libevent/libevent.gyp
@@ -3,54 +3,78 @@
# found in the LICENSE file.
{
- 'targets': [
- {
- 'target_name': 'libevent',
- 'product_name': 'event',
- 'type': '<(library)',
- 'sources': [
- 'buffer.c',
- 'evbuffer.c',
- 'evdns.c',
- 'event.c',
- 'event_tagging.c',
- 'evrpc.c',
- 'evutil.c',
- 'http.c',
- 'log.c',
- 'poll.c',
- 'select.c',
- 'signal.c',
- 'strlcpy.c',
+ 'variables': {
+ 'use_system_libevent%': 0,
+ },
+ 'conditions': [
+ ['use_system_libevent==0', {
+ 'targets': [
+ {
+ 'target_name': 'libevent',
+ 'product_name': 'event',
+ 'type': '<(library)',
+ 'sources': [
+ 'buffer.c',
+ 'evbuffer.c',
+ 'evdns.c',
+ 'event.c',
+ 'event_tagging.c',
+ 'evrpc.c',
+ 'evutil.c',
+ 'http.c',
+ 'log.c',
+ 'poll.c',
+ 'select.c',
+ 'signal.c',
+ 'strlcpy.c',
+ ],
+ 'defines': [
+ 'HAVE_CONFIG_H',
+ ],
+ 'include_dirs': [
+ '.', # libevent includes some of its own headers with
+ # #include <...> instead of #include "..."
+ ],
+ 'conditions': [
+ # libevent has platform-specific implementation files. Since its
+ # native build uses autoconf, platform-specific config.h files are
+ # provided and live in platform-specific directories.
+ [ 'OS == "linux"', {
+ 'sources': [ 'epoll.c', 'epoll_sub.c' ],
+ 'include_dirs': [ 'linux' ],
+ 'link_settings': {
+ 'libraries': [
+ # We need rt for clock_gettime().
+ # TODO(port) Maybe on FreeBSD as well?
+ '-lrt',
+ ],
+ },
+ }],
+ [ 'OS == "mac" or OS == "freebsd"', {
+ 'sources': [ 'kqueue.c' ],
+ 'include_dirs': [ 'mac' ]
+ }],
+ ],
+ },
],
- 'defines': [
- 'HAVE_CONFIG_H',
- ],
- 'include_dirs': [
- '.', # libevent includes some of its own headers with #include <...>
- # instead of #include "..."
- ],
- 'conditions': [
- # libevent has platform-specific implementation files. Since its
- # native build uses autoconf, platform-specific config.h files are
- # provided and live in platform-specific directories.
- [ 'OS == "linux"', {
- 'sources': [ 'epoll.c', 'epoll_sub.c' ],
- 'include_dirs': [ 'linux' ],
+ }, { # use_system_libevent != 0
+ 'targets': [
+ {
+ 'target_name': 'libevent',
+ 'type': 'settings',
+ 'direct_dependent_settings': {
+ 'defines': [
+ 'USE_SYSTEM_LIBEVENT',
+ ],
+ },
'link_settings': {
'libraries': [
- # We need rt for clock_gettime().
- # TODO(port) Maybe on FreeBSD as well?
- '-lrt',
+ '-levent',
],
},
- }],
- [ 'OS == "mac" or OS == "freebsd"', {
- 'sources': [ 'kqueue.c' ],
- 'include_dirs': [ 'mac' ]
- }],
+ }
],
- },
+ }],
],
}