Skip to content

Commit f90fc83

Browse files
richardlauRafaelGSS
authored andcommitted
src: fix dynamically linked zlib version
Report the version of the dynamically linked zlib if built with `configure --shared-zlib` instead of the hardcoded version that corresponds to the bundled version of zlib in `deps`. PR-URL: #51007 Refs: #50910 Refs: #50158 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 4eedf5e commit f90fc83

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

node.gypi

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
} ],
142142
[ 'node_shared_zlib=="false"', {
143143
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
144+
'defines': [ 'NODE_BUNDLED_ZLIB' ],
144145
'conditions': [
145146
[ 'force_load=="true"', {
146147
'xcode_settings': {

src/node_metadata.cc

+9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
#include "uv.h"
1616
#include "uvwasi.h"
1717
#include "v8.h"
18+
19+
#ifdef NODE_BUNDLED_ZLIB
1820
#include "zlib_version.h"
21+
#else
22+
#include <zlib.h>
23+
#endif // NODE_BUNDLED_ZLIB
1924

2025
#if HAVE_OPENSSL
2126
#include <openssl/opensslv.h>
@@ -79,7 +84,11 @@ Metadata::Versions::Versions() {
7984
node = NODE_VERSION_STRING;
8085
v8 = v8::V8::GetVersion();
8186
uv = uv_version_string();
87+
#ifdef NODE_BUNDLED_ZLIB
8288
zlib = ZLIB_VERSION;
89+
#else
90+
zlib = zlibVersion();
91+
#endif // NODE_BUNDLED_ZLIB
8392
ares = ARES_VERSION_STR;
8493
modules = NODE_STRINGIFY(NODE_MODULE_VERSION);
8594
nghttp2 = NGHTTP2_VERSION;

0 commit comments

Comments
 (0)