Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
9049c1f
tls: introduce `secureContext` for `tls.connect`
indutny Dec 11, 2015
9f0ef5a
doc: fix heading type for v4.6.2 changelog
Nov 8, 2016
1dfb5b5
v8: update make-v8.sh to use git
Nov 1, 2016
620cdc5
tools: fix release script on macOS 10.12
evanlucas Sep 28, 2016
8807981
doc: fix typo in http.md
anu0012 Oct 18, 2016
f472c09
doc: reference signal(7) for the list of signals
emadb Oct 27, 2016
f669a08
src: fix typo rval to value
maasencioh Oct 11, 2016
a7ae887
governance: expand use of CTC issue tracker
Trott Oct 6, 2016
af645a0
doc: explain why GitHub merge button is not used
jalafel Oct 12, 2016
4f8bf1b
doc: explains why Reviewed-By is added in PRs
jalafel Oct 12, 2016
695ee1e
doc: highlight deprecated API in ToC
ilfroloff Sep 2, 2016
4de7a6e
build: fix config.gypi target
danbev Oct 12, 2016
9a192a9
net: fix ambiguity in EOF handling
indutny Oct 12, 2016
132425a
doc: specify that errno is a number, not a string
Oct 10, 2016
f9b24f4
test: use npm sandbox in test-npm-install
joaocgreis Oct 13, 2016
68ccc7a
doc: update reference to list hash algorithms in crypto.md
sstern6 Oct 11, 2016
e564cb6
doc: add ctc-review label information
Trott Oct 13, 2016
3b839d1
doc: remove confusing reference in governance doc
Trott Oct 13, 2016
279e30c
doc: add CTC meeting minutes for 2016-10-12
mhdawson Oct 13, 2016
3cefd65
build: export openssl symbols on windows
bnoordhuis Apr 18, 2016
84849f1
build: export more openssl symbols on Windows
Jul 10, 2016
4238460
lib: remove let from for loops
Sep 30, 2016
9b9762c
streams: fix regression in `unpipe()`
addaleax Oct 18, 2016
d9c3364
test: add regression test for `unpipe()`
Oct 18, 2016
c8dccf2
tools: avoid let in for loops
jalafel Oct 12, 2016
4a6bd86
test: fix flaky test-child-process-fork-dgram
Trott Oct 14, 2016
c94482b
http: 451 status code "Unavailable For Legal Reasons"
mbarinov Dec 21, 2015
bd99b2d
test: checking if error constructor is assert.AssertionError
larissayvette Oct 12, 2016
a038fcc
test: add regression test for instanceof
fhinkel Oct 19, 2016
a64af39
test: remove duplicate required module
Trott Oct 18, 2016
c1e5e66
doc: improve header styling for API docs
Fishrock123 Sep 27, 2016
e9c6aff
doc: add 2016-10-19 CTC meeting minutes
joshgav Oct 19, 2016
1a701f1
doc: add 2016-09-28 CTC meeting minutes
joshgav Oct 27, 2016
8240092
doc: add 2016-10-05 CTC meeting minutes
joshgav Oct 27, 2016
9dad98b
doc: add 2016-10-26 CTC meeting minutes
Trott Oct 28, 2016
d1d207b
doc: add Sakthipriyan to the CTC
rvagg Nov 2, 2016
bf25994
tls: fix leak of WriteWrap+TLSWrap combination
indutny Nov 12, 2016
0f41058
doc: clarify relation between a file and a module
marzelin Oct 11, 2016
f9baa11
tools: remove dangling eslint symlink
sam-github Oct 26, 2016
80a26c7
test: writable stream finished state
Sep 27, 2016
ba4a3ed
test: writable stream ending state
Sep 22, 2016
40ef239
test: writable stream needDrain state
Sep 27, 2016
2b2dde8
doc: add italoacasas to collaborators
Nov 18, 2016
00a1782
doc: update CONTRIBUTING.md to address editing PRs
gibfahn Oct 19, 2016
91fce10
deps: back port OpenBSD fix in c-ares/c-ares
qbit Oct 23, 2016
527db40
test: add coverage for execFileSync() errors
cjihrig Oct 20, 2016
bb2fdf5
build: cherry pick V8 change for windows DLL support
stefanmb Jul 20, 2016
f21c2b9
build: configure --shared
sxa Jul 4, 2016
0138b4d
build: windows sharedlib support
Nov 16, 2016
e97723b
build: abstract out shared library suffix
Jul 12, 2016
12da258
https: fix memory leak with https.request()
imyller Sep 18, 2016
03f7031
test: remove call to `net.Socket.resume()`
ALJCepeda Sep 21, 2016
b3fccc2
test: enable cyrillic punycode test case
bnoordhuis Sep 21, 2016
cec5e36
test: fix test-cluster-worker-init.js flakyness
imyller Sep 21, 2016
f0192ec
src: don't abort when c-ares initialization fails
bnoordhuis Sep 22, 2016
bdb6cf9
win,msi: mark INSTALLDIR property as secure
joaocgreis Sep 26, 2016
347547a
test: expand test coverage for url.js
jun-oka Sep 30, 2016
a3a184d
lib: fix TypeError in v8-polyfill
geek Sep 30, 2016
3919edb
build: don't build icu with -fno-rtti
bnoordhuis Sep 30, 2016
7904066
test: refactor test-net-server-max-connections
Trott Oct 4, 2016
c48c318
doc: change ./node to node in debugger.md
AnnaMag Oct 5, 2016
475fe96
doc: simplify process.memoryUsage() example code
watson Nov 12, 2016
9a02414
zlib: fix raw inflate with custom dictionary
thusoy Sep 20, 2016
748e424
debugger: make listen address configurable
bnoordhuis Oct 10, 2015
524ebfb
doc: child_process .stdio accepts a String type
skovhus Nov 19, 2016
66e26cd
doc: child_process.execSync .stdio default is pipe
skovhus Nov 20, 2016
4c47446
deps: make gtest output tap
bnoordhuis Aug 9, 2016
7c73105
build: run cctests as part of test-ci target
bnoordhuis Aug 10, 2016
eb34f68
deps: revert default gtest reporter change
mscdex Oct 17, 2016
747013b
test: output tap13 instead of almost-tap
jbergstroem Oct 12, 2016
36abbbe
gtest: output tap comments as yamlish
jbergstroem Oct 25, 2016
02e6c84
gitignore: ignore all tap files
jbergstroem Oct 25, 2016
4571c84
dgram: generalized send queue to handle close
mcollina May 30, 2016
a2621a2
test: remove FIXME pummel/test-tls-securepair-client
ALJCepeda Sep 24, 2016
3b448a7
lib: changed var to const in linkedlist
AdriVanHoudt Sep 17, 2016
fafffd4
test: fix test-child-process-fork-regr-gh-2847
santigimeno Oct 6, 2016
fc77cbb
doc: make node(1) more consistent with tradition
strugee Oct 8, 2016
b4353e9
src: fix typo in #endif comment
juanandresnyc Oct 9, 2016
e5d2a95
src: remove out-of-date TODO comment
danbev Oct 10, 2016
51b251d
test: add coverage for spawnSync() killSignal
cjihrig Oct 6, 2016
462c640
doc: fix typo in email address in README
Trott Oct 5, 2016
6d742b3
test: remove err timer from test-http-set-timeout
BethGriggs Oct 24, 2016
9d5e7f5
test: use strict assertions in module loader test
bnoordhuis Oct 24, 2016
533ce48
tools: make --repeat work with -j in test.py
Trott Oct 24, 2016
f18f3b6
util: use template strings
a0viedo Oct 17, 2016
ed31f9c
benchmark: add microbenchmarks for ES Map
rvagg Jul 7, 2016
59d821d
build: use wxneeded on openbsd
qbit Oct 21, 2016
bcd156f
test: refactor test-async-wrap-check-providers
Oct 26, 2016
b0476c5
test: fix flaky test-fs-watch-recursive on OS X
Trott Oct 26, 2016
e08173a
doc: fix outdate ninja link
lovexi Oct 25, 2016
d9955fb
test: add test for HTTP client "aborted" event
kemitchell Jun 22, 2016
5e820ae
doc: update Diagnostics WG info
joshgav Oct 27, 2016
2c75886
test: move timer-dependent test to sequential
Trott Nov 3, 2016
861b689
doc: update GOVERNANCE.md to use "meeting chair"
Trott Nov 3, 2016
d3c25c1
doc: update minute-taking procedure for CTC
Trott Nov 2, 2016
c5181ed
build: reduce noise from doc target
danbev Nov 4, 2016
96bdfae
test: improve test-debugger-util-regression
santigimeno Nov 6, 2016
f6f0b38
events: pass the original listener added by once
davidtaikocha Apr 29, 2016
3b5cede
src: renaming ares_task struct to node_ares_task
danbev Jun 20, 2016
51e09d0
src: normalize malloc, realloc
mhdawson Sep 1, 2016
62e83b3
src: Malloc/Calloc size 0 returns non-null pointer
Trott Sep 17, 2016
9389572
crypto: fix faulty logic in iv size check
bnoordhuis Oct 11, 2016
50a4471
http: fix connection upgrade checks
mscdex Aug 23, 2016
54c38eb
tickprocessor: apply c++filt manually on mac
indutny Sep 10, 2016
b1bd1c4
tools: allow test.py to use full paths of tests
reconbot Nov 19, 2016
9144d37
test: cleanup test-dgram-error-message-address
Goyapa Oct 5, 2016
c1effb1
deps: fix build with libc++ 3.8.0
jbergstroem Nov 23, 2016
cc36a63
test: remove watchdog in test-debug-signal-cluster
Trott Nov 5, 2016
4e73e75
2016-12-06, Version 4.7.0 'Argon' (LTS)
Nov 22, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
build: configure --shared
Add configure flag for building a shared library that can be
embedded in other applications (like Electron). Add flags
--without-bundled-v8 and --without-v8-platform to control V8
dependencies used.

PR-URL: #6994
Ref: #7487
Ref: #9385
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
sxa authored and Myles Borins committed Nov 18, 2016
commit f21c2b9d3b4595d63e7f9ebd88b9d5fc964131fb
9 changes: 9 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
'python%': 'python',

'node_shared%': 'false',
'force_dynamic_crt%': 0,
'node_use_v8_platform%': 'true',
'node_use_bundled_v8%': 'true',
'node_module_version%': '',

'node_tag%': '',
'uv_library%': 'static_library',

Expand Down Expand Up @@ -291,6 +297,9 @@
],
'ldflags!': [ '-rdynamic' ],
}],
[ 'node_shared=="true"', {
'cflags': [ '-fPIC' ],
}]
],
}],
['OS=="android"', {
Expand Down
35 changes: 32 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ from gyp.common import GetFlavor
sys.path.insert(0, os.path.join(root_dir, 'tools', 'configure.d'))
import nodedownload

# imports in tools/
sys.path.insert(0, os.path.join(root_dir, 'tools'))

# parse our options
parser = optparse.OptionParser()

Expand Down Expand Up @@ -385,6 +388,26 @@ parser.add_option('--enable-static',
dest='enable_static',
help='build as static library')

parser.add_option('--shared',
action='store_true',
dest='shared',
help='compile shared library for embedding node in another project. ' +
'(This mode is not officially supported for regular applications)')

parser.add_option('--without-v8-platform',
action='store_true',
dest='without_v8_platform',
default=False,
help='do not initialize v8 platform during node.js startup. ' +
'(This mode is not officially supported for regular applications)')

parser.add_option('--without-bundled-v8',
action='store_true',
dest='without_bundled_v8',
default=False,
help='do not use V8 includes from the bundled deps folder. ' +
'(This mode is not officially supported for regular applications)')

(options, args) = parser.parse_args()

# Expand ~ in the install prefix now, it gets written to multiple files.
Expand Down Expand Up @@ -774,7 +797,14 @@ def configure_node(o):
if options.enable_static:
o['variables']['node_target_type'] = 'static_library'

o['variables']['node_module_version'] = 46
o['variables']['node_shared'] = b(options.shared)
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)
node_module_version = getmoduleversion.get_version()
shlib_suffix = '%s.dylib' if sys.platform == 'darwin' else 'so.%s'
shlib_suffix %= node_module_version
o['variables']['node_module_version'] = int(node_module_version)
o['variables']['shlib_suffix'] = shlib_suffix

if options.linked_module:
o['variables']['library_files'] = options.linked_module
Expand Down Expand Up @@ -820,8 +850,7 @@ def configure_v8(o):
o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables.
o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true'
o['variables']['node_enable_d8'] = b(options.enable_d8)


o['variables']['force_dynamic_crt'] = 1 if options.shared else 0
def configure_openssl(o):
o['variables']['node_use_openssl'] = b(not options.without_ssl)
o['variables']['node_shared_openssl'] = b(options.shared_openssl)
Expand Down
56 changes: 48 additions & 8 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
'node_use_lttng%': 'false',
'node_use_etw%': 'false',
'node_use_perfctr%': 'false',
'node_use_v8_platform%': 'true',
'node_use_bundled_v8%': 'true',
'node_shared%': 'false',
'force_dynamic_crt%': 0,
'node_module_version%': 'true',
'node_has_winsdk%': 'false',
'node_shared_zlib%': 'false',
'node_shared_http_parser%': 'false',
Expand Down Expand Up @@ -101,6 +106,11 @@
}, {
'use_openssl_def': 0,
}],
[ 'node_shared=="true"', {
'node_target_type%': 'shared_library',
}, {
'node_target_type%': 'executable',
}],
],
},

Expand Down Expand Up @@ -220,6 +230,42 @@


'conditions': [
[ 'node_shared=="false"', {
'msvs_settings': {
'VCManifestTool': {
'EmbedManifest': 'true',
'AdditionalManifestFiles': 'src/res/node.exe.extra.manifest'
}
},
}, {
'defines': [
'NODE_SHARED_MODE',
],
'conditions': [
[ 'node_module_version!=""', {
'product_extension': 'so.<(node_module_version)',
}]
],
}],
[ 'node_use_bundled_v8=="true"', {
'include_dirs': [
'deps/v8' # include/v8_platform.h
],

'dependencies': [
'deps/v8/tools/gyp/v8.gyp:v8',
'deps/v8/tools/gyp/v8.gyp:v8_libplatform'
],
}],
[ 'node_use_v8_platform=="true"', {
'defines': [
'NODE_USE_V8_PLATFORM=1',
],
}, {
'defines': [
'NODE_USE_V8_PLATFORM=0',
],
}],
[ 'node_enable_d8=="true"', {
'dependencies': [ 'deps/v8/src/d8.gyp:d8' ],
}],
Expand Down Expand Up @@ -292,7 +338,7 @@
],
},
'conditions': [
['OS in "linux freebsd"', {
['OS in "linux freebsd" and node_shared=="false"', {
'ldflags': [
'-Wl,--whole-archive,'
'<(PRODUCT_DIR)/obj.target/deps/openssl/'
Expand Down Expand Up @@ -460,7 +506,7 @@
'NODE_PLATFORM="sunos"',
],
}],
[ 'OS=="freebsd" or OS=="linux"', {
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"', {
'ldflags': [ '-Wl,-z,noexecstack',
'-Wl,--whole-archive <(V8_BASE)',
'-Wl,--no-whole-archive' ]
Expand All @@ -469,12 +515,6 @@
'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
}],
],
'msvs_settings': {
'VCManifestTool': {
'EmbedManifest': 'true',
'AdditionalManifestFiles': 'src/res/node.exe.extra.manifest'
}
},
},
{
'target_name': 'mkssldef',
Expand Down
37 changes: 31 additions & 6 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
#include "string_bytes.h"
#include "util.h"
#include "uv.h"
#if NODE_USE_V8_PLATFORM
#include "libplatform/libplatform.h"
#endif // NODE_USE_V8_PLATFORM
#include "v8-debug.h"
#include "v8-profiler.h"
#include "zlib.h"
Expand Down Expand Up @@ -167,6 +169,30 @@ static v8::Platform* default_platform;
static uv_sem_t debug_semaphore;
#endif

static struct {
#if NODE_USE_V8_PLATFORM
void Initialize(int thread_pool_size) {
platform_ = v8::platform::CreateDefaultPlatform(thread_pool_size);
V8::InitializePlatform(platform_);
}

void PumpMessageLoop(Isolate* isolate) {
v8::platform::PumpMessageLoop(platform_, isolate);
}

void Dispose() {
delete platform_;
platform_ = nullptr;
}

v8::Platform* platform_;
#else // !NODE_USE_V8_PLATFORM
void Initialize(int thread_pool_size) {}
void PumpMessageLoop(Isolate* isolate) {}
void Dispose() {}
#endif // !NODE_USE_V8_PLATFORM
} v8_platform;

static void PrintErrorString(const char* format, ...) {
va_list ap;
va_start(ap, format);
Expand Down Expand Up @@ -4226,11 +4252,11 @@ static void StartNodeInstance(void* arg) {
SealHandleScope seal(isolate);
bool more;
do {
v8::platform::PumpMessageLoop(default_platform, isolate);
v8_platform.PumpMessageLoop(isolate);
more = uv_run(env->event_loop(), UV_RUN_ONCE);

if (more == false) {
v8::platform::PumpMessageLoop(default_platform, isolate);
v8_platform.PumpMessageLoop(isolate);
EmitBeforeExit(env);

// Emit `beforeExit` if the loop became alive either after emitting
Expand Down Expand Up @@ -4291,8 +4317,8 @@ int Start(int argc, char** argv) {
#endif

const int thread_pool_size = 4;
default_platform = v8::platform::CreateDefaultPlatform(thread_pool_size);
V8::InitializePlatform(default_platform);

v8_platform.Initialize(thread_pool_size);
V8::Initialize();

int exit_code = 1;
Expand All @@ -4309,8 +4335,7 @@ int Start(int argc, char** argv) {
}
V8::Dispose();

delete default_platform;
default_platform = nullptr;
v8_platform.Dispose();

delete[] exec_argv;
exec_argv = nullptr;
Expand Down
14 changes: 10 additions & 4 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,17 +396,23 @@ extern "C" NODE_EXTERN void node_module_register(void* mod);
# define NODE_MODULE_EXPORT __attribute__((visibility("default")))
#endif

#ifdef NODE_SHARED_MODE
# define NODE_CTOR_PREFIX
#else
# define NODE_CTOR_PREFIX static
#endif

#if defined(_MSC_VER)
#pragma section(".CRT$XCU", read)
#define NODE_C_CTOR(fn) \
static void __cdecl fn(void); \
NODE_CTOR_PREFIX void __cdecl fn(void); \
__declspec(dllexport, allocate(".CRT$XCU")) \
void (__cdecl*fn ## _)(void) = fn; \
static void __cdecl fn(void)
NODE_CTOR_PREFIX void __cdecl fn(void)
#else
#define NODE_C_CTOR(fn) \
static void fn(void) __attribute__((constructor)); \
static void fn(void)
NODE_CTOR_PREFIX void fn(void) __attribute__((constructor)); \
NODE_CTOR_PREFIX void fn(void)
#endif

#define NODE_MODULE_X(modname, regfunc, priv, flags) \
Expand Down
14 changes: 9 additions & 5 deletions tools/getnodeversion.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import os,re
import os
import re

node_version_h = os.path.join(os.path.dirname(__file__), '..', 'src',
node_version_h = os.path.join(
os.path.dirname(__file__),
'..',
'src',
'node_version.h')

f = open(node_version_h)

for line in f:
if re.match('#define NODE_MAJOR_VERSION', line):
if re.match('^#define NODE_MAJOR_VERSION', line):
major = line.split()[2]
if re.match('#define NODE_MINOR_VERSION', line):
if re.match('^#define NODE_MINOR_VERSION', line):
minor = line.split()[2]
if re.match('#define NODE_PATCH_VERSION', line):
if re.match('^#define NODE_PATCH_VERSION', line):
patch = line.split()[2]

print '%(major)s.%(minor)s.%(patch)s'% locals()
17 changes: 15 additions & 2 deletions tools/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,22 @@ def subdir_files(path, dest, action):

def files(action):
is_windows = sys.platform == 'win32'
output_file = 'node'
output_prefix = 'out/Release/'

exeext = '.exe' if is_windows else ''
action(['out/Release/node' + exeext], 'bin/node' + exeext)
if 'false' == variables.get('node_shared'):
if is_windows:
output_file += '.exe'
else:
if is_windows:
output_file += '.dll'
else:
# GYP will output to lib.target, this is hardcoded in its source,
# see the _InstallablaeTargetInstallPath function.
output_prefix += 'lib.target/'
output_file = 'lib' + output_file + '.so'

action([output_prefix + output_file], 'bin/' + output_file)

if 'true' == variables.get('node_use_dtrace'):
action(['out/Release/node.d'], 'lib/dtrace/node.d')
Expand Down