Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 70060ee

Browse filesBrowse files
danbevMylesBorins
authored andcommitted
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: #14986 Refs: #14158 Refs: #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>
1 parent 578d80b commit 70060ee
Copy full SHA for 70060ee

File tree

Expand file treeCollapse file tree

5 files changed

+87
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+87
-14
lines changed
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464
'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a',
6565
}],
6666
['openssl_fips != ""', {
67-
'OPENSSL_PRODUCT': 'libcrypto.a',
67+
'OPENSSL_PRODUCT': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)',
6868
}, {
69-
'OPENSSL_PRODUCT': 'libopenssl.a',
69+
'OPENSSL_PRODUCT': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
7070
}],
7171
['OS=="mac"', {
7272
'clang%': 1,
Collapse file

‎node.gyp‎

Copy file name to clipboardExpand all lines: node.gyp
+55-6Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,13 @@
339339
[ 'OS=="win"', {
340340
'sources': [
341341
'src/backtrace_win32.cc',
342-
'src/res/node.rc',
342+
],
343+
'conditions': [
344+
[ 'node_target_type!="static_library"', {
345+
'sources': [
346+
'src/res/node.rc',
347+
],
348+
}],
343349
],
344350
'defines!': [
345351
'NODE_PLATFORM="win"',
@@ -506,7 +512,7 @@
506512
'target_name': 'node_etw',
507513
'type': 'none',
508514
'conditions': [
509-
[ 'node_use_etw=="true"', {
515+
[ 'node_use_etw=="true" and node_target_type!="static_library"', {
510516
'actions': [
511517
{
512518
'action_name': 'node_etw',
@@ -527,7 +533,7 @@
527533
'target_name': 'node_perfctr',
528534
'type': 'none',
529535
'conditions': [
530-
[ 'node_use_perfctr=="true"', {
536+
[ 'node_use_perfctr=="true" and node_target_type!="static_library"', {
531537
'actions': [
532538
{
533539
'action_name': 'node_perfctr_man',
@@ -589,13 +595,15 @@
589595
'<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
590596
],
591597
'conditions': [
592-
[ 'node_use_dtrace=="false" and node_use_etw=="false"', {
598+
[ 'node_use_dtrace=="false" and node_use_etw=="false" or '
599+
'node_target_type=="static_library"', {
593600
'inputs': [ 'src/notrace_macros.py' ]
594601
}],
595-
['node_use_lttng=="false"', {
602+
['node_use_lttng=="false" or node_target_type=="static_library"', {
596603
'inputs': [ 'src/nolttng_macros.py' ]
597604
}],
598-
[ 'node_use_perfctr=="false"', {
605+
[ 'node_use_perfctr=="false" or '
606+
'node_target_type=="static_library"', {
599607
'inputs': [ 'src/noperfctr_macros.py' ]
600608
}]
601609
],
@@ -949,6 +957,47 @@
949957
], # end targets
950958

951959
'conditions': [
960+
[ 'node_target_type=="static_library"', {
961+
'targets': [
962+
{
963+
'target_name': 'static_node',
964+
'type': 'executable',
965+
'product_name': '<(node_core_target_name)',
966+
'dependencies': [
967+
'<(node_core_target_name)',
968+
],
969+
'sources+': [
970+
'src/node_main.cc',
971+
],
972+
'include_dirs': [
973+
'deps/v8/include',
974+
],
975+
'xcode_settings': {
976+
'OTHER_LDFLAGS': [
977+
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)'
978+
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
979+
],
980+
},
981+
'msvs_settings': {
982+
'VCLinkerTool': {
983+
'AdditionalOptions': [
984+
'/WHOLEARCHIVE:<(PRODUCT_DIR)/lib/'
985+
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
986+
],
987+
},
988+
},
989+
'conditions': [
990+
['OS in "linux freebsd openbsd solaris android"', {
991+
'ldflags': [
992+
'-Wl,--whole-archive,<(OBJ_DIR)/<(STATIC_LIB_PREFIX)'
993+
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
994+
'-Wl,--no-whole-archive',
995+
],
996+
}],
997+
],
998+
},
999+
],
1000+
}],
9521001
['OS=="aix"', {
9531002
'targets': [
9541003
{
Collapse file

‎node.gypi‎

Copy file name to clipboardExpand all lines: node.gypi
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
'src/node_lttng.cc'
7979
],
8080
} ],
81-
[ 'node_use_etw=="true"', {
81+
[ 'node_use_etw=="true" and node_target_type!="static_library"', {
8282
'defines': [ 'HAVE_ETW=1' ],
8383
'dependencies': [ 'node_etw' ],
8484
'sources': [
@@ -90,7 +90,7 @@
9090
'tools/msvs/genfiles/node_etw_provider.rc',
9191
]
9292
} ],
93-
[ 'node_use_perfctr=="true"', {
93+
[ 'node_use_perfctr=="true" and node_target_type!="static_library"', {
9494
'defines': [ 'HAVE_PERFCTR=1' ],
9595
'dependencies': [ 'node_perfctr' ],
9696
'sources': [
Collapse file

‎test/addons/openssl-binding/binding.gyp‎

Copy file name to clipboardExpand all lines: test/addons/openssl-binding/binding.gyp
+15-4Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
{
2+
'includes': ['../../../config.gypi'],
3+
'variables': {
4+
'node_target_type%': '',
5+
},
26
'targets': [
37
{
48
'target_name': 'binding',
59
'conditions': [
6-
['node_use_openssl=="true"', {
7-
'sources': ['binding.cc'],
8-
'include_dirs': ['../../../deps/openssl/openssl/include'],
9-
}]
10+
['node_use_openssl=="true"', {
11+
'sources': ['binding.cc'],
12+
'include_dirs': ['../../../deps/openssl/openssl/include'],
13+
'conditions': [
14+
['OS=="win" and node_target_type=="static_library"', {
15+
'libraries': [
16+
'../../../../$(Configuration)/lib/<(OPENSSL_PRODUCT)'
17+
],
18+
}],
19+
],
20+
}]
1021
]
1122
},
1223
]
Collapse file
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
{
2+
'includes': ['../../../config.gypi'],
3+
'variables': {
4+
'node_target_type%': '',
5+
},
26
'targets': [
37
{
48
'target_name': 'binding',
59
'sources': ['binding.cc'],
610
'include_dirs': ['../../../deps/zlib'],
11+
'conditions': [
12+
['node_target_type=="static_library"', {
13+
'conditions': [
14+
['OS=="win"', {
15+
'libraries': ['../../../../$(Configuration)/lib/zlib.lib'],
16+
}],
17+
],
18+
}],
19+
],
720
},
821
]
922
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.