Browse Source

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 <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
Alex Hultman 9 years ago
committed by cjihrig
parent
commit
c843e58914
  1. 7
      node.gyp
  2. 9
      tools/mkssldef.py

7
node.gyp

@ -372,9 +372,14 @@
'-Wl,--no-whole-archive', '-Wl,--no-whole-archive',
], ],
}], }],
# openssl.def is based on zlib.def, zlib symbols
# are always exported.
['use_openssl_def==1', { ['use_openssl_def==1', {
'sources': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'], 'sources': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
}], }],
['OS=="win" and use_openssl_def==0', {
'sources': ['deps/zlib/win32/zlib.def'],
}],
], ],
}], }],
], ],
@ -570,6 +575,8 @@
'-X^DSO', '-X^DSO',
'-X^_', '-X^_',
'-X^private_', '-X^private_',
# Base generated DEF on zlib.def
'-Bdeps/zlib/win32/zlib.def'
], ],
}, },
'conditions': [ 'conditions': [

9
tools/mkssldef.py

@ -7,6 +7,7 @@ import sys
categories = [] categories = []
defines = [] defines = []
excludes = [] excludes = []
bases = []
if __name__ == '__main__': if __name__ == '__main__':
out = sys.stdout out = sys.stdout
@ -18,6 +19,7 @@ if __name__ == '__main__':
elif option.startswith('-C'): categories += option[2:].split(',') elif option.startswith('-C'): categories += option[2:].split(',')
elif option.startswith('-D'): defines += option[2:].split(',') elif option.startswith('-D'): defines += option[2:].split(',')
elif option.startswith('-X'): excludes += option[2:].split(',') elif option.startswith('-X'): excludes += option[2:].split(',')
elif option.startswith('-B'): bases += option[2:].split(',')
excludes = map(re.compile, excludes) excludes = map(re.compile, excludes)
exported = [] exported = []
@ -40,5 +42,12 @@ if __name__ == '__main__':
if not satisfy(meta[3], categories): continue if not satisfy(meta[3], categories): continue
exported.append(name) 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) print('EXPORTS', file=out)
for name in sorted(exported): print(' ', name, file=out) for name in sorted(exported): print(' ', name, file=out)

Loading…
Cancel
Save