Skip to content

Commit

Permalink
build: include the libuv and zlib into node
Browse files Browse the repository at this point in the history
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 <[email protected]>

Fixes: #17444
PR-URL: #18383
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
yhwang authored and addaleax committed Feb 26, 2018
1 parent f869139 commit f7e1402
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 3 deletions.
2 changes: 1 addition & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
},
},
'conditions': [
['OS in "linux freebsd openbsd solaris android"', {
['OS!="aix"', {
'ldflags': [
'-Wl,--whole-archive,<(obj_dir)/<(STATIC_LIB_PREFIX)'
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
Expand Down
62 changes: 60 additions & 2 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,32 @@
}],
[ 'node_shared_zlib=="false"', {
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
'conditions': [
[ 'force_load=="true"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)'
'zlib<(STATIC_LIB_SUFFIX)',
],
},
'msvs_settings': {
'VCLinkerTool': {
'AdditionalOptions': [
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\zlib<(STATIC_LIB_SUFFIX)',
],
},
},
'conditions': [
['OS!="aix" and node_shared=="false"', {
'ldflags': [
'-Wl,--whole-archive,<(obj_dir)/deps/zlib/<(STATIC_LIB_PREFIX)'
'zlib<(STATIC_LIB_SUFFIX)',
'-Wl,--no-whole-archive',
],
}],
],
}],
],
}],

[ 'node_shared_http_parser=="false"', {
Expand All @@ -119,6 +145,32 @@

[ 'node_shared_libuv=="false"', {
'dependencies': [ 'deps/uv/uv.gyp:libuv' ],
'conditions': [
[ 'force_load=="true"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)'
'uv<(STATIC_LIB_SUFFIX)',
],
},
'msvs_settings': {
'VCLinkerTool': {
'AdditionalOptions': [
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\libuv<(STATIC_LIB_SUFFIX)',
],
},
},
'conditions': [
['OS!="aix" and node_shared=="false"', {
'ldflags': [
'-Wl,--whole-archive,<(obj_dir)/deps/uv/<(STATIC_LIB_PREFIX)'
'uv<(STATIC_LIB_SUFFIX)',
'-Wl,--no-whole-archive',
],
}],
],
}],
],
}],

[ 'node_shared_nghttp2=="false"', {
Expand Down Expand Up @@ -240,12 +292,18 @@
'-Wl,-force_load,<(PRODUCT_DIR)/<(openssl_product)',
],
},
'msvs_settings': {
'VCLinkerTool': {
'AdditionalOptions': [
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\<(openssl_product)',
],
},
},
'conditions': [
['OS in "linux freebsd" and node_shared=="false"', {
'ldflags': [
'-Wl,--whole-archive,'
'<(obj_dir)/deps/openssl/'
'<(openssl_product)',
'<(obj_dir)/deps/openssl/<(openssl_product)',
'-Wl,--no-whole-archive',
],
}],
Expand Down

0 comments on commit f7e1402

Please sign in to comment.