mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
test: --enable-static linked executable
The motivation for this commit is to enable projects embedding Node.js and building with --enable-static to be able to run the test suite and linter. Currently when building with --enable-static no node executable will be created which means that the tests (apart from the cctest) and linter cannot be run. This is currently a work in progress and works on MacOS but I need to run the CI, and manually on different environments to verify that it works as expected. PR-URL: https://github.com/nodejs/node/pull/14986 Refs: https://github.com/nodejs/node/issues/14158 Refs: https://github.com/nodejs/node/pull/14892 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
1 parent
578d80b59b
commit
70060eef65
5 files changed
+87
-14
No files matched your search
+2
-2
@@ -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,
|
||||
|
||||
@@ -339,7 +339,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"',
|
||||
@@ -506,7 +512,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',
|
||||
@@ -527,7 +533,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',
|
||||
@@ -589,13 +595,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' ]
|
||||
}]
|
||||
],
|
||||
@@ -949,6 +957,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': [
|
||||
{
|
||||
|
||||
@@ -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': [
|
||||
@@ -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': [
|
||||
|
||||
@@ -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)'
|
||||
],
|
||||
}],
|
||||
],
|
||||
}]
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
@@ -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'],
|
||||
}],
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user