Browse Source

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()

Upstreamed in https://codereview.chromium.org/11421013/
v0.9.4-release
Ben Noordhuis 12 years ago
parent
commit
a25ebb1997
  1. 15
      deps/v8/build/common.gypi
  2. 13
      deps/v8/build/standalone.gypi
  3. 3
      deps/v8/src/d8.gyp
  4. 17
      deps/v8/src/platform-freebsd.cc
  5. 8
      deps/v8/tools/gyp/v8.gyp

15
deps/v8/build/common.gypi

@ -274,8 +274,7 @@
}, },
}, },
}], }],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ ['OS in "linux freebsd dragonflybsd openbsd solaris netbsd".split()', {
or OS=="netbsd"', {
'conditions': [ 'conditions': [
[ 'v8_no_strict_aliasing==1', { [ 'v8_no_strict_aliasing==1', {
'cflags': [ '-fno-strict-aliasing' ], 'cflags': [ '-fno-strict-aliasing' ],
@ -285,8 +284,8 @@
['OS=="solaris"', { ['OS=="solaris"', {
'defines': [ '__C99FEATURES__=1' ], # isinf() etc. 'defines': [ '__C99FEATURES__=1' ], # isinf() etc.
}], }],
['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ ['(OS=="linux" or OS=="freebsd" or OS=="dragonflybsd" or OS=="openbsd" \
or OS=="netbsd" or OS=="mac" or OS=="android") and \ 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=="arm" or v8_target_arch=="ia32" or \
v8_target_arch=="mipsel")', { v8_target_arch=="mipsel")', {
# Check whether the host compiler and target compiler support the # Check whether the host compiler and target compiler support the
@ -314,7 +313,7 @@
}], }],
], ],
}], }],
['OS=="freebsd" or OS=="openbsd"', { ['OS=="freebsd" or OS=="dragonflybsd" or OS=="openbsd"', {
'cflags': [ '-I/usr/local/include' ], 'cflags': [ '-I/usr/local/include' ],
}], }],
['OS=="netbsd"', { ['OS=="netbsd"', {
@ -346,7 +345,7 @@
}, },
}, },
'conditions': [ 'conditions': [
['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', 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
'-Wnon-virtual-dtor', '-Woverloaded-virtual' ], '-Wnon-virtual-dtor', '-Woverloaded-virtual' ],
}], }],
@ -368,8 +367,8 @@
}, # Debug }, # Debug
'Release': { 'Release': {
'conditions': [ 'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \ ['OS=="linux" or OS=="freebsd" or OS=="dragonflybsd" \
or OS=="android"', { or OS=="openbsd" or OS=="netbsd" or OS=="android"', {
'conditions': [ 'conditions': [
[ 'gcc_version==44 and clang==0', { [ 'gcc_version==44 and clang==0', {
'cflags': [ 'cflags': [

13
deps/v8/build/standalone.gypi

@ -38,8 +38,7 @@
'variables': { 'variables': {
'variables': { 'variables': {
'conditions': [ 'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \ ['OS!="win"', {
OS=="netbsd" or OS=="mac"', {
# This handles the Unix platforms we generally deal with. # This handles the Unix platforms we generally deal with.
# Anything else gets passed through, which probably won't work # Anything else gets passed through, which probably won't work
# very well; such hosts should pass an explicit target_arch # very well; such hosts should pass an explicit target_arch
@ -47,9 +46,8 @@
'host_arch%': 'host_arch%':
'<!(uname -m | sed -e "s/i.86/ia32/;\ '<!(uname -m | sed -e "s/i.86/ia32/;\
s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/mips.*/mipsel/")', s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/mips.*/mipsel/")',
}, { }],
# OS!="linux" and OS!="freebsd" and OS!="openbsd" and ['OS=="win"', {
# OS!="netbsd" and OS!="mac"
'host_arch%': 'ia32', 'host_arch%': 'ia32',
}], }],
], ],
@ -89,8 +87,7 @@
}, },
}, },
'conditions': [ 'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ ['OS!="win"', {
or OS=="netbsd"', {
'target_defaults': { 'target_defaults': {
'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
'-Wnon-virtual-dtor', '-pthread', '-fno-rtti', '-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"', { ['OS=="win"', {
'target_defaults': { 'target_defaults': {
'defines': [ 'defines': [

3
deps/v8/src/d8.gyp

@ -61,8 +61,7 @@
'libraries': [ '-lreadline', ], 'libraries': [ '-lreadline', ],
'sources': [ 'd8-readline.cc' ], 'sources': [ 'd8-readline.cc' ],
}], }],
['(OS=="linux" or OS=="mac" or OS=="freebsd" or OS=="netbsd" \ [ 'OS!="win"', {
or OS=="openbsd" or OS=="solaris" or OS=="android")', {
'sources': [ 'd8-posix.cc', ] 'sources': [ 'd8-posix.cc', ]
}], }],
[ 'OS=="win"', { [ 'OS=="win"', {

17
deps/v8/src/platform-freebsd.cc

@ -43,12 +43,15 @@
#include <sys/fcntl.h> // open #include <sys/fcntl.h> // open
#include <unistd.h> // getpagesize #include <unistd.h> // getpagesize
// If you don't have execinfo.h then you need devel/libexecinfo from ports. // 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 <strings.h> // index
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <limits.h> #include <limits.h>
#if !defined(__DragonFly__)
#include <execinfo.h> // backtrace, backtrace_symbols
#endif
#undef MAP_TYPE #undef MAP_TYPE
#include "v8.h" #include "v8.h"
@ -296,6 +299,9 @@ void OS::SignalCodeMovingGC() {
int OS::StackWalk(Vector<OS::StackFrame> frames) { int OS::StackWalk(Vector<OS::StackFrame> frames) {
#if defined(__DragonFly__)
return 0;
#else
int frames_size = frames.length(); int frames_size = frames.length();
ScopedVector<void*> addresses(frames_size); ScopedVector<void*> addresses(frames_size);
@ -320,6 +326,7 @@ int OS::StackWalk(Vector<OS::StackFrame> frames) {
free(symbols); free(symbols);
return frames_count; return frames_count;
#endif
} }
@ -612,6 +619,13 @@ void FreeBSDSemaphore::Wait() {
bool FreeBSDSemaphore::Wait(int timeout) { 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 const long kOneSecondMicros = 1000000; // NOLINT
// Split timeout into second and nanosecond parts. // Split timeout into second and nanosecond parts.
@ -637,6 +651,7 @@ bool FreeBSDSemaphore::Wait(int timeout) {
if (result == -1 && errno == ETIMEDOUT) return false; // Timeout. if (result == -1 && errno == ETIMEDOUT) return false; // Timeout.
CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup. CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup.
} }
#endif
} }

8
deps/v8/tools/gyp/v8.gyp

@ -678,6 +678,14 @@
'libraries': [ 'libraries': [
'-L/usr/local/lib -lexecinfo', '-L/usr/local/lib -lexecinfo',
]}, ]},
}],
['OS=="dragonflybsd"', {
'link_settings': {
'libraries': [
'-pthread',
]},
}],
['OS=="freebsd" or OS=="dragonflybsd"', {
'sources': [ 'sources': [
'../../src/platform-freebsd.cc', '../../src/platform-freebsd.cc',
'../../src/platform-posix.cc' '../../src/platform-posix.cc'

Loading…
Cancel
Save