Commit 5253363c authored by yangguo@chromium.org's avatar yangguo@chromium.org

Add netbsd support to gyp build.

Review URL: http://codereview.chromium.org/9071004
Patch from Matthew Sporleder <msporleder@gmail.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10341 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ea3a515d
# Copyright 2011 the V8 project authors. All rights reserved. # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are # modification, are permitted provided that the following conditions are
# met: # met:
...@@ -215,7 +215,8 @@ ...@@ -215,7 +215,8 @@
}, },
}, },
}], }],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
or OS=="netbsd"', {
'conditions': [ 'conditions': [
[ 'target_arch=="ia32"', { [ 'target_arch=="ia32"', {
'cflags': [ '-m32' ], 'cflags': [ '-m32' ],
...@@ -259,7 +260,10 @@ ...@@ -259,7 +260,10 @@
['OS=="freebsd" or OS=="openbsd"', { ['OS=="freebsd" or OS=="openbsd"', {
'cflags': [ '-I/usr/local/include' ], 'cflags': [ '-I/usr/local/include' ],
}], }],
['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { ['OS=="netbsd"', {
'cflags': [ '-I/usr/pkg/include' ],
}],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
'-Wnon-virtual-dtor' ], '-Wnon-virtual-dtor' ],
}], }],
...@@ -267,7 +271,7 @@ ...@@ -267,7 +271,7 @@
}, },
'Release': { 'Release': {
'conditions': [ 'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
'cflags!': [ 'cflags!': [
'-O2', '-O2',
'-Os', '-Os',
...@@ -290,6 +294,9 @@ ...@@ -290,6 +294,9 @@
['OS=="freebsd" or OS=="openbsd"', { ['OS=="freebsd" or OS=="openbsd"', {
'cflags': [ '-I/usr/local/include' ], 'cflags': [ '-I/usr/local/include' ],
}], }],
['OS=="netbsd"', {
'cflags': [ '-I/usr/pkg/include' ],
}],
['OS=="mac"', { ['OS=="mac"', {
'xcode_settings': { 'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3', # -O3 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
......
# Copyright 2011 the V8 project authors. All rights reserved. # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are # modification, are permitted provided that the following conditions are
# met: # met:
...@@ -37,13 +37,16 @@ ...@@ -37,13 +37,16 @@
'variables': { 'variables': {
'variables': { 'variables': {
'conditions': [ 'conditions': [
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
# This handles the Linux platforms we generally deal with. Anything # This handles the Linux platforms we generally deal with.
# else gets passed through, which probably won't work very well; such # Anything else gets passed through, which probably won't work
# hosts should pass an explicit target_arch to gyp. # very well; such hosts should pass an explicit target_arch
# to gyp.
'host_arch%': 'host_arch%':
'<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/mips.*/mips/")', '<!(uname -m | sed -e "s/i.86/ia32/;\
}, { # OS!="linux" and OS!="freebsd" and OS!="openbsd" s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/mips.*/mips/")',
}, {
# OS!="linux" and OS!="freebsd" and OS!="openbsd" and OS!="netbsd"
'host_arch%': 'ia32', 'host_arch%': 'ia32',
}], }],
], ],
...@@ -78,7 +81,8 @@ ...@@ -78,7 +81,8 @@
}, },
}, },
'conditions': [ 'conditions': [
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
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',
...@@ -96,7 +100,9 @@ ...@@ -96,7 +100,9 @@
}], }],
], ],
}, },
}], # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"' }],
# 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"
# or OS=="netbsd"'
['OS=="win"', { ['OS=="win"', {
'target_defaults': { 'target_defaults': {
'defines': [ 'defines': [
......
...@@ -366,7 +366,8 @@ static Handle<Value> GetStdout(int child_fd, ...@@ -366,7 +366,8 @@ static Handle<Value> GetStdout(int child_fd,
// We're disabling usage of waitid in Mac OS X because it doens't work for us: // We're disabling usage of waitid in Mac OS X because it doens't work for us:
// a parent process hangs on waiting while a child process is already a zombie. // a parent process hangs on waiting while a child process is already a zombie.
// See http://code.google.com/p/v8/issues/detail?id=401. // See http://code.google.com/p/v8/issues/detail?id=401.
#if defined(WNOWAIT) && !defined(ANDROID) && !defined(__APPLE__) #if defined(WNOWAIT) && !defined(ANDROID) && !defined(__APPLE__) \
&& !defined(__NetBSD__)
#if !defined(__FreeBSD__) #if !defined(__FreeBSD__)
#define HAS_WAITID 1 #define HAS_WAITID 1
#endif #endif
......
...@@ -64,8 +64,8 @@ ...@@ -64,8 +64,8 @@
'libraries': [ '-lreadline', ], 'libraries': [ '-lreadline', ],
'sources': [ 'd8-readline.cc' ], 'sources': [ 'd8-readline.cc' ],
}], }],
[ '(OS=="linux" or OS=="mac" or OS=="freebsd" \ ['(OS=="linux" or OS=="mac" or OS=="freebsd" or OS=="netbsd" \
or OS=="openbsd" or OS=="solaris" or OS=="android")', { or OS=="openbsd" or OS=="solaris" or OS=="android")', {
'sources': [ 'd8-posix.cc', ] 'sources': [ 'd8-posix.cc', ]
}], }],
[ 'OS=="win"', { [ 'OS=="win"', {
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Platform specific code for OpenBSD goes here. For the POSIX comaptible parts // Platform specific code for OpenBSD and NetBSD goes here. For the POSIX
// the implementation is in platform-posix.cc. // comaptible parts the implementation is in platform-posix.cc.
#include <pthread.h> #include <pthread.h>
#include <semaphore.h> #include <semaphore.h>
...@@ -742,8 +742,20 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { ...@@ -742,8 +742,20 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
if (sample == NULL) sample = &sample_obj; if (sample == NULL) sample = &sample_obj;
// Extracting the sample from the context is extremely machine dependent. // Extracting the sample from the context is extremely machine dependent.
ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
sample->state = isolate->current_vm_state(); sample->state = isolate->current_vm_state();
ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
#ifdef __NetBSD__
mcontext_t& mcontext = ucontext->uc_mcontext;
#if V8_HOST_ARCH_IA32
sample->pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_EIP]);
sample->sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_ESP]);
sample->fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_EBP]);
#elif V8_HOST_ARCH_X64
sample->pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_RIP]);
sample->sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RSP]);
sample->fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RBP]);
#endif // V8_HOST_ARCH
#else // OpenBSD
#if V8_HOST_ARCH_IA32 #if V8_HOST_ARCH_IA32
sample->pc = reinterpret_cast<Address>(ucontext->sc_eip); sample->pc = reinterpret_cast<Address>(ucontext->sc_eip);
sample->sp = reinterpret_cast<Address>(ucontext->sc_esp); sample->sp = reinterpret_cast<Address>(ucontext->sc_esp);
...@@ -752,7 +764,8 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { ...@@ -752,7 +764,8 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
sample->pc = reinterpret_cast<Address>(ucontext->sc_rip); sample->pc = reinterpret_cast<Address>(ucontext->sc_rip);
sample->sp = reinterpret_cast<Address>(ucontext->sc_rsp); sample->sp = reinterpret_cast<Address>(ucontext->sc_rsp);
sample->fp = reinterpret_cast<Address>(ucontext->sc_rbp); sample->fp = reinterpret_cast<Address>(ucontext->sc_rbp);
#endif #endif // V8_HOST_ARCH
#endif // __NetBSD__
sampler->SampleStack(sample); sampler->SampleStack(sample);
sampler->Tick(sample); sampler->Tick(sample);
} }
......
# Copyright 2011 the V8 project authors. All rights reserved. # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are # modification, are permitted provided that the following conditions are
# met: # met:
...@@ -684,6 +684,17 @@ ...@@ -684,6 +684,17 @@
], ],
} }
], ],
['OS=="netbsd"', {
'link_settings': {
'libraries': [
'-L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lexecinfo',
]},
'sources': [
'../../src/platform-openbsd.cc',
'../../src/platform-posix.cc'
],
}
],
['OS=="solaris"', { ['OS=="solaris"', {
'sources': [ 'sources': [
'../../src/platform-solaris.cc', '../../src/platform-solaris.cc',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment