Reviewers: Michael Starzinger,
Message:
v8: fix dragonflybsd build
* fix gyp build
* don't require libexecinfo, it's not there
* libpthread doesn't implement sem_timedwait(), fall back to sem_wait()
DragonFlyBSD is a mostly compatible fork of FreeBSD. This commit papers
over the
remaining differences.
Description:
fix dragonflybsd build
Please review this at https://codereview.chromium.org/11421013/
Affected files:
M build/common.gypi
M build/standalone.gypi
M src/d8.gyp
M src/platform-freebsd.cc
M tools/gyp/v8.gyp
Index: build/common.gypi
diff --git a/build/common.gypi b/build/common.gypi
index
87fda5cfb0e355df425fe90e0f1d31fa8fba0eb8..4c7b055b9c321592bb117f426bb7e5122f21fbc8
100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -279,8 +279,7 @@
},
},
}],
- ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
- or OS=="netbsd"', {
+ ['OS in "linux freebsd dragonflybsd openbsd solaris
netbsd".split()', {
'conditions': [
[ 'v8_no_strict_aliasing==1', {
'cflags': [ '-fno-strict-aliasing' ],
@@ -290,8 +289,8 @@
['OS=="solaris"', {
'defines': [ '__C99FEATURES__=1' ], # isinf() etc.
}],
- ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
- or OS=="netbsd" or OS=="mac" or OS=="android") and \
+ ['(OS=="linux" or OS=="freebsd" or OS=="dragonflybsd" or
OS=="openbsd" \
+ or OS=="solaris" or OS=="netbsd" or OS=="mac" or OS=="android")
and \
(v8_target_arch=="arm" or v8_target_arch=="ia32" or \
v8_target_arch=="mipsel")', {
# Check whether the host compiler and target compiler support the
@@ -324,7 +323,7 @@
}],
],
}],
- ['OS=="freebsd" or OS=="openbsd"', {
+ ['OS=="freebsd" or OS=="dragonflybsd" or OS=="openbsd"', {
'cflags': [ '-I/usr/local/include' ],
}],
['OS=="netbsd"', {
@@ -363,7 +362,7 @@
['v8_enable_extra_checks==1', {
'defines': ['ENABLE_EXTRA_CHECKS',],
}],
- ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or
OS=="netbsd"', {
+ ['OS in "linux freebsd dragonflybsd openbsd netbsd".split()', {
'cflags':
[ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
'-Wnon-virtual-dtor', '-Woverloaded-virtual' ],
}],
@@ -391,8 +390,8 @@
['v8_enable_extra_checks==1', {
'defines': ['ENABLE_EXTRA_CHECKS',],
}],
- ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
- or OS=="android"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="dragonflybsd" \
+ or OS=="openbsd" or OS=="netbsd" or OS=="android"', {
'cflags!': [
'-O2',
'-Os',
Index: build/standalone.gypi
diff --git a/build/standalone.gypi b/build/standalone.gypi
index
7145a16e0c29eee3b14777a74fc1c6561c3bc774..e6c7088997b89ea1aa06fdcec3bf241100a622c3
100644
--- a/build/standalone.gypi
+++ b/build/standalone.gypi
@@ -38,8 +38,7 @@
'variables': {
'variables': {
'conditions': [
- ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \
- OS=="netbsd" or OS=="mac"', {
+ ['OS!="win"', {
# This handles the Unix platforms we generally deal with.
# Anything else gets passed through, which probably won't
work
# very well; such hosts should pass an explicit target_arch
@@ -47,9 +46,8 @@
'host_arch%':
'<!(uname -m | sed -e "s/i.86/ia32/;\
s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/mips.*/mipsel/")',
- }, {
- # OS!="linux" and OS!="freebsd" and OS!="openbsd" and
- # OS!="netbsd" and OS!="mac"
+ }],
+ ['OS=="win"', {
'host_arch%': 'ia32',
}],
],
@@ -89,8 +87,7 @@
},
},
'conditions': [
- ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
- or OS=="netbsd"', {
+ ['OS!="win"', {
'target_defaults': {
'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
'-Wnon-virtual-dtor', '-pthread', '-fno-rtti',
@@ -109,8 +106,6 @@
],
},
}],
- # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"
- # or OS=="netbsd"'
['OS=="win"', {
'target_defaults': {
'defines': [
Index: src/d8.gyp
diff --git a/src/d8.gyp b/src/d8.gyp
index
2aa94ccf92dd04c78be29f6240b4035fe1b2cb4e..051b0922b72bb0660e882e46ad1829c74565ea7e
100644
--- a/src/d8.gyp
+++ b/src/d8.gyp
@@ -61,8 +61,7 @@
'libraries': [ '-lreadline', ],
'sources': [ 'd8-readline.cc' ],
}],
- ['(OS=="linux" or OS=="mac" or OS=="freebsd" or OS=="netbsd" \
- or OS=="openbsd" or OS=="solaris" or OS=="android")', {
+ [ 'OS!="win"', {
'sources': [ 'd8-posix.cc', ]
}],
[ 'OS=="win"', {
Index: src/platform-freebsd.cc
diff --git a/src/platform-freebsd.cc b/src/platform-freebsd.cc
index
3ec02b780c047ca157163384cb056c37c39d5c70..c2cf6cbaec814fae4686e4d04e0e0aaec57afb17
100644
--- a/src/platform-freebsd.cc
+++ b/src/platform-freebsd.cc
@@ -43,12 +43,15 @@
#include <sys/fcntl.h> // open
#include <unistd.h> // getpagesize
// If you don't have execinfo.h then you need devel/libexecinfo from ports.
-#include <execinfo.h> // backtrace, backtrace_symbols
#include <strings.h> // index
#include <errno.h>
#include <stdarg.h>
#include <limits.h>
+#if !defined(__DragonFly__)
+#include <execinfo.h> // backtrace, backtrace_symbols
+#endif
+
#undef MAP_TYPE
#include "v8.h"
@@ -296,6 +299,9 @@ void OS::SignalCodeMovingGC() {
int OS::StackWalk(Vector<OS::StackFrame> frames) {
+#if defined(__DragonFly__)
+ return 0;
+#else
int frames_size = frames.length();
ScopedVector<void*> addresses(frames_size);
@@ -320,6 +326,7 @@ int OS::StackWalk(Vector<OS::StackFrame> frames) {
free(symbols);
return frames_count;
+#endif
}
@@ -618,6 +625,13 @@ void FreeBSDSemaphore::Wait() {
bool FreeBSDSemaphore::Wait(int timeout) {
+#if defined(__DragonFly__)
+ /* DragonFlyBSD lacks sem_timedwait() and there is no good way to
emulate it.
+ */
+ if (sem_wait(&sem_)) abort();
+ USE(timeout);
+ return true;
+#else
const long kOneSecondMicros = 1000000; // NOLINT
// Split timeout into second and nanosecond parts.
@@ -643,6 +657,7 @@ bool FreeBSDSemaphore::Wait(int timeout) {
if (result == -1 && errno == ETIMEDOUT) return false; // Timeout.
CHECK(result == -1 && errno == EINTR); // Signal caused spurious
wakeup.
}
+#endif
}
Index: tools/gyp/v8.gyp
diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp
index
5ca9725380a5f1d6706c42324a7a0ede0549b949..c85e6825b388ba3c89e6c05860b12eeb2119e560
100644
--- a/tools/gyp/v8.gyp
+++ b/tools/gyp/v8.gyp
@@ -687,6 +687,14 @@
'libraries': [
'-L/usr/local/lib -lexecinfo',
]},
+ }],
+ ['OS=="dragonflybsd"', {
+ 'link_settings': {
+ 'libraries': [
+ '-pthread',
+ ]},
+ }],
+ ['OS=="freebsd" or OS=="dragonflybsd"', {
'sources': [
'../../src/platform-freebsd.cc',
'../../src/platform-posix.cc'
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev