From 0d7e89b075086d8f65c36d78730e93b8ea3dcefc Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Fri, 5 Aug 2016 04:36:40 +0200 Subject: [PATCH] build: export zlib symbols on Windows Base the generated openssl.def on existing zlib.def. We cannot specify more than one DEF file per executable so we need to merge the two DEF files to expose both OpenSSL and Zlib functionality to addons. If OpenSSL is not used, link against zlib.def itself. PR-URL: https://github.com/nodejs/node/pull/7983 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- node.gyp | 7 +++++++ tools/mkssldef.py | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/node.gyp b/node.gyp index 88b880d7438843..9f0645fe4245a1 100644 --- a/node.gyp +++ b/node.gyp @@ -370,9 +370,14 @@ '-Wl,--no-whole-archive', ], }], + # openssl.def is based on zlib.def, zlib symbols + # are always exported. ['use_openssl_def==1', { 'sources': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'], }], + ['OS=="win" and use_openssl_def==0', { + 'sources': ['deps/zlib/win32/zlib.def'], + }], ], }], ], @@ -568,6 +573,8 @@ '-X^DSO', '-X^_', '-X^private_', + # Base generated DEF on zlib.def + '-Bdeps/zlib/win32/zlib.def' ], }, 'conditions': [ diff --git a/tools/mkssldef.py b/tools/mkssldef.py index 8cbdbabd976ba9..8354e5712ef099 100755 --- a/tools/mkssldef.py +++ b/tools/mkssldef.py @@ -7,6 +7,7 @@ categories = [] defines = [] excludes = [] +bases = [] if __name__ == '__main__': out = sys.stdout @@ -18,6 +19,7 @@ elif option.startswith('-C'): categories += option[2:].split(',') elif option.startswith('-D'): defines += option[2:].split(',') elif option.startswith('-X'): excludes += option[2:].split(',') + elif option.startswith('-B'): bases += option[2:].split(',') excludes = map(re.compile, excludes) exported = [] @@ -40,5 +42,12 @@ def test(expr): if not satisfy(meta[3], categories): continue exported.append(name) + for filename in bases: + for line in open(filename).readlines(): + line = line.strip() + if line == 'EXPORTS': continue + if line[0] == ';': continue + exported.append(line) + print('EXPORTS', file=out) for name in sorted(exported): print(' ', name, file=out)