Skip to content

Commit

Permalink
src: fix dynamically linked zlib version
Browse files Browse the repository at this point in the history
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 <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
richardlau committed Dec 4, 2023
1 parent d4bcdd8 commit 7b3eb31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
} ],
[ 'node_shared_zlib=="false"', {
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
'defines': [ 'NODE_BUNDLED_ZLIB' ],
'conditions': [
[ 'force_load=="true"', {
'xcode_settings': {
Expand Down
9 changes: 9 additions & 0 deletions src/node_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
#include "uv.h"
#include "uvwasi.h"
#include "v8.h"

#ifdef NODE_BUNDLED_ZLIB
#include "zlib_version.h"
#else
#include <zlib.h>
#endif // NODE_BUNDLED_ZLIB

#if HAVE_OPENSSL
#include <openssl/opensslv.h>
Expand Down Expand Up @@ -79,7 +84,11 @@ Metadata::Versions::Versions() {
node = NODE_VERSION_STRING;
v8 = v8::V8::GetVersion();
uv = uv_version_string();
#ifdef NODE_BUNDLED_ZLIB
zlib = ZLIB_VERSION;
#else
zlib = zlibVersion();
#endif // NODE_BUNDLED_ZLIB
ares = ARES_VERSION_STR;
modules = NODE_STRINGIFY(NODE_MODULE_VERSION);
nghttp2 = NGHTTP2_VERSION;
Expand Down

0 comments on commit 7b3eb31

Please sign in to comment.