summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-24 18:26:24 +0000
committersgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-24 18:26:24 +0000
commitc7848cc2522c8057fe0c54a3485a98cd309c551f (patch)
tree7bc96c92ac98bb96cf427059a188ca6685aabcbd
parent8c1445388c4f9cdf1f2214d7924935b5891150ca (diff)
downloadchromium_src-c7848cc2522c8057fe0c54a3485a98cd309c551f.zip
chromium_src-c7848cc2522c8057fe0c54a3485a98cd309c551f.tar.gz
chromium_src-c7848cc2522c8057fe0c54a3485a98cd309c551f.tar.bz2
Get libevent building and linking in base_unittests in the Mac SCons build:
* Call the $LIBEVENT_DIR/SConscript file on both Linux and Mac. * Add generation of the config.h file. * Modify the libevent_prebuild.sh script so SCons can pass in the input file name (because SCons executes things from top of tree) but the script still defaults to what XCode wants. * Only build epoll.c and epoll_sub.c on Linux. * Only build kqueue.c on Mac. * Add -framework AppKit to the link lines. * Add -fobjc-gc to Objective C compilation. * Add message_pump_mac.mm to the base input file list on Mac. * Build message_pump_libevent.cc on for base on both Linux and Mac. * Link against -levent on both Linux and Mac. Review URL: http://codereview.chromium.org/4254 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2555 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/SConscript5
-rw-r--r--build/SConscript.main4
-rw-r--r--third_party/libevent/SConscript39
-rwxr-xr-xthird_party/libevent/libevent.xcodeproj/libevent_prebuild.sh7
4 files changed, 43 insertions, 12 deletions
diff --git a/base/SConscript b/base/SConscript
index ad77557..b9667bd 100644
--- a/base/SConscript
+++ b/base/SConscript
@@ -131,6 +131,7 @@ if env['PLATFORM'] in ('darwin', 'posix'):
'debug_util_posix.cc',
'file_util_posix.cc',
'lock_impl_posix.cc',
+ 'message_pump_libevent.cc',
'platform_thread_posix.cc',
'process_util_posix.cc',
'shared_memory_posix.cc',
@@ -149,6 +150,7 @@ if env['PLATFORM'] == 'darwin':
'file_util_mac.mm',
'file_version_info_mac.mm',
'hmac_mac.cc',
+ 'message_pump_mac.mm',
'platform_thread_mac.mm',
'sys_string_conversions_mac.cc',
'worker_pool_mac.mm',
@@ -160,7 +162,6 @@ if env['PLATFORM'] == 'posix':
'base_paths_linux.cc',
'file_util_linux.cc',
'hmac_nss.cc',
- 'message_pump_libevent.cc',
'nss_init.cc',
'sys_string_conversions_linux.cc',
'worker_pool.cc',
@@ -231,7 +232,7 @@ if env['PLATFORM'] == 'win32':
],
)
-if env['PLATFORM'] == 'posix':
+if env['PLATFORM'] in ('posix', 'darwin'):
env_tests.Append(
LIBS = [
'event',
diff --git a/build/SConscript.main b/build/SConscript.main
index 8807cbd..80c1052 100644
--- a/build/SConscript.main
+++ b/build/SConscript.main
@@ -368,6 +368,7 @@ elif env['PLATFORM'] == 'darwin':
],
CXXFLAGS = [
'-fvisibility-inlines-hidden',
+ '${str(SOURCE).endswith(".mm") and "-fobjc-gc" or ""}',
],
CCFLAGS = [
'-fmessage-length=0',
@@ -392,6 +393,7 @@ elif env['PLATFORM'] == 'darwin':
'/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks',
],
FRAMEWORKS = [
+ 'AppKit',
'ApplicationServices',
'Foundation',
],
@@ -507,7 +509,7 @@ if LoadComponent('third_party'):
'$LIBXML_DIR/SConscript',
'$LIBXSLT_DIR/SConscript',
])
- if env['PLATFORM'] == 'posix':
+ if env['PLATFORM'] in ('posix', 'darwin'):
sconscripts.extend([
'$LIBEVENT_DIR/SConscript',
])
diff --git a/third_party/libevent/SConscript b/third_party/libevent/SConscript
index 34ead9e..3d1eb9b 100644
--- a/third_party/libevent/SConscript
+++ b/third_party/libevent/SConscript
@@ -15,29 +15,41 @@ env.Append(
],
)
+if env['PLATFORM'] == 'darwin':
+ env.Prepend(
+ CPPPATH = [
+ '$LIBEVENT_DIR/generated/',
+ ],
+ )
+ env['ENV']['CONFIGURATION_TEMP_DIR'] = env.Dir('$LIBEVENT_DIR').abspath
+ env.Command('$LIBEVENT_DIR/generated/config.h',
+ ['libevent.xcodeproj/libevent_prebuild.sh', 'config.h.in'],
+ 'sh ${SOURCES[0]} ${SOURCES[1]}')
+
+
+if env['PLATFORM'] == 'posix':
+ env.Prepend(
+ CPPPATH = [
+ '$LIBEVENT_DIR/linux/',
+ ],
+ )
+
env.Prepend(
CPPPATH = [
'$LIBEVENT_DIR',
'$LIBEVENT_DIR/compat/',
- '$LIBEVENT_DIR/linux/',
],
)
-
input_files = [
'buffer.c',
- #'devpoll.c',
- 'epoll.c',
- 'epoll_sub.c',
'evbuffer.c',
'evdns.c',
'event.c',
'event_tagging.c',
- #'evport.c',
'evrpc.c',
'evutil.c',
'http.c',
- #'kqueue.c',
'log.c',
'poll.c',
'select.c',
@@ -45,5 +57,16 @@ input_files = [
'strlcpy.c',
]
+if env['PLATFORM'] == 'posix':
+ input_files.extend([
+ 'epoll.c',
+ 'epoll_sub.c',
+ ])
+
+if env['PLATFORM'] == 'darwin':
+ input_files.extend([
+ 'kqueue.c',
+ ])
+
-env.ChromeStaticLibrary('libevent', input_files)
+env.ChromeStaticLibrary('event', input_files)
diff --git a/third_party/libevent/libevent.xcodeproj/libevent_prebuild.sh b/third_party/libevent/libevent.xcodeproj/libevent_prebuild.sh
index 38c7da3..6e6c48c 100755
--- a/third_party/libevent/libevent.xcodeproj/libevent_prebuild.sh
+++ b/third_party/libevent/libevent.xcodeproj/libevent_prebuild.sh
@@ -11,6 +11,11 @@ GENERATED_DIR="${CONFIGURATION_TEMP_DIR}/generated"
# Generate config.h the same way that "sh configure" would
mkdir -p "${GENERATED_DIR}"
+CONFIG_H_IN="$1"
+if test "X${CONFIG_H_IN}" = "X"; then
+ CONFIG_H_IN="config.h.in"
+fi
+
CONFIG_H="${GENERATED_DIR}/config.h"
sed -e s/'^#undef DNS_USE_GETTIMEOFDAY_FOR_ID$'/'#define DNS_USE_GETTIMEOFDAY_FOR_ID 1'/ \
-e s/'^#undef HAVE_DLFCN_H$'/'#define HAVE_DLFCN_H 1'/ \
@@ -76,7 +81,7 @@ sed -e s/'^#undef DNS_USE_GETTIMEOFDAY_FOR_ID$'/'#define DNS_USE_GETTIMEOFDAY_FO
-e s/'^#undef TIME_WITH_SYS_TIME$'/'#define TIME_WITH_SYS_TIME 1'/ \
-e s/'^#undef VERSION$'/'#define VERSION "1.4.7-stable"'/ \
-e s@'^\(#undef .*\)$'@'/* \1 */'@ \
- < config.h.in \
+ < "${CONFIG_H_IN}" \
> "${CONFIG_H}.new"
if ! diff -q "${CONFIG_H}.new" "${CONFIG_H}" >& /dev/null ; then