Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: --enable-static linked executable #14986

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,6 @@ v8:
tools/make-v8.sh
$(MAKE) -C deps/v8 $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)

ifeq ($(NODE_TARGET_TYPE),static_library)
test: all
$(MAKE) cctest
else
test: all
$(MAKE) build-addons
$(MAKE) build-addons-napi
Expand All @@ -221,7 +217,6 @@ test: all
$(CI_NATIVE_SUITES) \
$(CI_DOC) \
known_issues
endif

# For a quick test, does not run linter or build doc
test-only: all
Expand Down
4 changes: 2 additions & 2 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a',
}],
['openssl_fips != ""', {
'OPENSSL_PRODUCT': 'libcrypto.a',
'OPENSSL_PRODUCT': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)',
}, {
'OPENSSL_PRODUCT': 'libopenssl.a',
'OPENSSL_PRODUCT': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
}],
['OS=="mac"', {
'clang%': 1,
Expand Down
2 changes: 0 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1461,8 +1461,6 @@ config = {
'BUILDTYPE': 'Debug' if options.debug else 'Release',
'USE_XCODE': str(int(options.use_xcode or 0)),
'PYTHON': sys.executable,
'NODE_TARGET_TYPE': variables['node_target_type'] if options.enable_static \
else '',
}

if options.prefix:
Expand Down
61 changes: 55 additions & 6 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,13 @@
[ 'OS=="win"', {
'sources': [
'src/backtrace_win32.cc',
'src/res/node.rc',
],
'conditions': [
[ 'node_target_type!="static_library"', {
'sources': [
'src/res/node.rc',
],
}],
],
'defines!': [
'NODE_PLATFORM="win"',
Expand Down Expand Up @@ -508,7 +514,7 @@
'target_name': 'node_etw',
'type': 'none',
'conditions': [
[ 'node_use_etw=="true"', {
[ 'node_use_etw=="true" and node_target_type!="static_library"', {
'actions': [
{
'action_name': 'node_etw',
Expand All @@ -529,7 +535,7 @@
'target_name': 'node_perfctr',
'type': 'none',
'conditions': [
[ 'node_use_perfctr=="true"', {
[ 'node_use_perfctr=="true" and node_target_type!="static_library"', {
'actions': [
{
'action_name': 'node_perfctr_man',
Expand Down Expand Up @@ -591,13 +597,15 @@
'<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
],
'conditions': [
[ 'node_use_dtrace=="false" and node_use_etw=="false"', {
[ 'node_use_dtrace=="false" and node_use_etw=="false" or '
'node_target_type=="static_library"', {
'inputs': [ 'src/notrace_macros.py' ]
}],
['node_use_lttng=="false"', {
['node_use_lttng=="false" or node_target_type=="static_library"', {
'inputs': [ 'src/nolttng_macros.py' ]
}],
[ 'node_use_perfctr=="false"', {
[ 'node_use_perfctr=="false" or '
'node_target_type=="static_library"', {
'inputs': [ 'src/noperfctr_macros.py' ]
}]
],
Expand Down Expand Up @@ -952,6 +960,47 @@
], # end targets

'conditions': [
[ 'node_target_type=="static_library"', {
'targets': [
{
'target_name': 'static_node',
'type': 'executable',
'product_name': '<(node_core_target_name)',
'dependencies': [
'<(node_core_target_name)',
],
'sources+': [
'src/node_main.cc',
],
'include_dirs': [
'deps/v8/include',
],
'xcode_settings': {
'OTHER_LDFLAGS': [
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)'
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
],
},
'msvs_settings': {
'VCLinkerTool': {
'AdditionalOptions': [
'/WHOLEARCHIVE:<(PRODUCT_DIR)/lib/'
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
],
},
},
'conditions': [
['OS in "linux freebsd openbsd solaris android"', {
'ldflags': [
'-Wl,--whole-archive,<(OBJ_DIR)/<(STATIC_LIB_PREFIX)'
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
'-Wl,--no-whole-archive',
],
}],
],
},
],
}],
['OS=="aix"', {
'targets': [
{
Expand Down
4 changes: 2 additions & 2 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
'src/node_lttng.cc'
],
} ],
[ 'node_use_etw=="true"', {
[ 'node_use_etw=="true" and node_target_type!="static_library"', {
'defines': [ 'HAVE_ETW=1' ],
'dependencies': [ 'node_etw' ],
'sources': [
Expand All @@ -90,7 +90,7 @@
'tools/msvs/genfiles/node_etw_provider.rc',
]
} ],
[ 'node_use_perfctr=="true"', {
[ 'node_use_perfctr=="true" and node_target_type!="static_library"', {
'defines': [ 'HAVE_PERFCTR=1' ],
'dependencies': [ 'node_perfctr' ],
'sources': [
Expand Down
19 changes: 15 additions & 4 deletions test/addons/openssl-binding/binding.gyp
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
{
'includes': ['../../../config.gypi'],
'variables': {
'node_target_type%': '',
},
'targets': [
{
'target_name': 'binding',
'conditions': [
['node_use_openssl=="true"', {
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/openssl/openssl/include'],
}]
['node_use_openssl=="true"', {
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/openssl/openssl/include'],
'conditions': [
['OS=="win" and node_target_type=="static_library"', {
'libraries': [
'../../../../$(Configuration)/lib/<(OPENSSL_PRODUCT)'
],
}],
],
}]
]
},
]
Expand Down
13 changes: 13 additions & 0 deletions test/addons/zlib-binding/binding.gyp
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
{
'includes': ['../../../config.gypi'],
'variables': {
'node_target_type%': '',
},
'targets': [
{
'target_name': 'binding',
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/zlib'],
'conditions': [
['node_target_type=="static_library"', {
'conditions': [
['OS=="win"', {
'libraries': ['../../../../$(Configuration)/lib/zlib.lib'],
}],
],
}],
],
},
]
}
3 changes: 0 additions & 3 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,6 @@ if "%config%"=="Debug" set test_args=--mode=debug %test_args%
if "%config%"=="Release" set test_args=--mode=release %test_args%
echo running 'cctest %cctest_args%'
"%config%\cctest" %cctest_args%
REM when building a static library there's no binary to run tests
if defined enable_static goto test-v8
call :run-python tools\test.py %test_args%

:test-v8
Expand Down Expand Up @@ -520,7 +518,6 @@ set "localcppfilelist=%localcppfilelist% %1"
goto exit

:lint-js
if defined enable_static goto exit
if defined lint_js_ci goto lint-js-ci
if not defined lint_js goto exit
if not exist tools\eslint goto no-lint
Expand Down