Skip to content

Commit f7e1402

Browse files
yhwangaddaleax
authored andcommitted
build: include the libuv and zlib into node
Add libuv and zlib into node executable and shared lib. Also fix an issue that openssl is not fully included in node executable for macOS. Signed-off-by: Yihong Wang <yh.wang@ibm.com> Fixes: #17444 PR-URL: #18383 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f869139 commit f7e1402

File tree

2 files changed

+61
-3
lines changed

2 files changed

+61
-3
lines changed

node.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
},
228228
},
229229
'conditions': [
230-
['OS in "linux freebsd openbsd solaris android"', {
230+
['OS!="aix"', {
231231
'ldflags': [
232232
'-Wl,--whole-archive,<(obj_dir)/<(STATIC_LIB_PREFIX)'
233233
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)',

node.gypi

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,32 @@
107107
}],
108108
[ 'node_shared_zlib=="false"', {
109109
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
110+
'conditions': [
111+
[ 'force_load=="true"', {
112+
'xcode_settings': {
113+
'OTHER_LDFLAGS': [
114+
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)'
115+
'zlib<(STATIC_LIB_SUFFIX)',
116+
],
117+
},
118+
'msvs_settings': {
119+
'VCLinkerTool': {
120+
'AdditionalOptions': [
121+
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\zlib<(STATIC_LIB_SUFFIX)',
122+
],
123+
},
124+
},
125+
'conditions': [
126+
['OS!="aix" and node_shared=="false"', {
127+
'ldflags': [
128+
'-Wl,--whole-archive,<(obj_dir)/deps/zlib/<(STATIC_LIB_PREFIX)'
129+
'zlib<(STATIC_LIB_SUFFIX)',
130+
'-Wl,--no-whole-archive',
131+
],
132+
}],
133+
],
134+
}],
135+
],
110136
}],
111137

112138
[ 'node_shared_http_parser=="false"', {
@@ -119,6 +145,32 @@
119145

120146
[ 'node_shared_libuv=="false"', {
121147
'dependencies': [ 'deps/uv/uv.gyp:libuv' ],
148+
'conditions': [
149+
[ 'force_load=="true"', {
150+
'xcode_settings': {
151+
'OTHER_LDFLAGS': [
152+
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)'
153+
'uv<(STATIC_LIB_SUFFIX)',
154+
],
155+
},
156+
'msvs_settings': {
157+
'VCLinkerTool': {
158+
'AdditionalOptions': [
159+
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\libuv<(STATIC_LIB_SUFFIX)',
160+
],
161+
},
162+
},
163+
'conditions': [
164+
['OS!="aix" and node_shared=="false"', {
165+
'ldflags': [
166+
'-Wl,--whole-archive,<(obj_dir)/deps/uv/<(STATIC_LIB_PREFIX)'
167+
'uv<(STATIC_LIB_SUFFIX)',
168+
'-Wl,--no-whole-archive',
169+
],
170+
}],
171+
],
172+
}],
173+
],
122174
}],
123175

124176
[ 'node_shared_nghttp2=="false"', {
@@ -240,12 +292,18 @@
240292
'-Wl,-force_load,<(PRODUCT_DIR)/<(openssl_product)',
241293
],
242294
},
295+
'msvs_settings': {
296+
'VCLinkerTool': {
297+
'AdditionalOptions': [
298+
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\<(openssl_product)',
299+
],
300+
},
301+
},
243302
'conditions': [
244303
['OS in "linux freebsd" and node_shared=="false"', {
245304
'ldflags': [
246305
'-Wl,--whole-archive,'
247-
'<(obj_dir)/deps/openssl/'
248-
'<(openssl_product)',
306+
'<(obj_dir)/deps/openssl/<(openssl_product)',
249307
'-Wl,--no-whole-archive',
250308
],
251309
}],

0 commit comments

Comments
 (0)