From f7e1402923c90804cfe1f0d1e971777bc9d30e24 Mon Sep 17 00:00:00 2001 From: Yihong Wang Date: Wed, 17 Jan 2018 13:16:14 -0800 Subject: [PATCH] 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 Fixes: https://github.com/nodejs/node/issues/17444 PR-URL: https://github.com/nodejs/node/pull/18383 Reviewed-By: Anna Henningsen Reviewed-By: Gireesh Punathil Reviewed-By: Ben Noordhuis Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- node.gyp | 2 +- node.gypi | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/node.gyp b/node.gyp index 4b1d0b11aa9ab6..3320e3b4cd122c 100644 --- a/node.gyp +++ b/node.gyp @@ -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)', diff --git a/node.gypi b/node.gypi index 49384db0a5ddb5..82953ee9ff9af4 100644 --- a/node.gypi +++ b/node.gypi @@ -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"', { @@ -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"', { @@ -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', ], }],