nodejs: add recipe for version 14 and 16

removed npm, bump version 12
used bundled v8
This commit is contained in:
Jerome Duval
2021-03-29 08:27:58 +02:00
parent 10ec0f1379
commit d7ccda033e
8 changed files with 2147 additions and 546 deletions

View File

@@ -1,143 +0,0 @@
SUMMARY="A JavaScript runtime built on Chrome's V8 Engine"
DESCRIPTION="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. \
As an asynchronous event driven JavaScript runtime, Node is designed to build scalable \
network applications. In the following \"hello world\" example, many connections can be \
handled concurrently. Upon each connection the callback is fired, but if there is no work \
to be done, Node will sleep."
HOMEPAGE="https://nodejs.org/"
COPYRIGHT="2006-2019 The Node.js Foundation"
LICENSE="BSD (2-clause)"
REVISION="3"
SOURCE_URI="https://nodejs.org/dist/v$portVersion/node-v$portVersion.tar.gz"
SOURCE_DIR="node-v$portVersion"
CHECKSUM_SHA256="d9132342815f04fdb8eb6cac5607fcee929a79e0339449774f411efed81693ac"
PATCHES="nodejs-v$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
GLOBAL_WRITABLE_FILES="
non-packaged/lib/node_modules directory keep-old
non-packaged/lib/node_modules/npm/npmrc auto-merge
"
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
ARCH=x86
else
ARCH=x64
fi
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandBinDir=$prefix/bin
fi
PROVIDES="
nodejs$secondaryArchSuffix = $portVersion
cmd:node$commandSuffix = $portVersion
cmd:npm$secondaryArchSuffix = $portVersion
cmd:npx$secondaryArchSuffix = $portVersion
lib:libnode$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcares$secondaryArchSuffix
lib:libexecinfo$secondaryArchSuffix
lib:libssp$secondaryArchSuffix
lib:libuv$secondaryArchSuffix
lib:libv8$secondaryArchSuffix
lib:libz$secondaryArchSuffix >= 1.2.8
"
PROVIDES_devel="
nodejs${secondaryArchSuffix}_devel
devel:libnode$secondaryArchSuffix = $portVersion
"
REQUIRES_devel="
nodejs$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
c_ares${seconddaryArchSuffix}_devel
gcc${secondaryArchSuffix}_syslibs
gcc${secondaryArchSuffix}_syslibs_devel
devel:libgcc$secondaryArchSuffix
devel:libexecinfo$secondaryArchSuffix
devel:libuv$secondaryArchSuffix
devel:libv8$secondaryArchSuffix
devel:libz$secondaryArchSuffix >= 1.2.8
"
BUILD_PREREQUIRES="
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:g++$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:ninja
cmd:python2
cmd:which
"
BUILD()
{
./configure --with-intl=none --dest-os=haiku --dest-cpu=$ARCH --shared --shared-v8 \
--shared-v8-libpath="$(finddir B_SYSTEM_LIB_DIRECTORY)" --shared-zlib \
--shared-cares --shared-libuv --without-bundled-v8 --openssl-no-asm \
--shared-v8-includes="$(finddir B_SYSTEM_HEADERS_DIRECTORY)"/v8 \
--prefix=$prefix
make $jobArgs
}
INSTALL()
{
mkdir -p $commandBinDir $libDir $dataDir $docDir $manDir
mkdir -p $prefix $developDir/headers $developDir/lib
mkdir -p $prefix/non-packaged/lib/node_modules
export PREFIX=$prefix/non-packaged
export USER_CONFIG=$(finddir B_USER_SETTINGS_DIRECTORY)
export INCLUDEDIR=$developDir/headers
make install
# Move the node_modules folder into the non-packaged folder
mv $prefix/lib/node_modules $prefix/non-packaged/lib
mkdir -p $prefix/non-packaged/lib/node_modules/npm/
echo -e "prefix = $prefix/non-packaged/" > $prefix/non-packaged/lib/node_modules/npm/npmrc
echo -e "userconfig = $USER_CONFIG/.npmrc" >> $prefix/non-packaged/lib/node_modules/npm/npmrc
echo -e "user = 1" >> $prefix/non-packaged/lib/node_modules/npm/npmrc
# Copy node binary and link npm and npmx to use the non-packaged folder
cp ./out/Release/node $prefix/bin/node
ln -sfn $prefix/non-packaged/lib/node_modules/npm/bin/npm-cli.js $prefix/bin/npm
ln -sfn $prefix/non-packaged/lib/node_modules/npm/bin/npx-cli.js $prefix/bin/npx
ln -sfn $prefix/lib/libnode.so.* $prefix/lib/libnode.so
# Install the develop directory
mv $prefix/include/* $developDir/headers
rm -rf $prefix/include
mv $prefix/share/man $manDir
mv $prefix/share/systemtap $dataDir
mv $prefix/share/doc $docDir
rm -rf $prefix/share
rm -rf $prefix/lib/node_modules
prepareInstalledDevelLib libnode
fixPkgconfig
packageEntries devel \
$developDir
}
TEST()
{
make check
}

View File

@@ -0,0 +1,90 @@
SUMMARY="A JavaScript runtime built on Chrome's V8 Engine"
DESCRIPTION="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. \
As an asynchronous event driven JavaScript runtime, Node is designed to build scalable \
network applications. In the following \"hello world\" example, many connections can be \
handled concurrently. Upon each connection the callback is fired, but if there is no work \
to be done, Node will sleep."
HOMEPAGE="https://nodejs.org/"
COPYRIGHT="2006-2019 The Node.js Foundation"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://nodejs.org/dist/v$portVersion/node-v$portVersion.tar.xz"
SOURCE_DIR="node-v$portVersion"
CHECKSUM_SHA256="052f37ace6f569b513b5a1154b2a45d3c4d8b07d7d7c807b79f1566db61e979d"
PATCHES="nodejs-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
nodejs12$secondaryArchSuffix = $portVersion
cmd:node = $portVersion compat >= 12
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcares$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libexecinfo$secondaryArchSuffix
lib:libnghttp2$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libuv$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
REPLACES="nodejs"
PROVIDES_devel="
nodejs12${secondaryArchSuffix}_devel
"
REQUIRES_devel="
nodejs12$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libcares$secondaryArchSuffix
devel:libexecinfo$secondaryArchSuffix
devel:libnghttp2$secondaryArchSuffix
devel:libssl$secondaryArchSuffix >= 1.1
devel:libuv$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:ninja
cmd:python2
cmd:which
"
BUILD()
{
./configure --with-intl=none --dest-os=haiku \
--shared-cares --shared-libuv --shared-nghttp2 --shared-openssl \
--shared-zlib \
--prefix=$prefix --without-npm
make $jobArgs
}
INSTALL()
{
make install
mkdir -p $(dirname $docDir $includeDir $manDir)
mv $prefix/include $includeDir
mv $prefix/share/man $manDir
mv $prefix/share/doc $docDir
packageEntries devel \
$developDir
strip $prefix/bin/node
rm -rf $prefix/share
}
TEST()
{
make test-only
}

View File

@@ -0,0 +1,89 @@
SUMMARY="A JavaScript runtime built on Chrome's V8 Engine"
DESCRIPTION="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. \
As an asynchronous event driven JavaScript runtime, Node is designed to build scalable \
network applications. In the following \"hello world\" example, many connections can be \
handled concurrently. Upon each connection the callback is fired, but if there is no work \
to be done, Node will sleep."
HOMEPAGE="https://nodejs.org/"
COPYRIGHT="2006-2019 The Node.js Foundation"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://nodejs.org/dist/v$portVersion/node-v$portVersion.tar.xz"
SOURCE_DIR="node-v$portVersion"
CHECKSUM_SHA256="4e7648a617f79b459d583f7dbdd31fbbac5b846d41598f3b54331a5b6115dfa6"
PATCHES="nodejs-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
nodejs14$secondaryArchSuffix = $portVersion
cmd:node = $portVersion compat >= 14
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcares$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libexecinfo$secondaryArchSuffix
lib:libnghttp2$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libuv$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_devel="
nodejs14${secondaryArchSuffix}_devel
"
REQUIRES_devel="
nodejs14$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libcares$secondaryArchSuffix
devel:libexecinfo$secondaryArchSuffix
devel:libnghttp2$secondaryArchSuffix >= 14.19
devel:libssl$secondaryArchSuffix >= 1.1
devel:libuv$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:ninja
cmd:python3.9
cmd:which
"
BUILD()
{
./configure --with-intl=none --dest-os=haiku \
--shared-cares --shared-libuv --shared-nghttp2 --shared-openssl \
--shared-zlib \
--prefix=$prefix --without-npm
make $jobArgs
}
INSTALL()
{
make install
mkdir -p $(dirname $docDir $includeDir $manDir)
mv $prefix/include $includeDir
mv $prefix/share/man $manDir
mv $prefix/share/doc $docDir
packageEntries devel \
$developDir
strip $prefix/bin/node
rm -rf $prefix/share
}
TEST()
{
make test-only
}

View File

@@ -0,0 +1,90 @@
SUMMARY="A JavaScript runtime built on Chrome's V8 Engine"
DESCRIPTION="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. \
As an asynchronous event driven JavaScript runtime, Node is designed to build scalable \
network applications. In the following \"hello world\" example, many connections can be \
handled concurrently. Upon each connection the callback is fired, but if there is no work \
to be done, Node will sleep."
HOMEPAGE="https://nodejs.org/"
COPYRIGHT="2006-2019 The Node.js Foundation"
LICENSE="BSD (2-clause)"
REVISION="1"
gitCommit="a9cdeeda880a56de6dad10b24b3bfa45e2cccb5d"
SOURCE_URI="https://github.com/nodejs/node/archive/$gitCommit.tar.gz"
SOURCE_DIR="node-$gitCommit"
CHECKSUM_SHA256="ced2e195341fadda87d7e6d8ef92cf1028080fb53275d211c81805504b433cbc"
PATCHES="nodejs-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86_64"
SECONDARY_ARCHITECTURES="?x86"
PROVIDES="
nodejs16$secondaryArchSuffix = $portVersion
cmd:node = $portVersion compat >= 16
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcares$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libexecinfo$secondaryArchSuffix
lib:libnghttp2$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libuv$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_devel="
nodejs16${secondaryArchSuffix}_devel
"
REQUIRES_devel="
nodejs16$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libcares$secondaryArchSuffix >= 2.4
devel:libexecinfo$secondaryArchSuffix
devel:libnghttp2$secondaryArchSuffix >= 14.20
devel:libssl$secondaryArchSuffix >= 1.1
devel:libuv$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:ninja
cmd:python3.9
cmd:which
"
BUILD()
{
./configure --with-intl=none --dest-os=haiku \
--shared-cares --shared-libuv --shared-nghttp2 --shared-openssl \
--shared-zlib \
--prefix=$prefix --without-npm
make $jobArgs
}
INSTALL()
{
make install
mkdir -p $(dirname $docDir $includeDir $manDir)
mv $prefix/include $includeDir
mv $prefix/share/man $manDir
mv $prefix/share/doc $docDir
packageEntries devel \
$developDir
strip $prefix/bin/node
rm -rf $prefix/share
}
TEST()
{
make test-only
}

View File

@@ -0,0 +1,614 @@
From 9419e88ca21e44917edfed599133d7f46fd0783c Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Wed, 22 May 2019 11:23:37 +0000
Subject: Initial Haiku support for Node.js
diff --git a/common.gypi b/common.gypi
index 102f090..c7e57b9 100644
--- a/common.gypi
+++ b/common.gypi
@@ -138,6 +138,9 @@
['target_arch in "ppc64 s390x"', {
'v8_enable_backtrace': 1,
}],
+ ['OS=="haiku"', {
+ 'clang%': 0,
+ }],
],
},
@@ -166,6 +169,10 @@
'cflags': [ '-fPIC' ],
'ldflags': [ '-fPIC' ]
}],
+ ['OS == "haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC']
+ }],
],
'msvs_settings': {
'VCCLCompilerTool': {
@@ -226,6 +233,10 @@
'cflags': [ '-fPIC' ],
'ldflags': [ '-fPIC' ]
}],
+ ['OS == "haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC']
+ }],
],
'msvs_settings': {
'VCCLCompilerTool': {
@@ -364,7 +375,7 @@
'cflags': [ '-pthread' ],
'ldflags': [ '-pthread' ],
}],
- [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', {
+ [ 'OS in "linux freebsd openbsd solaris android aix cloudabi haiku"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++1y' ],
'defines': [ '__STDC_FORMAT_MACROS' ],
@@ -378,6 +389,10 @@
'cflags': [ '-I/usr/local/include' ],
'ldflags': [ '-Wl,-z,wxneeded' ],
}],
+ ['OS=="haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC' ],
+ }],
],
'conditions': [
[ 'target_arch=="ia32"', {
@@ -537,6 +552,12 @@
'OPENSSL_NO_PINSHARED'
],
}],
+ ['OS=="haiku"', {
+ 'ldflags': [ '-lroot', '-lbsd', '-lstdc++', '-lnetwork', '-Wl,-Bsymbolic', '-Wl,--export-dynamic', '-fPIC' ],
+ 'ldflags!': [ '-pthreads', '-pthread', '-rdynamic' ],
+ 'clang%': 0,
+ '%v8_use_snapshot':0,
+ }],
['node_shared_openssl!="true"', {
# `OPENSSL_THREADS` is defined via GYP for openSSL for all architectures.
'defines': [
diff --git a/configure.py b/configure.py
index e6485a7..2663035 100755
--- a/configure.py
+++ b/configure.py
@@ -47,7 +47,7 @@ from fetch_deps import FetchDeps
parser = optparse.OptionParser()
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
- 'android', 'aix', 'cloudabi')
+ 'android', 'aix', 'cloudabi', 'haiku')
valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc',
'ppc64', 'x32','x64', 'x86', 'x86_64', 's390x')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
index 76984d4..eda4459 100644
--- a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
+++ b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
@@ -8,11 +8,9 @@
],
'openssl_cflags_linux-x86_64': [
'-Wall -O3',
- '-pthread -m64',
- '-Wall -O3',
+ '-m64',
],
'openssl_ex_libs_linux-x86_64': [
- '-ldl -pthread',
],
'openssl_cli_srcs_linux-x86_64': [
'openssl/apps/asn1pars.c',
diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
index 11d3aa6..aba5d54 100644
--- a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
+++ b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
@@ -692,11 +692,10 @@
],
'openssl_cflags_linux-x86_64': [
'-Wall -O3',
- '-pthread -m64',
+ '-m64',
'-Wall -O3',
],
- 'openssl_ex_libs_linux-x86_64': [
- '-ldl -pthread',
+ 'openssl_ex_libs_linux-x86_64': [
],
},
'include_dirs': [
diff --git a/deps/openssl/openssl/crypto/rand/rand_unix.c b/deps/openssl/openssl/crypto/rand/rand_unix.c
index ec6be79..861f56a 100644
--- a/deps/openssl/openssl/crypto/rand/rand_unix.c
+++ b/deps/openssl/openssl/crypto/rand/rand_unix.c
@@ -369,7 +369,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
* Note: Sometimes getentropy() can be provided but not implemented
* internally. So we need to check errno for ENOSYS
*/
-# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux)
+# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux) && !defined(__HAIKU__)
extern int getentropy(void *buffer, size_t length) __attribute__((weak));
if (getentropy != NULL) {
diff --git a/deps/openssl/openssl_common.gypi b/deps/openssl/openssl_common.gypi
index d866630..52558d8 100644
--- a/deps/openssl/openssl_common.gypi
+++ b/deps/openssl/openssl_common.gypi
@@ -56,7 +56,14 @@
'ENGINESDIR="/dev/null"',
'__EXTENSIONS__'
],
- }, {
+ },'OS=="haiku"', {
+ '!ldflags': ['-pthread', '-pthreads'],
+ 'defines': [
+ 'OPENSSLDIR="/boot/system/data/ssl/"',
+ 'ENGINESDIR="/dev/null"',
+ 'TERMIOS',
+ ],
+ },{
# linux and others
'cflags': ['-Wno-missing-field-initializers',],
'defines': [
diff --git a/node.gypi b/node.gypi
index 116c1c7..9d5e5f3 100644
--- a/node.gypi
+++ b/node.gypi
@@ -257,6 +257,16 @@
'NODE_PLATFORM="sunos"',
],
}],
+ [ 'OS=="haiku"', {
+ 'libraries': [
+ '-lroot',
+ '-lnetwork',
+ '-lbsd',
+ ],
+ 'defines': [
+ 'NODE_PLATFORM="haiku"',
+ ],
+ }],
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"'
' and force_load=="true"', {
'ldflags': [
diff --git a/src/node.cc b/src/node.cc
index 00ae36c..87b8b03 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -554,7 +554,7 @@ inline void PlatformInit() {
if (nr == SIGKILL || nr == SIGSTOP)
continue;
act.sa_handler = (nr == SIGPIPE || nr == SIGXFSZ) ? SIG_IGN : SIG_DFL;
- CHECK_EQ(0, sigaction(nr, &act, nullptr));
+ //CHECK_EQ(0, sigaction(nr, &act, nullptr));
}
#endif // !NODE_SHARED_MODE
diff --git a/src/node_os.cc b/src/node_os.cc
index b6fbb12..f97528b 100644
--- a/src/node_os.cc
+++ b/src/node_os.cc
@@ -34,7 +34,7 @@
#include <array>
#include <cerrno>
#include <cstring>
-
+#include <iostream>
namespace node {
namespace os {
@@ -120,7 +120,17 @@ static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
// [model, speed, (5 entries of cpu_times), model2, speed2, ...]
std::vector<Local<Value>> result(count * 7);
for (int i = 0, j = 0; i < count; i++) {
+ /*
uv_cpu_info_t* ci = cpu_infos + i;
+
+ std::cout << ci->speed << std::endl;
+ std::cout << ci->model << std::endl;
+ std::cout << ci->cpu_times.user << std::endl;
+ std::cout << ci->cpu_times.nice << std::endl;
+ std::cout << ci->cpu_times.sys << std::endl;
+ std::cout << ci->cpu_times.idle << std::endl;
+ std::cout << ci->cpu_times.irq << std::endl;
+
result[j++] = OneByteString(isolate, ci->model);
result[j++] = Number::New(isolate, ci->speed);
result[j++] = Number::New(isolate, ci->cpu_times.user);
@@ -128,10 +138,11 @@ static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
result[j++] = Number::New(isolate, ci->cpu_times.sys);
result[j++] = Number::New(isolate, ci->cpu_times.idle);
result[j++] = Number::New(isolate, ci->cpu_times.irq);
+ */
}
uv_free_cpu_info(cpu_infos, count);
- args.GetReturnValue().Set(Array::New(isolate, result.data(), result.size()));
+ // args.GetReturnValue().Set(Array::New(isolate, result.data(), result.size()));
}
diff --git a/src/node_report.cc b/src/node_report.cc
index c93e03a..a4f57df 100644
--- a/src/node_report.cc
+++ b/src/node_report.cc
@@ -686,16 +686,16 @@ static void PrintSystemInformation(JSONWriter* writer) {
{"core_file_size_blocks", RLIMIT_CORE},
{"data_seg_size_kbytes", RLIMIT_DATA},
{"file_size_blocks", RLIMIT_FSIZE},
-#if !(defined(_AIX) || defined(__sun))
+#if !(defined(_AIX) || defined(__sun) || defined(__HAIKU__))
{"max_locked_memory_bytes", RLIMIT_MEMLOCK},
#endif
-#ifndef __sun
+#if !(defined(__sun) || defined(__HAIKU__))
{"max_memory_size_kbytes", RLIMIT_RSS},
#endif
{"open_files", RLIMIT_NOFILE},
{"stack_size_bytes", RLIMIT_STACK},
{"cpu_time_seconds", RLIMIT_CPU},
-#ifndef __sun
+#if !(defined(__sun) || defined(__HAIKU__))
{"max_user_processes", RLIMIT_NPROC},
#endif
#ifndef __OpenBSD__
diff --git a/tools/utils.py b/tools/utils.py
index 9734836..94e4d8c 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -57,6 +57,8 @@ def GuessOS():
return 'win32'
elif id == 'FreeBSD':
return 'freebsd'
+ elif id == 'Haiku':
+ return 'haiku'
elif id == 'OpenBSD':
return 'openbsd'
elif id == 'SunOS':
--
2.30.0
From 156f441d65fda25326d3c3a982dc02ac9a4ccb25 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 27 Mar 2021 21:40:26 +0100
Subject: v8 Haiku patches
diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn
index 90ec409..3f754fa 100644
--- a/deps/v8/BUILD.gn
+++ b/deps/v8/BUILD.gn
@@ -679,7 +679,7 @@ config("toolchain") {
}
}
- if (is_clang) {
+ if (is_clang && !is_haiku) {
cflags += [ "-Wmissing-field-initializers" ]
if (v8_current_cpu != "mips" && v8_current_cpu != "mipsel") {
@@ -3638,6 +3638,11 @@ v8_component("v8_libbase") {
"src/base/debug/stack_trace_fuchsia.cc",
"src/base/platform/platform-fuchsia.cc",
]
+ } else if (is_haiku) {
+ sources += [
+ "src/base/debug/stack_trace_posix.cc",
+ "src/base/platform/platform-haiku.cc",
+ ]
} else if (is_mac || is_ios) {
sources += [
"src/base/debug/stack_trace_posix.cc",
@@ -4076,6 +4081,13 @@ if (is_fuchsia && !build_with_chromium) {
group("v8_fuzzers") {
testonly = true
+
+ if(host_os == "haiku"){
+ data_deps = []
+ }
+
+ if (host_os != "haiku") {
+
data_deps = [
":v8_simple_json_fuzzer",
":v8_simple_multi_return_fuzzer",
@@ -4087,6 +4099,8 @@ group("v8_fuzzers") {
":v8_simple_wasm_compile_fuzzer",
":v8_simple_wasm_fuzzer",
]
+ }
+
}
if (is_component_build) {
diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h
index 7670c0e..646c599 100644
--- a/deps/v8/include/v8config.h
+++ b/deps/v8/include/v8config.h
@@ -61,6 +61,7 @@
// V8_OS_CYGWIN - Cygwin
// V8_OS_DRAGONFLYBSD - DragonFlyBSD
// V8_OS_FREEBSD - FreeBSD
+// V8_OS_HAIKU - Haiku
// V8_OS_FUCHSIA - Fuchsia
// V8_OS_LINUX - Linux
// V8_OS_MACOSX - Mac OS X
@@ -100,6 +101,9 @@
# define V8_OS_BSD 1
# define V8_OS_FREEBSD 1
# define V8_OS_POSIX 1
+#elif defined(__HAIKU__)
+# define V8_OS_HAIKU 1
+# define V8_OS_POSIX 1
#elif defined(__Fuchsia__)
# define V8_OS_FUCHSIA 1
# define V8_OS_POSIX 1
diff --git a/deps/v8/src/base/debug/stack_trace_posix.cc b/deps/v8/src/base/debug/stack_trace_posix.cc
index ed602af..58b3b5d 100644
--- a/deps/v8/src/base/debug/stack_trace_posix.cc
+++ b/deps/v8/src/base/debug/stack_trace_posix.cc
@@ -25,14 +25,15 @@
#include <string>
#include <vector>
-#if V8_LIBC_GLIBC || V8_LIBC_BSD || V8_LIBC_UCLIBC || V8_OS_SOLARIS
+#if V8_LIBC_GLIBC || V8_LIBC_BSD || V8_LIBC_UCLIBC || V8_OS_SOLARIS || V8_OS_HAIKU
#define HAVE_EXECINFO_H 1
#endif
-#if HAVE_EXECINFO_H
+#if defined(HAVE_EXECINFO_H)
#include <cxxabi.h>
#include <execinfo.h>
#endif
+
#if V8_OS_MACOSX
#include <AvailabilityMacros.h>
#endif
diff --git a/deps/v8/src/base/export-template.h b/deps/v8/src/base/export-template.h
index 861cfe4..8c6d885 100644
--- a/deps/v8/src/base/export-template.h
+++ b/deps/v8/src/base/export-template.h
@@ -83,6 +83,7 @@
// definition sites instead.
#define EXPORT_TEMPLATE_DECLARE_MSVC_HACK(export, _)
#define EXPORT_TEMPLATE_DEFINE_MSVC_HACK(export, _) export
+#define EXPORT_TEMPLATE_TEST_MSVC_HACK_DEFAULT(...) true
// EXPORT_TEMPLATE_STYLE is an internal helper macro that identifies which
// export style needs to be used for the provided FOO_EXPORT macro definition.
@@ -159,5 +160,5 @@ EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport));
#undef EXPORT_TEMPLATE_TEST
#undef EXPORT_TEMPLATE_TEST_DEFAULT_DEFAULT
#undef EXPORT_TEMPLATE_TEST_MSVC_HACK_MSVC_HACK
-
+#undef EXPORT_TEMPLATE_TEST_MSVC_HACK_DEFAULT
#endif // V8_BASE_EXPORT_TEMPLATE_H_
diff --git a/deps/v8/src/base/platform/platform-haiku.cc b/deps/v8/src/base/platform/platform-haiku.cc
new file mode 100644
index 0000000..7367510
--- /dev/null
+++ b/deps/v8/src/base/platform/platform-haiku.cc
@@ -0,0 +1,50 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Platform-specific code for Haiku goes here. For the POSIX-compatible
+// parts, the implementation is in platform-posix.cc.
+
+#include <pthread.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+
+#include <errno.h>
+#include <fcntl.h> // open
+#include <stdarg.h>
+#include <strings.h> // index
+#include <sys/mman.h> // mmap & munmap
+#include <sys/stat.h> // open
+#include <sys/types.h> // mmap & munmap
+#include <unistd.h> // sysconf
+
+#include <cmath>
+
+#undef MAP_TYPE
+
+#include "src/base/macros.h"
+#include "src/base/platform/platform-posix-time.h"
+#include "src/base/platform/platform-posix.h"
+#include "src/base/platform/platform.h"
+
+namespace v8 {
+namespace base {
+
+TimezoneCache* OS::CreateTimezoneCache() {
+ return new PosixDefaultTimezoneCache();
+}
+
+std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
+ return std::vector<SharedLibraryAddress>();
+}
+
+void OS::SignalCodeMovingGC() {}
+
+void OS::AdjustSchedulingParams() {}
+
+} // namespace base
+} // namespace v8
diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc
index c50cdd7..477bde5 100644
--- a/deps/v8/src/base/platform/platform-posix.cc
+++ b/deps/v8/src/base/platform/platform-posix.cc
@@ -60,7 +60,7 @@
#include <sys/resource.h>
#endif
-#if !defined(_AIX) && !defined(V8_OS_FUCHSIA)
+#if !defined(_AIX) && !defined(V8_OS_FUCHSIA) && !defined(__HAIKU__)
#include <sys/syscall.h>
#endif
@@ -76,6 +76,14 @@ extern int madvise(caddr_t, size_t, int);
#endif
#endif
+#if defined(__HAIKU__)
+extern "C" int posix_madvise(void*, size_t, int);
+#endif
+
+#if defined(__HAIKU__)
+#define MADV_FREE POSIX_MADV_DONTNEED
+#endif
+
#ifndef MADV_FREE
#define MADV_FREE MADV_DONTNEED
#endif
@@ -127,7 +135,7 @@ int GetProtectionFromMemoryPermission(OS::MemoryPermission access) {
int GetFlagsForMemoryPermission(OS::MemoryPermission access) {
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
if (access == OS::MemoryPermission::kNoAccess) {
-#if !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX
+#if !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX && !V8_OS_HAIKU
flags |= MAP_NORESERVE;
#endif // !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX
#if V8_OS_QNX
@@ -362,6 +370,8 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
int ret = madvise(address, size, MADV_FREE_REUSABLE);
#elif defined(_AIX) || defined(V8_OS_SOLARIS)
int ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_FREE);
+#elif defined(__HAIKU__)
+ int ret = posix_madvise(address, size, MADV_FREE);
#else
int ret = madvise(address, size, MADV_FREE);
#endif
@@ -373,6 +383,8 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
// imply runtime support.
#if defined(_AIX) || defined(V8_OS_SOLARIS)
ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_DONTNEED);
+#elif defined(__HAIKU__)
+ ret = posix_madvise(address, size, MADV_FREE);
#else
ret = madvise(address, size, MADV_DONTNEED);
#endif
diff --git a/deps/v8/src/libsampler/sampler.cc b/deps/v8/src/libsampler/sampler.cc
index e445dfc..77fa74c 100644
--- a/deps/v8/src/libsampler/sampler.cc
+++ b/deps/v8/src/libsampler/sampler.cc
@@ -12,7 +12,7 @@
#include <sys/time.h>
#include <atomic>
-#if !V8_OS_QNX && !V8_OS_AIX
+#if !V8_OS_QNX && !V8_OS_AIX && !V8_OS_HAIKU
#include <sys/syscall.h> // NOLINT
#endif
@@ -20,7 +20,7 @@
#include <mach/mach.h>
// OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h>
// and is a typedef for struct sigcontext. There is no uc_mcontext.
-#elif !V8_OS_OPENBSD
+#elif !V8_OS_OPENBSD && !V8_OS_HAIKU
#include <ucontext.h>
#endif
@@ -481,6 +481,16 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) {
state->sp = reinterpret_cast<void*>(mcontext.mc_r13);
state->fp = reinterpret_cast<void*>(mcontext.mc_r11);
#endif // V8_HOST_ARCH_*
+#elif V8_OS_HAIKU
+#if V8_HOST_ARCH_IA32
+ state->pc = reinterpret_cast<void*>(mcontext.eip);
+ state->sp = reinterpret_cast<void*>(mcontext.esp);
+ state->fp = reinterpret_cast<void*>(mcontext.ebp);
+#elif V8_HOST_ARCH_X64
+ state->pc = reinterpret_cast<void*>(mcontext.rip);
+ state->sp = reinterpret_cast<void*>(mcontext.rsp);
+ state->fp = reinterpret_cast<void*>(mcontext.rbp);
+#endif // V8_HOST_ARCH_*
#elif V8_OS_NETBSD
#if V8_HOST_ARCH_IA32
state->pc = reinterpret_cast<void*>(mcontext.__gregs[_REG_EIP]);
diff --git a/deps/v8/tools/mb/mb.py b/deps/v8/tools/mb/mb.py
index f66f82a..f20ff24 100755
--- a/deps/v8/tools/mb/mb.py
+++ b/deps/v8/tools/mb/mb.py
@@ -855,12 +855,15 @@ class MetaBuildWrapper(object):
subdir, exe = 'linux64', 'gn'
elif self.platform == 'darwin':
subdir, exe = 'mac', 'gn'
+ elif self.platform == 'haiku1':
+ subdir, exe = 'haiku','gn'
+ gn_path = "/bin/gn"
else:
subdir, exe = 'win', 'gn.exe'
arch = platform.machine()
if (arch.startswith('s390') or arch.startswith('ppc') or
- self.platform.startswith('aix')):
+ self.platform.startswith('aix') or self.platform.startswith('haiku')):
# use gn in PATH
gn_path = 'gn'
else:
--
2.30.0
From a42c21ff72c6dec2384fa78d0f3634a88d2fb0b7 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sun, 28 Mar 2021 10:37:44 +0200
Subject: v8 gyp build for Haiku
diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi
index 602d606..5f9a0f6 100644
--- a/tools/v8_gypfiles/features.gypi
+++ b/tools/v8_gypfiles/features.gypi
@@ -46,6 +46,11 @@
}, {
'is_fuchsia': 0,
}],
+ ['OS == "haiku"', {
+ 'is_haiku': 1,
+ }, {
+ 'is_haiku': 0,
+ }],
['OS=="android"', { # GYP reverts OS to linux so use `-D OS=android`
'is_android': 1,
}, {
diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
index 26b8e56..f480c04 100644
--- a/tools/v8_gypfiles/v8.gyp
+++ b/tools/v8_gypfiles/v8.gyp
@@ -991,6 +991,17 @@
'<(V8_ROOT)/src/base/platform/platform-fuchsia.cc',
]
}],
+ ['is_haiku', {
+ 'link_settings': {
+ 'libraries': [
+ '-lexecinfo',
+ ]
+ },
+ 'sources': [
+ '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
+ '<(V8_ROOT)/src/base/platform/platform-haiku.cc',
+ ]
+ }],
['OS == "mac" or OS == "ios"', {
'sources': [
'<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
--
2.30.0

View File

@@ -0,0 +1,632 @@
From 3aaf81dbdc8d0d657588d1d312090f61b57f9e70 Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Wed, 22 May 2019 11:23:37 +0000
Subject: Initial Haiku support for Node.js
diff --git a/common.gypi b/common.gypi
index e610650..515ae80 100644
--- a/common.gypi
+++ b/common.gypi
@@ -257,6 +257,9 @@
'_target_name!="<(node_core_target_name)")', {
'cflags!': ['-Werror'],
}],
+ ['OS=="haiku"', {
+ 'clang%': 0,
+ }],
],
'msvs_settings': {
'VCCLCompilerTool': {
@@ -285,6 +288,10 @@
['target_arch=="arm64"', {
'TargetMachine' : 0, # NotSet. MACHINE:ARM64 is inferred from the input files.
}],
+ ['OS == "haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC']
+ }],
],
'GenerateDebugInformation': 'true',
'SuppressStartupBanner': 'true',
@@ -345,6 +352,10 @@
['_type!="static_library"', {
'xcode_settings': {'OTHER_LDFLAGS': ['-fsanitize=address']},
}],
+ ['OS == "haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC']
+ }],
],
}],
['v8_enable_pointer_compression == 1', {
@@ -372,7 +383,7 @@
'cflags': [ '-pthread' ],
'ldflags': [ '-pthread' ],
}],
- [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', {
+ [ 'OS in "linux freebsd openbsd solaris android aix cloudabi haiku"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++1y' ],
'defines': [ '__STDC_FORMAT_MACROS' ],
@@ -386,6 +397,10 @@
'cflags': [ '-I/usr/local/include' ],
'ldflags': [ '-Wl,-z,wxneeded' ],
}],
+ ['OS=="haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC' ],
+ }],
],
'conditions': [
[ 'target_arch=="ia32"', {
@@ -545,6 +560,12 @@
'OPENSSL_NO_PINSHARED'
],
}],
+ ['OS=="haiku"', {
+ 'ldflags': [ '-lroot', '-lbsd', '-lstdc++', '-lnetwork', '-Wl,-Bsymbolic', '-Wl,--export-dynamic', '-fPIC' ],
+ 'ldflags!': [ '-pthreads', '-pthread', '-rdynamic' ],
+ 'clang%': 0,
+ '%v8_use_snapshot':0,
+ }],
['node_shared_openssl!="true"', {
# `OPENSSL_THREADS` is defined via GYP for openSSL for all architectures.
'defines': [
diff --git a/configure.py b/configure.py
index e6f7e4d..e7cbf3d 100755
--- a/configure.py
+++ b/configure.py
@@ -48,7 +48,7 @@ from fetch_deps import FetchDeps
parser = optparse.OptionParser()
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
- 'android', 'aix', 'cloudabi')
+ 'android', 'aix', 'cloudabi', 'haiku')
valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc',
'ppc64', 'x32','x64', 'x86', 'x86_64', 's390x')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
index 76984d4..eda4459 100644
--- a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
+++ b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
@@ -8,11 +8,9 @@
],
'openssl_cflags_linux-x86_64': [
'-Wall -O3',
- '-pthread -m64',
- '-Wall -O3',
+ '-m64',
],
'openssl_ex_libs_linux-x86_64': [
- '-ldl -pthread',
],
'openssl_cli_srcs_linux-x86_64': [
'openssl/apps/asn1pars.c',
diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
index 11d3aa6..aba5d54 100644
--- a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
+++ b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
@@ -692,11 +692,10 @@
],
'openssl_cflags_linux-x86_64': [
'-Wall -O3',
- '-pthread -m64',
+ '-m64',
'-Wall -O3',
],
- 'openssl_ex_libs_linux-x86_64': [
- '-ldl -pthread',
+ 'openssl_ex_libs_linux-x86_64': [
],
},
'include_dirs': [
diff --git a/deps/openssl/openssl/crypto/rand/rand_unix.c b/deps/openssl/openssl/crypto/rand/rand_unix.c
index ec6be79..861f56a 100644
--- a/deps/openssl/openssl/crypto/rand/rand_unix.c
+++ b/deps/openssl/openssl/crypto/rand/rand_unix.c
@@ -369,7 +369,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
* Note: Sometimes getentropy() can be provided but not implemented
* internally. So we need to check errno for ENOSYS
*/
-# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux)
+# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux) && !defined(__HAIKU__)
extern int getentropy(void *buffer, size_t length) __attribute__((weak));
if (getentropy != NULL) {
diff --git a/deps/openssl/openssl_common.gypi b/deps/openssl/openssl_common.gypi
index d866630..52558d8 100644
--- a/deps/openssl/openssl_common.gypi
+++ b/deps/openssl/openssl_common.gypi
@@ -56,7 +56,14 @@
'ENGINESDIR="/dev/null"',
'__EXTENSIONS__'
],
- }, {
+ },'OS=="haiku"', {
+ '!ldflags': ['-pthread', '-pthreads'],
+ 'defines': [
+ 'OPENSSLDIR="/boot/system/data/ssl/"',
+ 'ENGINESDIR="/dev/null"',
+ 'TERMIOS',
+ ],
+ },{
# linux and others
'cflags': ['-Wno-missing-field-initializers',],
'defines': [
diff --git a/node.gypi b/node.gypi
index 43dbda7..dc9933d 100644
--- a/node.gypi
+++ b/node.gypi
@@ -256,6 +256,16 @@
'NODE_PLATFORM="sunos"',
],
}],
+ [ 'OS=="haiku"', {
+ 'libraries': [
+ '-lroot',
+ '-lnetwork',
+ '-lbsd',
+ ],
+ 'defines': [
+ 'NODE_PLATFORM="haiku"',
+ ],
+ }],
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"'
' and force_load=="true"', {
'ldflags': [
diff --git a/src/node.cc b/src/node.cc
index 905afd8..48ade67 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -607,7 +607,7 @@ inline void PlatformInit() {
if (nr == SIGKILL || nr == SIGSTOP)
continue;
act.sa_handler = (nr == SIGPIPE || nr == SIGXFSZ) ? SIG_IGN : SIG_DFL;
- CHECK_EQ(0, sigaction(nr, &act, nullptr));
+ //CHECK_EQ(0, sigaction(nr, &act, nullptr));
}
#endif // !NODE_SHARED_MODE
diff --git a/src/node_os.cc b/src/node_os.cc
index 2e151ac..a07b856 100644
--- a/src/node_os.cc
+++ b/src/node_os.cc
@@ -34,7 +34,7 @@
#include <array>
#include <cerrno>
#include <cstring>
-
+#include <iostream>
namespace node {
namespace os {
@@ -114,7 +114,17 @@ static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
// [model, speed, (5 entries of cpu_times), model2, speed2, ...]
std::vector<Local<Value>> result(count * 7);
for (int i = 0, j = 0; i < count; i++) {
+ /*
uv_cpu_info_t* ci = cpu_infos + i;
+
+ std::cout << ci->speed << std::endl;
+ std::cout << ci->model << std::endl;
+ std::cout << ci->cpu_times.user << std::endl;
+ std::cout << ci->cpu_times.nice << std::endl;
+ std::cout << ci->cpu_times.sys << std::endl;
+ std::cout << ci->cpu_times.idle << std::endl;
+ std::cout << ci->cpu_times.irq << std::endl;
+
result[j++] = OneByteString(isolate, ci->model);
result[j++] = Number::New(isolate, ci->speed);
result[j++] = Number::New(isolate, ci->cpu_times.user);
@@ -122,10 +132,11 @@ static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
result[j++] = Number::New(isolate, ci->cpu_times.sys);
result[j++] = Number::New(isolate, ci->cpu_times.idle);
result[j++] = Number::New(isolate, ci->cpu_times.irq);
+ */
}
uv_free_cpu_info(cpu_infos, count);
- args.GetReturnValue().Set(Array::New(isolate, result.data(), result.size()));
+ // args.GetReturnValue().Set(Array::New(isolate, result.data(), result.size()));
}
diff --git a/src/node_report.cc b/src/node_report.cc
index 3b97bb7..25dcb4c 100644
--- a/src/node_report.cc
+++ b/src/node_report.cc
@@ -684,16 +684,16 @@ static void PrintSystemInformation(JSONWriter* writer) {
{"core_file_size_blocks", RLIMIT_CORE},
{"data_seg_size_kbytes", RLIMIT_DATA},
{"file_size_blocks", RLIMIT_FSIZE},
-#if !(defined(_AIX) || defined(__sun))
+#if !(defined(_AIX) || defined(__sun) || defined(__HAIKU__))
{"max_locked_memory_bytes", RLIMIT_MEMLOCK},
#endif
-#ifndef __sun
+#if !(defined(__sun) || defined(__HAIKU__))
{"max_memory_size_kbytes", RLIMIT_RSS},
#endif
{"open_files", RLIMIT_NOFILE},
{"stack_size_bytes", RLIMIT_STACK},
{"cpu_time_seconds", RLIMIT_CPU},
-#ifndef __sun
+#if !(defined(__sun) || defined(__HAIKU__))
{"max_user_processes", RLIMIT_NPROC},
#endif
#ifndef __OpenBSD__
diff --git a/tools/utils.py b/tools/utils.py
index 9734836..94e4d8c 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -57,6 +57,8 @@ def GuessOS():
return 'win32'
elif id == 'FreeBSD':
return 'freebsd'
+ elif id == 'Haiku':
+ return 'haiku'
elif id == 'OpenBSD':
return 'openbsd'
elif id == 'SunOS':
--
2.30.0
From c0213e9265469a8b1348d729849769f5cea7623d Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 27 Mar 2021 14:01:44 +0100
Subject: Haiku v8 patches
diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn
index 167e635..77a0d56 100644
--- a/deps/v8/BUILD.gn
+++ b/deps/v8/BUILD.gn
@@ -260,7 +260,7 @@ if (v8_enable_snapshot_native_code_counters == "") {
if (v8_enable_pointer_compression == "") {
# TODO(v8:v7703): temporarily enable pointer compression on arm64 and on x64
v8_enable_pointer_compression =
- v8_current_cpu == "arm64" || v8_current_cpu == "x64"
+ (v8_current_cpu == "arm64" || v8_current_cpu == "x64") && !is_haiku
}
if (v8_enable_fast_torque == "") {
v8_enable_fast_torque = v8_enable_fast_mksnapshot
@@ -790,7 +790,7 @@ config("toolchain") {
}
}
- if (is_clang) {
+ if (is_clang && !is_haiku) {
cflags += [ "-Wmissing-field-initializers" ]
if (v8_current_cpu != "mips" && v8_current_cpu != "mipsel") {
@@ -3887,6 +3887,11 @@ v8_component("v8_libbase") {
"src/base/debug/stack_trace_fuchsia.cc",
"src/base/platform/platform-fuchsia.cc",
]
+ } else if (is_haiku) {
+ sources += [
+ "src/base/debug/stack_trace_posix.cc",
+ "src/base/platform/platform-haiku.cc",
+ ]
} else if (is_mac || is_ios) {
sources += [
"src/base/debug/stack_trace_posix.cc",
@@ -4431,6 +4436,13 @@ if (is_fuchsia && !build_with_chromium) {
group("v8_fuzzers") {
testonly = true
+
+ if(host_os == "haiku"){
+ data_deps = []
+ }
+
+ if (host_os != "haiku") {
+
data_deps = [
":v8_simple_json_fuzzer",
":v8_simple_multi_return_fuzzer",
@@ -4442,6 +4454,8 @@ group("v8_fuzzers") {
":v8_simple_wasm_compile_fuzzer",
":v8_simple_wasm_fuzzer",
]
+ }
+
}
if (is_component_build) {
diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h
index 9825232..4a07457 100644
--- a/deps/v8/include/v8config.h
+++ b/deps/v8/include/v8config.h
@@ -61,6 +61,7 @@
// V8_OS_CYGWIN - Cygwin
// V8_OS_DRAGONFLYBSD - DragonFlyBSD
// V8_OS_FREEBSD - FreeBSD
+// V8_OS_HAIKU - Haiku
// V8_OS_FUCHSIA - Fuchsia
// V8_OS_LINUX - Linux
// V8_OS_MACOSX - Mac OS X
@@ -100,6 +101,9 @@
# define V8_OS_BSD 1
# define V8_OS_FREEBSD 1
# define V8_OS_POSIX 1
+#elif defined(__HAIKU__)
+# define V8_OS_HAIKU 1
+# define V8_OS_POSIX 1
#elif defined(__Fuchsia__)
# define V8_OS_FUCHSIA 1
# define V8_OS_POSIX 1
diff --git a/deps/v8/src/base/debug/stack_trace_posix.cc b/deps/v8/src/base/debug/stack_trace_posix.cc
index ed602af..58b3b5d 100644
--- a/deps/v8/src/base/debug/stack_trace_posix.cc
+++ b/deps/v8/src/base/debug/stack_trace_posix.cc
@@ -25,14 +25,15 @@
#include <string>
#include <vector>
-#if V8_LIBC_GLIBC || V8_LIBC_BSD || V8_LIBC_UCLIBC || V8_OS_SOLARIS
+#if V8_LIBC_GLIBC || V8_LIBC_BSD || V8_LIBC_UCLIBC || V8_OS_SOLARIS || V8_OS_HAIKU
#define HAVE_EXECINFO_H 1
#endif
-#if HAVE_EXECINFO_H
+#if defined(HAVE_EXECINFO_H)
#include <cxxabi.h>
#include <execinfo.h>
#endif
+
#if V8_OS_MACOSX
#include <AvailabilityMacros.h>
#endif
diff --git a/deps/v8/src/base/export-template.h b/deps/v8/src/base/export-template.h
index 861cfe4..8c6d885 100644
--- a/deps/v8/src/base/export-template.h
+++ b/deps/v8/src/base/export-template.h
@@ -83,6 +83,7 @@
// definition sites instead.
#define EXPORT_TEMPLATE_DECLARE_MSVC_HACK(export, _)
#define EXPORT_TEMPLATE_DEFINE_MSVC_HACK(export, _) export
+#define EXPORT_TEMPLATE_TEST_MSVC_HACK_DEFAULT(...) true
// EXPORT_TEMPLATE_STYLE is an internal helper macro that identifies which
// export style needs to be used for the provided FOO_EXPORT macro definition.
@@ -159,5 +160,5 @@ EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport));
#undef EXPORT_TEMPLATE_TEST
#undef EXPORT_TEMPLATE_TEST_DEFAULT_DEFAULT
#undef EXPORT_TEMPLATE_TEST_MSVC_HACK_MSVC_HACK
-
+#undef EXPORT_TEMPLATE_TEST_MSVC_HACK_DEFAULT
#endif // V8_BASE_EXPORT_TEMPLATE_H_
diff --git a/deps/v8/src/base/platform/platform-haiku.cc b/deps/v8/src/base/platform/platform-haiku.cc
new file mode 100644
index 0000000..c4f0ae3
--- /dev/null
+++ b/deps/v8/src/base/platform/platform-haiku.cc
@@ -0,0 +1,59 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Platform-specific code for Haiku goes here. For the POSIX-compatible
+// parts, the implementation is in platform-posix.cc.
+
+#include <pthread.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+#include <fcntl.h> // open
+#include <sys/mman.h> // mmap & munmap
+#include <sys/stat.h> // open
+#include <unistd.h> // sysconf
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <strings.h> // index
+
+#include <cmath>
+
+#include <OS.h>
+
+#undef MAP_TYPE
+
+#include "src/base/macros.h"
+#include "src/base/platform/platform-posix-time.h"
+#include "src/base/platform/platform-posix.h"
+#include "src/base/platform/platform.h"
+
+namespace v8 {
+namespace base {
+
+TimezoneCache* OS::CreateTimezoneCache() {
+ return new PosixDefaultTimezoneCache();
+}
+
+std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
+ return std::vector<SharedLibraryAddress>();
+}
+
+void OS::SignalCodeMovingGC() {}
+
+void OS::AdjustSchedulingParams() {}
+
+// static
+void* Stack::GetStackStart() {
+ thread_info threadInfo;
+ get_thread_info(find_thread(NULL), &threadInfo);
+ return threadInfo.stack_base;
+}
+
+} // namespace base
+} // namespace v8
diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc
index 17fc5b5..4b2020f 100644
--- a/deps/v8/src/base/platform/platform-posix.cc
+++ b/deps/v8/src/base/platform/platform-posix.cc
@@ -61,7 +61,7 @@
#include <sys/resource.h>
#endif
-#if !defined(_AIX) && !defined(V8_OS_FUCHSIA)
+#if !defined(_AIX) && !defined(V8_OS_FUCHSIA) && !defined(__HAIKU__)
#include <sys/syscall.h>
#endif
@@ -77,6 +77,14 @@ extern int madvise(caddr_t, size_t, int);
#endif
#endif
+#if defined(__HAIKU__)
+extern "C" int posix_madvise(void*, size_t, int);
+#endif
+
+#if defined(__HAIKU__)
+#define MADV_FREE POSIX_MADV_DONTNEED
+#endif
+
#ifndef MADV_FREE
#define MADV_FREE MADV_DONTNEED
#endif
@@ -413,6 +421,8 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
int ret = madvise(address, size, MADV_FREE_REUSABLE);
#elif defined(_AIX) || defined(V8_OS_SOLARIS)
int ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_FREE);
+#elif defined(__HAIKU__)
+ int ret = posix_madvise(address, size, MADV_FREE);
#else
int ret = madvise(address, size, MADV_FREE);
#endif
@@ -424,6 +434,8 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
// imply runtime support.
#if defined(_AIX) || defined(V8_OS_SOLARIS)
ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_DONTNEED);
+#elif defined(__HAIKU__)
+ ret = posix_madvise(address, size, MADV_FREE);
#else
ret = madvise(address, size, MADV_DONTNEED);
#endif
@@ -971,7 +983,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
// keep this version in POSIX as most Linux-compatible derivatives will
// support it. MacOS and FreeBSD are different here.
#if !defined(V8_OS_FREEBSD) && !defined(V8_OS_MACOSX) && !defined(_AIX) && \
- !defined(V8_OS_SOLARIS)
+ !defined(V8_OS_SOLARIS) && !defined(V8_OS_HAIKU)
// static
void* Stack::GetStackStart() {
diff --git a/deps/v8/src/libsampler/sampler.cc b/deps/v8/src/libsampler/sampler.cc
index e2091ce..0d5e7f2 100644
--- a/deps/v8/src/libsampler/sampler.cc
+++ b/deps/v8/src/libsampler/sampler.cc
@@ -12,7 +12,7 @@
#include <sys/time.h>
#include <atomic>
-#if !V8_OS_QNX && !V8_OS_AIX
+#if !V8_OS_QNX && !V8_OS_AIX && !V8_OS_HAIKU
#include <sys/syscall.h> // NOLINT
#endif
@@ -20,7 +20,7 @@
#include <mach/mach.h>
// OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h>
// and is a typedef for struct sigcontext. There is no uc_mcontext.
-#elif !V8_OS_OPENBSD
+#elif !V8_OS_OPENBSD && !V8_OS_HAIKU
#include <ucontext.h>
#endif
@@ -483,6 +483,16 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) {
state->sp = reinterpret_cast<void*>(mcontext.__gregs[_REG_SP]);
state->fp = reinterpret_cast<void*>(mcontext.__gregs[_REG_FP]);
#endif // V8_HOST_ARCH_*
+#elif V8_OS_HAIKU
+#if V8_HOST_ARCH_IA32
+ state->pc = reinterpret_cast<void*>(mcontext.eip);
+ state->sp = reinterpret_cast<void*>(mcontext.esp);
+ state->fp = reinterpret_cast<void*>(mcontext.ebp);
+#elif V8_HOST_ARCH_X64
+ state->pc = reinterpret_cast<void*>(mcontext.rip);
+ state->sp = reinterpret_cast<void*>(mcontext.rsp);
+ state->fp = reinterpret_cast<void*>(mcontext.rbp);
+#endif // V8_HOST_ARCH_*
#elif V8_OS_NETBSD
#if V8_HOST_ARCH_IA32
state->pc = reinterpret_cast<void*>(mcontext.__gregs[_REG_EIP]);
diff --git a/deps/v8/tools/mb/mb.py b/deps/v8/tools/mb/mb.py
index f3e4615..c3649ba 100755
--- a/deps/v8/tools/mb/mb.py
+++ b/deps/v8/tools/mb/mb.py
@@ -869,12 +869,15 @@ class MetaBuildWrapper(object):
subdir, exe = 'linux64', 'gn'
elif self.platform == 'darwin':
subdir, exe = 'mac', 'gn'
+ elif self.platform == 'haiku1':
+ subdir, exe = 'haiku','gn'
+ gn_path = "/bin/gn"
else:
subdir, exe = 'win', 'gn.exe'
arch = platform.machine()
if (arch.startswith('s390') or arch.startswith('ppc') or
- self.platform.startswith('aix')):
+ self.platform.startswith('aix') or self.platform.startswith('haiku')):
# use gn in PATH
gn_path = 'gn'
else:
--
2.30.0
From 820caf91ac5d59bd030a36ef49fc807e18d6d596 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 27 Mar 2021 18:23:32 +0100
Subject: v8 gyp build for Haiku
diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi
index b24e0b3..c2a7ecb 100644
--- a/tools/v8_gypfiles/features.gypi
+++ b/tools/v8_gypfiles/features.gypi
@@ -46,6 +46,11 @@
}, {
'is_fuchsia': 0,
}],
+ ['OS == "haiku"', {
+ 'is_haiku': 1,
+ }, {
+ 'is_haiku': 0,
+ }],
['OS=="android"', { # GYP reverts OS to linux so use `-D OS=android`
'is_android': 1,
}, {
diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
index 48ec392..5e3c90c 100644
--- a/tools/v8_gypfiles/v8.gyp
+++ b/tools/v8_gypfiles/v8.gyp
@@ -1085,6 +1085,17 @@
'<(V8_ROOT)/src/base/platform/platform-fuchsia.cc',
]
}],
+ ['is_haiku', {
+ 'link_settings': {
+ 'libraries': [
+ '-lexecinfo',
+ ]
+ },
+ 'sources': [
+ '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
+ '<(V8_ROOT)/src/base/platform/platform-haiku.cc',
+ ]
+ }],
['OS == "mac" or OS == "ios"', {
'sources': [
'<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
--
2.30.0

View File

@@ -0,0 +1,632 @@
From 7b6a3a86db18f55a9676dd5c62088f61af7cdfd2 Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Wed, 22 May 2019 11:23:37 +0000
Subject: Initial Haiku support for Node.js
diff --git a/common.gypi b/common.gypi
index 79a22ac..cf2ca6c 100644
--- a/common.gypi
+++ b/common.gypi
@@ -258,6 +258,9 @@
'_target_name!="<(node_core_target_name)")', {
'cflags!': ['-Werror'],
}],
+ ['OS=="haiku"', {
+ 'clang%': 0,
+ }],
],
'msvs_settings': {
'VCCLCompilerTool': {
@@ -286,6 +289,10 @@
['target_arch=="arm64"', {
'TargetMachine' : 0, # NotSet. MACHINE:ARM64 is inferred from the input files.
}],
+ ['OS == "haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC']
+ }],
],
'GenerateDebugInformation': 'true',
'SuppressStartupBanner': 'true',
@@ -346,6 +353,10 @@
['_type!="static_library"', {
'xcode_settings': {'OTHER_LDFLAGS': ['-fsanitize=address']},
}],
+ ['OS == "haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC']
+ }],
],
}],
['v8_enable_pointer_compression == 1', {
@@ -373,7 +384,7 @@
'cflags': [ '-pthread' ],
'ldflags': [ '-pthread' ],
}],
- [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', {
+ [ 'OS in "linux freebsd openbsd solaris android aix cloudabi haiku"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++1y' ],
'defines': [ '__STDC_FORMAT_MACROS' ],
@@ -387,6 +398,10 @@
'cflags': [ '-I/usr/local/include' ],
'ldflags': [ '-Wl,-z,wxneeded' ],
}],
+ ['OS=="haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC' ],
+ }],
],
'conditions': [
[ 'target_arch=="ia32"', {
@@ -545,6 +560,12 @@
'OPENSSL_NO_PINSHARED'
],
}],
+ ['OS=="haiku"', {
+ 'ldflags': [ '-lroot', '-lbsd', '-lstdc++', '-lnetwork', '-Wl,-Bsymbolic', '-Wl,--export-dynamic', '-fPIC' ],
+ 'ldflags!': [ '-pthreads', '-pthread', '-rdynamic' ],
+ 'clang%': 0,
+ '%v8_use_snapshot':0,
+ }],
['node_shared_openssl!="true"', {
# `OPENSSL_THREADS` is defined via GYP for openSSL for all architectures.
'defines': [
diff --git a/configure.py b/configure.py
index b526507..6d96881 100755
--- a/configure.py
+++ b/configure.py
@@ -45,7 +45,7 @@ from gyp_node import run_gyp
parser = argparse.ArgumentParser()
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
- 'android', 'aix', 'cloudabi')
+ 'android', 'aix', 'cloudabi', 'haiku')
valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc',
'ppc64', 'x32','x64', 'x86', 'x86_64', 's390x')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
index 76984d4..eda4459 100644
--- a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
+++ b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
@@ -8,11 +8,9 @@
],
'openssl_cflags_linux-x86_64': [
'-Wall -O3',
- '-pthread -m64',
- '-Wall -O3',
+ '-m64',
],
'openssl_ex_libs_linux-x86_64': [
- '-ldl -pthread',
],
'openssl_cli_srcs_linux-x86_64': [
'openssl/apps/asn1pars.c',
diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
index d473731..291779a 100644
--- a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
+++ b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
@@ -694,11 +694,10 @@
],
'openssl_cflags_linux-x86_64': [
'-Wall -O3',
- '-pthread -m64',
+ '-m64',
'-Wall -O3',
],
- 'openssl_ex_libs_linux-x86_64': [
- '-ldl -pthread',
+ 'openssl_ex_libs_linux-x86_64': [
],
},
'include_dirs': [
diff --git a/deps/openssl/openssl/crypto/rand/rand_unix.c b/deps/openssl/openssl/crypto/rand/rand_unix.c
index ec6be79..861f56a 100644
--- a/deps/openssl/openssl/crypto/rand/rand_unix.c
+++ b/deps/openssl/openssl/crypto/rand/rand_unix.c
@@ -369,7 +369,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
* Note: Sometimes getentropy() can be provided but not implemented
* internally. So we need to check errno for ENOSYS
*/
-# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux)
+# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux) && !defined(__HAIKU__)
extern int getentropy(void *buffer, size_t length) __attribute__((weak));
if (getentropy != NULL) {
diff --git a/deps/openssl/openssl_common.gypi b/deps/openssl/openssl_common.gypi
index d866630..52558d8 100644
--- a/deps/openssl/openssl_common.gypi
+++ b/deps/openssl/openssl_common.gypi
@@ -56,7 +56,14 @@
'ENGINESDIR="/dev/null"',
'__EXTENSIONS__'
],
- }, {
+ },'OS=="haiku"', {
+ '!ldflags': ['-pthread', '-pthreads'],
+ 'defines': [
+ 'OPENSSLDIR="/boot/system/data/ssl/"',
+ 'ENGINESDIR="/dev/null"',
+ 'TERMIOS',
+ ],
+ },{
# linux and others
'cflags': ['-Wno-missing-field-initializers',],
'defines': [
diff --git a/node.gypi b/node.gypi
index dde4f83..3ea543c 100644
--- a/node.gypi
+++ b/node.gypi
@@ -256,6 +256,16 @@
'NODE_PLATFORM="sunos"',
],
}],
+ [ 'OS=="haiku"', {
+ 'libraries': [
+ '-lroot',
+ '-lnetwork',
+ '-lbsd',
+ ],
+ 'defines': [
+ 'NODE_PLATFORM="haiku"',
+ ],
+ }],
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"'
' and force_load=="true"', {
'ldflags': [
diff --git a/src/node.cc b/src/node.cc
index b757013..856a664 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -622,7 +622,7 @@ inline void PlatformInit() {
if (nr == SIGKILL || nr == SIGSTOP)
continue;
act.sa_handler = (nr == SIGPIPE || nr == SIGXFSZ) ? SIG_IGN : SIG_DFL;
- CHECK_EQ(0, sigaction(nr, &act, nullptr));
+ //CHECK_EQ(0, sigaction(nr, &act, nullptr));
}
#endif // !NODE_SHARED_MODE
diff --git a/src/node_os.cc b/src/node_os.cc
index 2bbb56a..ff3c466 100644
--- a/src/node_os.cc
+++ b/src/node_os.cc
@@ -34,7 +34,7 @@
#include <array>
#include <cerrno>
#include <cstring>
-
+#include <iostream>
namespace node {
namespace os {
@@ -115,7 +115,17 @@ static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
std::vector<Local<Value>> result;
result.reserve(count * 7);
for (int i = 0; i < count; i++) {
+ /*
uv_cpu_info_t* ci = cpu_infos + i;
+
+ std::cout << ci->speed << std::endl;
+ std::cout << ci->model << std::endl;
+ std::cout << ci->cpu_times.user << std::endl;
+ std::cout << ci->cpu_times.nice << std::endl;
+ std::cout << ci->cpu_times.sys << std::endl;
+ std::cout << ci->cpu_times.idle << std::endl;
+ std::cout << ci->cpu_times.irq << std::endl;
+
result.emplace_back(OneByteString(isolate, ci->model));
result.emplace_back(Number::New(isolate, ci->speed));
result.emplace_back(
@@ -128,10 +138,11 @@ static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
Number::New(isolate, static_cast<double>(ci->cpu_times.idle)));
result.emplace_back(
Number::New(isolate, static_cast<double>(ci->cpu_times.irq)));
+ */
}
uv_free_cpu_info(cpu_infos, count);
- args.GetReturnValue().Set(Array::New(isolate, result.data(), result.size()));
+ // args.GetReturnValue().Set(Array::New(isolate, result.data(), result.size()));
}
diff --git a/src/node_report.cc b/src/node_report.cc
index 13f87b1..de4455e 100644
--- a/src/node_report.cc
+++ b/src/node_report.cc
@@ -688,16 +688,16 @@ static void PrintSystemInformation(JSONWriter* writer) {
{"core_file_size_blocks", RLIMIT_CORE},
{"data_seg_size_kbytes", RLIMIT_DATA},
{"file_size_blocks", RLIMIT_FSIZE},
-#if !(defined(_AIX) || defined(__sun))
+#if !(defined(_AIX) || defined(__sun) || defined(__HAIKU__))
{"max_locked_memory_bytes", RLIMIT_MEMLOCK},
#endif
-#ifndef __sun
+#if !(defined(__sun) || defined(__HAIKU__))
{"max_memory_size_kbytes", RLIMIT_RSS},
#endif
{"open_files", RLIMIT_NOFILE},
{"stack_size_bytes", RLIMIT_STACK},
{"cpu_time_seconds", RLIMIT_CPU},
-#ifndef __sun
+#if !(defined(__sun) || defined(__HAIKU__))
{"max_user_processes", RLIMIT_NPROC},
#endif
#ifndef __OpenBSD__
diff --git a/tools/utils.py b/tools/utils.py
index 9734836..94e4d8c 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -57,6 +57,8 @@ def GuessOS():
return 'win32'
elif id == 'FreeBSD':
return 'freebsd'
+ elif id == 'Haiku':
+ return 'haiku'
elif id == 'OpenBSD':
return 'openbsd'
elif id == 'SunOS':
--
2.30.0
From 5c88a61428cba2e630b3152fc3f3a82429a8bac3 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 27 Mar 2021 14:01:44 +0100
Subject: Haiku v8 patches
diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn
index a9ab678..b87fbe0 100644
--- a/deps/v8/BUILD.gn
+++ b/deps/v8/BUILD.gn
@@ -322,7 +322,7 @@ if (v8_enable_snapshot_native_code_counters == "") {
}
if (v8_enable_pointer_compression == "") {
v8_enable_pointer_compression =
- v8_current_cpu == "arm64" || v8_current_cpu == "x64"
+ (v8_current_cpu == "arm64" || v8_current_cpu == "x64") && !is_haiku
}
if (v8_enable_fast_torque == "") {
v8_enable_fast_torque = v8_enable_fast_mksnapshot
@@ -1018,7 +1018,7 @@ config("toolchain") {
}
}
- if (is_clang) {
+ if (is_clang && !is_haiku) {
cflags += [ "-Wmissing-field-initializers" ]
if (v8_current_cpu != "mips" && v8_current_cpu != "mipsel") {
@@ -4484,6 +4484,11 @@ v8_component("v8_libbase") {
"src/base/platform/platform-fuchsia.cc",
]
deps += [ "//third_party/fuchsia-sdk/sdk/pkg/zx" ]
+ } else if (is_haiku) {
+ sources += [
+ "src/base/debug/stack_trace_posix.cc",
+ "src/base/platform/platform-haiku.cc",
+ ]
} else if (is_mac || is_ios) {
sources += [
"src/base/debug/stack_trace_posix.cc",
@@ -5182,6 +5187,13 @@ if (is_fuchsia && !build_with_chromium) {
group("v8_fuzzers") {
testonly = true
+
+ if(host_os == "haiku"){
+ data_deps = []
+ }
+
+ if (host_os != "haiku") {
+
data_deps = [
":v8_simple_inspector_fuzzer",
":v8_simple_json_fuzzer",
@@ -5194,6 +5206,8 @@ group("v8_fuzzers") {
":v8_simple_wasm_compile_fuzzer",
":v8_simple_wasm_fuzzer",
]
+ }
+
}
if (is_component_build) {
diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h
index acd34d7..32d751f 100644
--- a/deps/v8/include/v8config.h
+++ b/deps/v8/include/v8config.h
@@ -69,6 +69,7 @@ path. Add it with -I<path> to the command line
// V8_OS_CYGWIN - Cygwin
// V8_OS_DRAGONFLYBSD - DragonFlyBSD
// V8_OS_FREEBSD - FreeBSD
+// V8_OS_HAIKU - Haiku
// V8_OS_FUCHSIA - Fuchsia
// V8_OS_LINUX - Linux
// V8_OS_MACOSX - Mac OS X
@@ -111,6 +112,9 @@ path. Add it with -I<path> to the command line
# define V8_OS_BSD 1
# define V8_OS_FREEBSD 1
# define V8_OS_POSIX 1
+#elif defined(__HAIKU__)
+# define V8_OS_HAIKU 1
+# define V8_OS_POSIX 1
#elif defined(__Fuchsia__)
# define V8_OS_FUCHSIA 1
# define V8_OS_POSIX 1
diff --git a/deps/v8/src/base/debug/stack_trace_posix.cc b/deps/v8/src/base/debug/stack_trace_posix.cc
index 270f1ca..f3b680f 100644
--- a/deps/v8/src/base/debug/stack_trace_posix.cc
+++ b/deps/v8/src/base/debug/stack_trace_posix.cc
@@ -25,14 +25,15 @@
#include <string>
#include <vector>
-#if V8_LIBC_GLIBC || V8_LIBC_BSD || V8_LIBC_UCLIBC || V8_OS_SOLARIS
+#if V8_LIBC_GLIBC || V8_LIBC_BSD || V8_LIBC_UCLIBC || V8_OS_SOLARIS || V8_OS_HAIKU
#define HAVE_EXECINFO_H 1
#endif
-#if HAVE_EXECINFO_H
+#if defined(HAVE_EXECINFO_H)
#include <cxxabi.h>
#include <execinfo.h>
#endif
+
#if V8_OS_MACOSX
#include <AvailabilityMacros.h>
#endif
diff --git a/deps/v8/src/base/export-template.h b/deps/v8/src/base/export-template.h
index 861cfe4..8c6d885 100644
--- a/deps/v8/src/base/export-template.h
+++ b/deps/v8/src/base/export-template.h
@@ -83,6 +83,7 @@
// definition sites instead.
#define EXPORT_TEMPLATE_DECLARE_MSVC_HACK(export, _)
#define EXPORT_TEMPLATE_DEFINE_MSVC_HACK(export, _) export
+#define EXPORT_TEMPLATE_TEST_MSVC_HACK_DEFAULT(...) true
// EXPORT_TEMPLATE_STYLE is an internal helper macro that identifies which
// export style needs to be used for the provided FOO_EXPORT macro definition.
@@ -159,5 +160,5 @@ EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport));
#undef EXPORT_TEMPLATE_TEST
#undef EXPORT_TEMPLATE_TEST_DEFAULT_DEFAULT
#undef EXPORT_TEMPLATE_TEST_MSVC_HACK_MSVC_HACK
-
+#undef EXPORT_TEMPLATE_TEST_MSVC_HACK_DEFAULT
#endif // V8_BASE_EXPORT_TEMPLATE_H_
diff --git a/deps/v8/src/base/platform/platform-haiku.cc b/deps/v8/src/base/platform/platform-haiku.cc
new file mode 100644
index 0000000..fa6656e
--- /dev/null
+++ b/deps/v8/src/base/platform/platform-haiku.cc
@@ -0,0 +1,59 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Platform-specific code for Haiku goes here. For the POSIX-compatible
+// parts, the implementation is in platform-posix.cc.
+
+#include <pthread.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+#include <fcntl.h> // open
+#include <sys/mman.h> // mmap & munmap
+#include <sys/stat.h> // open
+#include <unistd.h> // sysconf
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <strings.h> // index
+
+#include <cmath>
+
+#include <OS.h>
+
+#undef MAP_TYPE
+
+#include "src/base/macros.h"
+#include "src/base/platform/platform-posix-time.h"
+#include "src/base/platform/platform-posix.h"
+#include "src/base/platform/platform.h"
+
+namespace v8 {
+namespace base {
+
+TimezoneCache* OS::CreateTimezoneCache() {
+ return new PosixDefaultTimezoneCache();
+}
+
+std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
+ return std::vector<SharedLibraryAddress>();
+}
+
+void OS::SignalCodeMovingGC() {}
+
+void OS::AdjustSchedulingParams() {}
+
+// static
+Stack::StackSlot Stack::GetStackStart() {
+ thread_info threadInfo;
+ get_thread_info(find_thread(NULL), &threadInfo);
+ return threadInfo.stack_base;
+}
+
+} // namespace base
+} // namespace v8
diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc
index 9e3a045..f22ee7e 100644
--- a/deps/v8/src/base/platform/platform-posix.cc
+++ b/deps/v8/src/base/platform/platform-posix.cc
@@ -61,7 +61,7 @@
#include <sys/resource.h>
#endif
-#if !defined(_AIX) && !defined(V8_OS_FUCHSIA)
+#if !defined(_AIX) && !defined(V8_OS_FUCHSIA) && !defined(__HAIKU__)
#include <sys/syscall.h>
#endif
@@ -77,6 +77,14 @@ extern int madvise(caddr_t, size_t, int);
#endif
#endif
+#if defined(__HAIKU__)
+extern "C" int posix_madvise(void*, size_t, int);
+#endif
+
+#if defined(__HAIKU__)
+#define MADV_FREE POSIX_MADV_DONTNEED
+#endif
+
#ifndef MADV_FREE
#define MADV_FREE MADV_DONTNEED
#endif
@@ -458,6 +466,8 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
int ret = madvise(address, size, MADV_FREE_REUSABLE);
#elif defined(_AIX) || defined(V8_OS_SOLARIS)
int ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_FREE);
+#elif defined(__HAIKU__)
+ int ret = posix_madvise(address, size, MADV_FREE);
#else
int ret = madvise(address, size, MADV_FREE);
#endif
@@ -469,6 +479,8 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
// imply runtime support.
#if defined(_AIX) || defined(V8_OS_SOLARIS)
ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_DONTNEED);
+#elif defined(__HAIKU__)
+ ret = posix_madvise(address, size, MADV_FREE);
#else
ret = madvise(address, size, MADV_DONTNEED);
#endif
@@ -1016,7 +1028,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
// keep this version in POSIX as most Linux-compatible derivatives will
// support it. MacOS and FreeBSD are different here.
#if !defined(V8_OS_FREEBSD) && !defined(V8_OS_MACOSX) && !defined(_AIX) && \
- !defined(V8_OS_SOLARIS)
+ !defined(V8_OS_SOLARIS) && !defined(V8_OS_HAIKU)
// static
Stack::StackSlot Stack::GetStackStart() {
diff --git a/deps/v8/src/libsampler/sampler.cc b/deps/v8/src/libsampler/sampler.cc
index e933c61..8cb384d 100644
--- a/deps/v8/src/libsampler/sampler.cc
+++ b/deps/v8/src/libsampler/sampler.cc
@@ -12,7 +12,7 @@
#include <sys/time.h>
#include <atomic>
-#if !V8_OS_QNX && !V8_OS_AIX
+#if !V8_OS_QNX && !V8_OS_AIX && !V8_OS_HAIKU
#include <sys/syscall.h> // NOLINT
#endif
@@ -20,7 +20,7 @@
#include <mach/mach.h>
// OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h>
// and is a typedef for struct sigcontext. There is no uc_mcontext.
-#elif !V8_OS_OPENBSD
+#elif !V8_OS_OPENBSD && !V8_OS_HAIKU
#include <ucontext.h>
#endif
@@ -489,6 +489,16 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) {
state->sp = reinterpret_cast<void*>(mcontext.__gregs[_REG_SP]);
state->fp = reinterpret_cast<void*>(mcontext.__gregs[_REG_FP]);
#endif // V8_HOST_ARCH_*
+#elif V8_OS_HAIKU
+#if V8_HOST_ARCH_IA32
+ state->pc = reinterpret_cast<void*>(mcontext.eip);
+ state->sp = reinterpret_cast<void*>(mcontext.esp);
+ state->fp = reinterpret_cast<void*>(mcontext.ebp);
+#elif V8_HOST_ARCH_X64
+ state->pc = reinterpret_cast<void*>(mcontext.rip);
+ state->sp = reinterpret_cast<void*>(mcontext.rsp);
+ state->fp = reinterpret_cast<void*>(mcontext.rbp);
+#endif // V8_HOST_ARCH_*
#elif V8_OS_NETBSD
#if V8_HOST_ARCH_IA32
state->pc = reinterpret_cast<void*>(mcontext.__gregs[_REG_EIP]);
diff --git a/deps/v8/tools/mb/mb.py b/deps/v8/tools/mb/mb.py
index 8ca9089..7615f31 100755
--- a/deps/v8/tools/mb/mb.py
+++ b/deps/v8/tools/mb/mb.py
@@ -873,12 +873,15 @@ class MetaBuildWrapper(object):
subdir, exe = 'linux64', 'gn'
elif self.platform == 'darwin':
subdir, exe = 'mac', 'gn'
+ elif self.platform == 'haiku1':
+ subdir, exe = 'haiku','gn'
+ gn_path = "/bin/gn"
else:
subdir, exe = 'win', 'gn.exe'
arch = platform.machine()
if (arch.startswith('s390') or arch.startswith('ppc') or
- self.platform.startswith('aix')):
+ self.platform.startswith('aix') or self.platform.startswith('haiku')):
# use gn in PATH
gn_path = 'gn'
else:
--
2.30.0
From d41e11ff7106444c7e08d50aaa96fd505bd2025f Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 27 Mar 2021 18:23:32 +0100
Subject: v8 gyp build for Haiku
diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi
index b21bf1d..00fd2cf 100644
--- a/tools/v8_gypfiles/features.gypi
+++ b/tools/v8_gypfiles/features.gypi
@@ -46,6 +46,11 @@
}, {
'is_fuchsia': 0,
}],
+ ['OS == "haiku"', {
+ 'is_haiku': 1,
+ }, {
+ 'is_haiku': 0,
+ }],
['OS=="android"', { # GYP reverts OS to linux so use `-D OS=android`
'is_android': 1,
}, {
diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
index 2b2d423..bc95ecd 100644
--- a/tools/v8_gypfiles/v8.gyp
+++ b/tools/v8_gypfiles/v8.gyp
@@ -946,6 +946,17 @@
'<(V8_ROOT)/src/base/platform/platform-fuchsia.cc',
]
}],
+ ['is_haiku', {
+ 'link_settings': {
+ 'libraries': [
+ '-lexecinfo',
+ ]
+ },
+ 'sources': [
+ '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
+ '<(V8_ROOT)/src/base/platform/platform-haiku.cc',
+ ]
+ }],
['OS == "mac" or OS == "ios"', {
'sources': [
'<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
--
2.30.0

View File

@@ -1,403 +0,0 @@
From ed9657362422bafc7d91ce8f10353a8bb6a8ee70 Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Wed, 22 May 2019 11:23:37 +0000
Subject: Initial Haiku support for Node.js
diff --git a/common.gypi b/common.gypi
index 223043e..faf30c7 100644
--- a/common.gypi
+++ b/common.gypi
@@ -107,6 +107,9 @@
['OS=="mac"', {
'clang%': 1,
}],
+ ['OS=="haiku"', {
+ 'clang%': 0,
+ }],
],
},
@@ -135,6 +138,10 @@
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ]
}],
+ ['OS == "haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC']
+ }],
],
'msvs_settings': {
'VCCLCompilerTool': {
@@ -195,6 +202,10 @@
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ]
}],
+ ['OS == "haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC']
+ }],
],
'msvs_settings': {
'VCCLCompilerTool': {
@@ -339,9 +350,10 @@
'cflags': [ '-pthread' ],
'ldflags': [ '-pthread' ],
}],
- [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', {
+ [ 'OS in "linux freebsd openbsd solaris android aix cloudabi haiku"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++1y' ],
+
'ldflags': [ '-rdynamic' ],
'target_conditions': [
# The 1990s toolchain on SmartOS can't handle thin archives.
@@ -352,6 +364,10 @@
'cflags': [ '-I/usr/local/include' ],
'ldflags': [ '-Wl,-z,wxneeded' ],
}],
+ ['OS=="haiku"', {
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC' ],
+ }],
],
'conditions': [
[ 'target_arch=="ia32"', {
@@ -482,6 +498,13 @@
'-Wl,--export-dynamic',
],
}],
+ ['OS=="haiku"', {
+ 'ldflags': [ '-lroot', '-lbsd', '-lstdc++', '-lnetwork', '-Wl,-Bsymbolic', '-Wl,--export-dynamic', '-fPIC' ],
+ 'ldflags!': [ '-pthread' ],
+ 'ldflags!': [ '-pthreads', '-rdynamic' ],
+ 'clang%': 0,
+ '%v8_use_snapshot':0,
+ }],
['node_shared_openssl!="true"', {
# `OPENSSL_THREADS` is defined via GYP for openSSL for all architectures.
'defines': [
diff --git a/configure.py b/configure.py
index 15ea568..32461f2 100755
--- a/configure.py
+++ b/configure.py
@@ -44,7 +44,7 @@ from fetch_deps import FetchDeps
parser = optparse.OptionParser()
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
- 'android', 'aix', 'cloudabi')
+ 'android', 'aix', 'cloudabi', "haiku")
valid_arch = ('arm', 'arm64', 'ia32', 'ppc',
'ppc64', 'x32','x64', 'x86', 'x86_64', 's390', 's390x')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
index 76984d4..eda4459 100644
--- a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
+++ b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl-cl.gypi
@@ -8,11 +8,9 @@
],
'openssl_cflags_linux-x86_64': [
'-Wall -O3',
- '-pthread -m64',
- '-Wall -O3',
+ '-m64',
],
'openssl_ex_libs_linux-x86_64': [
- '-ldl -pthread',
],
'openssl_cli_srcs_linux-x86_64': [
'openssl/apps/asn1pars.c',
diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
index 11d3aa6..aba5d54 100644
--- a/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
+++ b/deps/openssl/config/archs/linux-x86_64/no-asm/openssl.gypi
@@ -692,11 +692,10 @@
],
'openssl_cflags_linux-x86_64': [
'-Wall -O3',
- '-pthread -m64',
+ '-m64',
'-Wall -O3',
],
- 'openssl_ex_libs_linux-x86_64': [
- '-ldl -pthread',
+ 'openssl_ex_libs_linux-x86_64': [
],
},
'include_dirs': [
diff --git a/deps/openssl/openssl/crypto/rand/rand_unix.c b/deps/openssl/openssl/crypto/rand/rand_unix.c
index 9cbc9ad..1f6268d 100644
--- a/deps/openssl/openssl/crypto/rand/rand_unix.c
+++ b/deps/openssl/openssl/crypto/rand/rand_unix.c
@@ -301,7 +301,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
* - Linux since 3.17 with glibc 2.25
* - FreeBSD since 12.0 (1200061)
*/
-# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux)
+# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux) && !defined(__HAIKU__)
extern int getentropy(void *buffer, size_t length) __attribute__((weak));
if (getentropy != NULL)
diff --git a/deps/openssl/openssl_common.gypi b/deps/openssl/openssl_common.gypi
index c4b95c2..5a05709 100644
--- a/deps/openssl/openssl_common.gypi
+++ b/deps/openssl/openssl_common.gypi
@@ -55,7 +55,14 @@
'ENGINESDIR="/dev/null"',
'__EXTENSIONS__'
],
- }, {
+ },'OS=="haiku"', {
+ '!ldflags': ['-pthread', '-pthreads'],
+ 'defines': [
+ 'OPENSSLDIR="/boot/system/data/ssl/"',
+ 'ENGINESDIR="/dev/null"',
+ 'TERMIOS',
+ ],
+ },{
# linux and others
'cflags': ['-Wno-missing-field-initializers',],
'defines': [
diff --git a/node.gypi b/node.gypi
index 10c09a6..360e4b6 100644
--- a/node.gypi
+++ b/node.gypi
@@ -267,6 +267,16 @@
'NODE_PLATFORM="sunos"',
],
}],
+ [ 'OS=="haiku"', {
+ 'libraries': [
+ '-lroot',
+ '-lnetwork',
+ '-lbsd',
+ ],
+ 'defines': [
+ 'NODE_PLATFORM="haiku"',
+ ],
+ }],
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"'
' and force_load=="true"', {
'ldflags': [ '-Wl,-z,noexecstack',
diff --git a/src/node.cc b/src/node.cc
index 953465e..8369cd4 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -492,7 +492,7 @@ inline void PlatformInit() {
if (nr == SIGKILL || nr == SIGSTOP)
continue;
act.sa_handler = (nr == SIGPIPE) ? SIG_IGN : SIG_DFL;
- CHECK_EQ(0, sigaction(nr, &act, nullptr));
+ //CHECK_EQ(0, sigaction(nr, &act, nullptr));
}
#endif // !NODE_SHARED_MODE
diff --git a/src/node_os.cc b/src/node_os.cc
index d2387f2..c1a31aa 100644
--- a/src/node_os.cc
+++ b/src/node_os.cc
@@ -34,7 +34,7 @@
#include <array>
#include <cerrno>
#include <cstring>
-
+#include <iostream>
namespace node {
namespace os {
@@ -120,7 +120,17 @@ static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
// [model, speed, (5 entries of cpu_times), model2, speed2, ...]
std::vector<Local<Value>> result(count * 7);
for (int i = 0, j = 0; i < count; i++) {
+ /*
uv_cpu_info_t* ci = cpu_infos + i;
+
+ std::cout << ci->speed << std::endl;
+ std::cout << ci->model << std::endl;
+ std::cout << ci->cpu_times.user << std::endl;
+ std::cout << ci->cpu_times.nice << std::endl;
+ std::cout << ci->cpu_times.sys << std::endl;
+ std::cout << ci->cpu_times.idle << std::endl;
+ std::cout << ci->cpu_times.irq << std::endl;
+
result[j++] = OneByteString(isolate, ci->model);
result[j++] = Number::New(isolate, ci->speed);
result[j++] = Number::New(isolate, ci->cpu_times.user);
@@ -128,10 +138,11 @@ static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
result[j++] = Number::New(isolate, ci->cpu_times.sys);
result[j++] = Number::New(isolate, ci->cpu_times.idle);
result[j++] = Number::New(isolate, ci->cpu_times.irq);
+ */
}
uv_free_cpu_info(cpu_infos, count);
- args.GetReturnValue().Set(Array::New(isolate, result.data(), result.size()));
+ // args.GetReturnValue().Set(Array::New(isolate, result.data(), result.size()));
}
diff --git a/src/node_report.cc b/src/node_report.cc
index 578da43..0f18c51 100644
--- a/src/node_report.cc
+++ b/src/node_report.cc
@@ -480,16 +480,16 @@ static void PrintSystemInformation(JSONWriter* writer) {
{"core_file_size_blocks", RLIMIT_CORE},
{"data_seg_size_kbytes", RLIMIT_DATA},
{"file_size_blocks", RLIMIT_FSIZE},
-#if !(defined(_AIX) || defined(__sun))
+#if !(defined(_AIX) || defined(__sun) || defined(__HAIKU__))
{"max_locked_memory_bytes", RLIMIT_MEMLOCK},
#endif
-#ifndef __sun
+#if !(defined(__sun) || defined(__HAIKU__))
{"max_memory_size_kbytes", RLIMIT_RSS},
#endif
{"open_files", RLIMIT_NOFILE},
{"stack_size_bytes", RLIMIT_STACK},
{"cpu_time_seconds", RLIMIT_CPU},
-#ifndef __sun
+#if !(defined(__sun) || defined(__HAIKU__))
{"max_user_processes", RLIMIT_NPROC},
#endif
{"virtual_memory_kbytes", RLIMIT_AS}
diff --git a/tools/utils.py b/tools/utils.py
index dd5ce3f..0b69b16 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -57,6 +57,8 @@ def GuessOS():
return 'win32'
elif id == 'FreeBSD':
return 'freebsd'
+ elif id == 'Haiku':
+ return 'haiku'
elif id == 'OpenBSD':
return 'openbsd'
elif id == 'SunOS':
--
2.21.0
From ff5bd3f52838dc769e68704497c7cb6b25c32b25 Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Fri, 31 May 2019 02:58:35 +0000
Subject: Import patch to use a shared V8 library.
diff --git a/common.gypi b/common.gypi
index faf30c7..25a04ca 100644
--- a/common.gypi
+++ b/common.gypi
@@ -38,7 +38,7 @@
# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
- 'v8_embedder_string': '-node.18',
+ 'v8_embedder_string': '-node.17',
##### V8 defaults for Node.js #####
@@ -499,7 +499,15 @@
],
}],
['OS=="haiku"', {
- 'ldflags': [ '-lroot', '-lbsd', '-lstdc++', '-lnetwork', '-Wl,-Bsymbolic', '-Wl,--export-dynamic', '-fPIC' ],
+ 'ldflags': [
+ '-lroot',
+ '-lbsd',
+ '-lstdc++',
+ '-lnetwork',
+ '-Wl,-Bsymbolic',
+ '-Wl,--export-dynamic',
+ '-fPIC',
+ '-lexecinfo'],
'ldflags!': [ '-pthread' ],
'ldflags!': [ '-pthreads', '-rdynamic' ],
'clang%': 0,
diff --git a/configure.py b/configure.py
index 32461f2..ab819d6 100755
--- a/configure.py
+++ b/configure.py
@@ -275,6 +275,26 @@ shared_optgroup.add_option('--shared-openssl-libpath',
dest='shared_openssl_libpath',
help='a directory to search for the shared OpenSSL DLLs')
+parser.add_option('--shared-v8',
+ action='store_true',
+ dest='shared_v8',
+ help='link to a shared V8 DLL instead of static linking')
+
+parser.add_option('--shared-v8-includes',
+ action='store',
+ dest='shared_v8_includes',
+ help='directory containing V8 header files')
+
+parser.add_option('--shared-v8-libname',
+ action='store',
+ dest='shared_v8_libname',
+ help='alternative lib name to link to (default: \'v8\')')
+
+parser.add_option('--shared-v8-libpath',
+ action='store',
+ dest='shared_v8_libpath',
+ help='a directory to search for the shared V8 DLL')
+
shared_optgroup.add_option('--shared-zlib',
action='store_true',
dest='shared_zlib',
@@ -1133,6 +1153,7 @@ def configure_library(lib, output):
def configure_v8(o):
+ o['variables']['node_shared_v8'] = b(options.shared_v8)
o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs.
o['variables']['v8_optimized_debug'] = 0 if options.v8_non_optimized_debug else 1
@@ -1158,6 +1179,16 @@ def configure_v8(o):
options.build_v8_with_gn = FetchDeps(v8_path)
o['variables']['build_v8_with_gn'] = b(options.build_v8_with_gn)
+ # assume shared_v8 if one of these is set?
+ if options.shared_v8_libpath:
+ o['libraries'] += ['-L%s' % options.shared_v8_libpath]
+ if options.shared_v8_libname:
+ o['libraries'] += ['-l%s' % options.shared_v8_libname]
+ elif options.shared_v8:
+ o['libraries'] += ['-lv8', '-lv8_libplatform']
+ if options.shared_v8_includes:
+ o['include_dirs'] += [options.shared_v8_includes]
+
def configure_openssl(o):
variables = o['variables']
diff --git a/node.gyp b/node.gyp
index df70d26..ae6aaaf 100644
--- a/node.gyp
+++ b/node.gyp
@@ -18,6 +18,7 @@
'node_shared_cares%': 'false',
'node_shared_libuv%': 'false',
'node_shared_nghttp2%': 'false',
+ 'node_shared_v8%': 'false',
'node_use_openssl%': 'true',
'node_shared_openssl%': 'false',
'node_v8_options%': '',
@@ -492,6 +493,8 @@
'src/cares_wrap.cc',
'src/connect_wrap.cc',
'src/connection_wrap.cc',
+ 'src/node_code_cache_stub.cc',
+ 'src/node_snapshot_stub.cc',
'src/debug_utils.cc',
'src/env.cc',
'src/fs_event_wrap.cc',
@@ -1067,6 +1070,7 @@
'deps/cares/include',
'deps/uv/include',
'test/cctest',
+ '/boot/system/develop/headers/v8/',
],
'defines': [ 'NODE_WANT_INTERNALS=1' ],
--
2.21.0