From a25ebb1997dc14ef16f1314cd8c8ede07a5a29e3 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 20 Nov 2012 18:12:07 +0100 Subject: [PATCH] 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/ --- deps/v8/build/common.gypi | 15 +++++++-------- deps/v8/build/standalone.gypi | 13 ++++--------- deps/v8/src/d8.gyp | 3 +-- deps/v8/src/platform-freebsd.cc | 17 ++++++++++++++++- deps/v8/tools/gyp/v8.gyp | 8 ++++++++ 5 files changed, 36 insertions(+), 20 deletions(-) diff --git a/deps/v8/build/common.gypi b/deps/v8/build/common.gypi index 426d625675..44cab4d0cb 100644 --- a/deps/v8/build/common.gypi +++ b/deps/v8/build/common.gypi @@ -274,8 +274,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' ], @@ -285,8 +284,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 @@ -314,7 +313,7 @@ }], ], }], - ['OS=="freebsd" or OS=="openbsd"', { + ['OS=="freebsd" or OS=="dragonflybsd" or OS=="openbsd"', { 'cflags': [ '-I/usr/local/include' ], }], ['OS=="netbsd"', { @@ -346,7 +345,7 @@ }, }, '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', '-Wnon-virtual-dtor', '-Woverloaded-virtual' ], }], @@ -368,8 +367,8 @@ }, # Debug 'Release': { 'conditions': [ - ['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"', { 'conditions': [ [ 'gcc_version==44 and clang==0', { 'cflags': [ diff --git a/deps/v8/build/standalone.gypi b/deps/v8/build/standalone.gypi index 7145a16e0c..e6c7088997 100644 --- a/deps/v8/build/standalone.gypi +++ b/deps/v8/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%': ' // open #include // getpagesize // If you don't have execinfo.h then you need devel/libexecinfo from ports. -#include // backtrace, backtrace_symbols #include // index #include #include #include +#if !defined(__DragonFly__) +#include // backtrace, backtrace_symbols +#endif + #undef MAP_TYPE #include "v8.h" @@ -296,6 +299,9 @@ void OS::SignalCodeMovingGC() { int OS::StackWalk(Vector frames) { +#if defined(__DragonFly__) + return 0; +#else int frames_size = frames.length(); ScopedVector addresses(frames_size); @@ -320,6 +326,7 @@ int OS::StackWalk(Vector frames) { free(symbols); return frames_count; +#endif } @@ -612,6 +619,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. @@ -637,6 +651,7 @@ bool FreeBSDSemaphore::Wait(int timeout) { if (result == -1 && errno == ETIMEDOUT) return false; // Timeout. CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup. } +#endif } diff --git a/deps/v8/tools/gyp/v8.gyp b/deps/v8/tools/gyp/v8.gyp index d57672c57a..5d3cad526f 100644 --- a/deps/v8/tools/gyp/v8.gyp +++ b/deps/v8/tools/gyp/v8.gyp @@ -678,6 +678,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'